Add xmake as build system

This commit is contained in:
Tindy X committed 2023-12-11 01:51:08 +08:00
1 parent 13623d6bcd
commit 547c771127
10 files changed
+302 -201

No files matched your search

+40 -36
View File
@@ -4,45 +4,49 @@ ARG THREADS="4"
ARG SHA=""
# build minimized
WORKDIR /
WORKDIR /subconverter
COPY . /subconverter/
RUN set -xe && \
apk add --no-cache --virtual .build-tools git g++ build-base linux-headers cmake python3 && \
apk add --no-cache --virtual .build-deps curl-dev rapidjson-dev pcre2-dev yaml-cpp-dev && \
git clone https://github.com/ftk/quickjspp --depth=1 && \
cd quickjspp && \
git submodule update --init && \
cmake -DCMAKE_BUILD_TYPE=Release . && \
make quickjs -j $THREADS && \
install -d /usr/lib/quickjs/ && \
install -m644 quickjs/libquickjs.a /usr/lib/quickjs/ && \
install -d /usr/include/quickjs/ && \
install -m644 quickjs/quickjs.h quickjs/quickjs-libc.h /usr/include/quickjs/ && \
install -m644 quickjspp.hpp /usr/include && \
cd .. && \
git clone https://github.com/PerMalmberg/libcron --depth=1 && \
cd libcron && \
git submodule update --init && \
cmake -DCMAKE_BUILD_TYPE=Release . && \
make libcron -j $THREADS && \
install -m644 libcron/out/Release/liblibcron.a /usr/lib/ && \
install -d /usr/include/libcron/ && \
install -m644 libcron/include/libcron/* /usr/include/libcron/ && \
install -d /usr/include/date/ && \
install -m644 libcron/externals/date/include/date/* /usr/include/date/ && \
cd .. && \
git clone https://github.com/ToruNiina/toml11 --branch="v3.7.1" --depth=1 && \
cd toml11 && \
cmake -DCMAKE_CXX_STANDARD=11 . && \
make install -j $THREADS && \
cd .. && \
git clone https://github.com/tindy2013/subconverter --depth=1 && \
cd subconverter && \
[ -n "$SHA" ] && sed -i 's/\(v[0-9]\.[0-9]\.[0-9]\)/\1-'"$SHA"'/' src/version.h;\
apk add --no-cache --virtual .build-tools git g++ build-base linux-headers cmake python3 curl unzip p7zip && \
apk add --no-cache --virtual .build-deps curl-dev rapidjson-dev pcre2-dev yaml-cpp-dev lua5.4-dev luajit-dev && \
curl -fsSL https://xmake.io/shget.text | bash && \
# git clone https://github.com/ftk/quickjspp --depth=1 && \
# cd quickjspp && \
# git submodule update --init && \
# cmake -DCMAKE_BUILD_TYPE=Release . && \
# make quickjs -j $THREADS && \
# install -d /usr/lib/quickjs/ && \
# install -m644 quickjs/libquickjs.a /usr/lib/quickjs/ && \
# install -d /usr/include/quickjs/ && \
# install -m644 quickjs/quickjs.h quickjs/quickjs-libc.h /usr/include/quickjs/ && \
# install -m644 quickjspp.hpp /usr/include && \
# cd .. && \
# git clone https://github.com/PerMalmberg/libcron --depth=1 && \
# cd libcron && \
# git submodule update --init && \
# cmake -DCMAKE_BUILD_TYPE=Release . && \
# make libcron -j $THREADS && \
# install -m644 libcron/out/Release/liblibcron.a /usr/lib/ && \
# install -d /usr/include/libcron/ && \
# install -m644 libcron/include/libcron/* /usr/include/libcron/ && \
# install -d /usr/include/date/ && \
# install -m644 libcron/externals/date/include/date/* /usr/include/date/ && \
# cd .. && \
# git clone https://github.com/ToruNiina/toml11 --branch="v3.7.1" --depth=1 && \
# cd toml11 && \
# cmake -DCMAKE_CXX_STANDARD=11 . && \
# make install -j $THREADS && \
# cd .. && \
# git clone https://github.com/tindy2013/subconverter --depth=1 && \
# cd subconverter && \
# [ -n "$SHA" ] && sed -i 's/\(v[0-9]\.[0-9]\.[0-9]\)/\1-'"$SHA"'/' src/version.h;\
# cmake -DCMAKE_BUILD_TYPE=Release -DUSE_EXTERNAL_CURL=ON -DUSE_EXTERNAL_RAPIDJSON=ON -DUSE_EXTERNAL_YAML_CPP=ON . && \
# make -j $THREADS && \
xmake f --root --static=false -m release && \
xmake --root subconverter --build release && \
python3 -m ensurepip && \
python3 -m pip install gitpython && \
python3 scripts/update_rules.py -c scripts/rules_config.conf && \
cmake -DCMAKE_BUILD_TYPE=Release . && \
make -j $THREADS
python3 scripts/update_rules.py -c scripts/rules_config.conf
# build final image
FROM alpine:3.16
+52 -43
View File
@@ -1,51 +1,60 @@
#!/bin/bash
set -xe
apk add gcc g++ build-base linux-headers cmake make autoconf automake libtool python2 python3
apk add mbedtls-dev mbedtls-static zlib-dev rapidjson-dev zlib-static pcre2-dev
#apk add gcc g++ build-base linux-headers cmake make autoconf automake libtool python2 python3
#apk add mbedtls-dev mbedtls-static zlib-dev rapidjson-dev zlib-static pcre2-dev
#
#git clone https://github.com/curl/curl --depth=1 --branch curl-8_4_0
#cd curl
#cmake -DCURL_USE_MBEDTLS=ON -DHTTP_ONLY=ON -DBUILD_TESTING=OFF -DBUILD_SHARED_LIBS=OFF -DCMAKE_USE_LIBSSH2=OFF -DBUILD_CURL_EXE=OFF . > /dev/null
#make install -j2 > /dev/null
#cd ..
#
#git clone https://github.com/jbeder/yaml-cpp --depth=1
#cd yaml-cpp
#cmake -DCMAKE_BUILD_TYPE=Release -DYAML_CPP_BUILD_TESTS=OFF -DYAML_CPP_BUILD_TOOLS=OFF . > /dev/null
#make install -j3 > /dev/null
#cd ..
#
#git clone https://github.com/ftk/quickjspp --depth=1
#cd quickjspp
#cmake -DCMAKE_BUILD_TYPE=Release .
#make quickjs -j3 > /dev/null
#install -d /usr/lib/quickjs/
#install -m644 quickjs/libquickjs.a /usr/lib/quickjs/
#install -d /usr/include/quickjs/
#install -m644 quickjs/quickjs.h quickjs/quickjs-libc.h /usr/include/quickjs/
#install -m644 quickjspp.hpp /usr/include/
#cd ..
#
#git clone https://github.com/PerMalmberg/libcron --depth=1
#cd libcron
#git submodule update --init
#cmake -DCMAKE_BUILD_TYPE=Release .
#make libcron install -j3
#cd ..
#
#git clone https://github.com/ToruNiina/toml11 --branch="v3.7.1" --depth=1
#cd toml11
#cmake -DCMAKE_CXX_STANDARD=11 .
#make install -j4
#cd ..
#
#export PKG_CONFIG_PATH=/usr/lib64/pkgconfig
#cmake -DCMAKE_BUILD_TYPE=Release .
#make -j3
#rm subconverter
## shellcheck disable=SC2046
#g++ -o base/subconverter $(find CMakeFiles/subconverter.dir/src/ -name "*.o") -static -lpcre2-8 -lyaml-cpp -L/usr/lib64 -lcurl -lmbedtls -lmbedcrypto -lmbedx509 -lz -l:quickjs/libquickjs.a -llibcron -O3 -s
git clone https://github.com/curl/curl --depth=1 --branch curl-8_4_0
cd curl
cmake -DCURL_USE_MBEDTLS=ON -DHTTP_ONLY=ON -DBUILD_TESTING=OFF -DBUILD_SHARED_LIBS=OFF -DCMAKE_USE_LIBSSH2=OFF -DBUILD_CURL_EXE=OFF . > /dev/null
make install -j2 > /dev/null
cd ..
apk add git g++ build-base linux-headers cmake python3 curl unzip p7zip
apk add lua5.4-dev luajit-dev mbedtls-dev mbedtls-static zlib-dev
curl -fsSL https://xmake.io/shget.text | bash
source "$HOME/.xmake/profile"
git clone https://github.com/jbeder/yaml-cpp --depth=1
cd yaml-cpp
cmake -DCMAKE_BUILD_TYPE=Release -DYAML_CPP_BUILD_TESTS=OFF -DYAML_CPP_BUILD_TOOLS=OFF . > /dev/null
make install -j3 > /dev/null
cd ..
git clone https://github.com/ftk/quickjspp --depth=1
cd quickjspp
cmake -DCMAKE_BUILD_TYPE=Release .
make quickjs -j3 > /dev/null
install -d /usr/lib/quickjs/
install -m644 quickjs/libquickjs.a /usr/lib/quickjs/
install -d /usr/include/quickjs/
install -m644 quickjs/quickjs.h quickjs/quickjs-libc.h /usr/include/quickjs/
install -m644 quickjspp.hpp /usr/include/
cd ..
git clone https://github.com/PerMalmberg/libcron --depth=1
cd libcron
git submodule update --init
cmake -DCMAKE_BUILD_TYPE=Release .
make libcron install -j3
cd ..
git clone https://github.com/ToruNiina/toml11 --branch="v3.7.1" --depth=1
cd toml11
cmake -DCMAKE_CXX_STANDARD=11 .
make install -j4
cd ..
export PKG_CONFIG_PATH=/usr/lib64/pkgconfig
cmake -DCMAKE_BUILD_TYPE=Release .
make -j3
rm subconverter
# shellcheck disable=SC2046
g++ -o base/subconverter $(find CMakeFiles/subconverter.dir/src/ -name "*.o") -static -lpcre2-8 -lyaml-cpp -L/usr/lib64 -lcurl -lmbedtls -lmbedcrypto -lmbedx509 -lz -l:quickjs/libquickjs.a -llibcron -O3 -s
xmake f --root --static=true -m release
xmake --root subconverter
cp "$(find build -name subconverter -type f)" base/subconverter
python3 -m ensurepip
python3 -m pip install gitpython
+56 -50
View File
@@ -1,59 +1,65 @@
#!/bin/bash
set -xe
brew reinstall rapidjson zlib pcre2 pkgconfig
#git clone https://github.com/curl/curl --depth=1 --branch curl-7_88_1
#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
#cmake -DCMAKE_USE_SECTRANSP=ON -DHTTP_ONLY=ON -DBUILD_TESTING=OFF -DBUILD_SHARED_LIBS=OFF -DCMAKE_USE_LIBSSH2=OFF . > /dev/null
#make -j8 > /dev/null
#brew reinstall rapidjson zlib pcre2 pkgconfig
#
##git clone https://github.com/curl/curl --depth=1 --branch curl-7_88_1
##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
##cmake -DCMAKE_USE_SECTRANSP=ON -DHTTP_ONLY=ON -DBUILD_TESTING=OFF -DBUILD_SHARED_LIBS=OFF -DCMAKE_USE_LIBSSH2=OFF . > /dev/null
##make -j8 > /dev/null
##cd ..
#
#git clone https://github.com/jbeder/yaml-cpp --depth=1
#cd yaml-cpp
#cmake -DCMAKE_BUILD_TYPE=Release -DYAML_CPP_BUILD_TESTS=OFF -DYAML_CPP_BUILD_TOOLS=OFF . > /dev/null
#make install -j8 > /dev/null
#cd ..
#
#git clone https://github.com/ftk/quickjspp --depth=1
#cd quickjspp
#cmake -DCMAKE_BUILD_TYPE=Release .
#make quickjs -j8
#install -d /usr/local/lib/quickjs/
#install -m644 quickjs/libquickjs.a /usr/local/lib/quickjs/
#install -d /usr/local/include/quickjs/
#install -m644 quickjs/quickjs.h quickjs/quickjs-libc.h /usr/local/include/quickjs/
#install -m644 quickjspp.hpp /usr/local/include/
#cd ..
#
#git clone https://github.com/PerMalmberg/libcron --depth=1
#cd libcron
#git submodule update --init
#cmake -DCMAKE_BUILD_TYPE=Release .
#make libcron install -j8
#install -m644 libcron/out/Release/liblibcron.a /usr/local/lib/
#install -d /usr/local/include/libcron/
#install -m644 libcron/include/libcron/* /usr/local/include/libcron/
#install -d /usr/local/include/date/
#install -m644 libcron/externals/date/include/date/* /usr/local/include/date/
#cd ..
#
#git clone https://github.com/ToruNiina/toml11 --depth=1
#cd toml11
#cmake -DCMAKE_CXX_STANDARD=11 .
#make install -j4
#cd ..
#
#cp /usr/local/opt/zlib/lib/libz.a .
#cp /usr/local/lib/libpcre2-8.a .
#
#cmake -DCMAKE_BUILD_TYPE=Release .
#make -j8
#rm subconverter
## shellcheck disable=SC2046
#c++ -Xlinker -unexported_symbol -Xlinker "*" -o base/subconverter -framework CoreFoundation -framework Security $(find CMakeFiles/subconverter.dir/src/ -name "*.o") $(find . -name "*.a") -lcurl -O3
git clone https://github.com/jbeder/yaml-cpp --depth=1
cd yaml-cpp
cmake -DCMAKE_BUILD_TYPE=Release -DYAML_CPP_BUILD_TESTS=OFF -DYAML_CPP_BUILD_TOOLS=OFF . > /dev/null
make install -j8 > /dev/null
cd ..
brew reinstall xmake rapidjson pkgconfig
git clone https://github.com/ftk/quickjspp --depth=1
cd quickjspp
cmake -DCMAKE_BUILD_TYPE=Release .
make quickjs -j8
install -d /usr/local/lib/quickjs/
install -m644 quickjs/libquickjs.a /usr/local/lib/quickjs/
install -d /usr/local/include/quickjs/
install -m644 quickjs/quickjs.h quickjs/quickjs-libc.h /usr/local/include/quickjs/
install -m644 quickjspp.hpp /usr/local/include/
cd ..
git clone https://github.com/PerMalmberg/libcron --depth=1
cd libcron
git submodule update --init
cmake -DCMAKE_BUILD_TYPE=Release .
make libcron install -j8
install -m644 libcron/out/Release/liblibcron.a /usr/local/lib/
install -d /usr/local/include/libcron/
install -m644 libcron/include/libcron/* /usr/local/include/libcron/
install -d /usr/local/include/date/
install -m644 libcron/externals/date/include/date/* /usr/local/include/date/
cd ..
git clone https://github.com/ToruNiina/toml11 --depth=1
cd toml11
cmake -DCMAKE_CXX_STANDARD=11 .
make install -j4
cd ..
cp /usr/local/opt/zlib/lib/libz.a .
cp /usr/local/lib/libpcre2-8.a .
cmake -DCMAKE_BUILD_TYPE=Release .
make -j8
rm subconverter
# shellcheck disable=SC2046
c++ -Xlinker -unexported_symbol -Xlinker "*" -o base/subconverter -framework CoreFoundation -framework Security $(find CMakeFiles/subconverter.dir/src/ -name "*.o") $(find . -name "*.a") -lcurl -O3
xmake f --root -m release
xmake --root subconverter
cp "$(find build -name subconverter -type f)" base/subconverter
python -m ensurepip
python -m pip install gitpython
+55 -49
View File
@@ -1,57 +1,63 @@
#!/bin/bash
set -xe
#
#git clone https://github.com/curl/curl --depth=1 --branch curl-8_4_0
#cd curl
#cmake -DCMAKE_BUILD_TYPE=Release -DCURL_USE_LIBSSH2=OFF -DHTTP_ONLY=ON -DCURL_USE_SCHANNEL=ON -DBUILD_SHARED_LIBS=OFF -DBUILD_CURL_EXE=OFF -DCMAKE_INSTALL_PREFIX="$MINGW_PREFIX" -G "Unix Makefiles" -DHAVE_LIBIDN2=OFF -DCURL_USE_LIBPSL=OFF .
#make install -j4
#cd ..
#
#git clone https://github.com/jbeder/yaml-cpp --depth=1
#cd yaml-cpp
#cmake -DCMAKE_BUILD_TYPE=Release -DYAML_CPP_BUILD_TESTS=OFF -DYAML_CPP_BUILD_TOOLS=OFF -DCMAKE_INSTALL_PREFIX="$MINGW_PREFIX" -G "Unix Makefiles" .
#make install -j4
#cd ..
#
#git clone https://github.com/ftk/quickjspp --depth=1
#cd quickjspp
#patch quickjs/quickjs-libc.c -i ../scripts/patches/0001-quickjs-libc-add-realpath-for-Windows.patch
#cmake -G "Unix Makefiles" -DCMAKE_BUILD_TYPE=Release .
#make quickjs -j4
#install -d "$MINGW_PREFIX/lib/quickjs/"
#install -m644 quickjs/libquickjs.a "$MINGW_PREFIX/lib/quickjs/"
#install -d "$MINGW_PREFIX/include/quickjs"
#install -m644 quickjs/quickjs.h quickjs/quickjs-libc.h "$MINGW_PREFIX/include/quickjs/"
#install -m644 quickjspp.hpp "$MINGW_PREFIX/include/"
#cd ..
#
#git clone https://github.com/PerMalmberg/libcron --depth=1
#cd libcron
#git submodule update --init
#cmake -G "Unix Makefiles" -DCMAKE_BUILD_TYPE=Release -DCMAKE_INSTALL_PREFIX="$MINGW_PREFIX" .
#make libcron install -j4
#cd ..
#
#git clone https://github.com/Tencent/rapidjson --depth=1
#cd rapidjson
#cmake -DRAPIDJSON_BUILD_DOC=OFF -DRAPIDJSON_BUILD_EXAMPLES=OFF -DRAPIDJSON_BUILD_TESTS=OFF -DCMAKE_INSTALL_PREFIX="$MINGW_PREFIX" -G "Unix Makefiles" .
#make install -j4
#cd ..
#
#git clone https://github.com/ToruNiina/toml11 --depth=1
#cd toml11
#cmake -DCMAKE_INSTALL_PREFIX="$MINGW_PREFIX" -G "Unix Makefiles" -DCMAKE_CXX_STANDARD=11 .
#make install -j4
#cd ..
#
#rm -f C:/Strawberry/perl/bin/pkg-config C:/Strawberry/perl/bin/pkg-config.bat
#cmake -DCMAKE_BUILD_TYPE=Release -G "Unix Makefiles" .
#make -j4
#rm subconverter.exe
## shellcheck disable=SC2046
#g++ $(find CMakeFiles/subconverter.dir/src -name "*.obj") curl/lib/libcurl.a -o base/subconverter.exe -static -lbcrypt -lpcre2-8 -l:quickjs/libquickjs.a -llibcron -lyaml-cpp -liphlpapi -lcrypt32 -lws2_32 -lwsock32 -lz -s
git clone https://github.com/curl/curl --depth=1 --branch curl-8_4_0
cd curl
cmake -DCMAKE_BUILD_TYPE=Release -DCURL_USE_LIBSSH2=OFF -DHTTP_ONLY=ON -DCURL_USE_SCHANNEL=ON -DBUILD_SHARED_LIBS=OFF -DBUILD_CURL_EXE=OFF -DCMAKE_INSTALL_PREFIX="$MINGW_PREFIX" -G "Unix Makefiles" -DHAVE_LIBIDN2=OFF -DCURL_USE_LIBPSL=OFF .
make install -j4
cd ..
git clone https://github.com/jbeder/yaml-cpp --depth=1
cd yaml-cpp
cmake -DCMAKE_BUILD_TYPE=Release -DYAML_CPP_BUILD_TESTS=OFF -DYAML_CPP_BUILD_TOOLS=OFF -DCMAKE_INSTALL_PREFIX="$MINGW_PREFIX" -G "Unix Makefiles" .
make install -j4
cd ..
git clone https://github.com/ftk/quickjspp --depth=1
cd quickjspp
patch quickjs/quickjs-libc.c -i ../scripts/patches/0001-quickjs-libc-add-realpath-for-Windows.patch
cmake -G "Unix Makefiles" -DCMAKE_BUILD_TYPE=Release .
make quickjs -j4
install -d "$MINGW_PREFIX/lib/quickjs/"
install -m644 quickjs/libquickjs.a "$MINGW_PREFIX/lib/quickjs/"
install -d "$MINGW_PREFIX/include/quickjs"
install -m644 quickjs/quickjs.h quickjs/quickjs-libc.h "$MINGW_PREFIX/include/quickjs/"
install -m644 quickjspp.hpp "$MINGW_PREFIX/include/"
cd ..
git clone https://github.com/PerMalmberg/libcron --depth=1
cd libcron
git submodule update --init
cmake -G "Unix Makefiles" -DCMAKE_BUILD_TYPE=Release -DCMAKE_INSTALL_PREFIX="$MINGW_PREFIX" .
make libcron install -j4
cd ..
git clone https://github.com/Tencent/rapidjson --depth=1
cd rapidjson
cmake -DRAPIDJSON_BUILD_DOC=OFF -DRAPIDJSON_BUILD_EXAMPLES=OFF -DRAPIDJSON_BUILD_TESTS=OFF -DCMAKE_INSTALL_PREFIX="$MINGW_PREFIX" -G "Unix Makefiles" .
make install -j4
cd ..
git clone https://github.com/ToruNiina/toml11 --depth=1
cd toml11
cmake -DCMAKE_INSTALL_PREFIX="$MINGW_PREFIX" -G "Unix Makefiles" -DCMAKE_CXX_STANDARD=11 .
make install -j4
cd ..
xmake f --root --static=true -m release
xmake --root subconverter
cp "$(find build -name subconverter -type f)" base/subconverter
python -m ensurepip
python -m pip install gitpython
python scripts/update_rules.py -c scripts/rules_config.conf
rm -f C:/Strawberry/perl/bin/pkg-config C:/Strawberry/perl/bin/pkg-config.bat
cmake -DCMAKE_BUILD_TYPE=Release -G "Unix Makefiles" .
make -j4
rm subconverter.exe
# shellcheck disable=SC2046
g++ $(find CMakeFiles/subconverter.dir/src -name "*.obj") curl/lib/libcurl.a -o base/subconverter.exe -static -lbcrypt -lpcre2-8 -l:quickjs/libquickjs.a -llibcron -lyaml-cpp -liphlpapi -lcrypt32 -lws2_32 -lwsock32 -lz -s
mv base subconverter
set +xe