Finish bootstrap scripts

I got this working on my Mac, which doesn't have Idris 2 of any form
installed. So it might work... good luck!
This commit is contained in:
Edwin Brady 2020-05-18 21:10:37 +01:00
parent b69068f4ff
commit 3634ec76b7
3 changed files with 32 additions and 29 deletions

View File

@ -5,27 +5,27 @@ Requirements: Chez Scheme (with threading support) and bash. On a Mac, you
will need to install `coreutils` to have access to `realpath` - you can will need to install `coreutils` to have access to `realpath` - you can
do this with `brew install coreutils`. do this with `brew install coreutils`.
0: Fix hard coded prefix (sorry) 0: Set the PREFIX
-------------------------------- -----------------
This isn't easily configurable yet - I will deal with it soon. So, before * Change the `prefix` in `config.mk`. The default is to install in
you start: `$HOME/.idris2sh`
* Change the `prefix` which is currently hard coded in `Idris.Main`. If you have an existing Idris 2, go to step 1b. Otherwise, read on...
1a: Installing without an existing Idris 2 1a: Installing without an existing Idris 2
------------------------------------------ ------------------------------------------
If you *don't* have Idris-2-in-Idris-1 installed, you can still build a If you *don't* have Idris-2-in-Idris-1 installed, you can still build a
bootstrapping compiler, as long as you have Chez Scheme installed. This is a bootstrapping compiler, as long as you have Chez Scheme installed. This is a
bit more fiddly than if you have Idris 2 installed (for the moment) but you bit more fiddly than if you have Idris 2 installed (for the moment - it should
only have to do it once. be scriptable) but you only have to do it once.
To begin, enter: To begin, enter:
* `make init-bootstrap SCHEME=scheme` * `make init-bootstrap SCHEME=chez`
(`scheme` is the executable name of the Chez Scheme compiler. You may need to (`chez` is the executable name of the Chez Scheme compiler. You may need to
replace this with the executable for Chez Scheme on your system. This could be replace this with the executable for Chez Scheme on your system. This could be
`chez`, `chezscheme` or `chezscheme9.5` or something else, depending on your `chez`, `chezscheme` or `chezscheme9.5` or something else, depending on your
system and the Chez Scheme version). system and the Chez Scheme version).
@ -35,18 +35,19 @@ compiler (which isn't necessarily up to date, but is up to date enough to
build the current repository). build the current repository).
Then, to build the libraries using this generated compiler, again using your Then, to build the libraries using this generated compiler, again using your
local variant for `scheme`. local variant for `chez`.
* `make libs SCHEME=scheme` * `make libs SCHEME=chez`
* `make install`SCHEME=chez
Make sure `$PREFIX/bin` is in your `PATH`. Then, go to the Self-hosting step
below, but you'll also need to add `SCHEME=chez` (with the appropriate name
for `chez`) so that the bootstrapping script knows where to look. That is:
* `rm -rf build` -- clean the build artefacts
* `make all IDRIS2_BOOT=idris2sh SCHEME=chez
* `make install` * `make install`
Finally, go to the Self-hosting step below, but you'll also need to add
`SCHEME=scheme` so that the bootstrapping script knows where to look.
That is:
* `make clean` -- to make sure you're building everything with the new version
* `make all IDRIS2_BOOT=idris2sh SCHEME=scheme && make install`
1b: Installing with an existing Idris 2 1b: Installing with an existing Idris 2
--------------------------------------- ---------------------------------------

View File

@ -23,14 +23,15 @@ ifeq ($(shell git status >/dev/null 2>&1; echo $$?), 0)
endif endif
endif endif
export IDRIS2_SUPPORT := libidris2_support${SHLIB_SUFFIX} IDRIS2_SUPPORT := libidris2_support${SHLIB_SUFFIX}
export IDRIS2_VERSION := ${MAJOR}.${MINOR}.${PATCH} export IDRIS2_VERSION := ${MAJOR}.${MINOR}.${PATCH}
IDRIS2_VERSION_TAG := ${IDRIS2_VERSION}${VER_TAG} IDRIS2_VERSION_TAG := ${IDRIS2_VERSION}${VER_TAG}
export SCHEME
export IDRIS2_CURDIR = $(CURDIR) export IDRIS2_CURDIR = $(CURDIR)
export IDRIS2_BOOT_PATH = ${IDRIS2_CURDIR}/libs/prelude/build/ttc:${IDRIS2_CURDIR}/libs/base/build/ttc:${IDRIS2_CURDIR}/libs/network/build/ttc export IDRIS2_BOOT_PATH = ${IDRIS2_CURDIR}/libs/prelude/build/ttc:${IDRIS2_CURDIR}/libs/base/build/ttc:${IDRIS2_CURDIR}/libs/network/build/ttc
.PHONY: all support clean support-clean init-bootstrap ${TARGET} .PHONY: all support clean support-clean bootstrap init-bootstrap ${TARGET}
all: support ${TARGET} libs all: support ${TARGET} libs
@ -95,5 +96,12 @@ install-libs: libs
${MAKE} -C libs/network install IDRIS2=../../${TARGET} IDRIS2_PATH=${IDRIS2_BOOT_PATH} IDRIS2_VERSION=${IDRIS2_VERSION} ${MAKE} -C libs/network install IDRIS2=../../${TARGET} IDRIS2_PATH=${IDRIS2_BOOT_PATH} IDRIS2_VERSION=${IDRIS2_VERSION}
${MAKE} -C libs/contrib install IDRIS2=../../${TARGET} IDRIS2_PATH=${IDRIS2_BOOT_PATH} ${MAKE} -C libs/contrib install IDRIS2=../../${TARGET} IDRIS2_PATH=${IDRIS2_BOOT_PATH}
init-bootstrap: init-bootstrap: support
./bootstrap.sh ${SCHEME} ${PREFIX} cp support/c/${IDRIS2_SUPPORT} bootstrap/idris2sh_app
sed s/libidris2_support.so/${IDRIS2_SUPPORT}/g bootstrap/idris2sh_app/idris2sh.ss > bootstrap/idris2sh_app/idris2-boot.ss
ifeq ($(OS), darwin)
sed -i '' 's|__PREFIX__|${PREFIX}|g' bootstrap/idris2sh_app/idris2-boot.ss
else
sed -i 's|__PREFIX__|${PREFIX}|g' bootstrap/idris2sh_app/idris2-boot.ss
endif
./bootstrap.sh

View File

@ -1,13 +1,7 @@
#!/bin/sh #!/bin/sh
make support
cp support/c/$IDRIS2_SUPPORT bootstrap/idris2-boot_app
cd bootstrap cd bootstrap
${SCHEME} --script compile.ss
sed s/libidris2_support.so/$IDRIS2_SUPPORT/g idris2sh_app/idris2sh.ss > idris2sh_app/idris2-boot.ss
sed -i "s|__PREFIX__|$2|g" idris2sh_app/idris2-boot.ss
$1 --script compile.ss
mkdir -p ../build/exec mkdir -p ../build/exec
mkdir -p ../build/exec/idris2sh_app mkdir -p ../build/exec/idris2sh_app