Last active
November 16, 2020 14:46
-
-
Save VADemon/c326e965090d08d9c653e138f5b0f285 to your computer and use it in GitHub Desktop.
Archiveteam wget-lua / wget-at self-compile zstd libzstd
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
#!/usr/bin/env bash | |
# | |
# This script clones and compiles wget-lua. | |
# | |
# first, try to detect gnutls or openssl | |
CONFIGURE_SSL_OPT="" | |
if builtin type -p pkg-config &>/dev/null | |
then | |
if pkg-config gnutls | |
then | |
echo "Compiling wget with GnuTLS." | |
CONFIGURE_SSL_OPT="--with-ssl=gnutls" | |
elif pkg-config openssl | |
then | |
echo "Compiling wget with OpenSSL." | |
CONFIGURE_SSL_OPT="--with-ssl=openssl" | |
fi | |
fi | |
if ! zstd --version | grep -q "v1.4."; then | |
echo "Need version v1.4.x of libzstd-dev and zstd" | |
#exit 1 | |
echo "I will try to compile and install it locally for wget-at to use!" | |
# NOT COMPLETELY TESTED | |
# fetch latest version of v1.4.x | |
zstdGit="https://github.com/facebook/zstd.git" | |
zstdTag=`git ls-remote --tags ${zstdGit} | grep 'v1.4.' | tail -n 1 | cut -d '/' -f 3` | |
# dont clone the whole repo | |
git clone --branch "${zstdTag}" "${zstdGit}" | |
export prefix="$HOME/.local/wget-at/" | |
# library will automatically be put under prefix' local path, zstd binary will not | |
cd zstd/lib && make install \ | |
&& cd .. && make && cp zstd "$prefix/bin" \ | |
&& echo "zstd sucessfully compiled and put inside $prefix" || echo "zstd compilation failed!" exit 1 | |
# Prepare custom overrides for wget-lua compilation | |
export LDFLAGS=-Wl,-rpath="$prefix/lib",--enable-new-dtags | |
export PKG_CONFIG_PATH="$prefix/lib/pkgconfig:$PKG_CONFIG_PATH" | |
export CPATH="$prefix/include:$CPATH" | |
export PATH="$prefix/bin:$PATH" | |
echo "You can add \"$prefix/bin\" to PATH permanently yourself if you wish to use this version of zstd-cli yourself." | |
fi | |
rm -rf get-wget-lua.tmp/ | |
mkdir -p get-wget-lua.tmp | |
cd get-wget-lua.tmp | |
git clone https://github.com/archiveteam/wget-lua.git | |
cd wget-lua | |
git checkout v1.20.3-at | |
#echo -n 1.20.3-at-lua | tee ./.version ./.tarball-version > /dev/null | |
if ./bootstrap && ./configure $CONFIGURE_SSL_OPT --disable-nls && make && src/wget -V | grep -q lua | |
then | |
cp src/wget ../../wget-at | |
cd ../../ | |
echo | |
echo | |
echo "###################################################################" | |
echo | |
echo "wget-lua successfully built." | |
echo | |
./wget-at --help | grep -iE "gnu|warc|lua" | |
rm -rf get-wget-lua.tmp | |
exit 0 | |
else | |
echo | |
echo "wget-lua not successfully built." | |
echo | |
exit 1 | |
fi |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment