1
0
forked from alex-eg/sex

7 Commits

Author SHA1 Message Date
Pavel Kulyov
ca71ae6e91 ci: drop manual eggs installation 2026-09-18 00:43:29 +03:00
Pavel Kulyov
0256aa8a22 deps: lock versions 2026-09-18 00:43:13 +03:00
Pavel Kulyov
c0a34fc64c readme: update installation docs 2026-09-18 00:43:13 +03:00
Pavel Kulyov
94c4a7008f infra: pepper some GNU on top of Makefile 2026-09-18 00:43:13 +03:00
Pavel Kulyov
e2fb4adae5 readme: add docs about static compilation 2026-09-18 00:26:17 +03:00
Pavel Kulyov
e3da2a1e79 Update gitignore 2026-09-18 00:26:17 +03:00
Pavel Kulyov
79ce3dace2 Add project-local dependencies installation 2026-09-18 00:26:16 +03:00
4 changed files with 56 additions and 37 deletions

View File

@@ -57,20 +57,9 @@ jobs:
hash -r hash -r
csc -version csc -version
- name: Install eggs # Eggs are pinned in eggs.lock and installed by the Makefile into .eggs/.
run: |
set -eu
mkdir -p .eggs
repo="$(chicken-install -repository)"
echo "CHICKEN_INSTALL_REPOSITORY=${PWD}/.eggs" >> "$GITHUB_ENV"
echo "CHICKEN_REPOSITORY_PATH=${PWD}/.eggs:${repo}" >> "$GITHUB_ENV"
export CHICKEN_INSTALL_REPOSITORY="${PWD}/.eggs"
export CHICKEN_REPOSITORY_PATH="${PWD}/.eggs:${repo}"
# shellcheck disable=SC2046
chicken-install $(cat dependencies.txt)
- name: Build sexc - name: Build sexc
run: make sexc && ./sexc --help run: make && ./sexc --help
- name: Run tests - name: Run tests
run: make run-tests run: make check

View File

