1
0
forked from alex-eg/sex

dev: require make deps manually for dev & CI

This commit is contained in:
2026-09-24 01:10:59 +03:00
parent e0987c1836
commit b1ab18b9af
3 changed files with 32 additions and 22 deletions

View File

@@ -57,7 +57,9 @@ jobs:
hash -r hash -r
csc -version csc -version
# Eggs are pinned in eggs.lock and installed by the Makefile into .eggs/. - name: Install dependencies
run: make deps
- name: Build sexc - name: Build sexc
run: make && ./sexc --help run: make && ./sexc --help

View File

@@ -34,24 +34,27 @@ DEPSLOCK = eggs.lock
EGGS_DIR := $(abspath .eggs) EGGS_DIR := $(abspath .eggs)
# Compiler's own repository (types.db, chicken.*), ignoring ambient venv vars. # Compiler's own repository (types.db, chicken.*), ignoring ambient venv vars.
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) 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)) CHICKEN_ABI := $(notdir $(SYSTEM_CHICKEN_REPO))
EGGS_STAMP := $(EGGS_DIR)/.installed-$(CHICKEN_ABI) EGGS_STAMP := $(EGGS_DIR)/.installed-$(CHICKEN_ABI)
export CHICKEN_EGG_CACHE := $(EGGS_DIR)/cache # Try project-local chicken repository first. In case it doesn't exist (packaging for distros),
export CHICKEN_INSTALL_REPOSITORY := $(EGGS_DIR) # system-wide repository will be used.
export CHICKEN_INSTALL_PREFIX := $(EGGS_DIR) unexport CHICKEN_INSTALL_REPOSITORY
unexport CHICKEN_EGG_CACHE
unexport CHICKEN_INSTALL_PREFIX
export CHICKEN_REPOSITORY_PATH := $(EGGS_DIR):$(SYSTEM_CHICKEN_REPO) export CHICKEN_REPOSITORY_PATH := $(EGGS_DIR):$(SYSTEM_CHICKEN_REPO)
all: sexc all: sexc
sexc: $(EGGS_STAMP) $(OBJ) main.scm sexc: $(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
@@ -82,11 +85,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: $(EGGS_STAMP) sex-tests:
$(MAKE) -C ./tests sex-tests $(MAKE) -C ./tests sex-tests
cp ./tests/sex-tests ./ cp ./tests/sex-tests ./
sextest: $(EGGS_STAMP) sextest:
$(MAKE) -C ./tools/sextest sextest $(MAKE) -C ./tools/sextest sextest
cp ./tools/sextest/sextest . cp ./tools/sextest/sextest .
@@ -116,9 +119,11 @@ installdirs:
uninstall: uninstall:
rm -f $(DESTDIR)$(bindir)/sexc rm -f $(DESTDIR)$(bindir)/sexc
# eggs.lock is the pin file (chicken-status -list). Install from it; $(EGGS_STAMP) deps-update: export CHICKEN_EGG_CACHE := $(EGGS_DIR)/cache
# do not float versions on a normal build. Regenerating the lock: $(EGGS_STAMP) deps-update: export CHICKEN_INSTALL_REPOSITORY := $(EGGS_DIR)
# make deps-update $(EGGS_STAMP) deps-update: export CHICKEN_INSTALL_PREFIX := $(EGGS_DIR)
$(EGGS_STAMP) deps-update: export CHICKEN_REPOSITORY_PATH := $(EGGS_DIR):$(SYSTEM_CHICKEN_REPO)
$(EGGS_STAMP): $(DEPSLOCK) $(EGGS_STAMP): $(DEPSLOCK)
mkdir -p $(CHICKEN_EGG_CACHE) mkdir -p $(CHICKEN_EGG_CACHE)
$(CHICKEN_INSTALL) -force -from-list $(DEPSLOCK) $(CHICKEN_INSTALL) -force -from-list $(DEPSLOCK)
@@ -126,10 +131,10 @@ $(EGGS_STAMP): $(DEPSLOCK)
deps: $(EGGS_STAMP) deps: $(EGGS_STAMP)
deps-update: $(DEPSFILE) deps-update: $(DEPSFILE) deps-clean
rm -rf $(EGGS_DIR)
mkdir -p $(CHICKEN_EGG_CACHE) mkdir -p $(CHICKEN_EGG_CACHE)
$(CHICKEN_INSTALL) -force $$(cat $(DEPSFILE)) $(CHICKEN_INSTALL) -force $$(cat $(DEPSFILE))
# Local repo only: a system path here would leak distro eggs into the lock.
CHICKEN_REPOSITORY_PATH=$(EGGS_DIR) $(CHICKEN_STATUS) -list | sort > $(DEPSLOCK).tmp CHICKEN_REPOSITORY_PATH=$(EGGS_DIR) $(CHICKEN_STATUS) -list | sort > $(DEPSLOCK).tmp
mv $(DEPSLOCK).tmp $(DEPSLOCK) mv $(DEPSLOCK).tmp $(DEPSLOCK)
touch $(EGGS_STAMP) touch $(EGGS_STAMP)

View File

@@ -12,22 +12,25 @@ Sex is statically typed, compiled general purpose language.
First, get yourself a Chicken, then, some Chicken deps. You also will First, get yourself a Chicken, then, some Chicken deps. You also will
need a C compiler. need a C compiler.
Eggs are installed into a project-local ~.eggs/~ repository; they do not ** Development
touch the Chicken system repository.
** Compilation
#+begin_src sh #+begin_src sh
make deps
make make
#+end_src #+end_src
That installs pinned eggs from ~eggs.lock~ into ~.eggs/~ if needed, then ~make deps~ installs pinned eggs from ~eggs.lock~ into a project-local
builds ~sexc~. ~dependencies.txt~ is the unpinned request list. To ~.eggs/~ repository. ~dependencies.txt~ is the unpinned request list.
refresh ~eggs.lock~ after changing it: To refresh ~eggs.lock~ after changing it:
#+begin_src sh #+begin_src sh
make deps-update make deps-update
#+end_src #+end_src
** Packaging for system package managers
- Depend ~sex~ package on Chicken-6 (with ~libchicken.a~) and all eggs from ~dependencies.txt~.
- Compile and install with ~make~ (usually no other arguments required).
- Move resulting ~sexc~ binary to the appropriate place.
** Static compilation ** Static compilation
The default ~CSC_FLAGS~ include ~-static~, so ~sexc~ does not need The default ~CSC_FLAGS~ include ~-static~, so ~sexc~ does not need
~.eggs~ at runtime and ~make install~ stays relocatable. Chicken must ~.eggs~ at runtime and ~make install~ stays relocatable. Chicken must