diff --git a/.travis.yml b/.travis.yml index 3b19ce7..bed3cfc 100644 --- a/.travis.yml +++ b/.travis.yml @@ -12,14 +12,15 @@ script: - echo No test scripts implemented yet. Travis is used only for deploy yet. before_deploy: -- package/update_version.sh $TRAVIS_TAG +- package/build_all.sh $TRAVIS_TAG deploy: - provider: releases api_key: secure: zFbsCIKcsvWU/Yc+9k294Qj8QY48VlkV8DSScP5gz6dQegeUSaSHI/YafherkFQ0B03bIY8yc7roMtDo7HAkEnPptjFhdUiOFI11+xDVb3s7Y8Ek2nV3znQzdtR4CR/94l3in6R3DH+eNA6+6Je/NIWLdVcvRX07RBSfBVdPmnsAyAD9KNTsl8Q4c20HgtLNxfWv2s5eCyD+heCTLYrErEZKZ5vYeeANmWomHvT2ED/4QerpBP8wkh59QXD1S79CF7oyq6X173ZJUQVxdBP+OSXt/mDBAoqf+TV6okawRZn48JluvCWAJ7BceX7t9emd1rVI/s8t3wCP+eMcmNn5g/6UJaCPnTJ5YplTuUWRc63UFSkE0AY8WYcRlrz+/OiXYgQ8LMXfN23aWgarHCbS2vHR3Afu9gpLCoKucr36hKhs3zfjJzVLFFW16mnbaTFcBzfDDRpkvOANB1aZwGVRFpTIWIMjkn0+lxWTC/moIJvQlfRPsC4dN5cDAilRQlguHzayebtGE8X0PuIe9A8bkET3V/y+KPnQiSJ7J+5PNoDSdqRAE4IKvVOLEyHtlqBVkvIHKnugUnWPIZ21gm5RemMEj9/YGa8Efwz7PIKtJJ3kFMGDYKVlIKyB+rg/TFWNdo6jjevnWM6y4SfVI3kFyjA+mp31o6nshrQy0zVQpd8= file: - - "package/debian/build/virtscreen_$TRAVIS_TAG-1_all.deb" + - package/debian/build/virtscreen_$TRAVIS_TAG-1_all.deb + - package/appimage/VirtScreen-x86_64.AppImage skip_cleanup: true on: tags: true diff --git a/Dockerfile b/Dockerfile index 4f9ba78..8f882f8 100644 --- a/Dockerfile +++ b/Dockerfile @@ -2,11 +2,8 @@ FROM ubuntu:bionic LABEL author="Bumsik Kim " -WORKDIR /app -CMD ["/bin/bash"] - RUN apt-get update && \ - apt-get install -y python3-all python3-pip python3-wheel fakeroot debmake debhelper fakeroot wget tar && \ + apt-get install -y python3-all python3-pip python3-wheel fakeroot debmake debhelper fakeroot wget tar curl && \ apt-get autoremove -y && \ ln /usr/bin/python3 /usr/bin/python && \ ln /usr/bin/pip3 /usr/bin/pip && \ @@ -18,3 +15,15 @@ RUN apt-get update && \ RUN wget https://repo.continuum.io/miniconda/Miniconda3-latest-Linux-x86_64.sh -O ~/miniconda.sh && \ bash ~/miniconda.sh -b -p ~/miniconda && \ rm ~/miniconda.sh + +# AppImageKit +WORKDIR /opt +RUN wget https://github.com/AppImage/AppImageKit/releases/download/10/appimagetool-x86_64.AppImage && \ + chmod a+x appimagetool-x86_64.AppImage && \ + ./appimagetool-x86_64.AppImage --appimage-extract && \ + mv squashfs-root appimagetool && \ + rm appimagetool-x86_64.AppImage +ENV PATH=/opt/appimagetool/usr/bin:$PATH + +WORKDIR /app +CMD ["/bin/bash"] diff --git a/Makefile b/Makefile index 4a93be4..d82dcdf 100644 --- a/Makefile +++ b/Makefile @@ -2,8 +2,9 @@ # for python packaging reference. DOCKER_NAME=kbumsik/virtscreen -DOCKER_RUN=docker run -v $(shell pwd)/package/debian:/app $(DOCKER_NAME) -DOCKER_RUN_TTY=docker run --interactive --tty -v $(shell pwd)/package/debian:/app $(DOCKER_NAME) +DOCKER_RUN=docker run --interactive --tty -v $(shell pwd):/app $(DOCKER_NAME) +DOCKER_RUN_TTY=docker run --interactive --tty -v $(shell pwd):/app $(DOCKER_NAME) +DOCKER_RUN_DEB=docker run -v $(shell pwd)/package/debian:/app $(DOCKER_NAME) .PHONY: @@ -41,29 +42,37 @@ docker-push: docker login docker push $(DOCKER_NAME) +# For AppImage packaging, https://github.com/AppImage/AppImageKit/wiki/Creating-AppImages +appimage-build: + $(DOCKER_RUN) package/appimage/build.sh + $(DOCKER_RUN) chown -R $(shell id -u):$(shell id -u) package/appimage + +appimage-clean: + $(DOCKER_RUN) rm -rf package/appimage/virtscreen.AppDir package/appimage/VirtScreen-x86_64.AppImage + # For Debian packaging, https://www.debian.org/doc/manuals/debmake-doc/ch08.en.html#setup-py deb-make: - $(DOCKER_RUN) /app/debmake.sh + $(DOCKER_RUN_DEB) /app/debmake.sh deb-build: deb-make - $(DOCKER_RUN) /app/copy_debian.sh - $(DOCKER_RUN) /app/debuild.sh + $(DOCKER_RUN_DEB) /app/copy_debian.sh + $(DOCKER_RUN_DEB) /app/debuild.sh deb-contents: - $(DOCKER_RUN) /app/contents.sh + $(DOCKER_RUN_DEB) /app/contents.sh deb-env-make: - $(DOCKER_RUN) /app/debmake.sh virtualenv + $(DOCKER_RUN_DEB) /app/debmake.sh virtualenv deb-env-build: deb-env-make - $(DOCKER_RUN) /app/copy_debian.sh virtualenv - $(DOCKER_RUN) /app/debuild.sh virtualenv + $(DOCKER_RUN_DEB) /app/copy_debian.sh virtualenv + $(DOCKER_RUN_DEB) /app/debuild.sh virtualenv deb-chown: - $(DOCKER_RUN) chown -R $(shell id -u):$(shell id -u) /app/build + $(DOCKER_RUN_DEB) chown -R $(shell id -u):$(shell id -u) /app/build deb-clean: - $(DOCKER_RUN) rm -rf /app/build + $(DOCKER_RUN_DEB) rm -rf /app/build # For AUR: https://wiki.archlinux.org/index.php/Python_package_guidelines # and: https://wiki.archlinux.org/index.php/Creating_packages @@ -95,4 +104,4 @@ arch-clean: cd package/archlinux rm -rf pkg src *.tar* -clean: arch-clean deb-clean python-clean +clean: appimage-clean arch-clean deb-clean python-clean diff --git a/package/appimage/AppRun b/package/appimage/AppRun new file mode 100755 index 0000000..2512c2b --- /dev/null +++ b/package/appimage/AppRun @@ -0,0 +1,15 @@ +#!/bin/sh +# This script is only for isolated miniconda environment +# Used in AppImage package +SCRIPTDIR=$(dirname $0) +ENV=$SCRIPTDIR/usr/share/virtscreen/env + +echo $SCRIPTDIR +export PYTHONPATH=$ENV/lib/python3.6 +export LD_LIBRARY_PATH=$ENV/lib +export QT_PLUGIN_PATH=$ENV/lib/python3.6/site-packages/PyQt5/Qt/plugins +export QML2_IMPORT_PATH=$ENV/lib/python3.6/site-packages/PyQt5/Qt/qml +# export QT_QPA_FONTDIR=/usr/share/fonts +# export QT_XKB_CONFIG_ROOT=/usr/share/X11/xkb + +$ENV/bin/python3 $ENV/bin/virtscreen diff --git a/package/appimage/build.sh b/package/appimage/build.sh new file mode 100755 index 0000000..9310785 --- /dev/null +++ b/package/appimage/build.sh @@ -0,0 +1,32 @@ +#!/bin/bash + +# Directory +DIR="$( cd "$( dirname "${BASH_SOURCE[0]}" )" && pwd )" +ROOT=$DIR/../.. + +cd $ROOT/package/appimage +mkdir virtscreen.AppDir +cd virtscreen.AppDir +# Create virtualenv +install -d usr/share/virtscreen +source $HOME/miniconda/bin/activate && \ + conda create -y --copy --prefix usr/share/virtscreen/env python=3.6 +# Install VirtScreen using pip +source $HOME/miniconda/bin/activate && \ + source activate usr/share/virtscreen/env && \ + pip install $ROOT +# Delete unnecessary installed files done by setup.py +rm -rf usr/share/virtscreen/env/lib/python3.6/site-packages/usr +# Copy desktop entry, icon, and AppRun +install -m 644 -D $ROOT/virtscreen.desktop \ + usr/share/applications/virtscreen.desktop +install -m 644 -D $ROOT/virtscreen.desktop \ + . +install -m 644 -D $ROOT/data/virtscreen.png \ + usr/share/pixmaps/virtscreen.png +install -m 644 -D $ROOT/data/virtscreen.png \ + . +install -m 755 -D $ROOT/package/appimage/AppRun \ + . +cd .. +appimagetool virtscreen.AppDir diff --git a/package/update_version.sh b/package/build_all.sh similarity index 94% rename from package/update_version.sh rename to package/build_all.sh index ea24251..c9ce382 100755 --- a/package/update_version.sh +++ b/package/build_all.sh @@ -32,6 +32,10 @@ build_pypi () { make -C $ROOT python-wheel } +build_appimage () { + make -C $ROOT appimage-build +} + build_arch () { wget -q https://github.com/kbumsik/VirtScreen/archive/$VERSION.tar.gz SHA256=$(sha256sum $VERSION.tar.gz | cut -d' ' -f1) @@ -49,5 +53,6 @@ build_debian () { override_version # build_pypi -build_arch +build_appimage +# build_arch build_debian