summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorAndreas Fankhauser hiddenalpha.ch2023-09-29 00:15:11 +0200
committerAndreas Fankhauser hiddenalpha.ch2023-09-29 00:15:11 +0200
commit7da966790a9a0590b6f480a2f3d486461bed3a5f (patch)
tree24a574b93ec5c9fe46c0eb833880ae731b0b92b4
parent6e57027641296e679fa109a8edd3ff53c745a6de (diff)
downloadgateleen-resclone-7da966790a9a0590b6f480a2f3d486461bed3a5f.zip
gateleen-resclone-7da966790a9a0590b6f480a2f3d486461bed3a5f.tar.gz
(qemu) Begun to add qemu build env setup.
-rw-r--r--README.txt2
-rw-r--r--contrib/build-env-setup/README.md143
2 files changed, 144 insertions, 1 deletions
diff --git a/README.txt b/README.txt
index f8f32d6..def51b1 100644
--- a/README.txt
+++ b/README.txt
@@ -49,7 +49,7 @@ From "gateleenResclone --help":
- libyajl 2.1.0 "http://lloyd.github.io/yajl"
- libarchive 3.3.3 "https://www.libarchive.org/"
-If you prefer to NOT cluttering your system with tons of never again used
+If you prefer to NOT clutter your system with tons of never again used
packages, you have the option to provide the dependencies from within the
project tree itself. For this, place the files as described below.
diff --git a/contrib/build-env-setup/README.md b/contrib/build-env-setup/README.md
new file mode 100644
index 0000000..14ac679
--- /dev/null
+++ b/contrib/build-env-setup/README.md
@@ -0,0 +1,143 @@
+
+Showcase how to build and install
+=================================
+
+WARN: Do NOT perform any of these steps on your host system! This script
+ MUST only be run on a system which is a
+ just-throw-it-away-if-broken system.
+
+Sometimes happy developers (like me) have no choice but using terribly
+restricted systems where setting up tools to run even something as
+trivial as configure/make/install becomes a nightmare if not impossible.
+I found it to be very handy to have some independent qemu VM at hand
+which lets me install whatever I need, neither with any special software
+nor any annoying privileges on a host machine. Qemu runs portable and in
+user mode even doesn't need any annoying permissions at all.
+
+
+
+## Setup a minimal system in your qemu VM
+
+This setup mainly targets debian. Nevertheless it tries to stay POSIX
+compatible as possible. So setup a minimal install of your system of
+choice and then as soon you've SSH access to a (posix) shell, you're
+ready for the next step.
+
+Still not sure which system to use? Link below provides some candidates.
+HINT: Windows IMHO is a terrible choice. So stop complaining if you go
+this route.
+
+https://en.wikipedia.org/wiki/POSIX#POSIX-oriented_operating_systems
+
+
+
+## Start VM with SSH access
+
+Easiest way to work with your machine is via SSH. Therefore if you've
+chosen to use a qemu VM, make sure you've setup and configured sshd
+properly inside the VM. Then just pass args like those to qemu:
+
+ --device e1000,netdev=n0 --netdev user,id=n0,hostfwd=tcp:127.0.0.1:2222-:22
+
+Started this way, the SSHDaemon inside the VM is accessible from your
+host via "localhost" at port "2222":
+
+ ssh localhost -p2222
+
+I strongly recommend using SSH paired with a well-designed
+terminal-emulator in place of some fancy VGA/GUI emulators or similar.
+Those commandline tools give immediate benefits like copy-pasting of
+script snippets which becomes very handy with the scripts which follow,
+or also with file transfers to get the final build result out the VM. My
+condolence to users which still think windows is the only way to use a
+computer.
+
+
+
+## Configure build environment
+
+Setup environ vars according to your chosen build system. Here are few examlpes:
+
+### Config for debian
+####### automake autoconf libtool
+true \
+ && PKGS_TO_ADD="git make gcc libc6-dev cmake autoconf automake libtool m4" \
+ && PKGS_TO_DEL="cmake autoconf automake libtool m4" \
+ && SUDO=sudo \
+ && PKGINIT="$SUDO apt update" \
+ && PKGADD="$SUDO apt install -y --no-install-recommends" \
+ && PKGDEL="$SUDO apt purge -y" \
+ && PKGCLEAN="$SUDO apt clean" \
+ && HOST= \
+ && true
+
+
+## make, install
+
+As soon environ is configured, we can trigger the build:
+
+true \
+ && GIT_TAG="master" \
+ && LIBARCHIVE_VERSION="3.6.2" \
+ && CURL_VERSION="8.3.0" \
+ \
+ && WORKDIR="/home/${USER}/work" \
+ && INSTALL_ROOT="/usr/${HOST:-local}" \
+ && CURL_VERSION_UGLY="$(echo "$CURL_VERSION"|sed 's;\.;_;g')" \
+ && CURL_URL="https://github.com/curl/curl/archive/refs/tags/curl-${CURL_VERSION_UGLY:?}.tar.gz" \
+ && CURL_SRCTGZ="/var/tmp/curl-${CURL_VERSION:?}.tgz" \
+ && CURL_BINTGZ="${CURL_SRCTGZ%.*}-bin.tgz" \
+ && LIBARCHIVE_URL="https://github.com/libarchive/libarchive/archive/refs/tags/v${LIBARCHIVE_VERSION:?}.tar.gz" \
+ && LIBARCHIVE_SRCTGZ="/var/tmp/libarchive-${LIBARCHIVE_VERSION:?}.tgz" \
+ && LIBARCHIVE_BINTGZ="${LIBARCHIVE_SRCTGZ%.*}-bin.tgz" \
+ \
+ && ${PKGINIT:?} && ${PKGADD:?} $PKGS_TO_ADD \
+ && if test ! -e "${LIBARCHIVE_SRCTGZ:?}"; then true \
+ && echo "Download ${LIBARCHIVE_URL:?}" \
+ && curl -sSLo "${LIBARCHIVE_SRCTGZ:?}" "${LIBARCHIVE_URL:?}" \
+ ;fi \
+ && if test ! -e "${CURL_SRCTGZ:?}"; then true \
+ && echo "Download ${CURL_URL:?}" \
+ && curl -sSLo "${CURL_SRCTGZ:?}" "${CURL_URL:?}" \
+ ;fi \
+ && if test ! -e "${LIBARCHIVE_BINTGZ}"; then (true \
+ && cd /tmp \
+ && tar xf "${LIBARCHIVE_SRCTGZ:?}" \
+ && cd "libarchive-${LIBARCHIVE_VERSION:?}" \
+ && cmake -D CMAKE_INSTALL_PREFIX="${PWD:?}/build/usr_local" . \
+ && make -j$(nproc) && make install \
+ && rm -rf build/usr_local/lib/pkgconfig \
+ && (cd build/usr_local && tar --owner=0 --group=0 -czf "${LIBARCHIVE_BINTGZ:?}" *) \
+ && cd /tmp && rm -rf "libarchive-${LIBARCHIVE_VERSION:?}" \
+ && $SUDO tar -C /usr/local -xzf "${LIBARCHIVE_BINTGZ}" \
+ );fi \
+ && if test ! -e "${CURL_BINTGZ:?}"; then (true
+
+ && cd /tmp \
+ && tar xf "${CURL_SRCTGZ:?}" \
+ && cd "curl-curl-${CURL_VERSION_UGLY:?}" \
+ && autoreconf -fi \
+ && ./configure --prefix="$PWD/build/usr_local" --enable-http --with-nghttp2 --with-nghttp3 --disable-alt-svc --disable-ares --disable-aws --disable-basic-auth --disable-bearer-auth --disable-bindlocal --disable-cookies --disable-curldebug --disable-dateparse --disable-debug --disable-dependency-tracking --disable-dict --disable-digest-auth --disable-dnsshuffle --disable-doh --disable-ech --disable-file --disable-form-api --disable-ftp --disable-get-easy-options --disable-gopher --disable-headers-api --disable-hsts --disable-http-auth --disable-imap --enable-ipv6 --disable-kerberos-auth --disable-largefile --disable-ldap --disable-ldaps --disable-libcurl-option --disable-libtool-lock --enable-manual --disable-mime --disable-mqtt --disable-negotiate-auth --disable-netrc --enable-ntlm --enable-ntlm-wb --disable-openssl-auto-load-config --disable-optimize --disable-pop3 --disable-progress-meter --enable-proxy --disable-pthreads --disable-rt --disable-rtsp --disable-smb --enable-smtp --disable-socketpair --disable-sspi --disable-symbol-hiding --disable-telnet --disable-tftp --disable-threaded-resolver --disable-tls-srp --disable-unix-sockets --disable-verbose --disable-versioned-symbols --disable-warnings --disable-websockets --disable-werror --without-schannel --without-secure-transport --without-amissl --without-ssl --without-openssl --without-gnutls --without-mbedtls --without-wolfssl --without-bearssl --without-rustls --without-test-nghttpx --without-test-caddy --without-test-httpd --without-pic --without-aix-soname --without-gnu-ld --without-sysroot --without-mingw1-deprecated --without-hyper --without-zlib --without-brotli --without-zstd --without-ldap-lib --without-lber-lib --without-gssapi-includes --without-gssapi-libs --without-gssapi --without-default-ssl-backend --without-random --without-ca-bundle --without-ca-path --without-ca-fallback --without-libpsl --without-libgsasl --without-librtmp --without-winidn --without-libidn2 --without-ngtcp2 --without-quiche --without-msh3 --without-zsh-functions-dir --without-fish-functions-dir CFLAGS=-fPIC \
+ && make clean && make -j$(nproc) && make install \
+ && (cd build/usr_local && rm -rf share/aclocal bin/curl-config lib/libcurl.la lib/pkgconfig) \
+ && (cd build/usr_local && tar --owner=0 --group=0 -czf "${CURL_BINTGZ:?}" *) \
+ && cd /tmp \
+ && rm -rf "curl-curl-${CURL_VERSION_UGLY:?}" \
+ );fi \
+
+ && printf '\n Build project itself\n\n' \
+ && mkdir -p "${WORKDIR:?}" && cd "${WORKDIR:?}" \
+ && git clone --depth 42 --branch "${GIT_TAG:?}" https://github.com/hiddenalpha/GateleenResclone.git . \
+ && git config advice.detachedHead false \
+ && git checkout --detach "${GIT_TAG:?}" \
+ && make clean && make -j$(nproc) \
+ && if test -z "$HOST"; then $SUDO make install; fi \
+ && find . -not -wholename './dist*' -delete \
+ && ${PKGDEL:?} $PKGS_TO_DEL && ${PKGCLEAN:?} \
+ && dirOfDistBundle="$(realpath dist)" \
+ && printf '\n SUCCESS :) Distribution bundle is ready in:\n\n %s\n\n Tip: Before pulling out your hair about how to get that archive out of\n your qemu VM. STOP kluding around with silly tools and learn how\n basic tools do the job perfectly fine:\n\n ssh %s@localhost -p2222 -- sh -c '\''true && cd "%s" && tar c *'\'' | tar x\n\n' "${dirOfDistBundle:?}" "$USER" "${dirOfDistBundle:?}" \
+ && true
+
+
+
+