Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[WIP] Macos subtree fix #1194

Draft
wants to merge 23 commits into
base: ide
Choose a base branch
from
Draft
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
23 commits
Select commit Hold shift + click to select a range
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
48 changes: 42 additions & 6 deletions configure
Original file line number Diff line number Diff line change
Expand Up @@ -17,17 +17,17 @@ die() {

usage() {
local gambit_config_help="$(cd src/gambit && ./configure --help | tail -n +63)"

cat <<EOF
This script configures the Gerbil and integrated Gambit build.

Usage: $0 [option] ... [var=value]...

Options controlling integrated Gambit configuration:
${gambit_config_help}

Options understood and processed by Gerbil:
--prefix=PREFIX where to install Gerbil; default prefix is /opt/gerbil
--dist[=no|maybe|yes] conform with the Filesystem Hierarchy Standard (FHS) for installation.
If \${prefix}/bin exists as a directory this is likely not a Gerbil-only installation and "maybe" tests for that.
defaults to "maybe".

--with-gambit=TAG integrated gambit git tag to check out for the build;
defaults to ${default_gambit_tag}
--enable-march=ARCH specify the machine architecture; it can be empty.
Expand All @@ -43,7 +43,13 @@ Gerbil Standard Library features:
--disable-sqlite

Default integrated Gambit configuration: ${default_gambit_config}

Options controlling integrated Gambit configuration:
${gambit_config_help}


EOF

}


Expand All @@ -65,6 +71,15 @@ package_out_of_tree() {
echo "It is now available as an external package: github.com/mighty-gerbils/gerbil-${pkg}"
}

gerbil_dist="maybe"
gerbil_maybe_in_dist () {
if [ -d "${prefix}/bin" ] && [ ! -L "${prefix}/bin" ]; then
gerbil_dist="yes"
else
gerbil_dist="no"
fi
}

if [ -f MANIFEST ] ; then
. ./MANIFEST
readonly gerbil_version="$gerbil_stamp_version"
Expand Down Expand Up @@ -108,6 +123,18 @@ while [ $# -gt 0 ]; do

--prefix=*)
prefix=$(echo "$1" | cut -d = -f 2-)
# Trim trailing /
prefix=${prefix%/}
shift
;;

--enable-dist)
gerbil_dist=yes
shift
;;

--enable-dist=*)
gerbil_dist=$(echo "$1" | cut -d = -f 2-)
shift
;;

