Add CMake support

Clean up file structure.
Update build scripts.
This commit is contained in:
Tindy X committed 2019-12-26 20:37:47 +08:00
1 parent e5eb7a4ae2
commit b89a8b1f7c
136 files changed
+326 -88

No files matched your search

+34
View File
@@ -0,0 +1,34 @@
#!/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 libevent-dev libevent-static zlib-static pcre-dev
git clone https://github.com/curl/curl
cd curl
./buildconf
./configure --with-ssl --disable-ldap --disable-ldaps --disable-rtsp --without-libidn2 > /dev/null
make install -j4 > /dev/null
cd ..
git clone https://github.com/jbeder/yaml-cpp
cd yaml-cpp
cmake . > /dev/null
make install -j4 > /dev/null
cd ..
git clone git://sourceware.org/git/bzip2.git
cd bzip2
make install -j4 > /dev/null
cd ..
cmake .
make -j4
g++ -o base/subconverter CMakeFiles/subconverter.dir/src/*.o -static -lpcrecpp -lpcre -levent -lyaml-cpp -lcurl -lssl -lcrypto -lz -lbz2 -ldl -lpthread -O3 -s
cd base
chmod +rx subconverter
chmod +r *
tar czf subconverter_linux64.tar.gz *
+18
View File
@@ -0,0 +1,18 @@
#!/bin/bash
mkdir obj
set -xe
c++ -std=c++17 -D_MACOS -Wall -fexceptions -c logger.cpp -o obj/logger.o
c++ -std=c++17 -D_MACOS -Wall -fexceptions -c main.cpp -o obj/main.o
c++ -std=c++17 -D_MACOS -Wall -fexceptions -c misc.cpp -o obj/misc.o
c++ -std=c++17 -D_MACOS -Wall -fexceptions -c multithread.cpp -o obj/multithread.o
c++ -std=c++17 -D_MACOS -Wall -fexceptions -c nodemanip.cpp -o obj/nodemanip.o
c++ -std=c++17 -D_MACOS -Wall -fexceptions -c rapidjson_extra.cpp -o obj/rapidjson_extra.o
c++ -std=c++17 -D_MACOS -Wall -fexceptions -c speedtestutil.cpp -o obj/speedtestutil.o
c++ -std=c++17 -D_MACOS -Wall -fexceptions -c subexport.cpp -o obj/subexport.o
c++ -std=c++17 -D_MACOS -Wall -fexceptions -c webget.cpp -o obj/webget.o
c++ -std=c++17 -D_MACOS -Wall -fexceptions -c webserver_libevent.cpp -o obj/webserver_libevent.o
c++ -o subconverter obj/logger.o obj/main.o obj/misc.o obj/multithread.o obj/nodemanip.o obj/rapidjson_extra.o obj/speedtestutil.o obj/subexport.o obj/webget.o obj/webserver_libevent.o -lpcrecpp -lpcre -levent -lpthread -lyaml-cpp -lcurl -lssl -lcrypto -lz -O3 -s
chmod +x subconverter
+39
View File
@@ -0,0 +1,39 @@
#!/bin/bash
mkdir obj
set -xe
brew reinstall yaml-cpp rapidjson libevent zlib pcre
git clone https://github.com/curl/curl
cd curl
./buildconf > /dev/null
./configure --with-ssl=/usr/local/opt/openssl@1.1 --without-mbedtls --disable-ldap --disable-ldaps --disable-rtsp --without-libidn2 > /dev/null
make -j8 > /dev/null
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 > /dev/null
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 .
cp /usr/local/lib/libpcre.a .
cp /usr/local/lib/libpcrecpp.a .
export CMAKE_CXX_FLAGS=-D_MACOS -I/usr/local/include -I/usr/local/opt/openssl@1.1/include -I/usr/local/opt/curl/include
cmake .
make -j8
c++ -Xlinker -unexported_symbol -Xlinker "*" -o base/subconverter obj/logger.o obj/main.o obj/misc.o obj/multithread.o obj/nodemanip.o obj/rapidjson_extra.o obj/speedtestutil.o obj/subexport.o obj/webget.o obj/webserver_libevent.o libpcrecpp.a libpcre.a 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
cd base
chmod +rx subconverter
chmod +r *
tar czf subconverter_darwin64.tar.gz *
cd ..
set +xe
+17
View File
@@ -0,0 +1,17 @@
#!/bin/bash
set -xe
apt update
apt install git cmake clang
apt install libevent libcurl openssl pcre
git clone https://github.com/jbeder/yaml-cpp
cd yaml-cpp
cmake -DCMAKE_INSTALL_PREFIX=/data/data/com.termux/files/usr .
make install -j3
cd ..
git clone https://github.com/tencent/rapidjson
cd rapidjson
cp -r include/* /data/data/com.termux/files/usr/include/
cd ..