From da69afbe8af89e51a48eed324ea60e1568ca2737 Mon Sep 17 00:00:00 2001 From: Tindy X <49061470+tindy2013@users.noreply.github.com> Date: Fri, 8 Nov 2019 14:11:21 +0800 Subject: [PATCH] Add Travis-CI build script --- .travis.yml | 35 +++++++++++++++++++++++++++++++++++ build.alpine.release.sh | 38 ++++++++++++++++++++++++++++++++++++++ build.macos.release.sh | 40 ++++++++++++++++++++++++++++++++++++++++ 3 files changed, 113 insertions(+) create mode 100644 .travis.yml create mode 100644 build.alpine.release.sh create mode 100644 build.macos.release.sh diff --git a/.travis.yml b/.travis.yml new file mode 100644 index 0000000..c595adb --- /dev/null +++ b/.travis.yml @@ -0,0 +1,35 @@ +language: cpp +sudo: required +stages: + - name: deploy + if: branch = master + - name: before_script + if: branch = master +matrix: + include: + - os: osx + compiler: clang + osx_image: xcode10.3 + script: + - chmod +x build.macos.release.sh + - ./build.macos.release.sh + deploy: + provider: releases + api_key: "$GITHUB_OAUTH_TOKEN" + file: "subconverter_darwin64.tar.gz" + skip_cleanup: true + draft: true + on: + tags: true + - services: docker + script: + - docker pull alpine:latest + - docker run -v $TRAVIS_BUILD_DIR:/root/workdir alpine:latest /bin/sh -c "apk add bash git && cd /root/workdir && chmod +x build.alpine.release.sh && bash build.alpine.release.sh" + deploy: + provider: releases + api_key: "$GITHUB_OAUTH_TOKEN" + file: "subconverter_linux64.tar.gz" + skip_cleanup: true + draft: true + on: + tags: true diff --git a/build.alpine.release.sh b/build.alpine.release.sh new file mode 100644 index 0000000..b5f7a6a --- /dev/null +++ b/build.alpine.release.sh @@ -0,0 +1,38 @@ +#!/bin/bash +mkdir obj +set -xe + +apk add gcc g++ build-base linux-headers cmake make autoconf automake libtool +apk add libressl-dev zlib-dev rapidjson-dev + +git clone https://github.com/curl/curl +cd curl +./buildconf +./configure > /dev/null +make install -j4 +cd .. + +git clone https://github.com/jbeder/yaml-cpp +cd yaml-cpp +cmake . +make install -j4 +cd .. + +git clone git://sourceware.org/git/bzip2.git +cd bzip2 +make install -j4 +cd .. + +g++ -Wall -std=c++1z -fexceptions -DCURL_STATICLIB -c logger.cpp -o obj\logger.o +g++ -Wall -std=c++1z -fexceptions -DCURL_STATICLIB -c main.cpp -o obj\main.o +g++ -Wall -std=c++1z -fexceptions -DCURL_STATICLIB -c misc.cpp -o obj\misc.o +g++ -Wall -std=c++1z -fexceptions -DCURL_STATICLIB -c nodemanip.cpp -o obj\nodemanip.o +g++ -Wall -std=c++1z -fexceptions -DCURL_STATICLIB -c rapidjson_extra.cpp -o obj\rapidjson_extra.o +g++ -Wall -std=c++1z -fexceptions -DCURL_STATICLIB -c speedtestutil.cpp -o obj\speedtestutil.o +g++ -Wall -std=c++1z -fexceptions -DCURL_STATICLIB -c subexport.cpp -o obj\subexport.o +g++ -Wall -std=c++1z -fexceptions -DCURL_STATICLIB -c webget.cpp -o obj\webget.o +g++ -Wall -std=c++1z -fexceptions -DCURL_STATICLIB -c webserver_libevent.cpp -o obj\webserver_libevent.o +g++ -o subconverter obj\logger.o obj\main.o obj\misc.o obj\nodemanip.o obj\rapidjson_extra.o obj\speedtestutil.o obj\subexport.o obj\webget.o obj\webserver_libevent.o -static -levent -lyaml-cpp -lcurl -lssl -lcrypto -lz -lbz2 -ldl -lpthread -O3 -s + +chmod +rx subconverter pref.ini *.yml +tar czf subconverter_linux64.tar.gz subconverter pref.ini *.yml diff --git a/build.macos.release.sh b/build.macos.release.sh new file mode 100644 index 0000000..ced527b --- /dev/null +++ b/build.macos.release.sh @@ -0,0 +1,40 @@ +#!/bin/bash +mkdir obj +set -xe + +brew reinstall yaml-cpp rapidjson libevent zlib + +git clone https://github.com/curl/curl +cd curl +./buildconf +./configure --with-ssl=/usr/local/opt/openssl@1.1 --without-mbedtls --disable-ldap --disable-ldaps --disable-rtsp --without-libidn2 +make -j8 +cd .. + +curl -L -o bzip2-1.0.6.tar.gz https://sourceforge.net/projects/bzip2/files/bzip2-1.0.6.tar.gz/download +tar xvf bzip2-1.0.6.tar.gz +cd bzip2-1.0.6 +make -j8 +cd .. + +cp /usr/local/lib/libevent.a . +cp /usr/local/opt/zlib/lib/libz.a . +cp /usr/local/opt/openssl@1.1/lib/libssl.a . +cp /usr/local/opt/openssl@1.1/lib/libcrypto.a . +cp /usr/local/lib/libyaml-cpp.a . + +c++ -Wall -std=c++17 -fexceptions -DCURL_STATICLIB -I/usr/local/include -I/usr/local/opt/openssl@1.1/include -I/usr/local/opt/curl/include -c logger.cpp -o obj\logger.o +c++ -Wall -std=c++17 -fexceptions -DCURL_STATICLIB -I/usr/local/include -I/usr/local/opt/openssl@1.1/include -I/usr/local/opt/curl/include -c main.cpp -o obj\main.o +c++ -Wall -std=c++17 -fexceptions -DCURL_STATICLIB -I/usr/local/include -I/usr/local/opt/openssl@1.1/include -I/usr/local/opt/curl/include -c misc.cpp -o obj\misc.o +c++ -Wall -std=c++17 -fexceptions -DCURL_STATICLIB -I/usr/local/include -I/usr/local/opt/openssl@1.1/include -I/usr/local/opt/curl/include -c nodemanip.cpp -o obj\nodemanip.o +c++ -Wall -std=c++17 -fexceptions -DCURL_STATICLIB -I/usr/local/include -I/usr/local/opt/openssl@1.1/include -I/usr/local/opt/curl/include -c rapidjson_extra.cpp -o obj\rapidjson_extra.o +c++ -Wall -std=c++17 -fexceptions -DCURL_STATICLIB -I/usr/local/include -I/usr/local/opt/openssl@1.1/include -I/usr/local/opt/curl/include -c speedtestutil.cpp -o obj\speedtestutil.o +c++ -Wall -std=c++17 -fexceptions -DCURL_STATICLIB -I/usr/local/include -I/usr/local/opt/openssl@1.1/include -I/usr/local/opt/curl/include -c subexport.cpp -o obj\subexport.o +c++ -Wall -std=c++17 -fexceptions -DCURL_STATICLIB -I/usr/local/include -I/usr/local/opt/openssl@1.1/include -I/usr/local/opt/curl/include -c webget.cpp -o obj\webget.o +c++ -Wall -std=c++17 -fexceptions -DCURL_STATICLIB -I/usr/local/include -I/usr/local/opt/openssl@1.1/include -I/usr/local/opt/curl/include -c webserver_libevent.cpp -o obj\webserver_libevent.o +c++ -Xlinker -unexported_symbol -Xlinker "*" -o subconverter obj\logger.o obj\main.o obj\misc.o obj\nodemanip.o obj\rapidjson_extra.o obj\speedtestutil.o obj\subexport.o obj\webget.o obj\webserver_libevent.o libevent.a curl/lib/.libs/libcurl.a libz.a libssl.a libcrypto.a libyaml-cpp.a bzip2-1.0.6/libbz2.a -ldl -lpthread -O3 -s + +chmod +rx subconverter pref.ini *.yml +tar czf subconverter_darwin64.tar.gz subconverter pref.ini *.yml + +set +xe