Last active
February 27, 2025 13:08
-
-
Save eminence/85961d47244a140fde89314837d0db0a to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/bin/sh | |
## https://gist.github.com/eminence/85961d47244a140fde89314837d0db0a | |
set -e | |
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 | |
#INSTALL_DIR=$PWD/prefix/ | |
INSTALL_DIR=/rd/gen/lxd/do_not_delete/$PLATIDENT/prefix | |
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
/cc mobile-shell/mobile-shell.github.io#47