Skip to content

Commit ccb996b

Browse files
authored
Add amalgamation Makefile target (#949)
Also include quickjs-libc.h, otherwise downstream users can compile but not call its functions.
1 parent e2f61ac commit ccb996b

File tree

3 files changed

+13
-5
lines changed

3 files changed

+13
-5
lines changed

.github/workflows/ci.yml

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -582,9 +582,10 @@ jobs:
582582
make
583583
- name: create amalgamation
584584
run: |
585-
build/qjs amalgam.js $RUNNER_TEMP/quickjs-amalgam.c
585+
make amalgam
586586
- name: build amalgamation
587587
run: |
588+
unzip -d $RUNNER_TEMP build/quickjs-amalgam.zip
588589
cc -Wall -I. -o $RUNNER_TEMP/run-test262.o -c run-test262.c
589590
cc -Wall -I/ -DQJS_BUILD_LIBC -o $RUNNER_TEMP/quickjs-amalgam.o -c $RUNNER_TEMP/quickjs-amalgam.c
590591
cc -o $RUNNER_TEMP/run-test262 $RUNNER_TEMP/run-test262.o $RUNNER_TEMP/quickjs-amalgam.o -lm

.github/workflows/release.yml

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -50,9 +50,7 @@ jobs:
5050
cd build
5151
cmake -DCMAKE_OSX_ARCHITECTURES="x86_64;arm64" ..
5252
make -j$(getconf _NPROCESSORS_ONLN)
53-
(cd .. && build/qjs amalgam.js build/quickjs-amalgam.c)
54-
cp ../quickjs.h .
55-
zip -9 quickjs-amalgam.zip quickjs-amalgam.c quickjs.h
53+
make -C .. amalgam # writes build/quickjs-amalgam.zip
5654
mv qjs qjs-darwin
5755
mv qjsc qjsc-darwin
5856
- name: check

Makefile

Lines changed: 10 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -45,6 +45,15 @@ endif
4545

4646
all: $(QJS)
4747

48+
amalgam: TEMP := $(shell mktemp -d)
49+
amalgam: $(QJS)
50+
$(QJS) amalgam.js $(TEMP)/quickjs-amalgam.c
51+
cp quickjs.h quickjs-libc.h $(TEMP)
52+
cd $(TEMP) && zip -9 quickjs-amalgam.zip quickjs-amalgam.c quickjs.h quickjs-libc.h
53+
cp $(TEMP)/quickjs-amalgam.zip $(BUILD_DIR)
54+
cd $(TEMP) && $(RM) quickjs-amalgam.zip quickjs-amalgam.c quickjs.h quickjs-libc.h
55+
$(RM) -d $(TEMP)
56+
4857
fuzz:
4958
clang -g -O1 -fsanitize=address,undefined,fuzzer -o fuzz fuzz.c
5059
./fuzz
@@ -117,4 +126,4 @@ unicode_gen: $(BUILD_DIR)
117126
libunicode-table.h: unicode_gen
118127
$(BUILD_DIR)/unicode_gen unicode $@
119128

120-
.PHONY: all ctest cxxtest debug fuzz install clean codegen distclean stats test test262 test262-update test262-check microbench unicode_gen $(QJS) $(QJSC)
129+
.PHONY: all amalgam ctest cxxtest debug fuzz install clean codegen distclean stats test test262 test262-update test262-check microbench unicode_gen $(QJS) $(QJSC)

0 commit comments

Comments
 (0)