diff --git a/development/build-with-docker.sh b/development/build-with-docker.sh index d3b14489..e1d561e2 100755 --- a/development/build-with-docker.sh +++ b/development/build-with-docker.sh @@ -3,12 +3,8 @@ PROJECTBRANCH=${1} PROJECTDIR=`pwd` set -xe -# note: all with DOCKERMODIFIER != "" is highly experimental and needs "someway" to include webkit binaries -# so without it will fail -#DOCKERMODIFIER=_qt562 - -DOCKERTAG=nixnote2/xenial${DOCKERMODIFIER} -DOCKERFILE=./development/docker/Dockerfile.ubuntu_xenial${DOCKERMODIFIER} +DOCKERTAG=nixnote2/focal +DOCKERFILE=./development/docker/Dockerfile.ubuntu_focal function error_exit { echo "$0: ***********error_exit***********" @@ -33,12 +29,6 @@ cd $PROJECTDIR docker build -t ${DOCKERTAG} -f ${DOCKERFILE} ./development/docker # stop after creating the image (e.g. you want to do the build manually) -if [ ! -z ${DOCKERMODIFIER} ] ; then - echo "Docker image ${DOCKERTAG} created.. " - echo "DOCKERMODIFIER set to $DOCKERMODIFIER .. you need to provide webkit manually.." - exit 1 -fi - if [ ! -d appdir ] ; then mkdir appdir || error_exit "mkdir appdir" fi @@ -53,33 +43,13 @@ if [ ! -d docker-build-${BUILD_TYPE} ]; then fi # start container (note: each call creates new container) - - - -# to try manually: -# DOCKERTAG=.. -# docker run --rm -it ${DOCKERTAG} /bin/bash -# then -# PROJECTBRANCH=feature/rc1 -# BUILD_TYPE=release -# ...copy command from bellow & paste.. -# -------------------- - -# **TEMPORARY** for beineri PPA recompile ################# -# PROJECTBRANCH=feature/rc1;BUILD_TYPE=release -# source /opt/qt*/bin/qt*-env.sh -# git fetch && git checkout $PROJECTBRANCH && git pull && ./development/build-with-qmake.sh ${BUILD_TYPE} noclean /usr/lib/nixnote2/tidy -# unset QTDIR; unset QT_PLUGIN_PATH ; unset LD_LIBRARY_PATH -# ./development/create-AppImage.sh -# mv *.AppImage appdir2 && chmod -R a+rwx appdir/*.AppImage - time docker run \ --rm \ -v $PROJECTDIR/appdir:/opt/nixnote2/appdir \ -v $PROJECTDIR/docker-build-${BUILD_TYPE}:/opt/nixnote2/qmake-build-${BUILD_TYPE} \ -v $PROJECTDIR/docker-build-${BUILD_TYPE}-t:/opt/nixnote2/qmake-build-${BUILD_TYPE}-t \ -it ${DOCKERTAG} \ - /bin/bash -c "cd nixnote2 && git fetch && git checkout $PROJECTBRANCH && git pull && ./development/build-with-qmake.sh ${BUILD_TYPE} noclean /usr/lib/nixnote2/tidy && ./development/run-tests.sh ${BUILD_TYPE} noclean /usr/lib/nixnote2/tidy && ./development/create-AppImage.sh && mv *.AppImage appdir && chmod -R a+rwx appdir/*.AppImage" + /bin/bash -c "cd nixnote2 && git fetch && git checkout $PROJECTBRANCH && git reset --hard origin/$PROJECTBRANCH && ./development/build-with-qmake.sh ${BUILD_TYPE} noclean /usr/lib/nixnote2/tidy browser && ./development/run-tests.sh ${BUILD_TYPE} noclean /usr/lib/nixnote2/tidy && ./development/create-AppImage-linuxdeploy.sh && mv *.AppImage appdir && chmod -R a+rwx appdir/*.AppImage" ls appdir/*.AppImage echo "If all got well then AppImage file in appdir is your binary" diff --git a/development/build-with-qmake.sh b/development/build-with-qmake.sh index aa2dea52..0153e495 100755 --- a/development/build-with-qmake.sh +++ b/development/build-with-qmake.sh @@ -6,6 +6,7 @@ set -xe BUILD_TYPE=${1} CLEAN=${2} TIDY_LIB_DIR=${3} +OAUTH_BACKEND=${4} CDIR=`pwd` function error_exit { @@ -44,6 +45,15 @@ if [ ! -d "${TIDY_LIB_DIR}" ]; then fi echo "$0: libtidy is expected in: ${TIDY_LIB_DIR}" +if [ -z "${OAUTH_BACKEND}" ] || [ "${OAUTH_BACKEND}" == "browser" ]; then + # by default will use system browser for OAuth because it's the simplest and working option + OAUTH_CONFIG="" +elif [ "${OAUTH_BACKEND}" == "webengine" ]; then + OAUTH_CONFIG="CONFIG+=oauth_webengine" +else + OAUTH_CONFIG="CONFIG+=oauth_webkit" +fi + if [ ! -d "${BUILD_DIR}" ]; then mkdir ${BUILD_DIR} fi @@ -56,7 +66,6 @@ if [ -d "${APPDIR}" ]; then rm *.AppImage 2>/dev/null || echo "failed to remove" fi - QMAKE_BINARY=qmake if [ "${TIDY_LIB_DIR}" == "/usr/lib" ] ; then @@ -71,10 +80,10 @@ elif [ -d ${TIDY_LIB_DIR}/pkgconfig ] ; then export PKG_CONFIG_PATH=${TIDY_LIB_DIR}/pkgconfig fi +echo ${QMAKE_BINARY} CONFIG+=${BUILD_TYPE} ${OAUTH_CONFIG} PREFIX=appdir/usr QMAKE_RPATHDIR+=${TIDY_LIB_DIR} QMAKE_CXX="ccache g++" || error_exit "$0: qmake" +${QMAKE_BINARY} CONFIG+=${BUILD_TYPE} ${OAUTH_CONFIG} PREFIX=appdir/usr QMAKE_RPATHDIR+=${TIDY_LIB_DIR} QMAKE_CXX="ccache g++" || error_exit "$0: qmake" -echo ${QMAKE_BINARY} CONFIG+=${BUILD_TYPE} PREFIX=appdir/usr QMAKE_RPATHDIR+=${TIDY_LIB_DIR} || error_exit "$0: qmake" -${QMAKE_BINARY} CONFIG+=${BUILD_TYPE} PREFIX=appdir/usr QMAKE_RPATHDIR+=${TIDY_LIB_DIR} || error_exit "$0: qmake" - +make clean make -j$(nproc) || error_exit "$0: make" make -j$(nproc) install || error_exit "$0: make install" diff --git a/development/create-AppImage-linuxdeploy.sh b/development/create-AppImage-linuxdeploy.sh new file mode 100755 index 00000000..07f8b640 --- /dev/null +++ b/development/create-AppImage-linuxdeploy.sh @@ -0,0 +1,29 @@ +#!/bin/bash + +PROG=nixnote2 +DESKTOP_FILE=appdir/usr/share/applications/${PROG}.desktop + +BUILD_DIR=$(cat _build_dir_.txt) +echo Build dir: ${BUILD_DIR} + +if [ ! -f "$DESKTOP_FILE" ]; then + echo "$DESKTOP_FILE not found!" + exit 1 +fi + +export VERSIONX=$(cat appdir/usr/share/nixnote2/version.txt) +echo Version: ${VERSIONX} + +# First, create appdir with bundled binaries +CMD="linuxdeploy --desktop-file=$DESKTOP_FILE --appdir=appdir --plugin qt" +echo About to run: $CMD +$CMD + +# Then remove nss libs from the AppDir as they are known to cause troubles, see +# https://github.com/probonopd/linuxdeployqt/issues/35 +rm -f appdir/usr/lib/libnss3.so +rm -f appdir/usr/lib/libnssutil3.so + +# Now create the actual appimage +echo "Creating AppImage" +appimagetool -n appdir diff --git a/development/docker/Dockerfile.ubuntu_focal b/development/docker/Dockerfile.ubuntu_focal new file mode 100644 index 00000000..17ffc493 --- /dev/null +++ b/development/docker/Dockerfile.ubuntu_focal @@ -0,0 +1,41 @@ +FROM ubuntu:focal + +ARG wdir="/opt" +WORKDIR $wdir + +ARG make_core=4 +ENV PATH="${wdir}/linuxdeploy:${wdir}/linuxdeploy-plugin-qt:${wdir}/appimagetool:${PATH}" +ENV DEBIAN_FRONTEND=noninteractive + +RUN apt-get update && apt-get install -y software-properties-common +RUN add-apt-repository ppa:nixnote/nixnote2-stable -y && apt-get update -qq +RUN apt-get update && apt-get install -y git-core qt5-default build-essential ccache p7zip-full libssl1.1 libcrypt1 libnss3 \ + wget curl make pkg-config \ + qtwebengine5-dev qtwebengine5-dev-tools \ + libboost-dev libboost-test-dev libboost-program-options-dev libevent-dev libcurl4-openssl-dev \ + libpoppler-qt5-dev libqt5webkit5-dev qt5-qmake qttools5-dev-tools libhunspell-dev nixnote2-tidy + +# install linuxdeploy +RUN wget -nv "https://github.com/linuxdeploy/linuxdeploy/releases/download/continuous/linuxdeploy-x86_64.AppImage" && \ + chmod a+x ./linuxdeploy-x86_64.AppImage && \ + ./linuxdeploy-x86_64.AppImage --appimage-extract && \ + mv squashfs-root linuxdeploy && \ + mv linuxdeploy/AppRun linuxdeploy/linuxdeploy + +# install linuxdeploy-plugin-qt +RUN wget -nv "https://github.com/linuxdeploy/linuxdeploy-plugin-qt/releases/download/continuous/linuxdeploy-plugin-qt-x86_64.AppImage" && \ + chmod a+x ./linuxdeploy-plugin-qt-x86_64.AppImage && \ + ./linuxdeploy-plugin-qt-x86_64.AppImage --appimage-extract && \ + mv squashfs-root linuxdeploy-plugin-qt && \ + mv linuxdeploy-plugin-qt/AppRun linuxdeploy-plugin-qt/linuxdeploy-plugin-qt + +# install appimagetool +RUN wget -nv "https://github.com/AppImage/AppImageKit/releases/download/continuous/appimagetool-x86_64.AppImage" && \ + chmod a+x appimagetool-x86_64.AppImage && \ + ./appimagetool-x86_64.AppImage --appimage-extract && \ + mv squashfs-root appimagetool && \ + mv appimagetool/AppRun appimagetool/appimagetool + +RUN cd $wdir && git clone "https://github.com/robert7/nixnote2.git" && cd nixnote2 && git checkout master + +CMD /bin/bash