@@ -1,4 +1,6 @@
CHICKEN_C = csc CHICKEN_C ?= csc
CHICKEN_INSTALL ?= chicken-install
CHICKEN_STATUS ?= chicken-status
CSC_FLAGS += -K prefix -static CSC_FLAGS += -K prefix -static
# What and why: # What and why:
# -emit-all-import-libraries: Emit import-libraries for all defined modules. # -emit-all-import-libraries: Emit import-libraries for all defined modules.
@@ -11,7 +13,6 @@ CSC_FLAGS += -K prefix -static
# "during expansion of (import ...) - cannot import from undefined module: sex-macros" # "during expansion of (import ...) - cannot import from undefined module: sex-macros"
# error. # error.
# -c: Stop after compilation to object files. This one is obvious. # -c: Stop after compilation to object files. This one is obvious.
CHICKEN_INSTALL = chicken-install
# GNU directory variables. Command line overrides, e.g. # GNU directory variables. Command line overrides, e.g.
# make prefix=$(HOME)/.local install # make prefix=$(HOME)/.local install
@@ -29,22 +30,28 @@ MODULES = utils types sex-macros reader sex-modules semen sex-fmt-c fmt-c-writer
OBJ = $(MODULES:%=%.o) OBJ = $(MODULES:%=%.o)
DEPSFILE = dependencies.txt DEPSFILE = dependencies.txt
DEPSLOCK = .eggs.lock DEPSLOCK = eggs.lock
EGGS_DIR := $(abspath .eggs)
DEPENDENCIES = $(shell cat $(DEPSFILE)) # Compiler's own repository (types.db, chicken.*), ignoring ambient venv vars.
CHICKEN_EXTERNAL_REPOSITORY := $(shell chicken-install -repository) SYSTEM_CHICKEN_REPO := $(shell env -u CHICKEN_INSTALL_REPOSITORY -u CHICKEN_REPOSITORY_PATH -u CHICKEN_EGG_CACHE -u CHICKEN_INSTALL_PREFIX $(CHICKEN_INSTALL) -repository 2>/dev/null)
CHICKEN_ABI := $(notdir $(SYSTEM_CHICKEN_REPO))
EGGS_STAMP := $(EGGS_DIR)/.installed-$(CHICKEN_ABI)
export CHICKEN_EGG_CACHE=$(abspath .eggs)/cache export CHICKEN_EGG_CACHE := $(EGGS_DIR)/cache
export CHICKEN_REPOSITORY_PATH=$(abspath .eggs):$(CHICKEN_EXTERNAL_REPOSITORY) export CHICKEN_INSTALL_REPOSITORY := $(EGGS_DIR)
export CHICKEN_INSTALL_REPOSITORY=$(abspath .eggs) export CHICKEN_INSTALL_PREFIX := $(EGGS_DIR)
export CHICKEN_REPOSITORY_PATH := $(EGGS_DIR):$(SYSTEM_CHICKEN_REPO)
all: sexc all: sexc
sexc: $(OBJ) main.scm sexc: $(EGGS_STAMP) $(OBJ) main.scm
$(CHICKEN_C) $(CSC_FLAGS) main.scm -o sexc-tmp -link sexc $(CHICKEN_C) $(CSC_FLAGS) main.scm -o sexc-tmp -link sexc
# otherwise csc hangs, probably because it tries to compile to sexc.o first # otherwise csc hangs, probably because it tries to compile to sexc.o first
mv sexc-tmp sexc mv sexc-tmp sexc
$(OBJ): $(EGGS_STAMP)
#------------------------------------------------------------------ #------------------------------------------------------------------
utils.o: utils.module.scm utils.scm utils.o: utils.module.scm utils.scm
@@ -75,11 +82,11 @@ sexc.o: sexc.module.scm types.o sexc.scm fmt-c-writer.o sex-macros.o sex-modules
$(CHICKEN_C) $(CSC_FLAGS) $(MODULE_FLAGS) sexc.module.scm -o sexc.o -unit sexc -link fmt-c-writer,sex-macros,sex-modules,reader,semen,types,utils $(CHICKEN_C) $(CSC_FLAGS) $(MODULE_FLAGS) sexc.module.scm -o sexc.o -unit sexc -link fmt-c-writer,sex-macros,sex-modules,reader,semen,types,utils
# Unit testing # Unit testing
sex-tests: sex-tests: $(EGGS_STAMP)
$(MAKE) -C ./tests sex-tests $(MAKE) -C ./tests sex-tests
cp ./tests/sex-tests ./ cp ./tests/sex-tests ./
sextest: sextest: $(EGGS_STAMP)
$(MAKE) -C ./tools/sextest sextest $(MAKE) -C ./tools/sextest sextest
cp ./tools/sextest/sextest . cp ./tools/sextest/sextest .
@@ -93,7 +100,7 @@ check-modules: sexc
check-exit-code: sexc check-exit-code: sexc
@$(MAKE) --no-print-directory -C ./tests/exit-code check SEXC=../../sexc @$(MAKE) --no-print-directory -C ./tests/exit-code check SEXC=../../sexc
run-tests: sexc sex-tests sextest check run-tests: sexc sex-tests sextest
./sex-tests && ./sextest --sexc=./sexc $(SEX_TEST_PROGRAMS:%=./tests/sex-programs/%.sex) && $(MAKE) check-modules && $(MAKE) check-exit-code ./sex-tests && ./sextest --sexc=./sexc $(SEX_TEST_PROGRAMS:%=./tests/sex-programs/%.sex) && $(MAKE) check-modules && $(MAKE) check-exit-code
install: all installdirs install: all installdirs
@@ -108,25 +115,36 @@ installdirs:
uninstall: uninstall:
rm -f $(DESTDIR)$(bindir)/sexc rm -f $(DESTDIR)$(bindir)/sexc
run-tests: sex-tests # eggs.lock is the pin file (chicken-status -list). Install from it;
./sex-tests # do not float versions on a normal build. Regenerating the lock:
# make deps-update
$(EGGS_STAMP): $(DEPSLOCK)
mkdir -p $(CHICKEN_EGG_CACHE)
$(CHICKEN_INSTALL) -force -from-list $(DEPSLOCK)
touch $@
.eggs.lock: $(DEPSFILE) deps: $(EGGS_STAMP)
env | grep CHICKEN
$(CHICKEN_INSTALL) $(DEPENDENCIES)
touch $(DEPSLOCK)
deps: $(DEPSLOCK) deps-update: $(DEPSFILE)
rm -rf $(EGGS_DIR)
mkdir -p $(CHICKEN_EGG_CACHE)
$(CHICKEN_INSTALL) -force $$(cat $(DEPSFILE))
CHICKEN_REPOSITORY_PATH=$(EGGS_DIR) $(CHICKEN_STATUS) -list | sort > $(DEPSLOCK).tmp
mv $(DEPSLOCK).tmp $(DEPSLOCK)
touch $(EGGS_STAMP)
clean: clean:
rm -f $(OBJ) main.o rm -f $(OBJ) main.o
rm -f *.import.scm rm -f *.import.scm
rm -f *.link rm -f *.link
rm -f sexc sex-tests sextest rm -f sexc sex-tests sextest
$(MAKE) -C ./tests clean
$(MAKE) -C ./tests/modules clean $(MAKE) -C ./tests/modules clean
$(MAKE) -C ./tools/sextest clean
deps-clean: deps-clean:
rm -rf $(EGGS_DIR) rm -rf $(EGGS_DIR)
.PHONY: all check run-tests check-modules check-exit-code install install-strip installdirs .PHONY: all check run-tests check-modules check-exit-code \
uninstall deps deps-update clean depsclean sex-tests sextest install install-strip installdirs uninstall \
deps deps-update deps-clean clean sex-tests sextest

View File

@@ -42,11 +42,15 @@ tree's ~.eggs~ path):
#+end_src #+end_src
** Installation ** Installation
GNU directory variables: ~prefix~, ~exec_prefix~, ~bindir~, ~DESTDIR~.
#+begin_src sh #+begin_src sh
# default installation (/usr/local/bin/) # default installation (/usr/local/bin/)
make install make install
# you can customize the prefix (will install to ~/.local/bin) # customize the prefix (installs to ~/.local/bin)
make prefix=~/.local install make prefix=$(HOME)/.local install
# staged install for packaging
make DESTDIR=/tmp/stage prefix=/usr install
#+end_src #+end_src
* Usage * Usage

8
eggs.lock Normal file
View File

@@ -0,0 +1,8 @@
(brev-separate "1.100")
(fmt "0.8.14")
(getopt-long "4.0")
(matchable "1.2")
(srfi-1 "0.5.1")
(srfi-13 "0.3.8")
(srfi-69 "0.5.3")
(test "1.3")