Page MenuHomePhorge

No OneTemporary

Size
3 KB
Referenced Files
None
Subscribers
None
diff --git a/Makefile b/Makefile
index 9807776..47327a1 100644
--- a/Makefile
+++ b/Makefile
@@ -1,74 +1,85 @@
MIX = mix
MYHTMLEX_CFLAGS = -g -O2 -std=c99 -pedantic -Wcomment -Wall
# we need to compile position independent code
MYHTMLEX_CFLAGS += -fpic -DPIC
# For some reason __erl_errno is undefined unless _REENTRANT is defined
MYHTMLEX_CFLAGS += -D_REENTRANT
# myhtmlex is using stpcpy, as defined in gnu string.h
# MYHTMLEX_CFLAGS += -D_GNU_SOURCE
# base on the same posix c source as myhtml
# MYHTMLEX_CFLAGS += -D_POSIX_C_SOURCE=199309
# turn warnings into errors
# MYHTMLEX_CFLAGS += -Werror
# ignore unused variables
# MYHTMLEX_CFLAGS += -Wno-unused-variable
# ignore unused parameter warnings
MYHTMLEX_CFLAGS += -Wno-unused-parameter
# set erlang include path
ERLANG_PATH = $(shell erl -eval 'io:format("~s", [lists:concat([code:root_dir(), "/erts-", erlang:system_info(version)])])' -s init stop -noshell)
MYHTMLEX_CFLAGS += -I$(ERLANG_PATH)/include
# expecting myhtml as a submodule in c_src/
# that way we can pin a version and package the whole thing in hex
# hex does not allow for non-app related dependencies.
MYHTML_PATH = c_src/myhtml
MYHTML_STATIC = $(MYHTML_PATH)/lib/libmyhtml_static.a
MYHTMLEX_CFLAGS += -I$(MYHTML_PATH)/include
# that would be used for a dynamically linked build
# MYHTMLEX_CFLAGS += -L$(MYHTML_PATH)/lib
MYHTMLEX_LDFLAGS = -shared
# C-Node
ERL_INTERFACE = $(wildcard $(ERLANG_PATH)/../lib/erl_interface-*)
CNODE_CFLAGS = $(MYHTMLEX_CFLAGS)
CNODE_CFLAGS += -L$(ERL_INTERFACE)/lib
CNODE_CFLAGS += -I$(ERL_INTERFACE)/include
CNODE_CFLAGS += -lerl_interface -lei
# platform specific
UNAME = $(shell uname -s)
ifeq ($(wilcard Makefile.$(UNAME)),)
include Makefile.$(UNAME)
endif
+# enumerate docker build tests
+BUILD_TESTS := $(patsubst %.dockerfile, %.dockerfile.PHONY, $(wildcard ./build-test/*.dockerfile))
+
.PHONY: all
all: myhtmlex
myhtmlex: priv/myhtmlex.so
$(MIX) compile
$(MYHTML_STATIC): $(MYHTML_PATH)
$(MAKE) -C $(MYHTML_PATH) library
priv/myhtmlex.so: c_src/myhtmlex.c $(MYHTML_STATIC)
$(CC) $(MYHTMLEX_CFLAGS) $(MYHTMLEX_LDFLAGS) -o $@ $< $(MYHTML_STATIC)
priv/cclient: c_src/cclient.c $(MYHTML_STATIC)
$(CC) -o $@ $< $(MYHTML_STATIC) $(CNODE_CFLAGS)
clean: clean-myhtml
$(RM) -r priv/myhtmlex*
$(RM) priv/cclient
$(RM) myhtmlex-*.tar
$(RM) -r package-test
clean-myhtml:
$(MAKE) -C $(MYHTML_PATH) clean
publish: clean
$(MIX) hex.publish
+test:
+ $(MIX) test
+
+build-tests: test $(BUILD_TESTS)
+
+%.dockerfile.PHONY: %.dockerfile
+ docker build -f $< .
+
diff --git a/build-test/ubuntu-14.04.dockerfile b/build-test/ubuntu-14.04.dockerfile
new file mode 100644
index 0000000..eb62836
--- /dev/null
+++ b/build-test/ubuntu-14.04.dockerfile
@@ -0,0 +1,33 @@
+FROM ubuntu:trusty
+
+RUN mkdir myhtmlex
+WORKDIR myhtmlex
+
+ENV DEBIAN_FRONTEND=noninteractive
+
+RUN apt-get update \
+ && apt-get install -y curl \
+ && curl -LO https://packages.erlang-solutions.com/erlang-solutions_1.0_all.deb \
+ && dpkg -i erlang-solutions_1.0_all.deb \
+ && apt-get update \
+ && apt-get install -y \
+ git \
+ esl-erlang \
+ elixir \
+ build-essential \
+ && mix local.hex --force \
+ && echo 'LANG=en_US.UTF-8' > /etc/default/locale \
+ && echo 'LANGUAGE=en_US' >> /etc/default/locale
+
+COPY . ./
+
+# Test build
+RUN mix deps.get \
+ && make \
+ && mix test \
+ && mix bench \
+ && make clean
+
+# Test that it works as a dependency
+RUN build-test/package.sh
+

File Metadata

Mime Type
text/x-diff
Expires
Sun, Jan 19, 6:44 PM (1 d, 18 h)
Storage Engine
blob
Storage Format
Raw Data
Storage Handle
55382
Default Alt Text
(3 KB)

Event Timeline