From 8ab27a39038c28a4fef2c3dbfa610987750c33bc Mon Sep 17 00:00:00 2001 From: laizenan Date: Sun, 24 Mar 2024 11:39:12 -0700 Subject: [PATCH] feat: update scripts for macos development --- .gitignore | 2 + CONTRIBUTING.md | 13 +++- scripts/build.macos.dev.sh | 73 +++++++++++++++++++ ...indows.release.sh => build.windows.dev.sh} | 0 4 files changed, 84 insertions(+), 4 deletions(-) create mode 100644 scripts/build.macos.dev.sh rename scripts/{dev.windows.release.sh => build.windows.dev.sh} (100%) diff --git a/.gitignore b/.gitignore index 0ee33ff2e..c0ed146dd 100644 --- a/.gitignore +++ b/.gitignore @@ -11,6 +11,8 @@ base/cache /cmake_install.cmake /tmp /subconverter +/base/subconverter +/*.a # Dependencies for development /curl diff --git a/CONTRIBUTING.md b/CONTRIBUTING.md index 4a85125f7..3434ec92c 100644 --- a/CONTRIBUTING.md +++ b/CONTRIBUTING.md @@ -36,7 +36,7 @@ pacman -S base-devel git mingw-w64-x86_64-gcc mingw-w64-x86_64-cmake mingw-w64-x 2. run script to initialize the project for development: ```shell -sh scripts/dev.windows.release.sh +sh scripts/build.windows.dev.sh ``` 3. debug the project with GDB: @@ -78,7 +78,7 @@ or use VSCode with the following configuration: make -j4 && cp subconverter.exe subconverter/subconverter.exe ``` -### Linux / macOS +### macOS 1. install the prerequisites: @@ -88,10 +88,15 @@ You should install all the following prequisites via your package manager. - patch - python -2. run the script to initialize the project for development: +for macos run +```shell +brew reinstall rapidjson zlib pcre2 pkgconfig +``` + +1. run the script to initialize the project for development: ```shell -sh scripts/build.macos.release.sh +sh scripts/build.macos.dev.sh ``` 3. run the executable for test: diff --git a/scripts/build.macos.dev.sh b/scripts/build.macos.dev.sh new file mode 100644 index 000000000..08782cec3 --- /dev/null +++ b/scripts/build.macos.dev.sh @@ -0,0 +1,73 @@ +#!/bin/bash +set -xe + +# remove all old deps +rm -rf curl libcron quickjspp rapidjson toml11 yaml-cpp +# remove tmp folder +rm -rf tmp + +# 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=Debug -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=Debug . +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=Debug . +make libcron install -j8 +install -m644 libcron/out/Debug/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=Debug . +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 + +python -m ensurepip +python -m pip install gitpython +python scripts/update_rules.py -c scripts/rules_config.conf + +cd base +chmod +rx subconverter +chmod +r ./* +cd .. +mv base subconverter + +set +xe diff --git a/scripts/dev.windows.release.sh b/scripts/build.windows.dev.sh similarity index 100% rename from scripts/dev.windows.release.sh rename to scripts/build.windows.dev.sh