Skip to content

Commit

Permalink
make sure wd builds in an isolated environment
Browse files Browse the repository at this point in the history
  • Loading branch information
deoxxa committed Jan 25, 2019
1 parent 6284d9b commit 48aed25
Show file tree
Hide file tree
Showing 5 changed files with 18 additions and 4 deletions.
2 changes: 2 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -2,3 +2,5 @@
/wd
/gdb.txt
/gdb.log
/release
/wd_static
14 changes: 10 additions & 4 deletions Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -3,21 +3,21 @@ prefix?=/usr/local
wd_cflags:=-std=c99 -Wall -Wextra -pedantic -I. $(CFLAGS)
wd_dynamic_libs:=-lcmark-gfm -lcmark-gfm-extensions -lduktape -ltermbox -luriparser
wd_static_libs:=vendor/cmark-gfm/extensions/cmark-gfm-extensions.a vendor/cmark-gfm/src/cmark-gfm.a vendor/duktape/src/duktape.a vendor/termbox/src/termbox.a vendor/uriparser/src/uriparser.a
wd_ldlibs:=-lcurl -lm $(LDLIBS)
wd_ldlibs:=-lcurl -lm -lssl -lcrypto -lssh2 -lz $(LDLIBS)
wd_objects:=$(patsubst %.c,%.o,$(wildcard *.c))
wd_vendor_deps:=
wd_static_flag:=

ifdef wd_vendor
wd_ldlibs:=$(wd_static_libs) $(wd_ldlibs)
wd_cflags:=-Ivendor/termbox/src -Ivendor/cmark-gfm/src -Ivendor/duktape/src -Ivendor/uriparser/include $(wd_cflags)
wd_cflags:=-Ivendor/termbox/src -Ivendor/cmark-gfm/src -Ivendor/cmark-gfm/extensions -Ivendor/duktape/src -Ivendor/uriparser/include $(wd_cflags)
wd_vendor_deps:=$(wd_static_libs)
else
wd_ldlibs:=$(wd_dynamic_libs) $(wd_ldlibs)
endif

ifdef wd_static
wd_static_flag:=-static
wd_static_flag:=-static
endif

all: wd
Expand All @@ -31,9 +31,15 @@ $(wd_objects): %.o: %.c
$(wd_vendor_deps):
$(MAKE) -C vendor

wd_static:
docker run --rm -v $$PWD:/wd alpine:3.6 sh -c 'apk add --update build-base curl-dev libressl-dev libssh2-dev && cd /wd && make wd_vendor=1 wd_static=1 && mv wd wd_static'

release: wd_static
curl --silent --output $@ --upload-file $< https://transfer.sh/wd

install: wd
install -D -v -m 755 wd $(DESTDIR)$(prefix)/bin/wd

clean:
rm -f wd $(wd_objects) $(wd_vendor_deps)
rm -f wd wd_static release $(wd_objects) $(wd_vendor_deps)
$(MAKE) -C vendor clean
2 changes: 2 additions & 0 deletions vendor/cmark-gfm/extensions/cmark-gfm-extensions_export.h
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
#define CMARK_GFM_EXTENSIONS_EXPORT
#define CMARK_GFM_EXTENSIONS_NO_EXPORT
2 changes: 2 additions & 0 deletions vendor/cmark-gfm/src/cmark-gfm_export.h
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
#define CMARK_GFM_EXPORT
#define CMARK_GFM_NO_EXPORT
2 changes: 2 additions & 0 deletions vendor/cmark-gfm/src/cmark-gfm_version.h
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
#define CMARK_GFM_VERSION ((0 << 24) | (28 << 16) | (3 << 8) | 19)
#define CMARK_GFM_VERSION_STRING "0.28.3.gfm.19"

0 comments on commit 48aed25

Please sign in to comment.