From 713914b3ad95e5079a34cf0f5d0fd87e514a4314 Mon Sep 17 00:00:00 2001 From: infactum Date: Sun, 24 Feb 2019 17:20:44 +0500 Subject: [PATCH] appimage support --- appveyor.yml | 34 +++- buildenv/Dockerfile.centos6 | 72 ++++++++ buildenv/app.desktop | 7 + buildenv/icon.svg | 320 ++++++++++++++++++++++++++++++++++++ libtgvoip/CMakeLists.txt | 1 + 5 files changed, 432 insertions(+), 2 deletions(-) create mode 100644 buildenv/Dockerfile.centos6 create mode 100644 buildenv/app.desktop create mode 100644 buildenv/icon.svg diff --git a/appveyor.yml b/appveyor.yml index c15cc3d..1da1d42 100644 --- a/appveyor.yml +++ b/appveyor.yml @@ -24,6 +24,9 @@ environment: - target_name: CentOS 7 docker_tag: centos7 + - target_name: AppImage + docker_tag: centos6 + init: - sh: | docker login -u "$docker_login" -p "$docker_password" @@ -34,6 +37,7 @@ install: build_script: - sh: >- + if [ "$target_name" = "AppImage" ] ; then exit 0; fi ; mkdir build; docker run --rm -v "$(pwd)":/src "$docker_image":"$docker_tag" /bin/bash -c " mkdir build && cd build; @@ -42,9 +46,35 @@ build_script: chmod +x tg2sip; chmod +x gen_db; cp tg2sip /src/build; - cp gen_db /src/build;" + cp gen_db /src/build;" 7z a tg2sip.zip ./build/tg2sip ./build/gen_db ./settings.ini; + - sh: >- + if [ "$target_name" != "AppImage" ] ; then exit 0; fi ; + mkdir build; + docker run --rm -v "$(pwd)":/src "$docker_image":"$docker_tag" /bin/bash -c " + mkdir build && cd build; + export PKG_CONFIG_PATH=/usr/local/lib/pkgconfig && cmake -DCMAKE_BUILD_TYPE=Release /src; + cmake --build .; + chmod +x tg2sip; + chmod +x gen_db; + linuxdeploy --appdir /src/build/tg2sip -e tg2sip; + linuxdeploy --appdir /src/build/tg2sip -e gen_db;" + wget https://github.com/AppImage/AppImageKit/releases/download/continuous/appimagetool-x86_64.AppImage -O appimagetool.AppImage; + chmod +x appimagetool.AppImage; + wget https://github.com/linuxdeploy/linuxdeploy/releases/download/continuous/linuxdeploy-x86_64.AppImage -O chmod +x linuxdeploy.AppImage; + chmod +x linuxdeploy.AppImage; + ./linuxdeploy.AppImage --appdir ./build/tg2sip -d ./buildenv/app.desktop -i ./buildenv/icon.svg; + ./linuxdeploy.AppImage --appdir ./build/gen_db -d ./buildenv/app.desktop -i ./buildenv/icon.svg; + ./appimagetool.AppImage tg2sip; + ./appimagetool.AppImage gen_db; + 7z a tg2sip.zip ./build/tg2sip-x86_64.AppImage ./build/gen_db-x86_64.AppImage ./settings.ini; + after_build: - sh: docker push "$docker_image":"$docker_tag" - - sh: appveyor PushArtifact tg2sip.zip -FileName tg2sip_"$docker_tag".zip -DeploymentName "TG2SIP $target_name" \ No newline at end of file + - sh: >- + if [ "$target_name" != "AppImage" ] ; then + appveyor PushArtifact tg2sip.zip -FileName tg2sip_"$docker_tag".zip -DeploymentName "TG2SIP $target_name" + else + appveyor PushArtifact tg2sip.zip -FileName tg2sip.zip -DeploymentName "TG2SIP AppImage" + fi \ No newline at end of file diff --git a/buildenv/Dockerfile.centos6 b/buildenv/Dockerfile.centos6 new file mode 100644 index 0000000..8b3b14e --- /dev/null +++ b/buildenv/Dockerfile.centos6 @@ -0,0 +1,72 @@ +FROM centos:6 as builder + +# https://www.softwarecollections.org/en/scls/rhscl/devtoolset-7/ +RUN yum -y install centos-release-scl yum-utils \ + && yum-config-manager --enable rhel-server-rhscl-7-rpms \ + && yum install -y devtoolset-7-gcc devtoolset-7-gcc-c++ + +RUN yum install -y \ + make \ + git wget \ + zlib-devel openssl-devel gperf \ + pkgconfig ccache gperf unzip \ + libpng-devel libjpeg-devel patchelf \ + epel-release \ + && yum install -y opus-devel + +RUN wget https://cmake.org/files/v3.9/cmake-3.9.6-Linux-x86_64.sh \ + && sh cmake-3.9.6-Linux-x86_64.sh --prefix=/usr --exclude-subdir + +COPY tdlib_header.patch / +COPY tdlib_threadname.patch / + +RUN source /opt/rh/devtoolset-7/enable \ + && git clone https://github.com/tdlib/td.git \ + && cd td \ + && git reset --hard v1.2.0 \ + && git apply /tdlib_header.patch \ + && git apply /tdlib_threadname.patch \ + && mkdir build \ + && cd build \ + && cmake -DCMAKE_BUILD_TYPE=Release .. \ + && cmake --build . --target install \ + && cd / \ + && rm -rf td + +COPY config_site.h / + +RUN source /opt/rh/devtoolset-7/enable \ + && git clone https://github.com/Infactum/pjproject.git \ + && cd pjproject \ + && cp /config_site.h pjlib/include/pj \ + && ./configure --disable-sound CFLAGS="-O3 -DNDEBUG" \ + && make dep && make && make install \ + && cd / \ + && rm -rf pjproject + +RUN source /opt/rh/devtoolset-7/enable \ + && git clone -n https://github.com/gabime/spdlog.git \ + && cd spdlog \ + && git checkout tags/v0.17.0 \ + && mkdir build \ + && cd build \ + && cmake -DCMAKE_BUILD_TYPE=Release -DSPDLOG_BUILD_EXAMPLES=OFF -DSPDLOG_BUILD_TESTING=OFF .. \ + && cmake --build . --target install \ + && cd / \ + && rm -rf spdlog + +RUN source /opt/rh/devtoolset-7/enable \ + && git clone --recursive https://github.com/linuxdeploy/linuxdeploy.git \ + && cd linuxdeploy \ + && git checkout f9fc51a832185158d3e0e64858c83a941047871f \ + && mkdir build \ + && cd build \ + && export PKG_CONFIG_PATH=/usr/local/lib/pkgconfig && cmake -DCMAKE_BUILD_TYPE=Release -DUSE_SYSTEM_CIMG=0 .. \ + && cmake --build . \ + && cp bin/linuxdeploy /usr/local/bin \ + && cd / \ + && rm -rf linuxdeploy + +COPY centos_entrypoint.sh / + +ENTRYPOINT ["/centos_entrypoint.sh"] diff --git a/buildenv/app.desktop b/buildenv/app.desktop new file mode 100644 index 0000000..252dfb2 --- /dev/null +++ b/buildenv/app.desktop @@ -0,0 +1,7 @@ +[Desktop Entry] +Name= +Exec= +Terminal=true +Type=Application +Icon=icon +Categories=AudioVideo; \ No newline at end of file diff --git a/buildenv/icon.svg b/buildenv/icon.svg new file mode 100644 index 0000000..83ac565 --- /dev/null +++ b/buildenv/icon.svg @@ -0,0 +1,320 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + image/svg+xml + + + + + + + + + + + + + + + + + + + + + + diff --git a/libtgvoip/CMakeLists.txt b/libtgvoip/CMakeLists.txt index 67ae01f..a9658fb 100644 --- a/libtgvoip/CMakeLists.txt +++ b/libtgvoip/CMakeLists.txt @@ -657,6 +657,7 @@ target_include_directories(libtgvoip PRIVATE ${PJSIP_INCLUDE_DIRS}) target_compile_definitions(libtgvoip PRIVATE + __STDC_FORMAT_MACROS WEBRTC_APM_DEBUG_DUMP=0 WEBRTC_POSIX WEBRTC_LINUX