[release] Build target for static lnav compiled with musl.

`musl-package` compiles a completely static `lnav` binary compiled with
musl-libc.
This commit is contained in:
Suresh Sundriyal 2020-09-14 06:27:12 -07:00
parent be106fcb8d
commit 271c961085
5 changed files with 54 additions and 48 deletions

View File

@ -21,7 +21,7 @@ PACKAGE_URLS = \
https://www.libssh2.org/download/libssh2-1.9.0.tar.gz \
https://curl.haxx.se/download/curl-7.72.0.tar.gz
.PHONY: linux freebsd pkger download-pkgs
.PHONY: linux freebsd pkger download-pkgs musl
%-vm: %
cd vagrant-static && vagrant up $<

View File

@ -29,6 +29,13 @@ Vagrant.configure(2) do |config|
freebsd.vm.base_mac = "080027D14C66"
end
config.vm.define :musl do |musl|
musl.vm.network "private_network", :type => 'dhcp'
musl.vm.provision "shell", path:"musl-pkg.sh"
musl.vm.provision "shell", path:"provision.sh"
musl.vm.box = "generic/alpine312"
end
config.vm.define :linux do |linux|
linux.vm.network :private_network, ip: "10.11.12.14"
linux.vm.provision "shell", path:"pkg.sh"

View File

@ -40,11 +40,23 @@ mkdir -p ~/github/lbuild
cd ~/github/lbuild
TARGET_FILE='/vagrant/lnav-linux.zip'
if test x"${OS}" != x"FreeBSD"; then
../lnav/configure \
LDFLAGS="-L${FAKE_ROOT}/lib" \
CPPFLAGS="-I${FAKE_ROOT}/include" \
PATH="${FAKE_ROOT}/bin:${PATH}"
if test x"$(lsb_release | awk '{print $3}')" == x"Alpine"; then
TARGET_FILE='/vagrant/lnav-musl.zip'
../lnav/configure \
CFLAGS='-static -no-pie -s' \
CXXFLAGS='-static -msse4 -U__unused -no-pie -s' \
LDFLAGS="-L${FAKE_ROOT}/lib" \
CPPFLAGS="-I${FAKE_ROOT}/include" \
--enable-static
PATH="${FAKE_ROOT}/bin:${PATH}"
else
../lnav/configure \
LDFLAGS="-L${FAKE_ROOT}/lib" \
CPPFLAGS="-I${FAKE_ROOT}/include" \
PATH="${FAKE_ROOT}/bin:${PATH}"
fi
else
../lnav/configure \
LDFLAGS="-L${FAKE_ROOT}/lib -static" \
@ -58,7 +70,7 @@ ${MAKE} -j2 && strip -o /vagrant/lnav src/lnav
if test x"${OS}" != x"FreeBSD"; then
mkdir instdir
make install-strip DESTDIR=$PWD/instdir
(cd instdir/ && zip -r /vagrant/lnav-linux.zip .)
(cd instdir/ && zip -r "${TARGET_FILE}" .)
fi
export PATH=${saved_PATH}

View File

@ -0,0 +1,6 @@
#! /bin/sh
sudo apk update && sudo apk upgrade
sudo apk add build-base m4 git zip perl ncurses autoconf automake libtool linux-headers
wget 'https://sourceware.org/git/?p=glibc.git;a=blob_plain;f=misc/sys/queue.h;hb=HEAD' -O queue.h
sudo mv queue.h /usr/include/sys/

View File

@ -76,32 +76,32 @@ OS=$(uname -s)
bunzip2 ncurses-5.9-20141206-patch.sh.bz2 &&
bash ./ncurses-5.9-20141206-patch.sh)
(cd ncurses-5.9 && \
./configure --prefix=${FAKE_ROOT} \
--enable-ext-mouse \
--enable-sigwinch \
--with-default-terminfo-dir=/usr/share/terminfo \
--enable-ext-colors \
--enable-widec \
--enable-termcap \
--with-fallbacks=$NCURSES_FALLBACKS \
&& \
make && make install)
(cd pcre-* && \
./configure --prefix=${FAKE_ROOT} \
--enable-jit \
--enable-utf \
&& \
make && make install)
if test x"${OS}" != x"FreeBSD"; then
(cd ncurses-5.9 && \
./configure --prefix=${FAKE_ROOT} \
--enable-ext-mouse \
--enable-sigwinch \
--with-default-terminfo-dir=/usr/share/terminfo \
--enable-ext-colors \
--enable-widec \
--enable-termcap \
--with-fallbacks=$NCURSES_FALLBACKS \
&& \
make && make install)
(cd pcre-* && \
./configure --prefix=${FAKE_ROOT} \
--enable-jit \
--enable-utf \
&& \
make && make install)
(cd zlib-1.2.11 && ./configure --prefix=${FAKE_ROOT} && make && make install)
(cd libssh2-* &&
./configure --prefix=${FAKE_ROOT} \
--with-libssl-prefix=/home/vagrant/fake.root \
--with-libz-prefix=/home/vagrant/fake.root \
--with-libssl-prefix=${FAKE_ROOT} \
--with-libz-prefix=${FAKE_ROOT} \
"CPPFLAGS=-I${FAKE_ROOT}/include" \
"LDFLAGS=-ldl -L${FAKE_ROOT}/lib" &&
make &&
@ -116,32 +116,13 @@ if test x"${OS}" != x"FreeBSD"; then
make &&
make install)
else
(cd ncurses-5.9 && \
./configure --prefix=${FAKE_ROOT} \
--enable-ext-mouse \
--enable-sigwinch \
--with-default-terminfo-dir=/usr/share/terminfo \
--enable-ext-colors \
--enable-widec \
--enable-termcap \
--with-fallbacks=$NCURSES_FALLBACKS \
&& \
make && make install)
(cd pcre-* && \
./configure --prefix=${FAKE_ROOT} \
--enable-jit \
--enable-utf \
&& \
make && make install)
(cd zlib-1.2.11 && ./configure --prefix=${FAKE_ROOT} "CFLAGS=-fPIC" \
&& make && make install)
(cd libssh2-* &&
./configure --prefix=${FAKE_ROOT} \
--with-libssl-prefix=/home/vagrant/fake.root \
--with-libz-prefix=/home/vagrant/fake.root \
--with-libssl-prefix=${FAKE_ROOT} \
--with-libz-prefix=${FAKE_ROOT} \
&&
make &&
make install)