From 0521f5271e75b2b76f51641d00998e2b3b47002d Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?St=C3=A9phane=20Lesimple?= Date: Sat, 21 Nov 2020 13:34:01 +0100 Subject: [PATCH] chore: enhance packaging --- .github/workflows/make-dist.sh | 21 +--- .github/workflows/release.yml | 212 +++++++++++---------------------- GNUmakefile.template | 6 + README.md | 2 + configure | 6 +- scripts/bash-based-configure | 6 +- 6 files changed, 90 insertions(+), 163 deletions(-) diff --git a/.github/workflows/make-dist.sh b/.github/workflows/make-dist.sh index a8222b3..e5a8851 100755 --- a/.github/workflows/make-dist.sh +++ b/.github/workflows/make-dist.sh @@ -4,31 +4,20 @@ set -x github_ref="$1" -if [ -n "$GITHUB_EVENT_PATH" ] && [ -f "$GITHUB_EVENT_PATH" ]; then - if command -v jq >/dev/null; then - upload_url=$(jq -r '.release.upload_url' < $GITHUB_EVENT_PATH) - echo "Upload URL is $upload_url" - echo "::set-output name=upload_url::$upload_url" - fi -else - echo "This should only be run from GitHub Actions" - exit 1 -fi - case "$MSYSTEM" in - MINGW64) os=win64; exe=.exe;; - MINGW32) os=win32; exe=.exe;; - *) os=linux64; exe='';; + MINGW64) os=win64; suf=$os-portable; exe=.exe;; + MINGW32) os=win32; suf=$os-portable; exe=.exe;; + *) os=linux64; suf=$os-static; exe='';; esac ./dvdisaster$exe --version if ./dvdisaster$exe --version | grep -q NOGUI; then GUI=0 - suffix="$os-cli-only" + suffix=$suf-cli-only else GUI=1 - suffix=$os-static + suffix=$suf fi archive=dvdisaster-$(echo "$github_ref" | grep -Eo '[^/]+$')-$suffix.zip diff --git a/.github/workflows/release.yml b/.github/workflows/release.yml index 0858e5d..51a935b 100644 --- a/.github/workflows/release.yml +++ b/.github/workflows/release.yml @@ -5,22 +5,40 @@ on: types: [published] jobs: - - win64-gui: + win: runs-on: windows-2016 + strategy: + matrix: + arch: [x86_64, i686] + ui: [cli, gui] + include: + - arch: x86_64 + msystem: MINGW64 + grep: x86-64 + - arch: i686 + msystem: MINGW32 + grep: 386 + - ui: cli + clionly: 1 defaults: run: shell: msys2 {0} steps: - uses: msys2/setup-msys2@v2 with: - msystem: MINGW64 + msystem: ${{ matrix.msystem }} update: false - install: git diffutils make pkg-config mingw-w64-x86_64-gtk2 mingw-w64-x86_64-glib2 mingw-w64-x86_64-gcc mingw-w64-x86_64-ghostscript mingw-w64-x86_64-jq mingw-w64-x86_64-ntldd-git man zip - - run: git config --global core.autocrlf input + install: git diffutils make pkg-config mingw-w64-${{ matrix.arch }}-glib2 mingw-w64-${{ matrix.arch }}-gcc mingw-w64-${{ matrix.arch }}-ghostscript mingw-w64-${{ matrix.arch }}-ntldd-git man zip + - name: install GUI prereqs + if: matrix.ui == 'gui' + run: pacman -S --noconfirm mingw-w64-${{ matrix.arch }}-gtk2 + - name: git config + run: git config --global core.autocrlf input shell: bash - uses: actions/checkout@v2 - name: configure + env: + CLI_ONLY: ${{ matrix.clionly }} run: ./configure - name: make run: nproc && make -j$(nproc) @@ -28,8 +46,14 @@ jobs: run: | ./dvdisaster.exe --version file dvdisaster.exe - ./dvdisaster.exe --version | grep -q -e dirty -e NOGUI && exit 1 - file dvdisaster.exe | grep -q 'x86-64, for MS Windows' + if ./dvdisaster.exe --version | grep dirty; then exit 1; fi + file dvdisaster.exe | grep -q '${{ matrix.grep }}, for MS Windows' + - name: check executable (GUI) + if: matrix.ui == 'gui' + run: if ./dvdisaster.exe --version | grep NOGUI; then exit 1; fi + - name: check executable (CLI) + if: matrix.ui == 'cli' + run: ./dvdisaster.exe --version | grep NOGUI - name: prepare dist run: ./.github/workflows/make-dist.sh ${{ github.ref }} id: dist @@ -44,138 +68,7 @@ jobs: env: GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} with: - upload_url: ${{ steps.dist.outputs.upload_url }} - asset_path: ./${{ steps.dist.outputs.archive }} - asset_name: ${{ steps.dist.outputs.archive }} - asset_content_type: application/zip - - win32-gui: - runs-on: windows-2016 - defaults: - run: - shell: msys2 {0} - steps: - - uses: msys2/setup-msys2@v2 - with: - msystem: MINGW32 - update: false - install: git diffutils make pkg-config mingw-w64-i686-gtk2 mingw-w64-i686-glib2 mingw-w64-i686-gcc mingw-w64-i686-ghostscript mingw-w64-i686-jq mingw-w64-i686-ntldd-git man zip - - run: git config --global core.autocrlf input - shell: bash - - uses: actions/checkout@v2 - - name: configure - run: ./configure - - name: make - run: nproc && make -j$(nproc) - - name: check executable - run: | - ./dvdisaster.exe --version - file dvdisaster.exe - ./dvdisaster.exe --version | grep -q -e dirty -e NOGUI && exit 1 - file dvdisaster.exe | grep -q '386, for MS Windows' - - name: prepare dist - run: ./.github/workflows/make-dist.sh ${{ github.ref }} - id: dist - - name: check executability of dist from cmd.exe - shell: cmd - run: | - cd dist - dvdisaster.exe --version - - name: Upload Release Asset - id: upload-release-asset - uses: actions/upload-release-asset@v1 - env: - GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} - with: - upload_url: ${{ steps.dist.outputs.upload_url }} - asset_path: ./${{ steps.dist.outputs.archive }} - asset_name: ${{ steps.dist.outputs.archive }} - asset_content_type: application/zip - - win64-cli: - runs-on: windows-2016 - defaults: - run: - shell: msys2 {0} - steps: - - uses: msys2/setup-msys2@v2 - with: - msystem: MINGW64 - update: false - install: git diffutils make pkg-config mingw-w64-x86_64-glib2 mingw-w64-x86_64-gcc mingw-w64-x86_64-ghostscript mingw-w64-x86_64-jq mingw-w64-x86_64-ntldd-git man zip - - run: git config --global core.autocrlf input - shell: bash - - uses: actions/checkout@v2 - - name: configure - run: env CLI_ONLY=1 ./configure - - name: make - run: nproc && make -j$(nproc) - - name: check executable - run: | - ./dvdisaster.exe --version - file dvdisaster.exe - ./dvdisaster.exe --version | grep -q -e dirty && exit 1 - ./dvdisaster.exe --version | grep -q NOGUI - file dvdisaster.exe | grep -q 'x86-64, for MS Windows' - - name: prepare dist - run: ./.github/workflows/make-dist.sh ${{ github.ref }} - id: dist - - name: check executability of dist from cmd.exe - shell: cmd - run: | - cd dist - dvdisaster.exe --version - - name: Upload Release Asset - id: upload-release-asset - uses: actions/upload-release-asset@v1 - env: - GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} - with: - upload_url: ${{ steps.dist.outputs.upload_url }} - asset_path: ./${{ steps.dist.outputs.archive }} - asset_name: ${{ steps.dist.outputs.archive }} - asset_content_type: application/zip - - win32-cli: - runs-on: windows-2016 - defaults: - run: - shell: msys2 {0} - steps: - - uses: msys2/setup-msys2@v2 - with: - msystem: MINGW32 - update: false - install: git diffutils make pkg-config mingw-w64-i686-glib2 mingw-w64-i686-gcc mingw-w64-i686-ghostscript mingw-w64-i686-jq mingw-w64-i686-ntldd-git man zip - - run: git config --global core.autocrlf input - shell: bash - - uses: actions/checkout@v2 - - name: configure - run: env CLI_ONLY=1 ./configure - - name: make - run: nproc && make -j$(nproc) - - name: check executable - run: | - ./dvdisaster.exe --version - file dvdisaster.exe - ./dvdisaster.exe --version | grep -q -e dirty && exit 1 - ./dvdisaster.exe --version | grep -q NOGUI - file dvdisaster.exe | grep -q '386, for MS Windows' - - name: prepare dist - run: ./.github/workflows/make-dist.sh ${{ github.ref }} - id: dist - - name: check executability of dist from cmd.exe - shell: cmd - run: | - cd dist - dvdisaster.exe --version - - name: Upload Release Asset - id: upload-release-asset - uses: actions/upload-release-asset@v1 - env: - GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} - with: - upload_url: ${{ steps.dist.outputs.upload_url }} + upload_url: ${{ github.event.release.upload_url }} asset_path: ./${{ steps.dist.outputs.archive }} asset_name: ${{ steps.dist.outputs.archive }} asset_content_type: application/zip @@ -185,7 +78,7 @@ jobs: steps: - uses: actions/checkout@v2 - name: install prerequisites - run: sudo apt update && sudo apt install -y libglib2.0-dev ghostscript man jq + run: sudo apt update && sudo apt install -y libglib2.0-dev ghostscript man - name: configure run: env CLI_ONLY=1 ./configure - name: make @@ -204,7 +97,44 @@ jobs: env: GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} with: - upload_url: ${{ steps.dist.outputs.upload_url }} + upload_url: ${{ github.event.release.upload_url }} asset_path: ./${{ steps.dist.outputs.archive }} asset_name: ${{ steps.dist.outputs.archive }} asset_content_type: application/zip + + linux64-appimage: + runs-on: ubuntu-16.04 + steps: + - uses: actions/checkout@v2 + - name: install prerequisites + run: sudo apt update && sudo apt install -y libglib2.0-dev ghostscript man wget libgtk2.0-dev + - name: configure + run: ./configure --prefix=/usr + - name: make + run: nproc && make -j$(nproc) && make + - name: make install + run: touch documentation/user-manual/manual.pdf && mkdir /tmp/dist && make install DESTDIR=/tmp/dist + - name: get linuxdeploy + run: wget https://github.com/linuxdeploy/linuxdeploy/releases/download/continuous/linuxdeploy-x86_64.AppImage && chmod 755 linuxdeploy-x86_64.AppImage + - name: build appimage + run: | + export VERSION=$(echo "${{ github.ref }}" | grep -Eo '[^/]+$') + ./linuxdeploy-x86_64.AppImage -d contrib/dvdisaster.desktop -i contrib/dvdisaster64.png -i contrib/dvdisaster48.png -i contrib/dvdisaster32.png -i contrib/dvdisaster16.png --icon-filename dvdisaster --appdir /tmp/dist/ --output appimage + - name: test appimage + id: dist + run: | + chmod 755 dvdisaster*.AppImage && ./dvdisaster*.AppImage --version + archive=$(ls -1 dvdisaster*.AppImage) + echo "::set-output name=archive::$archive" + echo "appimage is <$archive>" + - name: Upload Release Asset + id: upload-release-asset + uses: actions/upload-release-asset@v1 + env: + GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} + with: + upload_url: ${{ github.event.release.upload_url }} + asset_path: ./${{ steps.dist.outputs.archive }} + asset_name: ${{ steps.dist.outputs.archive }} + asset_content_type: application/zip + diff --git a/GNUmakefile.template b/GNUmakefile.template index ec40637..d826f79 100644 --- a/GNUmakefile.template +++ b/GNUmakefile.template @@ -63,6 +63,12 @@ LIBS = $(INTL_LIBS) $(CAM_LIBS) $(GTK_LIBS) $(EFENCE_LIBS) $(MUDFLAP_LIBS) -lm CFILES = $(CFG_CFILES) OFILES = $(CFG_OFILES) +# special case for DESTDIR, if BUILDROOT is undef and DESTDIR is, +# set BUILDROOT to DESTDIR +ifeq "" "$(BUILDROOT)" +BUILDROOT = $(DESTDIR) +endif + ###################################################################### # Compilation related ###################################################################### diff --git a/README.md b/README.md index c4edf1d..1a14de2 100644 --- a/README.md +++ b/README.md @@ -20,6 +20,8 @@ This version is built on top of the latest upstream version, with the following For more information please refer to the [CHANGELOG](CHANGELOG). +This version will never break compatibility with upstream versions, the goal is to ensure an optical media protected by upstream dvdisaster will still be able to be repaired with this version 10+ years from now. Regression tests are here to ensure this is the case. + ## 3 available protection modes ("codecs") **RS01** creates error correction files which are stored separately from the image they belong to. diff --git a/configure b/configure index 5cefbb9..66ef0d9 100755 --- a/configure +++ b/configure @@ -3,7 +3,7 @@ # Load the shell functions needed for the rest of this script. BASH_BASED_CONFIGURE=./scripts/bash-based-configure -BASH_BASED_CONFIGURE_OPTS="--buildtmp=$(pwd)/build" +BASH_BASED_CONFIGURE_OPTS="--buildtmp=$(pwd)/build $@" REQUIRED_CFLAGS="-DPATCHLEVEL=4 -D_FILE_OFFSET_BITS=64 -D_LARGEFILE_SOURCE -D_LARGEFILE64_SOURCE -I. -pipe" RECOMMENDED_CFLAGS="-O2 -fomit-frame-pointer -Wall -Wno-deprecated-declarations -Wno-stringop-truncation" DEBUG_CFLAGS="-ggdb -Wall" @@ -41,10 +41,10 @@ GET_PKGNAME GET_PREFIX /usr/local GET_BINDIR GET_MANDIR -GET_DOCDIR /usr/share/doc +GET_DOCDIR GET_DIR "$PKGNAME" docsub "Documentation sub"\ " put documentation into this subdirectory\n under \$DOCDIR " -GET_LOCALEDIR /usr/share/locale +GET_LOCALEDIR GET_BUILDROOT GET_BUILDTMP diff --git a/scripts/bash-based-configure b/scripts/bash-based-configure index 63ac9ab..92a0d6e 100644 --- a/scripts/bash-based-configure +++ b/scripts/bash-based-configure @@ -602,7 +602,7 @@ function GET_BINDIR() function GET_DOCDIR() { local default="$1" - path_from_default "doc" "$default" $cfg_docdir + path_from_default "share/doc" "$default" $cfg_docdir DOCDIR=$ret_path if test -n "$cfg_help_mode"; then @@ -620,7 +620,7 @@ function GET_DOCDIR() function GET_LOCALEDIR() { local default="$1" - path_from_default "locale" "$default" $cfg_localedir + path_from_default "share/locale" "$default" $cfg_localedir LOCALEDIR=$ret_path if test -n "$cfg_help_mode"; then @@ -638,7 +638,7 @@ function GET_LOCALEDIR() function GET_MANDIR() { local default="$1" - path_from_default "man" "$default" $cfg_mandir + path_from_default "share/man" "$default" $cfg_mandir MANDIR=$ret_path if test -n "$cfg_help_mode"; then