Expand Down Expand Up @@ -208,8 +235,15 @@ while [ $# -gt 0 ]; do
;;
esac
done
if [ "${gerbil_dist}" = "maybe" ] ; then
gerbil_maybe_in_dist
fi

gerbil_prefix="${prefix}/${gerbil_version}"
if [ "${gerbil_dist}" = "no" ] ; then
gerbil_prefix="${prefix}/${gerbil_version}"
else
gerbil_prefix="${prefix}/libexec/gerbil/${gerbil_version}"
fi

if [ -z "${CFLAGS}" ]; then
CFLAGS="${cflags_opt}"
Expand Down Expand Up @@ -257,8 +291,10 @@ fi
rm -f build-env.sh
cat > build-env.sh <<EOF
GERBIL_PREFIX=${gerbil_prefix}
GERBIL_DIST=${gerbil_dist}
GERBIL_FHS=${prefix}
GERBIL_VERSION=${gerbil_version}
export GERBIL_PREFIX GERBIL_VERSION
export GERBIL_PREFIX GERBIL_VERSION GERBIL_DIST GERBIL_FHS
EOF

exit 0
19 changes: 19 additions & 0 deletions install.sh
Original file line number Diff line number Diff line change
Expand Up @@ -55,6 +55,18 @@ link_version() {
(cd "${base}" && rm -f share && ln -sf current/share share) || die
}

link_dist () {
local prefix="${1}"
local gerbil="${2}"
local rel="${gerbil#$prefix}"
local dist_bin="${prefix}/bin"
local gerbil_bin="..${rel}/bin"

echo; echo "Making executable links"; echo;
(cd "${dist_bin}" && ln -sfv ${gerbil_bin}/gx* "${gerbil_bin}/gerbil" .) || die
}


if [ -e build-env.sh ]; then
. ./build-env.sh
else
Expand All @@ -68,3 +80,10 @@ GERBIL_BASE=$(dirname "${GERBIL_PREFIX}")
if [ "${GERBIL_BASE}/${GERBIL_VERSION}" = "${GERBIL_PREFIX}" ]; then
link_version "${DESTDIR}${GERBIL_BASE}" "${GERBIL_VERSION}"
fi

if [ "$GERBIL_DIST" = "yes" ]; then
link_dist "${DESTDIR}${GERBIL_FHS}" "${DESTDIR}${GERBIL_PREFIX}"
fi


echo; echo "Done! Enjoy Gerbil'ing :)"; echo
63 changes: 63 additions & 0 deletions macos/README.org
Original file line number Diff line number Diff line change
Expand Up @@ -216,3 +216,66 @@ lrwxr-xr-x 1 root wheel 11 5 Mar 17:31 src -> current/src
drwxr-xr-x 7 root wheel 224 5 Mar 17:31 v0.18.1-51-gd9c691b1
#+end_src

* MacPorts

The easy way.

#+begin_src sh
cd ~/src/gerbil/macos/ports

prefix=/opt/local
SRC_CONF="${prefix}/etc/macports/sources.conf"

add_source () {
SRC="${1:-`pwd`}"
TMP="$(mktemp)"

echo "file://$SRC" > $TMP
cat ${SRC_CONF} >> $TMP
sudo mv -v $TMP $SRC_CONF
}

maybe_add_source () {
SRC="${1:-`pwd`}"
grep -e "$SRC" "$SRC_CONF" || add_source $SRC
}

maybe_add_source
portindex

#+end_src



#+begin_src tcl :tangle ./ports/lang/gerbil-scheme/Portfile :mkdirp #t
# -*- coding: utf-8; mode: tcl; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- vim:fenc=utf-8:ft=tcl:et:sw=4:ts=4:sts=4

PortSystem 1.0

name gerbil-scheme
version 0.18.1
categories lang
platforms darwin
license {LGPL-2.1+ Apache-2}
maintainers nomaintainer
description Gerbil Scheme
long_description Gerbil Scheme: A LISP for the 21st Century
homepage https://cons.io

fetch.type git
git.url https://github.com/mighty-gerbils/gerbil.git
# git.branch v0.18.1
git.branch 882e8292019f1c5f8fc8895f9e2751186974520c

depends_lib port:openssl3 \
port:zlib

depends_build port:autoconf

configure.args --enable-march= --enable-dist

compiler.whitelist macports-gcc-13

build.cmd "export GERBIL_GCC='${configure.cc}'; make -j4"

#+end_src
29 changes: 29 additions & 0 deletions macos/ports/lang/gerbil-scheme/Portfile
Original file line number Diff line number Diff line change
@@ -0,0 +1,29 @@
# -*- coding: utf-8; mode: tcl; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- vim:fenc=utf-8:ft=tcl:et:sw=4:ts=4:sts=4

PortSystem 1.0

name gerbil-scheme
version 0.18.1
categories lang
platforms darwin
license {LGPL-2.1+ Apache-2}
maintainers nomaintainer
description Gerbil Scheme
long_description Gerbil Scheme: A LISP for the 21st Century
homepage https://cons.io

fetch.type git
git.url https://github.com/mighty-gerbils/gerbil.git
# git.branch v0.18.1
git.branch 882e8292019f1c5f8fc8895f9e2751186974520c

depends_lib port:openssl3 \
port:zlib

depends_build port:autoconf

configure.args --enable-march= --enable-dist

compiler.whitelist macports-gcc-13

build.cmd "export GERBIL_GCC='${configure.cc}'; make -j4"
Loading