2015-04-14 12:36:29 +00:00
|
|
|
#! /usr/bin/env bash
|
2014-11-04 14:36:49 +00:00
|
|
|
|
2019-02-17 15:40:35 +00:00
|
|
|
OS=$(uname -s)
|
2017-03-16 00:01:58 +00:00
|
|
|
if test x"${OS}" != x"FreeBSD"; then
|
2020-08-29 05:04:53 +00:00
|
|
|
source scl_source enable devtoolset-9
|
2017-03-16 00:01:58 +00:00
|
|
|
fi
|
|
|
|
|
2019-02-17 15:40:35 +00:00
|
|
|
if test x"${OS}" != x"FreeBSD"; then
|
|
|
|
MAKE=make
|
|
|
|
else
|
|
|
|
MAKE=gmake
|
|
|
|
fi
|
|
|
|
|
2014-11-04 14:36:49 +00:00
|
|
|
FAKE_ROOT=/home/vagrant/fake.root
|
|
|
|
|
2016-02-28 19:40:26 +00:00
|
|
|
SRC_VERSION=$1
|
|
|
|
|
2014-11-04 16:51:45 +00:00
|
|
|
mkdir -p ~/github
|
|
|
|
|
2014-11-04 14:36:49 +00:00
|
|
|
cd ~/github
|
|
|
|
if ! test -d lnav; then
|
|
|
|
git clone git://github.com/tstack/lnav.git
|
|
|
|
fi
|
|
|
|
|
|
|
|
cd ~/github/lnav
|
|
|
|
git pull
|
2016-02-28 19:40:26 +00:00
|
|
|
|
|
|
|
if test -n "$SRC_VERSION"; then
|
|
|
|
git checkout $SRC_VERSION
|
|
|
|
fi
|
|
|
|
|
2015-04-05 22:44:51 +00:00
|
|
|
saved_PATH=${PATH}
|
2015-04-17 07:48:46 +00:00
|
|
|
export PATH=${FAKE_ROOT}/bin:${PATH}
|
|
|
|
saved_LD_LIBRARY_PATH=${LD_LIBRARY_PATH}
|
|
|
|
export LD_LIBRARY_PATH=${LD_LIBRARY_PATH}:${FAKE_ROOT}/lib
|
2015-04-05 22:44:51 +00:00
|
|
|
./autogen.sh
|
2014-11-04 14:36:49 +00:00
|
|
|
|
|
|
|
rm -rf ~/github/lbuild
|
|
|
|
mkdir -p ~/github/lbuild
|
|
|
|
|
|
|
|
cd ~/github/lbuild
|
|
|
|
|
2020-09-14 13:27:12 +00:00
|
|
|
TARGET_FILE='/vagrant/lnav-linux.zip'
|
2015-04-14 12:36:29 +00:00
|
|
|
if test x"${OS}" != x"FreeBSD"; then
|
2020-09-14 13:27:12 +00:00
|
|
|
if test x"$(lsb_release | awk '{print $3}')" == x"Alpine"; then
|
|
|
|
TARGET_FILE='/vagrant/lnav-musl.zip'
|
|
|
|
../lnav/configure \
|
2020-10-29 21:34:47 +00:00
|
|
|
--with-libarchive=${FAKE_ROOT} \
|
2021-06-11 06:01:05 +00:00
|
|
|
CFLAGS='-static -g1 -gz=zlib -no-pie -O2' \
|
|
|
|
CXXFLAGS='-static -g1 -gz=zlib -U__unused -no-pie -O2' \
|
2021-05-26 20:10:37 +00:00
|
|
|
LDFLAGS="-L${FAKE_ROOT}/lib" \
|
|
|
|
CPPFLAGS="-I${FAKE_ROOT}/include" \
|
|
|
|
LIBS="-L${FAKE_ROOT}/lib -lexecinfo -lssh2 -llzma -lssl -lcrypto -lz" \
|
2020-09-14 13:27:12 +00:00
|
|
|
--enable-static
|
|
|
|
PATH="${FAKE_ROOT}/bin:${PATH}"
|
|
|
|
else
|
|
|
|
../lnav/configure \
|
2021-03-30 21:30:57 +00:00
|
|
|
--enable-static \
|
2020-10-29 04:17:57 +00:00
|
|
|
--with-libarchive=${FAKE_ROOT} \
|
2020-09-14 13:27:12 +00:00
|
|
|
LDFLAGS="-L${FAKE_ROOT}/lib" \
|
2020-10-29 04:17:57 +00:00
|
|
|
CPPFLAGS="-I${FAKE_ROOT}/include -O2" \
|
2021-04-16 22:09:07 +00:00
|
|
|
LIBS="-L${FAKE_ROOT}/lib -lssh2 -llzma -lssl -lcrypto -lz" \
|
2020-09-14 13:27:12 +00:00
|
|
|
PATH="${FAKE_ROOT}/bin:${PATH}"
|
|
|
|
fi
|
2015-04-14 12:36:29 +00:00
|
|
|
else
|
|
|
|
../lnav/configure \
|
2021-03-30 21:30:57 +00:00
|
|
|
--enable-static \
|
2019-02-17 15:40:35 +00:00
|
|
|
LDFLAGS="-L${FAKE_ROOT}/lib -static" \
|
|
|
|
LIBS="-lm -lelf" \
|
2020-10-29 04:17:57 +00:00
|
|
|
CPPFLAGS="-I${FAKE_ROOT}/include -O2" \
|
2015-10-15 02:52:22 +00:00
|
|
|
PATH="${FAKE_ROOT}/bin:${PATH}"
|
2015-04-14 12:36:29 +00:00
|
|
|
fi
|
|
|
|
|
2021-05-28 20:26:31 +00:00
|
|
|
${MAKE} -j2 && cp src/lnav /vagrant/lnav
|
2016-02-28 19:40:26 +00:00
|
|
|
|
2016-07-29 03:23:13 +00:00
|
|
|
if test x"${OS}" != x"FreeBSD"; then
|
|
|
|
mkdir instdir
|
2021-05-28 20:26:31 +00:00
|
|
|
make install DESTDIR=$PWD/instdir
|
2020-09-14 13:27:12 +00:00
|
|
|
(cd instdir/ && zip -r "${TARGET_FILE}" .)
|
2016-07-29 03:23:13 +00:00
|
|
|
fi
|
2016-07-31 02:04:46 +00:00
|
|
|
|
|
|
|
export PATH=${saved_PATH}
|
|
|
|
export LD_LIBRARY_PATH=${saved_LD_LIBRARY_PATH}
|