From 177773eb6634f6f7924b31d20d11fce173e99e72 Mon Sep 17 00:00:00 2001 From: tobtoht Date: Fri, 15 Jan 2021 22:04:53 +0100 Subject: [PATCH] Reproducible appimages --- .drone.yml | 52 +++++++++++---------------------------- BUILDING.md | 12 ++++++++- Dockerfile | 27 +++++++++++++++++++- Dockerfile_appimage | 18 -------------- contrib/build-appimage.sh | 24 ++++++++++++++---- 5 files changed, 71 insertions(+), 62 deletions(-) delete mode 100644 Dockerfile_appimage mode change 100644 => 100755 contrib/build-appimage.sh diff --git a/.drone.yml b/.drone.yml index edb6c13..ee478ba 100644 --- a/.drone.yml +++ b/.drone.yml @@ -15,6 +15,7 @@ steps: path: /files commands: - TOR_BIN="/usr/local/tor/bin/tor" make -j11 release-static + - contrib/build-appimage.sh environment: OPENSSL_ROOT_DIR: /usr/local/openssl/ CMAKEFLAGS_EXTRA: -DFETCH_DEPS=Off @@ -24,15 +25,24 @@ steps: - name: ccache_linux_release path: /root/.ccache - name: files_linux_release - path: /files + path: /linux-release + - name: files_linux_appimage + path: /linux-release-appimage commands: - export FN="feather-`echo $DRONE_COMMIT_AFTER | cut -c 1-7`.zip" - - export TARGET_DIR="/files/$DRONE_SOURCE_BRANCH" + - export TARGET_DIR="/linux-release/$DRONE_SOURCE_BRANCH" - mkdir -p "$TARGET_DIR" - echo "writing to $TARGET_DIR/$FN" - strip -s build/bin/feather - zip -j "$TARGET_DIR/$FN" build/feather.log build/bin/feather - echo "[*] written to https://build.featherwallet.org/files/linux-release/$DRONE_SOURCE_BRANCH/$FN" + - # AppImage + - export FN="feather-`git rev-parse --short HEAD`.AppImage" + - export TARGET_DIR="/linux-release-appimage/$DRONE_SOURCE_BRANCH" + - mkdir -p "$TARGET_DIR" + - echo "writing to $TARGET_DIR/$FN" + - mv "feather.AppImage" "$TARGET_DIR/$FN" + - echo "[*] written to https://build.featherwallet.org/files/linux-release-appimage/$DRONE_SOURCE_BRANCH/$FN" volumes: - name: ccache_linux_release @@ -44,41 +54,9 @@ volumes: - name: files_linux_release host: path: /build/feather_files/files/linux-release/ - ---- -kind: pipeline -type: docker -name: linux-release-appimage -steps: - - name: build - image: feather:appimage - volumes: - - name: files_linux_release - path: /files - commands: - - export FN="feather-`echo $DRONE_COMMIT_AFTER | cut -c 1-7`.zip" - - export BRANCH="$DRONE_SOURCE_BRANCH" - - cp /files/$BRANCH/$FN feather.zip - - bash ./contrib/build-appimage.sh - - name: deploy - image: feather:appimage - volumes: - - name: files_linux_appimage - path: /files - commands: - - export FN="feather-`git rev-parse --short HEAD`.AppImage" - - export TARGET_DIR="/files/$DRONE_SOURCE_BRANCH" - - mkdir -p "$TARGET_DIR" - - echo "writing to $TARGET_DIR/$FN" - - mv "Feather-1.0-x86_64.AppImage" "$TARGET_DIR/$FN" - - echo "[*] written to https://build.featherwallet.org/files/linux-release-appimage/$DRONE_SOURCE_BRANCH/$FN" -volumes: - - name: files_linux_appimage - host: - path: /build/feather_files/files/linux-release-appimage/ - - name: files_linux_release - host: - path: /build/feather_files/files/linux-release/ +- name: files_linux_appimage + host: + path: /build/feather_files/files/linux-release-appimage/ --- kind: pipeline diff --git a/BUILDING.md b/BUILDING.md index 1be8608..2676cac 100644 --- a/BUILDING.md +++ b/BUILDING.md @@ -1,4 +1,4 @@ -# Buildbot builds +## Buildbot builds The docker build bins can be found here: https://build.featherwallet.org/files/ @@ -34,6 +34,8 @@ Building the base image takes a while. You only need to build the base image onc #### 3. Build +##### Standalone binary + ```bash docker run --rm -it -v $PWD:/feather --env OPENSSL_ROOT_DIR=/usr/local/openssl/ -w /feather feather:linux sh -c 'TOR_BIN="/usr/local/tor/bin/tor" make release-static -j4' ``` @@ -48,6 +50,14 @@ Hashes for tagged commits should match: beta-1: d1a52e3bac1abbae4adda1fc88cb2a7a06fbd61085868421897c6a4f3f4eb091 feather ``` +##### AppImage + +First create the standalone binary using the Docker command in the previous step. + +```bash +docker run --rm -it -v $PWD:/feather -w /feather feather:linux contrib/build-appimage.sh +``` + ### Windows (reproducible) #### 1. Clone diff --git a/Dockerfile b/Dockerfile index 78b8e42..54d6e81 100644 --- a/Dockerfile +++ b/Dockerfile @@ -30,13 +30,23 @@ RUN apt-get update && \ # libxkbcommon bison \ # zeromq - libsodium-dev + libsodium-dev \ +# AppImage tools + file squashfs-tools desktop-file-utils patchelf RUN add-apt-repository ppa:git-core/ppa && \ apt-get update && \ apt-get install -y git && \ rm -rf /var/lib/apt/lists/* +RUN mkdir appimagetool && \ + cd appimagetool && \ + wget https://github.com/AppImage/AppImageKit/releases/download/12/appimagetool-x86_64.AppImage && \ + echo "d918b4df547b388ef253f3c9e7f6529ca81a885395c31f619d9aaf7030499a13 appimagetool-x86_64.AppImage" | sha256sum -c && \ + chmod +x appimagetool-x86_64.AppImage && \ + ./appimagetool-x86_64.AppImage --appimage-extract && \ + rm appimagetool-x86_64.AppImage + RUN git clone -b xorgproto-2020.1 --depth 1 https://gitlab.freedesktop.org/xorg/proto/xorgproto && \ cd xorgproto && \ git reset --hard c62e8203402cafafa5ba0357b6d1c019156c9f36 && \ @@ -362,3 +372,18 @@ RUN git clone https://git.wownero.com/feather/monero-seed.git && \ make -Cbuild -j$THREADS && \ make -Cbuild install && \ rm -rf $(pwd) + +RUN git clone https://github.com/plougher/squashfs-tools.git && \ + cd squashfs-tools/squashfs-tools && \ + git reset --hard 38fa0720526222827da44b3b6c3f7eb63e8f5c2f && \ + make && \ + make install && \ + rm -rf $(pwd) + +RUN mkdir linuxdeployqt && \ + cd linuxdeployqt && \ + wget https://github.com/probonopd/linuxdeployqt/releases/download/7/linuxdeployqt-7-x86_64.AppImage && \ + echo "645276306a801d7154d59e5b4b3c2fac3d34e09be57ec31f6d9a09814c6c162a linuxdeployqt-7-x86_64.AppImage" | sha256sum -c && \ + chmod +x linuxdeployqt-7-x86_64.AppImage && \ + ./linuxdeployqt-7-x86_64.AppImage --appimage-extract && \ + rm linuxdeployqt-7-x86_64.AppImage diff --git a/Dockerfile_appimage b/Dockerfile_appimage deleted file mode 100644 index 07efe28..0000000 --- a/Dockerfile_appimage +++ /dev/null @@ -1,18 +0,0 @@ -FROM ubuntu:20.04 - -ARG DEBIAN_FRONTEND=noninteractive - -RUN apt clean && apt update -RUN apt install -y golang git build-essential wget curl ngrep unzip file squashfs-tools desktop-file-utils patchelf libxkbcommon-x11-dev libx11-xcb-dev libxcb-icccm4 libxcb-image0 libxcb-keysyms1 libxcb-randr0 libxcb-render0 libxcb-render-util0 libxcb-shape0 libxcb-sync1 libxcb-xfixes0 libxcb-shm0 libxcb-keysyms1 libxcb-xkb1 - -RUN go get github.com/probonopd/go-appimage/src/appimagetool -RUN go build -trimpath -ldflags="-s -w" github.com/probonopd/go-appimage/src/appimagetool -RUN chmod +x appimagetool - -RUN cd /usr/bin && \ - wget -c https://github.com/probonopd/uploadtool/raw/master/upload.sh -O uploadtool && \ - chmod +x uploadtool - -RUN cd / && \ - wget -c https://github.com/AppImage/AppImageKit/releases/download/continuous/runtime-x86_64 && \ - chmod +x runtime-x86_64 diff --git a/contrib/build-appimage.sh b/contrib/build-appimage.sh old mode 100644 new mode 100755 index 9143d94..c68b503 --- a/contrib/build-appimage.sh +++ b/contrib/build-appimage.sh @@ -1,18 +1,32 @@ #!/bin/bash set -e +unset SOURCE_DATE_EPOCH APPDIR="$PWD/feather.AppDir" mkdir -p "$APPDIR" mkdir -p "$APPDIR/usr/share/applications/" mkdir -p "$APPDIR/usr/bin" -unzip -q feather.zip - cp "$PWD/src/assets/feather.desktop" "$APPDIR/usr/share/applications/feather.desktop" cp "$PWD/src/assets/images/appicons/64x64.png" "$APPDIR/feather.png" -cp "$PWD/feather" "$APPDIR/usr/bin/feather" +cp "$PWD/build/bin/feather" "$APPDIR/usr/bin/feather" -/appimagetool deploy "$APPDIR/usr/share/applications/feather.desktop" -VERSION=1.0 /appimagetool ./feather.AppDir +LD_LIBRARY_PATH=/usr/local/lib /linuxdeployqt/squashfs-root/AppRun feather.AppDir/usr/share/applications/feather.desktop -bundle-non-qt-libs +find feather.AppDir/ -exec touch -h -a -m -t 202101010100.00 {} \; + +# Manually create AppImage (reproducibly) + +# download runtime +wget -nc https://github.com/AppImage/AppImageKit/releases/download/12/runtime-x86_64 +echo "24da8e0e149b7211cbfb00a545189a1101cb18d1f27d4cfc1895837d2c30bc30 runtime-x86_64" | sha256sum -c + +mksquashfs feather.AppDir feather.squashfs -info -root-owned -no-xattrs -noappend -fstime 0 +# mksquashfs writes a timestamp to the header +printf '\x00\x00\x00\x00' | dd conv=notrunc of=feather.squashfs bs=1 seek=$((0x8)) + +rm -f feather.AppImage +cat runtime-x86_64 >> feather.AppImage +cat feather.squashfs >> feather.AppImage +chmod a+x feather.AppImage