From 0fca6a488fe7570ccd07c6de56773b9200a32a55 Mon Sep 17 00:00:00 2001 From: Ahmed Zetao Yang Date: Wed, 31 Jan 2018 00:04:04 +0800 Subject: [PATCH] deb and rpm packaging & add appveyor (#85) * improvement of deb package * rpm and deb package & add appveyor * deploy to Github Release * support fedora 27 --- .travis.yml | 256 +++++++++++---------------------------------- .travis_linux.sh | 108 +++++++++++++++++++ appveyor.yml | 64 ++++++++++++ rpm/flameshot.spec | 76 ++++++++++++++ 4 files changed, 308 insertions(+), 196 deletions(-) create mode 100644 .travis_linux.sh create mode 100644 appveyor.yml create mode 100644 rpm/flameshot.spec diff --git a/.travis.yml b/.travis.yml index 3067ab44..0de300b1 100644 --- a/.travis.yml +++ b/.travis.yml @@ -1,204 +1,68 @@ -os: linux -sudo: false dist: trusty -#dist: xenial ### wait ubuntu 16.04's coming from travis-ci -stages: - - Build & Test - - Packaging - - name: Deploy -# if: branch = master +sudo: required +services: + - docker +language: cpp + +os: + - linux + +cache: + directories: + - $HOME/.cache + env: - global: - #### Destination binary path - - BUILD_DST_PATH=build - #### Destination packaging path. If we use one by job they doesn't need to wait until the others end - - APPIMAGE_DST_PATH=build-appimage - - DEB_DST_PATH=build-deb + global: + # Environment variables for packpack + - PRODUCT=flameshot + - VERSION=0.5.0 + - RELEASE=1 + - ARCH=x86_64 +# - DOCKER_REPO=packpack/packpack + - DOCKER_REPO=vitzy/packpack + matrix: + #The actual list of distribution is available on + #https://hub.docker.com/r/packpack/packpack/tags/ + #https://hub.docker.com/r/vitzy/packpack/tags/ + - OS=fedora DIST=26 + - OS=fedora DIST=27 + # trusty: only for build & test & AppImage + - OS=ubuntu DIST=trusty #14.04 LTS; Qt version is 5.2.1, flameshot not support + - OS=ubuntu DIST=xenial #16.04 LTS + - OS=ubuntu DIST=artful #17.10 + - OS=debian DIST=jessie #8 + - OS=debian DIST=stretch #9 -jobs: - include: -############## Build & Test ############## - - stage: Build & Test - #language: cpp -> Not necessary because we use specific versions - #compiler: gcc -> Not necessary because we use specific versions - cache: - - ccache: true - - apt: true - - directories: - ### > Save the build directory to reuse in other jobs - - &build_dst_path build - addons: &build_apt - apt: - sources: - # qt5 >= 5.3 - - sourceline: 'ppa:beineri/opt-qt532-trusty' - # g++ & gcc >= 4.9 - - ubuntu-toolchain-r-test - packages: - - git - - build-essential +before_install: + - if [[ "${TRAVIS_OS_NAME}" == "linux" && "${DIST}" == "trusty" ]]; then sudo add-apt-repository -y ppa:ubuntu-toolchain-r/test; fi + - if [[ "${TRAVIS_OS_NAME}" == "linux" && "${DIST}" == "trusty" ]]; then sudo apt-get -qq update ; fi + # - export VERSION=0.5.0 - #### Replacement of: qt5-qmake, qt5-default, qttools5-dev-tools - - qt53base - - qt53tools +before_script: + - if [[ "${TRAVIS_OS_NAME}" == "linux" && "${DIST}" == "trusty" ]]; then chmod +x .travis_linux.sh ; fi - #### Using g++ >= 4.9 - - g++-4.9 - - gcc-4.9 +install: + - if [[ "${TRAVIS_OS_NAME}" == "linux" && "${DIST}" == "trusty" ]]; then sudo apt-get install -qq git; sudo apt-get install -qq build-essential ; fi + - if [[ "${TRAVIS_OS_NAME}" == "linux" && "${DIST}" == "trusty" ]]; then sudo -E apt-get -yq --no-install-suggests --no-install-recommends --force-yes install openssl libssl-dev ; fi + # - if [[ "${TRAVIS_OS_NAME}" == "linux" ]]; then sudo -E apt-get -yq --no-install-suggests --no-install-recommends --force-yes install libgl1-mesa-dev ; fi + - if [[ "${TRAVIS_OS_NAME}" == "linux" && "${DIST}" == "trusty" ]]; then sudo -E apt-get -yq --no-install-suggests --no-install-recommends --force-yes install tree ; fi + - if [[ "${TRAVIS_OS_NAME}" == "linux" && "${DIST}" == "trusty" ]]; then sudo apt-get install -qq gcc-4.9; sudo apt-get install -qq g++-4.9 ; fi + - if [[ "${TRAVIS_OS_NAME}" == "linux" && "${DIST}" == "trusty" ]]; then sudo apt-get install -qq git ; fi - before_install: - ##### Clean cache folder - - rm -rf $BUILD_DST_PATH/* +script: + # - git submodule update --init --recursive + # - git describe --long + - if [[ "${TRAVIS_OS_NAME}" == "linux" ]]; then bash ./.travis_linux.sh ; fi + - pwd && ls - before_script: &build_before_script - #### Use qt5 == 5.3 instead other version - - source /opt/qt53/bin/qt53-env.sh && qmake --version - - ##### Use gcc y cpp == 4.9 instead other version - - export CC=gcc-4.9 CXX=g++-4.9 - - script: - - qmake QMAKE_CXX=$CXX QMAKE_CC=$CC QMAKE_LINK=$CXX DESTDIR=$BUILD_DST_PATH - - # Building flameshot - - make -j$(nproc) - - # Running flameshot tests - - make check -j$(nproc) - - ls -alhR - - after_script: - #### Wait for the cache to update - - sleep 10 - - -############## Packaging AppImage ############## - - stage: Packaging - #language: cpp - #compiler: gcc - cache: - - directories: - - *build_dst_path - ### > Save the appimage directory to reuse in other jobs - - &appimage_dst_path build-appimage - addons: - apt: - sources: - # qt5 >= 5.3 - - sourceline: 'ppa:beineri/opt-qt532-trusty' - packages: - #### Replacement of: qt5-qmake, qt5-default, qttools5-dev-tools - - qt53base - # - qt53tools - before_install: - ##### Clean cache folder - - rm -rf $APPIMAGE_DST_PATH/* - - before_script: - #### Use qt5 == 5.3 instead other version - - source /opt/qt53/bin/qt53-env.sh && qmake --version - - ##### Download and install linuxdeployqt - - wget -c "https://github.com/probonopd/linuxdeployqt/releases/download/continuous/linuxdeployqt-continuous-x86_64.AppImage" -O linuxdeployqt - - chmod +x linuxdeployqt - ## Extract linuxdeployqt in 'squashfs-root/' - - ./linuxdeployqt --appimage-extract - # - ls -R | grep ":$" | sed -e 's/:$//' -e 's/[^-][^\/]*\//--/g' -e 's/^/ /' -e 's/-/|/' - #|-squashfs-root - #|---usr - #|-----bin - #|-----lib - #|-----share - #|-------doc - #|---------libicu52 - #|---------libpcre3 - #|---------qt59base - #|-----translations - - script: - #### Prepare packing - - mkdir appdir - - cp $BUILD_DST_PATH/flameshot appdir/ - - cp docs/desktopEntry/package/* appdir/ - - cp img/flameshot.png appdir/ - - ls -alhR appdir/ - - #### Configure env vars - - unset QTDIR QT_PLUGIN_PATH LD_LIBRARY_PATH - - export VERSION=$(git rev-parse --short HEAD) # linuxdeployqt uses this for naming the file - - #### Packaging - - ./squashfs-root/usr/bin/linuxdeployqt appdir/flameshot -verbose=2 -bundle-non-qt-libs - - ln -sf plugins/platforms/ appdir/platforms # An unknown bug - - ./squashfs-root/usr/bin/linuxdeployqt appdir/flameshot -verbose=2 -appimage - - ls -alhR ./*.AppImage - - cp *.AppImage $APPIMAGE_DST_PATH/ - - after_script: - #### Wait for the cache to update - - sleep 10 - - - -############## Packaging Deb ############## - # - stage: Packaging - # cache: - # - directories: - # - *build_dst_path - # ### > Save the deb directory to reuse in other jobs - # - &deb_dst_path build-deb - # addons: - # apt: - # sources: - # - ubuntu-toolchain-r-test - # packages: - # - debhelper - # - fakeroot - # - qt5-qmake - # - qt5-default - # - qttools5-dev-tools - # before_install: - # ##### Clean cache folder - # - rm -rf $DEB_DST_PATH/* - - # script: - # - ls -alhR $BUILD_DST_PATH - # - echo "Do .deb" > $DEB_DST_PATH/dev.txt - # - ls -alhR $DEB_DST_PATH - # - dpkg-buildpackage -rfakeroot -b -us -uc - - # after_script: - # #### Wait for the cache to update - # - sleep 10 - - -############## Deploy ############## - - stage: Deploy - cache: - - directories: - - *build_dst_path - - *appimage_dst_path - #- *deb_dst_path - script: - # - ls -alhR $BUILD_DST_PATH - - ls -alhR ./build* - - #### Upload all files to transfer.sh - - WHERE_FIND="$BUILD_DST_PATH $APPIMAGE_DST_PATH $DEB_DST_PATH" - - | - for file_path in $(find $WHERE_FIND -maxdepth 1 -mindepth 1 -type f) - do - curl --upload-file "$file_path" "https://transfer.sh/$(basename $file_path)" - printf "\n\n" - done - - before_cache: - #### Clean cache to optimize future builds - - find . -type f -delete - - -notifications: - email: - on_success: change - on_failure: always +# deploy: +# # Deploy packages to Github Release +# provider: releases +# api_key: "GITHUB ENCYPTED OAUTH TOKEN" +# file_glob: true +# file: dist/*.{deb,rpm,AppImage} +# skip_cleanup: true +# on: +# tags: true +# branch: master diff --git a/.travis_linux.sh b/.travis_linux.sh new file mode 100644 index 00000000..4c106418 --- /dev/null +++ b/.travis_linux.sh @@ -0,0 +1,108 @@ +#!/bin/bash +if [[ "${DIST}" != "trusty" ]]; then + git clone https://github.com/packpack/packpack.git packpack ; + mkdir ./dist ; + pwd && ls ; + packpack/packpack ; + if [ $OS == "ubuntu" ]; + then curl --upload-file build/flameshot_*_*.deb "https://transfer.sh/flameshot_$VERSION-$RELEASE_ubuntu_$ARCH.deb" ; + # copy deb to dist path for distribution + cp build/flameshot_*_*.deb dist/flameshot_$VERSION-$RELEASE_ubuntu_$ARCH.deb ; + elif [ $OS == "debian" ]; + then curl --upload-file build/flameshot_*_*.deb "https://transfer.sh/flameshot_$VERSION-$RELEASE_debian_$ARCH.deb" ; + cp build/flameshot_*_*.deb dist/flameshot_$VERSION-$RELEASE_debian_$ARCH.deb ; + elif [ $OS == "fedora" ]; + then curl --upload-file build/flameshot-$VERSION-$RELEASE.*.$ARCH.rpm "https://transfer.sh/flameshot_$VERSION-$RELEASE_fedora_$ARCH.rpm" ; + cp build/flameshot-$VERSION-$RELEASE.*.$ARCH.rpm dist/flameshot_$VERSION-$RELEASE_fedora_$ARCH.rpm ; + else echo ""; + fi + echo -e "\n" ; + pwd && ls ; +elif [[ "${DIST}" == "trusty" ]]; then + project_dir=$(pwd) + DIST_PATH='dist' + BUILD_DST_PATH='build-test' + APPIMAGE_DST_PATH='build-appimage' + + # Install qt5.3.2 + sudo add-apt-repository ppa:beineri/opt-qt532-trusty -y + sudo apt-get update -qq + sudo apt-get -y install qt53base qt53tools + source /opt/qt53/bin/qt53-env.sh && qmake --version + export CC=gcc-4.9 CXX=g++-4.9 + + mkdir build-test + qmake QMAKE_CXX=$CXX QMAKE_CC=$CC QMAKE_LINK=$CXX DESTDIR=$BUILD_DST_PATH + # Building flameshot + make -j$(nproc) + # Running flameshot tests + make check -j$(nproc) + ls -alhR + + # + # Packaging AppImage using linuxdeployqt + # + mkdir build-appimage + mkdir -p ./build-appimage/appdir/usr/bin + mkdir -p ./build-appimage/appdir/usr/share/applications + mkdir -p ./build-appimage/appdir/usr/share/dbus-1/interfaces + mkdir -p ./build-appimage/appdir/usr/share/dbus-1/services + mkdir -p ./build-appimage/appdir/usr/share/metainfo + mkdir -p ./build-appimage/appdir/usr/share/bash-completion/completions + mkdir -p ./build-appimage/appdir/usr/share/flameshot/translations + cp $BUILD_DST_PATH/flameshot $APPIMAGE_DST_PATH/appdir/usr/bin + cp ${project_dir}/dbus/org.dharkael.Flameshot.xml $APPIMAGE_DST_PATH/appdir/usr/share/dbus-1/interfaces + cp ${project_dir}/dbus/package/org.dharkael.Flameshot.service $APPIMAGE_DST_PATH/appdir/usr/share/dbus-1/services + cp ${project_dir}/docs/appdata/flameshot.appdata.xml $APPIMAGE_DST_PATH/appdir/usr/share/metainfo + cp ${project_dir}/docs/bash-completion/flameshot $APPIMAGE_DST_PATH/appdir/usr/share/bash-completion/completions + cp ${project_dir}/translations/*.qm $APPIMAGE_DST_PATH/appdir/usr/share/flameshot/translations + cp ${project_dir}/docs/desktopEntry/package/* $APPIMAGE_DST_PATH/appdir/usr/share/applications + cp ${project_dir}/img/flameshot.png $APPIMAGE_DST_PATH/appdir + ls -alhR $APPIMAGE_DST_PATH/appdir + + # Copy other project files + cp "${project_dir}/README.md" "$APPIMAGE_DST_PATH/appdir/README.md" + cp "${project_dir}/LICENSE" "$APPIMAGE_DST_PATH/appdir/LICENSE" + echo ${VERSION} > ./$APPIMAGE_DST_PATH/appdir/version + echo "${TRAVIS_COMMIT}" >> ./$APPIMAGE_DST_PATH/appdir/version + + # Configure env vars + unset QTDIR; unset QT_PLUGIN_PATH ; unset LD_LIBRARY_PATH + tree $APPIMAGE_DST_PATH/appdir + + # Get linuxdeployqt tool + wget -c "https://github.com/probonopd/linuxdeployqt/releases/download/continuous/linuxdeployqt-continuous-x86_64.AppImage" -O linuxdeployqt + chmod +x linuxdeployqt + + # Packaging + # -verbose=2 + ./linuxdeployqt $APPIMAGE_DST_PATH/appdir/usr/bin/flameshot -bundle-non-qt-libs + + rm -f $APPIMAGE_DST_PATH/appdir/usr/lib/libatk-1.0.so.0 + cd $APPIMAGE_DST_PATH/appdir/usr/bin + ln -sf ../plugins/platforms/ . # An unknown bug + cd ${project_dir} + + # -verbose=2 + ./linuxdeployqt $APPIMAGE_DST_PATH/appdir/usr/share/applications/flameshot.desktop -appimage + + ls -alhR ./*.AppImage + cp *.AppImage $APPIMAGE_DST_PATH/ + + tree $APPIMAGE_DST_PATH/ + + ls -l $APPIMAGE_DST_PATH/*.AppImage + + mkdir dist + + # Rename AppImage and move AppImage to DIST_PATH + cd $APPIMAGE_DST_PATH && mv Take_graphical_screenshot-${VERSION}-x86_64.AppImage flameshot_x86_64_${VERSION}.AppImage + cd .. && cp $APPIMAGE_DST_PATH/flameshot_x86_64_${VERSION}.AppImage $DIST_PATH/flameshot_x86_64_${VERSION}.AppImage + + pwd + + curl --upload-file $DIST_PATH/flameshot_x86_64_${VERSION}.AppImage "https://transfer.sh/flameshot_x86_64_${VERSION}.AppImage" ; + + exit 0 ; +else echo "" ; +fi diff --git a/appveyor.yml b/appveyor.yml new file mode 100644 index 00000000..a0ee5fb3 --- /dev/null +++ b/appveyor.yml @@ -0,0 +1,64 @@ +image: Visual Studio 2015 + +version: 0.5.0.{build} + +branches: + only: + - dev + +environment: + COMPILER: msvc + VSVER: 14 + + matrix: + - QT: C:\Qt\5.9.2\msvc2015_64 + PLATFORM: amd64 + - QT: C:\Qt\5.9.2\msvc2015 + PLATFORM: x86 + +# scripts that run after cloning repository +install: + - set PATH=%QT%\bin\;C:\Qt\Tools\QtCreator\bin\;C:\Qt\QtIFW3.0.1\bin\;%PATH% + +# scripts that run before build +before_build: + - call "C:\Program Files (x86)\Microsoft Visual Studio 14.0\VC\vcvarsall.bat" %PLATFORM% + # After calling vcvarsall.bat, %PLATFORM% will be X64 or x86 + - qmake --version + - mkdir build + - cd build + - if "%PLATFORM%" EQU "X64" (qmake -r -spec win32-msvc CONFIG+=x86_64 CONFIG-=debug CONFIG+=release ../flameshot.pro) + - if "%PLATFORM%" EQU "x86" (qmake -r -spec win32-msvc CONFIG+=Win32 CONFIG-=debug CONFIG+=release ../flameshot.pro) + +# custom build scripts +build_script: + - nmake + +# scripts that run after build +after_build: + - set flameshot_version=0.5.0 + # Clone OpenSSL DLLs + - git clone https://github.com/tamlok/openssl-utils.git openssl-utils.git + - mkdir distrib\flameshot + - windeployqt.exe --dir .\distrib\flameshot %APPVEYOR_BUILD_FOLDER%\build\release\flameshot.exe + - copy "%APPVEYOR_BUILD_FOLDER%\build\release\flameshot.exe" "distrib\flameshot\flameshot.exe" + - copy "%APPVEYOR_BUILD_FOLDER%\README.md" "distrib\flameshot\README.md" + - copy "%APPVEYOR_BUILD_FOLDER%\LICENSE" "distrib\flameshot\LICENSE.txt" + - echo %flameshot_version% > "distrib\flameshot\version.txt" + - echo %APPVEYOR_REPO_COMMIT% >> "distrib\flameshot\version.txt" + - copy "distrib\flameshot\flameshot.exe" "distrib\flameshot_win_%PLATFORM%.exe" + # Delete translations\qt_*.qm + # - del /F /Q "distrib\flameshot\translations\qt_*.qm" + # Copy OpenSSL DLLs + - if "%PLATFORM%" EQU "X64" (xcopy "openssl-utils.git\win64\*.dll" "distrib\flameshot") + - if "%PLATFORM%" EQU "x86" (xcopy "openssl-utils.git\win32\*.dll" "distrib\flameshot") + - cd distrib + - 7z a flameshot_win_%PLATFORM%_portable_%flameshot_version%.zip flameshot + - curl --upload-file ./flameshot_win_%PLATFORM%_portable_%flameshot_version%.zip https://transfer.sh/flameshot_win_%PLATFORM%_portable_%flameshot_version%.zip + + +# artifacts: +# - path: build\distrib\flameshot_win_%PLATFORM%_portable_%flameshot_version%.zip +# name: portable +# - path: build\distrib\flameshot_win_%PLATFORM%.exe +# name: exe_only \ No newline at end of file diff --git a/rpm/flameshot.spec b/rpm/flameshot.spec new file mode 100644 index 00000000..8659ce61 --- /dev/null +++ b/rpm/flameshot.spec @@ -0,0 +1,76 @@ +Name: flameshot +Version: 0.5.0 +Release: 1%{?dist} +Summary: Powerful yet simple to use screenshot software +Summary(eu-ES): Potente pero simple de usar software de capturas + +%global sourcename flameshot + +Group: Application +License: GPLv3 +URL: https://github.com/lupoDharkael/%{sourcename} +Source0: https://github.com/lupoDharkael/%{sourcename}/archive/v%{version}.tar.gz + +#%%define _binaries_in_noarch_packages_terminate_build 0 +#BuildArch: noarch + +BuildRequires: gcc-c++ >= 4.9.2 +BuildRequires: pkgconfig(Qt5Core) >= 5.3.0 +BuildRequires: pkgconfig(Qt5Gui) >= 5.3.0 +BuildRequires: pkgconfig(Qt5Widgets) >= 5.3.0 +BuildRequires: qt5-qttools-devel +BuildRequires: qt5-linguist +BuildRequires: git + +Requires: qt5-qtbase >= 5.3.0 +Requires: qt5-qttools + +%description +Flameshot is a screenshot software, it's +powerful yet simple to use for GNU/Linux + +%prep +%setup -q -n v%{version} + +%build +#%%qmake_qt5 PREFIX=%{_prefix} +%qmake_qt5 CONFIG+=packaging CONFIG-=debug CONFIG+=release +make %{?_smp_mflags} + +%install +%make_install INSTALL_ROOT=%{buildroot} + +%post -p /sbin/ldconfig +%postun -p /sbin/ldconfig + +%files +%doc README.md +%license LICENSE +%{_bindir}/%{name} +%{_datadir}/dbus-1/interfaces/org.dharkael.Flameshot.xml +%{_datadir}/metainfo/flameshot.appdata.xml +%{_datadir}/dbus-1/services/org.dharkael.Flameshot.service +%{_datadir}/flameshot/translations/Internationalization_*.qm +%{_datadir}/applications/%{name}.desktop +%{_datadir}/applications/%{name}-init.desktop +%{_datadir}/applications/%{name}-config.desktop +%{_datadir}/bash-completion/completions/%{name} +%{_datadir}/icons/%{name}.png +#%%{_datadir}/icons/hicolor/scalable/apps/%{name}.svg +#%%{_datadir}/icons/flameshot/apps/scalable/%{name}.svg + +%changelog +* Tue Jan 09 2018 Zetao Yang - 0.5.0-1 +- Updated for flameshot 0.5.0 +- Catalan translation. +- Debian package configuration. +- Add --raw flag: prints the raw bytes of the png after the capture. +- Bash completion. +- Blur tool. +- Preview draw size on mouse pointer after tool selection. +- App Launcher tool: choose an app to open the capture. +- Travis integration +- Configuration import, export and reset. +- Experimental Wayland support (Plasma & Gnome) +* Tue Jan 09 2018 Zetao Yang - 0.5.0-1 +- Initial package \ No newline at end of file