3 SRCDIR
= $(realpath
$(dir $(firstword $(MAKEFILE_LIST
))))
5 DEPS_ROOT
= $(SRCDIR
)/dependency
/install
6 DEPS_PREFIX
= $(DEPS_ROOT
)/usr
7 DEPS_BIN
= $(DEPS_PREFIX
)/bin
8 DEPS_LIB
= $(DEPS_PREFIX
)/lib
9 DEPS_INC
= $(DEPS_PREFIX
)/include
12 LIBMUSL_SHA1
= 027c3ae2182fa53c2b554ca98a28dc5cfca4b2c3
14 LIBNCURSES
= ncurses-6.0
15 LIBNCURSES_SHA1
= acd606135a5124905da770803c05f1f20dd3b21c
17 LIBTERMKEY
= libtermkey-0.18
18 LIBTERMKEY_SHA1
= 0a78ba7aaa2f3b53f2273268366fef349c9be4ab
21 #LIBLUA_SHA1 = 1676c6a041d90b6982db8cef1e5fb26000ab6dee
22 #LIBLUA_LPEG_SHA1 = aaa6df78cf5e2e31d690d96c6cd9f960f80f4347
24 LIBLUA_SHA1
= ef15259421197e3d85b7d6e4871b8c26fd82c1cf
25 LIBLUA_LPEG_SHA1
= 459d7cd7dd1e3096096d55ebd4475bc8f4da6927
27 #LIBLUA_SHA1 = b3882111ad02ecc6b972f8c1241647905cb2e3fc
30 LIBLPEG_SHA1
= 64a0920c9243b624a277c987d2219b6c50c43971
32 LIBNCURSES_CONFIG
= --disable-database
--with-fallbacks
=st
,st-256color
,xterm
,xterm-256color
,vt100 \
33 --with-shared
--enable-widec
--enable-ext-colors
--with-termlib
=tinfo \
34 --without-ada
--without-cxx
--without-cxx-binding
--without-manpages \
35 --without-tests
--without-progs
--without-debug
--without-profile \
36 --without-cxx-shared
--without-termlib
--without--ticlib
44 dependency
/sources
/musl-
%: | dependency
/sources
45 wget
-c
-O
$@.part http
://www.musl-libc.org
/releases
/$(LIBMUSL
).
tar.gz
47 [ -z
$(LIBMUSL_SHA1
) ] ||
(echo
'$(LIBMUSL_SHA1) $@' | sha1sum
-c
)
49 dependency
/build
/libmusl-extract
: dependency
/sources
/$(LIBMUSL
).
tar.gz | dependency
/build
50 tar xzf
$< -C
$(dir $@
)
53 dependency
/build
/libmusl-configure
: dependency
/build
/libmusl-extract
54 # tweak musl gcc wrapper/spec file to support static PIE linking
55 sed
-i
's#%{pie:S}crt1.o#%{pie:%{static:rcrt1.o%s;:Scrt1.o%s};:crt1.o%s}#' $(dir $<)/$(LIBMUSL
)/tools
/musl-gcc.specs.sh
56 cd
$(dir $<)/$(LIBMUSL
) && .
/configure
--prefix=$(DEPS_PREFIX
) --syslibdir
=$(DEPS_PREFIX
)/lib
59 dependency
/build
/libmusl-build
: dependency
/build
/libmusl-configure
60 $(MAKE
) -C
$(dir $<)/$(LIBMUSL
)
63 dependency
/build
/libmusl-install
: dependency
/build
/libmusl-build
64 $(MAKE
) -C
$(dir $<)/$(LIBMUSL
) install
67 dependency
/sources
/ncurses-
%: | dependency
/sources
68 wget
-c
-O
$@.part http
://ftp.gnu.org
/gnu
/ncurses
/$(LIBNCURSES
).
tar.gz
70 [ -z
$(LIBNCURSES_SHA1
) ] ||
(echo
'$(LIBNCURSES_SHA1) $@' | sha1sum
-c
)
72 dependency
/build
/libncurses-extract
: dependency
/sources
/$(LIBNCURSES
).
tar.gz | dependency
/build
73 tar xzf
$< -C
$(dir $@
)
76 dependency
/build
/libncurses-configure
: dependency
/build
/libncurses-extract
77 cd
$(dir $<)/$(LIBNCURSES
) && .
/configure
--prefix=/usr
--libdir=/usr
/lib
$(LIBNCURSES_CONFIG
)
80 dependency
/build
/libncurses-build
: dependency
/build
/libncurses-configure
81 $(MAKE
) -C
$(dir $<)/$(LIBNCURSES
)
84 dependency
/build
/libncurses-install
: dependency
/build
/libncurses-build
85 $(MAKE
) -C
$(dir $<)/$(LIBNCURSES
) install.libs DESTDIR
=$(DEPS_ROOT
)
88 dependency
/sources
/libtermkey-
%: | dependency
/sources
89 wget
-c
-O
$@.part http
://www.leonerd.org.uk
/code
/libtermkey
/$(LIBTERMKEY
).
tar.gz
91 [ -z
$(LIBTERMKEY_SHA1
) ] ||
(echo
'$(LIBTERMKEY_SHA1) $@' | sha1sum
-c
)
93 dependency
/build
/libtermkey-extract
: dependency
/sources
/$(LIBTERMKEY
).
tar.gz | dependency
/build
94 tar xzf
$< -C
$(dir $@
)
97 dependency
/build
/libtermkey-build
: dependency
/build
/libtermkey-extract dependency
/build
/libncurses-install
98 # TODO no sane way to avoid pkg-config and specify LDFLAGS?
99 sed
-i
's/LDFLAGS+=-lncurses$$/LDFLAGS+=-lncursesw/g' $(dir $<)/$(LIBTERMKEY
)/Makefile
100 $(MAKE
) -C
$(dir $<)/$(LIBTERMKEY
) PREFIX
=$(DEPS_PREFIX
) termkey.h libtermkey.la
103 dependency
/build
/libtermkey-install
: dependency
/build
/libtermkey-build
104 $(MAKE
) -C
$(dir $<)/$(LIBTERMKEY
) PREFIX
=$(DEPS_PREFIX
) install-inc install-lib
107 dependency
/sources
/lua-
%.
tar.gz
: | dependency
/sources
108 wget
-c
-O
$@.part http
://www.lua.org
/ftp
/$(LIBLUA
).
tar.gz
110 [ -z
$(LIBLUA_SHA1
) ] ||
(echo
'$(LIBLUA_SHA1) $@' | sha1sum
-c
)
112 dependency
/build
/liblua-extract
: dependency
/sources
/$(LIBLUA
).
tar.gz | dependency
/build
113 tar xzf
$< -C
$(dir $@
)
116 dependency
/sources
/lua-
%-lpeg.patch1
: | dependency
/sources
117 wget
-c
-O
$@.part http
://www.brain-dump.org
/projects
/vis
/$(LIBLUA
)-lpeg.patch1
119 [ -z
$(LIBLUA_LPEG_SHA1
) ] ||
(echo
'$(LIBLUA_LPEG_SHA1) $@' | sha1sum
-c
)
121 dependency
/build
/liblua-patch
: dependency
/build
/liblua-extract dependency
/sources
/$(LIBLUA
)-lpeg.patch1 dependency
/build
/liblpeg-extract
122 cd
$(dir $<)/$(LIBLUA
) && patch
-p1
< ..
/..
/sources
/$(LIBLUA
)-lpeg.patch1
123 cp
$(dir $<)/$(LIBLPEG
)/*.
[ch
] $(dir $<)/$(LIBLUA
)/src
126 dependency
/build
/liblua-build
: dependency
/build
/liblua-patch
127 $(MAKE
) -C
$(dir $<)/$(LIBLUA
)/src
all CC
=$(CC
) MYCFLAGS
="-DLUA_COMPAT_5_1 -DLUA_COMPAT_5_2 -DLUA_COMPAT_ALL -DLUA_USE_POSIX -DLUA_USE_DLOPEN -fPIC" MYLIBS
="-Wl,-E -ldl -lm"
128 #$(MAKE) -C $(dir $<)/$(LIBLUA) posix CC=$(CC)
131 dependency
/build
/liblua-install
: dependency
/build
/liblua-build
132 $(MAKE
) -C
$(dir $<)/$(LIBLUA
) INSTALL_TOP
=$(DEPS_PREFIX
) install
135 dependency
/sources
/lpeg-
%: | dependency
/sources
136 wget
-c
-O
$@.part http
://www.inf.puc-rio.br
/~roberto
/lpeg
/$(LIBLPEG
).
tar.gz
138 [ -z
$(LIBLPEG_SHA1
) ] ||
(echo
'$(LIBLPEG_SHA1) $@' | sha1sum
-c
)
140 dependency
/build
/liblpeg-extract
: dependency
/sources
/$(LIBLPEG
).
tar.gz | dependency
/build
141 tar xzf
$< -C
$(dir $@
)
144 dependencies-common
: dependency
/build
/libtermkey-install dependency
/build
/liblua-install
146 dependency
/build
/local
: dependencies-common
149 dependency
/build
/standalone
: dependency
/build
/libncurses-install dependencies-common
153 rm -f dependency
/build
/libmusl-install
154 rm -rf dependency
/build
/*curses
*
155 rm -rf dependency
/build
/libtermkey
*
156 rm -rf dependency
/build
/*lua
*
157 rm -rf dependency
/build
/*lpeg
*
158 rm -f dependency
/build
/local
159 rm -f dependency
/build
/standalone
160 rm -rf dependency
/install
164 [ ! -e dependency
/build
/standalone
] ||
$(MAKE
) dependencies-clean
165 mkdir
-p dependency
/build
166 [ -e dependency
/build
/libncurses-install
] || touch \
167 dependency
/build
/libncurses-extract \
168 dependency
/build
/libncurses-configure \
169 dependency
/build
/libncurses-build \
170 dependency
/build
/libncurses-install
171 $(MAKE
) dependency
/build
/local
174 .
/configure
--environment-only
175 $(MAKE
) dependencies-local
176 .
/configure CFLAGS
="-I$(DEPS_INC)" LDFLAGS
="-L$(DEPS_LIB)" LD_LIBRARY_PATH
="$(DEPS_LIB)"
178 @echo Run with
: LD_LIBRARY_PATH
=$(DEPS_LIB
) .
/vis
181 [ ! -e dependency
/build
/local
] ||
$(MAKE
) dependencies-clean
182 .
/configure CFLAGS
="-I$(DEPS_INC)" LDFLAGS
="-L$(DEPS_LIB)" --environment-only
--static
183 CFLAGS
="$(CFLAGS)" $(MAKE
) dependency
/build
/libmusl-install
184 PATH
=$(DEPS_BIN
):$$PATH PKG_CONFIG_PATH
= PKG_CONFIG_LIBDIR
= CFLAGS
="$(CFLAGS)" LDFLAGS
="$(LDFLAGS)" $(MAKE
) \
185 CC
=musl-gcc dependency
/build
/standalone
186 PATH
=$(DEPS_BIN
):$$PATH PKG_CONFIG_PATH
= PKG_CONFIG_LIBDIR
= .
/configure
--static \
187 CFLAGS
="-I$(DEPS_INC) --static -Wl,--as-needed" LDFLAGS
="-L$(DEPS_LIB)" CC
=musl-gcc
188 PATH
=$(DEPS_BIN
):$$PATH $(MAKE
)
190 .PHONY
: standalone local dependencies-common dependencies-local dependencies-clean