summaryrefslogtreecommitdiff
path: root/doc/note/qemu/build-libarchive.txt
diff options
context:
space:
mode:
Diffstat (limited to 'doc/note/qemu/build-libarchive.txt')
-rw-r--r--doc/note/qemu/build-libarchive.txt72
1 files changed, 72 insertions, 0 deletions
diff --git a/doc/note/qemu/build-libarchive.txt b/doc/note/qemu/build-libarchive.txt
new file mode 100644
index 0000000..96f95d6
--- /dev/null
+++ b/doc/note/qemu/build-libarchive.txt
@@ -0,0 +1,72 @@
+
+### Debian native
+### TODO: test this
+true \
+ && PKGS_TO_ADD="make gcc curl ca-certificates libc6-dev" \
+ && SUDO=sudo \
+ && PKGINIT="$SUDO apt update" \
+ && PKGADD="$SUDO apt install -y --no-install-recommends" \
+ && PKGCLEAN="$SUDO apt clean" \
+ && HOST= \
+ && true
+
+
+### Alpine mingw cross
+true \
+ && PKGS_TO_ADD="make mingw-w64-gcc curl tar" \
+ && SUDO="/home/$USER/.local/bin/sudo" \
+ && PKGINIT=true \
+ && PKGADD="$SUDO apk add" \
+ && PKGCLEAN="$SUDO apk cache clean 2>&1| grep -v 'ERROR: Package cache is not enabled'" \
+ && HOST=x86_64-w64-mingw32 \
+ && true
+
+
+### General
+true \
+ && LIBARCHIVE_VERSION="3.6.2" \
+ && CACHE_DIR="/var/tmp" \
+ && true
+
+
+### Make
+true \
+ && if test -n "$(ls -A)"; then true \
+ && printf '\n It is recommended to run this script in an empty dir.\n\n' \
+ && false \
+ ;fi \
+ && LIBARCHIVE_URL="https://github.com/libarchive/libarchive/releases/download/v${LIBARCHIVE_VERSION:?}/libarchive-${LIBARCHIVE_VERSION:?}.tar.gz" \
+ && LIBARCHIVE_SRCTGZ="${CACHE_DIR:?}/libarchive-${LIBARCHIVE_VERSION:?}.tgz" \
+ && LIBARCHIVE_BINTGZ="${LIBARCHIVE_SRCTGZ%.*}-bin.tgz" \
+ && if test -n "$HOST"; then HOST_="${HOST:?}-" ;fi \
+ && ${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 "${LIBARCHIVE_BINTGZ}"; then (true \
+ && printf '\n Build libarchive\n\n' \
+ && tar xf "${LIBARCHIVE_SRCTGZ:?}" \
+ && cd "libarchive-${LIBARCHIVE_VERSION:?}" \
+ && ./configure --prefix="${PWD:?}/build/usr_local" --host=${HOST} \
+ --enable-bsdtar=static --enable-bsdcat=static --enable-bsdcpio=static \
+ --disable-rpath --enable-posix-regex-lib \
+ --with-libiconv-prefix="${PWD%/*}/libiconv-1.16-mingw64" \
+ CC=${HOST_}gcc CPP=${HOST_}cpp \
+ && make clean && make -j$(nproc) && make install \
+ && (cd build/usr_local \
+ && rm -rf lib/pkgconfig lib/libarchive.la \
+ && find -type f -not -wholename MD5SUM -exec md5sum {} + > MD5SUM \
+ && tar --owner=0 --group=0 -czf "${LIBARCHIVE_BINTGZ:?}" * \
+ && md5sum -b "${LIBARCHIVE_BINTGZ:?}" > "${LIBARCHIVE_BINTGZ:?}.md5" \
+ ) \
+ && cd .. && rm -rf "libarchive-${LIBARCHIVE_VERSION:?}" \
+ );fi \
+ && printf '\n DONE\n\n'
+
+
+## Install
+true \
+ && $SUDO tar -C "${INSTALL_ROOT:?}" -xzf "${LIBARCHIVE_BINTGZ:?}" \
+ && true
+