Skip to content

Instantly share code, notes, and snippets.

Embed
What would you like to do?
#!/bin/sh
## https://gist.github.com/eminence/85961d47244a140fde89314837d0db0a
set -e
: ${INSTALL_DIR?You must set FOO with FOO=bar $0 $@}
PWD=`pwd`
DD=$PWD/downloads/ # Download Directory
function download {
BASE=`basename $1`
mkdir -p $DD
if [ -e $DD/$BASE ]; then
echo "$BASE is already downloaded, skipping."
return 0
fi
curl -o $DD/$BASE -L $1
}
echo -n "Do you want to download packages into $DD/ ? [y/N] "
read do_download
if [ "$do_download" == "y" ]; then
download https://github.com/tmux/tmux/releases/download/2.6/tmux-2.6.tar.gz
download https://github.com/libevent/libevent/releases/download/release-2.1.8-stable/libevent-2.1.8-stable.tar.gz
download http://ftp.gnu.org/gnu/ncurses/ncurses-6.0.tar.gz
download https://github.com/google/protobuf/releases/download/v3.4.1/protobuf-cpp-3.4.1.tar.gz
download https://github.com/mobile-shell/mosh/releases/download/mosh-1.3.2/mosh-1.3.2.tar.gz
download https://www.openssl.org/source/openssl-1.0.2l.tar.gz
download https://github.com/telmich/gpm/archive/1.20.7.tar.gz
file downloads/*
echo ""
echo "Unpacking all the tarballs"
(cd downloads; ls *.tar.gz | xargs -n1 tar -zxf)
else
echo "You are expected to manually put the necessary files into $DD/"
fi
TMUX_SRC_DIR=$DD/tmux-2.6
LIBEVENT_SRC_DIR=$DD/libevent-2.1.8-stable
NCURSES_SRC_DIR=$DD/ncurses-6.0
PROTOBUF_SRC_DIR=$DD/protobuf-3.4.1
MOSH_SRC_DIR=$DD/mosh-1.3.2
OPENSSL_SRC_DIR=$DD/openssl-1.0.2l
GPM_SRC_DIR=$DD/gpm-1.20.7
echo ""
echo "========================================"
echo "About to build the following packages:"
(cd $DD; ls -1 *.tar.gz)
echo ""
echo "Everything will be installed to ${INSTALL_DIR}"
echo "Temporary build dir: ${PWD}"
echo "Press enter to continue or ctrl-c to exit"
read c
export CFLAGS="-I${INSTALL_DIR}/include -fPIC"
export CXXFLAGS=$CFLAGS
export PATH="${INSTALL_DIR}/bin:${PATH}"
export LDFLAGS="-L${INSTALL_DIR}/lib -Wl,-rpath,${INSTALL_DIR}/lib"
export PKG_CONFIG_PATH="${INSTALL_DIR}/lib/pkgconfig"
export LD_LIBRARY_PATH="${INSTALL_DIR}/lib"
MAKEOPTS=-j4
cd $LIBEVENT_SRC_DIR
make clean || echo
./configure --enable-static=yes --enable-shared=yes --prefix=${INSTALL_DIR} && make $MAKEOPTS && make install
echo "libevent done. Press enter to continue"
read c
cd $OPENSSL_SRC_DIR
make clean || echo
./config no-shared -fPIC --prefix=${INSTALL_DIR} && make $MAKEOPTS && make install
echo "Openssl done. Press enter to continue"
read c
echo "Building protobuf..."
cd $PROTOBUF_SRC_DIR
make clean || echo
./configure --disable-shared --prefix=${INSTALL_DIR}; make $MAKEOPTS && make install
echo "protobuf done. Press enter to continue"
read c
echo "Building ncursesw..."
cd $NCURSES_SRC_DIR
make clean || echo
./configure --enable-pc-files --enable-widec --without-gpm --with-pkg-config-libdir=${PKG_CONFIG_PATH} --prefix=${INSTALL_DIR} && make $MAKEOPTS && make install
echo "Ncursesw done. Press enter to continue"
read c
echo "Building ncurses..."
cd $NCURSES_SRC_DIR
make clean || echo
./configure --enable-pc-files --without-gpm --with-pkg-config-libdir=${PKG_CONFIG_PATH} --prefix=${INSTALL_DIR} && make $MAKEOPTS && make install
echo "Ncurses done. Press enter to continue"
read c
echo "Building tmux..."
cd $TMUX_SRC_DIR
make clean || echo
./configure --prefix=${INSTALL_DIR} && make $MAKEOPTS && make install
echo "tmux done. Press enter to continue"
read c
echo "Building mosh..."
cd $MOSH_SRC_DIR
make clean || echo
./configure --prefix=${INSTALL_DIR} && make $MAKEOPTS && make install
echo "Mosh done"
echo "Everything done"
echo "Installed to ${INSTALL_DIR}"
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
You can’t perform that action at this time.