build: add ./configure, compile .go files.
* configure: New file. * build-aux/build-guile.sh: New file. * makefile (all-go): New target.
This commit is contained in:
parent
cd4a80d3cb
commit
7b9871478b
|
@ -1,3 +1,4 @@
|
|||
*.go
|
||||
*~
|
||||
/bin/gash
|
||||
/.config.make
|
16
bin/gash.in
16
bin/gash.in
|
@ -1,5 +1,13 @@
|
|||
#!@GUILE@ \
|
||||
-L . --no-auto-compile -s
|
||||
#! /bin/sh
|
||||
# -*-scheme-*-
|
||||
exec ${GUILE-guile} -L $(pwd)/bin -L $(pwd) -C $(pwd)/bin -C $(pwd) --no-auto-compile -e '(gash)' -s $0 $@
|
||||
!#
|
||||
(setenv "SHELL" ((compose canonicalize-path car command-line)))
|
||||
((@ (gash gash) main) (command-line))
|
||||
(define-module (gash)
|
||||
#:export (main))
|
||||
|
||||
(set! %load-path (append '("@GUILE_SITE_DIR@") %load-path))
|
||||
(set! %load-compiled-path (append '("@GUILE_SITE_CCACHE_DIR@") %load-compiled-path))
|
||||
|
||||
(define (main args)
|
||||
(setenv "SHELL" ((compose canonicalize-path car command-line)))
|
||||
((@ (gash gash) main) (command-line)))
|
||||
|
|
|
@ -0,0 +1,68 @@
|
|||
#! /bin/sh
|
||||
|
||||
# Gash --- Guile As SHell
|
||||
# Copyright © 2018 Jan (janneke) Nieuwenhuizen <janneke@gnu.org>
|
||||
#
|
||||
# This file is part of Gash.
|
||||
#
|
||||
# Gash is free software; you can redistribute it and/or modify it
|
||||
# under the terms of the GNU General Public License as published by
|
||||
# the Free Software Foundation; either version 3 of the License, or (at
|
||||
# your option) any later version.
|
||||
#
|
||||
# Gash is distributed in the hope that it will be useful, but
|
||||
# WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
# GNU General Public License for more details.
|
||||
#
|
||||
# You should have received a copy of the GNU General Public License
|
||||
# along with Gash. If not, see <http://www.gnu.org/licenses/>.
|
||||
|
||||
if [ -n "$BUILD_DEBUG" ]; then
|
||||
set -x
|
||||
fi
|
||||
|
||||
export GUILE
|
||||
export GUILE_AUTO_COMPILE
|
||||
export GUILE_LOAD_PATH
|
||||
export GUILE_LOAD_COMPILED_PATH
|
||||
|
||||
GUILE_LOAD_PATH=$(pwd):$GUILE_LOAD_PATH
|
||||
GUILE_LOAD_COMPILED_PATH=$(pwd):$GUILE_LOAD_COMPILED_PATH
|
||||
GUILE=${GUILE-$(command -v guile)}
|
||||
GUILE_TOOLS=${GUILE_TOOLS-$(command -v guile-tools)}
|
||||
GUILE_AUTO_COMPILE=0
|
||||
|
||||
set -e
|
||||
|
||||
SCM_FILES="
|
||||
gash/gash.scm
|
||||
gash/io.scm
|
||||
gash/job.scm
|
||||
gash/peg.scm
|
||||
gash/pipe.scm
|
||||
gash/util.scm
|
||||
"
|
||||
|
||||
export srcdir=.
|
||||
export host=$($GUILE -c "(display %host-type)")
|
||||
|
||||
for i in $SCM_FILES; do
|
||||
go=${i%%.scm}.go
|
||||
if [ $i -nt $go ]; then
|
||||
echo " GUILEC $i"
|
||||
$GUILE_TOOLS compile -L bin -L gash -o $go $i
|
||||
fi
|
||||
done
|
||||
|
||||
SCRIPTS="
|
||||
bin/gash
|
||||
"
|
||||
|
||||
for i in $SCRIPTS; do
|
||||
go=${i%%.scm}.go
|
||||
if [ $i -nt $go ]; then
|
||||
echo " GUILEC $i"
|
||||
$GUILE_TOOLS compile -L guile -L scripts -o $go $i
|
||||
fi
|
||||
done
|
|
@ -0,0 +1,39 @@
|
|||
#! /bin/sh
|
||||
|
||||
# parse --prefix=PREFIX, mainly for GuixSD/Debian
|
||||
cmdline=$(echo "$@")
|
||||
PREFIX=${cmdline##*--prefix=}
|
||||
PREFIX=${PREFIX% *}
|
||||
PREFIX=${PREFIX% -*}
|
||||
if [ -z "$PREFIX" ]; then
|
||||
PREFIX=/usr/local
|
||||
fi
|
||||
|
||||
GUILE=$(command -v guile)
|
||||
GUILE_TOOLS=$(command -v guile-tools)
|
||||
GUILE_SITE_DIR=$PREFIX/share/guile/site/$GUILE_EFFECTIVE_VERSION
|
||||
GUILE_SITE_CCACHE_DIR=$PREFIX/lib/guile/$GUILE_EFFECTIVE_VERSION/site-ccache
|
||||
GUILE_EFFECTIVE_VERSION=$(guile -c '(display (effective-version))')
|
||||
|
||||
sed \
|
||||
-e s,@GUILE@,$GUILE,\
|
||||
-e s,@GUILE_SITE_DIR@,$GUILE_SITE_DIR,\
|
||||
-e s,@GUILE_SITE_CCACHE_DIR@,$GUILE_SITE_CCACHE_DIR,\
|
||||
bin/gash.in > bin/gash
|
||||
chmod +x bin/gash
|
||||
cat > .config.make <<EOF
|
||||
GUILE=$GUILE
|
||||
GUILE_TOOLS=$GUILE_TOOLS
|
||||
PREFIX=$PREFIX
|
||||
BINDIR=$PREFIX/bin
|
||||
DOCDIR=$PREFIX/share/doc/gash
|
||||
GUILE_EFFECTIVE_VERSION=$GUILE_EFFECTIVE_VERSION
|
||||
GUILE_SITE_DIR=$GUILE_SITE_DIR
|
||||
GUILE_SITE_CCACHE_DIR=$GUILE_SITE_CCACHE_DIR
|
||||
EOF
|
||||
|
||||
cat <<EOF
|
||||
Run:
|
||||
make to build gash
|
||||
make help for help on other targets
|
||||
EOF
|
55
makefile
55
makefile
|
@ -1,10 +1,55 @@
|
|||
all: bin/gash
|
||||
.PHONY: all all-go clean install
|
||||
-include .config.make
|
||||
|
||||
GUILE = $(shell $(SHELL) -c "command -v guile")
|
||||
default: all
|
||||
|
||||
.config.make: makefile
|
||||
./configure --prefix=$(PREFIX)
|
||||
|
||||
bin/gash: bin/gash.in
|
||||
sed s,@GUILE@,$(GUILE), $< > $@
|
||||
chmod +x $@
|
||||
./configure --prefix=$(PREFIX)
|
||||
|
||||
all: all-go bin/gash
|
||||
|
||||
all-go:
|
||||
build-aux/build-guile.sh
|
||||
|
||||
clean:
|
||||
rm -f bin/gash
|
||||
git clean -fdx
|
||||
|
||||
clean-go:
|
||||
rm -f $(shell find . -name '*.go')
|
||||
|
||||
check: all
|
||||
echo TODO
|
||||
|
||||
install: all
|
||||
mkdir -p $(DESTDIR)$(BINDIR)
|
||||
cp bin/gash $(DESTDIR)$(BINDIR)/gash
|
||||
mkdir -p $(DESTDIR)$(GUILE_SITE_DIR)
|
||||
tar -cf- gash/*.scm | tar -C $(DESTDIR)$(GUILE_SITE_DIR) -xf-
|
||||
mkdir -p $(DESTDIR)$(GUILE_SITE_CCACHE_DIR)
|
||||
cp bin/gash.go $(DESTDIR)$(GUILE_SITE_CCACHE_DIR)
|
||||
tar -cf- gash/*.go | tar -C $(DESTDIR)$(GUILE_SITE_CCACHE_DIR) -xf-
|
||||
mkdir -p $(DESTDIR)$(DOCDIR)
|
||||
cp -f COPYING README TODO $(DOCDIR)
|
||||
|
||||
define HELP_TOP
|
||||
Usage: make [OPTION]... [TARGET]...
|
||||
|
||||
Targets:
|
||||
all update everything
|
||||
all-go update .go files
|
||||
clean run git clean -dfx
|
||||
clean-go clean .go files
|
||||
install install in $(PREFIX)
|
||||
endef
|
||||
export HELP_TOP
|
||||
help:
|
||||
@echo "$$HELP_TOP"
|
||||
|
||||
export GUILE
|
||||
export GUILE_TOOLS
|
||||
export GUILE_LOAD_PATH
|
||||
export GUILE_LOAD_COMPILED_PATH
|
||||
|
||||
|
|
Loading…
Reference in New Issue