From 20b108ce2f991c2c556f57310f62824ccd442aca Mon Sep 17 00:00:00 2001 From: Alfred Wingate Date: Thu, 26 Oct 2023 14:16:49 +0300 Subject: [PATCH] dev-scheme/gerbil: add 0.17 * 0.17 works with gambit 4.9.4 and 4.9.5. * 0.18 only works against an unreleased version of gambit https://github.com/mighty-gerbils/gerbil/commit/4eecb14219f487893b81a6eb19dd3c50b7066d2a Closes: https://gitlab.com/src_prepare/src_prepare-overlay/-/issues/53 Signed-off-by: Alfred Wingate --- dev-scheme/gerbil/Manifest | 1 + .../gebril-0.17-add-support-for-destdir.patch | 77 +++++++++++ dev-scheme/gerbil/gerbil-0.17.ebuild | 129 ++++++++++++++++++ dev-scheme/gerbil/metadata.xml | 4 +- 4 files changed, 209 insertions(+), 2 deletions(-) create mode 100644 dev-scheme/gerbil/files/gebril-0.17-add-support-for-destdir.patch create mode 100644 dev-scheme/gerbil/gerbil-0.17.ebuild diff --git a/dev-scheme/gerbil/Manifest b/dev-scheme/gerbil/Manifest index d1147d6..3fbd882 100644 --- a/dev-scheme/gerbil/Manifest +++ b/dev-scheme/gerbil/Manifest @@ -1 +1,2 @@ DIST gerbil-0.16.tar.gz 1715765 BLAKE2B 74cd501b19c8f124f9478c73080e92c2ba0bf92e8cb9faa4cba492b2def8a61633897b67def4200e53962ccf22287f58cf7fdd33604104acc80bde12dd58b07c SHA512 46782b4b71a3b437501b825f2f164e53b285d3a4cdba8f04485edaaa589d8500535c06a47a1464fc537ab7546413dde37c8d6a16a5e076a99ccf255905ed105d +DIST gerbil-0.17.tar.gz 1792073 BLAKE2B 1c28f3e44b1618408dba83598e55d136aa800e3482322fbd8761c0c4c851b5358d0a040d88c33be896008af33f5132a32faca8ab1ef28928a9dcdb8ac96bdfbe SHA512 c23d5ead0b23991181c977b9fe5784df5ba9ee46221b44a3f3a194d7669b7fb1268b9bfa310f5cfd1c994036f2fbee2f8611c9bce556f1c235e17babc31ce43d diff --git a/dev-scheme/gerbil/files/gebril-0.17-add-support-for-destdir.patch b/dev-scheme/gerbil/files/gebril-0.17-add-support-for-destdir.patch new file mode 100644 index 0000000..c7a44bd --- /dev/null +++ b/dev-scheme/gerbil/files/gebril-0.17-add-support-for-destdir.patch @@ -0,0 +1,77 @@ +From 7bb1c82c8cad8818f8805f28e7ff5b39d82c1ab0 Mon Sep 17 00:00:00 2001 +From: Alfred Wingate +Date: Thu, 26 Oct 2023 16:15:45 +0300 +Subject: [PATCH] Add support for destdir + +Signed-off-by: Alfred Wingate +--- a/Makefile.in ++++ b/Makefile.in +@@ -83,9 +83,9 @@ tags: + cd src && LDFLAGS="$(LIBS)" ./build.sh tags + + install: +- mkdir -p ${gerbil_bin} ${gerbil_share} ${gerbil_bin_linkdir} ${gerbil_share_linkdir} +- cd src && ./install +- cp -a --link --remove-destination ${gerbil_bin}/* ${gerbil_bin_linkdir} || \ +- cp -a ${gerbil_bin}/* ${gerbil_bin_linkdir} +- cp -a --link --remove-destination ${gerbil_share}/* ${gerbil_share_linkdir} || \ +- cp -a ${gerbil_share}/* ${gerbil_share_linkdir} ++ mkdir -p $(DESTDIR)${gerbil_bin} $(DESTDIR)${gerbil_share} $(DESTDIR)${gerbil_bin_linkdir} $(DESTDIR)${gerbil_share_linkdir} ++ cd src && ./install $(DESTDIR) ++ cp -a --link --remove-destination $(DESTDIR)${gerbil_bin}/* $(DESTDIR)${gerbil_bin_linkdir} || \ ++ cp -a $(DESTDIR)${gerbil_bin}/* $(DESTDIR)${gerbil_bin_linkdir} ++ cp -a --link --remove-destination $(DESTDIR)${gerbil_share}/* $(DESTDIR)${gerbil_share_linkdir} || \ ++ cp -a $(DESTDIR)${gerbil_share}/* $(DESTDIR)${gerbil_share_linkdir} +--- a/src/install ++++ b/src/install +@@ -2,6 +2,7 @@ + ;; -*- Scheme -*- + + (define default-gerbil-home #f) ++(define destdir #f) + + (define (die . message-bits) + (parameterize ((current-output-port (current-error-port))) +@@ -28,7 +29,7 @@ + (copy-file from to)))) + + (define (patch-gxc-shebang) +- (let* ((filename (string-append default-gerbil-home "/bin/gxc")) ++ (let* ((filename (string-append destdir default-gerbil-home "/bin/gxc")) + (new-content (with-input-from-file filename + (lambda () + (with-output-to-string +@@ -40,17 +41,19 @@ + (lambda () + (display new-content))))) + +-(define (main) ++(define (main . args) ++ (if args ++ (set! destdir (car args))) + (if (not default-gerbil-home) + (die "This gerbil build was not configured with a prefix, so there's nothing to do.")) +- (create-directory-if-necessary default-gerbil-home) +- (install "../bin" (string-append default-gerbil-home "/bin")) +- (install "../lib" (string-append default-gerbil-home "/lib")) +- (create-directory-if-necessary (string-append default-gerbil-home "/share")) +- (create-directory-if-necessary (string-append default-gerbil-home "/share/emacs")) +- (create-directory-if-necessary (string-append default-gerbil-home "/share/emacs/site-lisp")) +- (create-directory-if-necessary (string-append default-gerbil-home "/share/emacs/site-lisp/gerbil")) +- (install "../etc/gerbil-mode.el" (string-append default-gerbil-home "/share/emacs/site-lisp/gerbil/gerbil-mode.el")) +- (create-directory-if-necessary (string-append default-gerbil-home "/share/gerbil")) +- (install "TAGS" (string-append default-gerbil-home "/share/gerbil/TAGS")) ++ (create-directory-if-necessary (string-append destdir default-gerbil-home)) ++ (install "../bin" (string-append destdir default-gerbil-home "/bin")) ++ (install "../lib" (string-append destdir default-gerbil-home "/lib")) ++ (create-directory-if-necessary (string-append destdir default-gerbil-home "/share")) ++ (create-directory-if-necessary (string-append destdir default-gerbil-home "/share/emacs")) ++ (create-directory-if-necessary (string-append destdir default-gerbil-home "/share/emacs/site-lisp")) ++ (create-directory-if-necessary (string-append destdir default-gerbil-home "/share/emacs/site-lisp/gerbil")) ++ (install "../etc/gerbil-mode.el" (string-append destdir default-gerbil-home "/share/emacs/site-lisp/gerbil/gerbil-mode.el")) ++ (create-directory-if-necessary (string-append destdir default-gerbil-home "/share/gerbil")) ++ (install "TAGS" (string-append destdir default-gerbil-home "/share/gerbil/TAGS")) + (patch-gxc-shebang)) +-- +2.42.0 + diff --git a/dev-scheme/gerbil/gerbil-0.17.ebuild b/dev-scheme/gerbil/gerbil-0.17.ebuild new file mode 100644 index 0000000..107c9a4 --- /dev/null +++ b/dev-scheme/gerbil/gerbil-0.17.ebuild @@ -0,0 +1,129 @@ +# Copyright 1999-2023 Gentoo Authors +# Distributed under the terms of the GNU General Public License v2 + +EAPI=8 + +inherit autotools elisp-common toolchain-funcs + +DESCRIPTION="Dialect of Scheme designed for Systems Programming" +HOMEPAGE="https://cons.io/ https://github.com/vyzo/gerbil" + +if [[ "${PV}" == *9999* ]]; then + inherit git-r3 + EGIT_REPO_URI="https://github.com/mighty-gerbils/gerbil" +else + SRC_URI="https://github.com/mighty-gerbils/gerbil/archive/refs/tags/v${PV}.tar.gz -> ${P}.tar.gz" + KEYWORDS="~amd64" +fi + +LICENSE="Apache-2.0 LGPL-2.1" +SLOT="0" +IUSE="emacs leveldb lmdb mysql +sqlite +xml yaml +zlib" + +# no tests +RESTRICT="test" + +SUPPORTED_GAMBIT=" + || ( + ~dev-scheme/gambit-4.9.5 + ~dev-scheme/gambit-4.9.4 + ) +" + +RDEPEND=" + ${SUPPORTED_GAMBIT} + emacs? ( >=app-editors/emacs-23.1:* ) + leveldb? ( dev-libs/leveldb:= ) + lmdb? ( dev-db/lmdb:= ) + mysql? ( dev-db/mysql-connector-c:= ) + sqlite? ( dev-db/sqlite:3 ) + xml? ( dev-libs/libxml2 ) + yaml? ( dev-libs/libyaml ) + zlib? ( sys-libs/zlib ) + dev-libs/openssl:= +" +DEPEND="${RDEPEND}" +BDEPEND="${SUPPORTED_GAMBIT}" + +SITEFILE="70${PN}-gentoo.el" + +DESTDIR="${EPREFIX}/opt/gerbil" + +PATCHES=( + "${FILESDIR}/gebril-0.17-add-support-for-destdir.patch" +) + +src_prepare() { + # NIH mix of autotools and scheme doesn't install well with autotools switches + #export GERBIL_HOME="${EPREFIX}/usr/share/${PN}" + unset GEBRIL_HOME + unset GERBIL_PATH + + # Verbose build process + export GAMBCOMP_VERBOSE="yes" + + eapply_user + + eapply ${PATCHES[@]} + + # Really + sed -i -e "s/v0.16/v${PV}/" -e "s/v0_16/v${PV/./_}/" configure.ac || die + + eautoconf + + sed -i "s|gcc|$(tc-getCC)|g" src/build.sh || die "Failed to fix CC setting" + sed -i "s|-O2|${CFLAGS}|g" src/build.sh || die "Failed to fix CFLAGS setting" + + sed -i 's|local target_lib_gerbil="${GERBIL_BASE}/lib/gerbil"|local target_lib_gerbil="${GERBIL_BASE}"|' \ + src/build.sh || die +} + +src_configure() { + + local myconf=( + $(use_enable leveldb) + $(use_enable lmdb) + $(use_enable mysql) + $(use_enable sqlite) + $(use_enable xml libxml) + $(use_enable yaml libyaml) + $(use_enable zlib) + ) + + econf ${myconf[@]} +} + +src_compile() { + ewarn "Build is extremely slow and IS NOT PARALLEL ~20min" + default +} + +src_install() { + emake DESTDIR="${D}" install + + # Move them to better positions. Quite ugly... + mkdir -p "${D}${DESTDIR}" || die + mv -T "${D}/usr/lib/gerbil/" "${D}${DESTDIR}" || die + rm -rf "${D}${DESTDIR}/share" || die + sed -i -e "s|/usr/lib/gerbil/|${DESTDIR}|" "${D}${DESTDIR}"/bin/gxc || die + + # Remove so that they can be installed with the eclass. + if use emacs; then + elisp-compile "${D}/usr/share/emacs/site-lisp/gerbil"/*.el || + die "Failed to compile elisp files" + elisp-site-file-install "${FILESDIR}/${SITEFILE}" + fi + + # Without this the programs compiled with gxc will break! + newenvd - 99gerbil <<- EOF + GERBIL_HOME="${DESTDIR}" + EOF +} + +pkg_postinst() { + use emacs && elisp-site-regen +} + +pkg_postrm() { + use emacs && elisp-site-regen +} diff --git a/dev-scheme/gerbil/metadata.xml b/dev-scheme/gerbil/metadata.xml index e738377..a49ea1f 100644 --- a/dev-scheme/gerbil/metadata.xml +++ b/dev-scheme/gerbil/metadata.xml @@ -26,7 +26,7 @@ and compiled macros. - https://github.com/vyzo/gerbil - vyzo/gerbil + https://github.com/mighty-gerbils/gerbil + mighty-gerbils/gerbil