Skip to content
This repository was archived by the owner on Nov 3, 2021. It is now read-only.

Commit 2e703fc

Browse files
committed
Support FreeBSD.
1 parent 62d2bea commit 2e703fc

File tree

3 files changed

+33
-12
lines changed

3 files changed

+33
-12
lines changed

Makefile

+12
Original file line numberDiff line numberDiff line change
@@ -10,6 +10,10 @@ repl: install shadow-cljs-repl-app
1010
test-refresh: install shadow-cljs-watch-test-autorun
1111
test: install echo-testing shadow-cljs-test
1212

13+
# Build a binary for FreeBSD using `make release-for-os` on a FreeBSD system.
14+
bin-for-os: install build pkg-for-os
15+
release-for-os: install test bin-for-os test-bin
16+
1317

1418
### Clojure ###
1519

@@ -67,6 +71,14 @@ pkg:
6771
--out-path ./target/pkg \
6872
./target/hello.js
6973

74+
pkg-for-os:
75+
@echo "building binary ..."
76+
@./node_modules/.bin/pkg \
77+
-c package.json \
78+
-t node10 \
79+
--output ./target/hello \
80+
./target/hello.js
81+
7082
pkg-renamed: pkg
7183
@mkdir -p ./target/bin-alpine
7284
@mv ./target/pkg/hello-alpine ./target/bin-alpine/hello

README.md

+4
Original file line numberDiff line numberDiff line change
@@ -61,6 +61,10 @@ Development:
6161
* `make test-refresh` -- Run project tests and watch for changes.
6262
* `make test` -- Run project tests.
6363

64+
To build a binary for FreeBSD, set up a development environment and run `make
65+
release-for-os` on a FreeBSD system, with resulting binary at `./target/hello`.
66+
67+
6468
Production:
6569

6670
* After running `make`, find redistributable binaries in `./target/bin-*/`.

test/bash/test_bin

+17-12
Original file line numberDiff line numberDiff line change
@@ -40,18 +40,23 @@ assert_equal() {
4040
resolve_exe() {
4141
# Resolve path to project-built binary based on the present platform.
4242

43-
case "$OSTYPE" in
44-
linux*)
45-
EXE="$TARGET/bin-linux/$NAME"
46-
;;
47-
darwin*)
48-
EXE="$TARGET/bin-mac/$NAME"
49-
;;
50-
*)
51-
echo "$PROG: unsupported OS: $OSTYPE" >&2
52-
return 2
53-
;;
54-
esac
43+
if [ -e "$TARGET/$NAME" ]; then
44+
# Prefer single binary, if found, which is a build for current OS.
45+
EXE="$TARGET/$NAME"
46+
else
47+
case "$OSTYPE" in
48+
linux*)
49+
EXE="$TARGET/bin-linux/$NAME"
50+
;;
51+
darwin*)
52+
EXE="$TARGET/bin-mac/$NAME"
53+
;;
54+
*)
55+
echo "$PROG: unsupported OS: $OSTYPE" >&2
56+
return 2
57+
;;
58+
esac
59+
fi
5560

5661
echo "Testing binary: $EXE"
5762
}

0 commit comments

Comments
 (0)