mirror of
				https://github.com/asdlokj1qpi233/subconverter.git
				synced 2025-10-31 05:42:31 +00:00 
			
		
		
		
	Compare commits
	
		
			10 Commits
		
	
	
		
			xmake-test
			...
			v0.8.6
		
	
	| Author | SHA1 | Date | |
|---|---|---|---|
|  | 9f8067ab11 | ||
|  | 3938ebfce9 | ||
|  | 0b15d63ef4 | ||
|  | c9e074daf7 | ||
|  | 0409830b3f | ||
|  | 4563be3d45 | ||
|  | 615b3a404e | ||
|  | 6b29778351 | ||
|  | 3cc58f38dd | ||
|  | 81d9167840 | 
							
								
								
									
										7
									
								
								.github/workflows/build.yml
									
									
									
									
										vendored
									
									
								
							
							
						
						
									
										7
									
								
								.github/workflows/build.yml
									
									
									
									
										vendored
									
									
								
							| @@ -1,8 +1,7 @@ | ||||
| name: GitHub CI | ||||
| on:  | ||||
|   push: | ||||
|     branches: | ||||
|       - '**' | ||||
|     branches: [ master ] | ||||
|     tags: | ||||
|       - '**' | ||||
|   workflow_dispatch: | ||||
| @@ -158,7 +157,7 @@ jobs: | ||||
|     - uses: msys2/setup-msys2@v2 | ||||
|       with: | ||||
|         update: true | ||||
|         install: base-devel git mingw-w64-x86_64-gcc mingw-w64-x86_64-cmake mingw-w64-x86_64-pcre2 patch mingw-w64-x86_64-xmake | ||||
|         install: base-devel git mingw-w64-x86_64-gcc mingw-w64-x86_64-cmake mingw-w64-x86_64-pcre2 patch | ||||
|         msystem: MINGW64 | ||||
|         path-type: inherit | ||||
|     - name: Add commit id into version | ||||
| @@ -198,7 +197,7 @@ jobs: | ||||
|     - uses: msys2/setup-msys2@v2 | ||||
|       with: | ||||
|         update: true | ||||
|         install: base-devel git mingw-w64-i686-gcc mingw-w64-i686-cmake mingw-w64-i686-pcre2 patch mingw-w64-i686-xmake | ||||
|         install: base-devel git mingw-w64-i686-gcc mingw-w64-i686-cmake mingw-w64-i686-pcre2 patch | ||||
|         msystem: MINGW32 | ||||
|         path-type: inherit | ||||
|     - name: Add commit id into version | ||||
|   | ||||
							
								
								
									
										63
									
								
								.github/workflows/docker.yml
									
									
									
									
										vendored
									
									
								
							
							
						
						
									
										63
									
								
								.github/workflows/docker.yml
									
									
									
									
										vendored
									
									
								
							| @@ -1,8 +1,7 @@ | ||||
| name: Publish Docker Image | ||||
| on:  | ||||
|   push: | ||||
|     branches: | ||||
|       - '**' | ||||
|     branches: [ master ] | ||||
|     tags: | ||||
|       - '**' | ||||
|  | ||||
| @@ -35,13 +34,12 @@ jobs: | ||||
|  | ||||
|       - name: Build and export | ||||
|         id: build | ||||
|         if: startsWith(github.ref, 'refs/heads/') | ||||
|         if: github.ref == 'refs/heads/master' | ||||
|         uses: docker/build-push-action@v3 | ||||
|         with: | ||||
|           platforms: linux/amd64 | ||||
|           context: . | ||||
|           file: scripts/Dockerfile | ||||
|           tags: tindy2013/subconverter:latest | ||||
|           context: scripts/ | ||||
|           tags: asdlokj1qpi23/subconverter:latest | ||||
|           build-args: | | ||||
|             SHA=${{ steps.vars.outputs.sha_short }} | ||||
|           outputs: type=image,push=true | ||||
| @@ -61,13 +59,12 @@ jobs: | ||||
|         uses: docker/build-push-action@v3 | ||||
|         with: | ||||
|           platforms: linux/amd64 | ||||
|           context: . | ||||
|           file: scripts/Dockerfile | ||||
|           tags: tindy2013/subconverter:${{steps.version.outputs.result}} | ||||
|           context: scripts/ | ||||
|           tags: asdlokj1qpi23/subconverter:${{steps.version.outputs.result}} | ||||
|           outputs: type=image,push=true | ||||
|  | ||||
|       - name: Save digest | ||||
|         if: startsWith(github.ref, 'refs/heads/') | ||||
|         if: github.ref == 'refs/heads/master' | ||||
|         run: echo ${{ steps.build.outputs.digest }} > /tmp/digest.txt | ||||
|  | ||||
|       - name: Save release digest | ||||
| @@ -104,13 +101,12 @@ jobs: | ||||
|  | ||||
|       - name: Build and export | ||||
|         id: build | ||||
|         if: startsWith(github.ref, 'refs/heads/') | ||||
|         if: github.ref == 'refs/heads/master' | ||||
|         uses: docker/build-push-action@v3 | ||||
|         with: | ||||
|           platforms: linux/386 | ||||
|           context: . | ||||
|           file: scripts/Dockerfile | ||||
|           tags: tindy2013/subconverter:latest | ||||
|           context: scripts/ | ||||
|           tags: asdlokj1qpi23/subconverter:latest-x86 | ||||
|           build-args: | | ||||
|             SHA=${{ steps.vars.outputs.sha_short }} | ||||
|           outputs: type=image,push=true | ||||
| @@ -130,13 +126,12 @@ jobs: | ||||
|         uses: docker/build-push-action@v3 | ||||
|         with: | ||||
|           platforms: linux/386 | ||||
|           context: . | ||||
|           file: scripts/Dockerfile | ||||
|           tags: tindy2013/subconverter:${{steps.version.outputs.result}} | ||||
|           context: scripts/ | ||||
|           tags: asdlokj1qpi23/subconverter:${{steps.version.outputs.result}}-x86 | ||||
|           outputs: type=image,push=true | ||||
|  | ||||
|       - name: Save digest | ||||
|         if: startsWith(github.ref, 'refs/heads/') | ||||
|         if: github.ref == 'refs/heads/master' | ||||
|         run: echo ${{ steps.build.outputs.digest }} > /tmp/digest.txt | ||||
|  | ||||
|       - name: Save release digest | ||||
| @@ -173,13 +168,12 @@ jobs: | ||||
|  | ||||
|       - name: Build and export | ||||
|         id: build | ||||
|         if: startsWith(github.ref, 'refs/heads/') | ||||
|         if: github.ref == 'refs/heads/master' | ||||
|         uses: docker/build-push-action@v3 | ||||
|         with: | ||||
|           platforms: linux/arm/v7 | ||||
|           context: . | ||||
|           file: scripts/Dockerfile | ||||
|           tags: tindy2013/subconverter:latest | ||||
|           context: scripts/ | ||||
|           tags: asdlokj1qpi23/subconverter:latest-armv7 | ||||
|           build-args: | | ||||
|             SHA=${{ steps.vars.outputs.sha_short }} | ||||
|             THREADS=4 | ||||
| @@ -200,15 +194,14 @@ jobs: | ||||
|         uses: docker/build-push-action@v3 | ||||
|         with: | ||||
|           platforms: linux/arm/v7 | ||||
|           context: . | ||||
|           file: scripts/Dockerfile | ||||
|           tags: tindy2013/subconverter:${{steps.version.outputs.result}} | ||||
|           context: scripts/ | ||||
|           tags: asdlokj1qpi23/subconverter:${{steps.version.outputs.result}}-armv7 | ||||
|           build-args: | | ||||
|             THREADS=4 | ||||
|           outputs: type=image,push=true | ||||
|  | ||||
|       - name: Save digest | ||||
|         if: startsWith(github.ref, 'refs/heads/') | ||||
|         if: github.ref == 'refs/heads/master' | ||||
|         run: echo ${{ steps.build.outputs.digest }} > /tmp/digest.txt | ||||
|  | ||||
|       - name: Save release digest | ||||
| @@ -245,13 +238,12 @@ jobs: | ||||
|  | ||||
|       - name: Build and export | ||||
|         id: build | ||||
|         if: startsWith(github.ref, 'refs/heads/') | ||||
|         if: github.ref == 'refs/heads/master' | ||||
|         uses: docker/build-push-action@v3 | ||||
|         with: | ||||
|           platforms: linux/arm64 | ||||
|           context: . | ||||
|           file: scripts/Dockerfile | ||||
|           tags: tindy2013/subconverter:latest | ||||
|           context: scripts/ | ||||
|           tags: asdlokj1qpi23/subconverter:latest-arm64 | ||||
|           build-args: | | ||||
|             SHA=${{ steps.vars.outputs.sha_short }} | ||||
|             THREADS=4 | ||||
| @@ -272,15 +264,14 @@ jobs: | ||||
|         uses: docker/build-push-action@v3 | ||||
|         with: | ||||
|           platforms: linux/arm64 | ||||
|           context: . | ||||
|           file: scripts/Dockerfile | ||||
|           tags: tindy2013/subconverter:${{steps.version.outputs.result}} | ||||
|           context: scripts/ | ||||
|           tags: asdlokj1qpi23/subconverter:${{steps.version.outputs.result}}-arm64 | ||||
|           build-args: | | ||||
|             THREADS=4 | ||||
|           outputs: type=image,push=true | ||||
|  | ||||
|       - name: Save digest | ||||
|         if: startsWith(github.ref, 'refs/heads/') | ||||
|         if: github.ref == 'refs/heads/master' | ||||
|         run: echo ${{ steps.build.outputs.digest }} > /tmp/digest.txt | ||||
|  | ||||
|       - name: Save release digest | ||||
| @@ -335,8 +326,8 @@ jobs: | ||||
|             return context.payload.ref.replace(/\/?refs\/tags\/v/, '') | ||||
|           result-encoding: string | ||||
|  | ||||
|       - name: Merge and push manifest on push | ||||
|         if: startsWith(github.ref, 'refs/heads/') | ||||
|       - name: Merge and push manifest on master branch | ||||
|         if: github.ref == 'refs/heads/master' | ||||
|         run: python scripts/merge_manifest.py | ||||
|  | ||||
|       - name: Merge and push manifest on release | ||||
|   | ||||
							
								
								
									
										4
									
								
								.gitignore
									
									
									
									
										vendored
									
									
								
							
							
						
						
									
										4
									
								
								.gitignore
									
									
									
									
										vendored
									
									
								
							| @@ -1,7 +1,5 @@ | ||||
| subconverter.exe | ||||
| .vscode | ||||
| cmake-build-* | ||||
| cmake-build-debug | ||||
| .idea | ||||
| base/cache | ||||
| build | ||||
| .xmake | ||||
|   | ||||
							
								
								
									
										36
									
								
								README.md
									
									
									
									
									
								
							
							
						
						
									
										36
									
								
								README.md
									
									
									
									
									
								
							| @@ -21,24 +21,24 @@ Utility to convert between various proxy subscription formats. | ||||
|  | ||||
| ## Supported Types | ||||
|  | ||||
| | Type         | As Source  | As Target    | Target Name | | ||||
| | ------------ | :--------: | :----------: | ----------- | | ||||
| | Clash        |     ✓      |      ✓       | clash       | | ||||
| | ClashR       |     ✓      |      ✓       | clashr      | | ||||
| | Quantumult   |     ✓      |      ✓       | quan        | | ||||
| | Quantumult X |     ✓      |      ✓       | quanx       | | ||||
| | Loon         |     ✓      |      ✓       | loon        | | ||||
| | SS (SIP002)  |     ✓      |      ✓       | ss          | | ||||
| | SS Android   |     ✓      |      ✓       | sssub       | | ||||
| | SSD          |     ✓      |      ✓       | ssd         | | ||||
| | SSR          |     ✓      |      ✓       | ssr         | | ||||
| | Surfboard    |     ✓      |      ✓       | surfboard   | | ||||
| | Surge 2      |     ✓      |      ✓       | surge&ver=2 | | ||||
| | Surge 3      |     ✓      |      ✓       | surge&ver=3 | | ||||
| | Surge 4      |     ✓      |      ✓       | surge&ver=4 | | ||||
| | V2Ray        |     ✓      |      ✓       | v2ray       | | ||||
| | Telegram-liked HTTP/Socks 5 links |     ✓      |      ×       | Only as source | | ||||
|  | ||||
| | Type                              | As Source | As Target    | Target Name    | | ||||
| |-----------------------------------|:---------:| :----------: |----------------| | ||||
| | Clash                             |     ✓     |      ✓       | clash          | | ||||
| | ClashR                            |     ✓     |      ✓       | clashr         | | ||||
| | Quantumult                        |     ✓     |      ✓       | quan           | | ||||
| | Quantumult X                      |     ✓     |      ✓       | quanx          | | ||||
| | Loon                              |     ✓     |      ✓       | loon           | | ||||
| | SS (SIP002)                       |     ✓     |      ✓       | ss             | | ||||
| | SS Android                        |     ✓     |      ✓       | sssub          | | ||||
| | SSD                               |     ✓     |      ✓       | ssd            | | ||||
| | SSR                               |     ✓     |      ✓       | ssr            | | ||||
| | Surfboard                         |     ✓     |      ✓       | surfboard      | | ||||
| | Surge 2                           |     ✓     |      ✓       | surge&ver=2    | | ||||
| | Surge 3                           |     ✓     |      ✓       | surge&ver=3    | | ||||
| | Surge 4                           |     ✓     |      ✓       | surge&ver=4    | | ||||
| | V2Ray                             |     ✓     |      ✓       | v2ray          | | ||||
| | Telegram-liked HTTP/Socks 5 links |     ✓     |      ×       | Only as source | | ||||
| | Singbox                           |     ×      |      ✓       | singbox        | | ||||
| Notice: | ||||
|  | ||||
| 1. Shadowrocket users should use `ss`, `ssr` or `v2ray` as target. | ||||
|   | ||||
| @@ -5,7 +5,7 @@ | ||||
| ;For more available options, please check the readme section | ||||
|  | ||||
| target=clash | ||||
| url=ss://Y2hhY2hhMjAtaWV0Zi1wb2x5MTMwNTpwYXNzd29yZA@www.example.com:1080#Example | ||||
| url=trojan://65474277@sqcu.hostmsu.ru:55551?allowinsecure=0&peer=mza.hkfq.xyz&mux=1&ws=0&wspath=&wshost=&ss=0&ssmethod=aes-128-gcm&sspasswd=&group=#%E9%A6%99%E6%B8%AFCN2-MZA%E8%8A%82%E7%82%B9-%E5%AE%BF%E8%BF%81%E8%81%94%E9%80%9A%E4%B8%AD%E8%BD%AC | ||||
| ;config=config/example_external_config.ini | ||||
| ;ver=3 | ||||
| ;udp=true | ||||
|   | ||||
| @@ -4,52 +4,45 @@ ARG THREADS="4" | ||||
| ARG SHA="" | ||||
|  | ||||
| # build minimized | ||||
| WORKDIR /subconverter | ||||
| COPY . /subconverter/ | ||||
| WORKDIR / | ||||
| RUN set -xe && \ | ||||
|     apk add --no-cache --virtual .build-tools git g++ build-base linux-headers cmake python3 curl unzip p7zip bash && \ | ||||
|     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 && \ | ||||
|     ls -alh && \ | ||||
|     source "$HOME/.xmake/profile" && \ | ||||
|     xmake f --root --static=false -m release -y -v && \ | ||||
|     xmake --root -v subconverter && \ | ||||
|     cp "$(find build -type f -name subconverter)" . && \ | ||||
|     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/asdlokj1qpi23/subconverter --depth=1 && \ | ||||
|     cd subconverter && \ | ||||
|     [ -n "$SHA" ] && sed -i 's/\(v[0-9]\.[0-9]\.[0-9]\)/\1-'"$SHA"'/' src/version.h;\ | ||||
|     python3 -m ensurepip && \ | ||||
|     python3 -m pip install gitpython && \ | ||||
|     python3 scripts/update_rules.py -c scripts/rules_config.conf | ||||
|     python3 scripts/update_rules.py -c scripts/rules_config.conf && \ | ||||
|     cmake -DCMAKE_BUILD_TYPE=Release . && \ | ||||
|     make -j $THREADS | ||||
|  | ||||
| # build final image | ||||
| FROM alpine:3.16 | ||||
|   | ||||
| @@ -1,60 +1,51 @@ | ||||
| #!/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 | ||||
| # | ||||
| #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 | ||||
| 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 git g++ build-base linux-headers cmake python3 curl unzip p7zip perl pkgconfig | ||||
| apk add lua5.4-dev luajit-dev zlib-dev zlib-static mbedtls-dev mbedtls-static | ||||
| curl -fsSL https://xmake.io/shget.text | bash | ||||
| source "$HOME/.xmake/profile" | ||||
| 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 .. | ||||
|  | ||||
| xmake f --root --static=true -m release -y -v | ||||
| xmake --root -v subconverter | ||||
| cp "$(find build -name subconverter -type f)" base/subconverter | ||||
| 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 | ||||
|  | ||||
| python3 -m ensurepip | ||||
| python3 -m pip install gitpython | ||||
|   | ||||
| @@ -1,65 +1,59 @@ | ||||
| #!/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 | ||||
| ##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 | ||||
| brew reinstall rapidjson zlib pcre2 pkgconfig | ||||
|  | ||||
| brew reinstall xmake rapidjson 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 .. | ||||
|  | ||||
| xmake f --root -m release -y -v | ||||
| xmake --root -v subconverter | ||||
| cp "$(find build -name subconverter -type f)" base/subconverter | ||||
| 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 | ||||
|  | ||||
| python -m ensurepip | ||||
| python -m pip install gitpython | ||||
|   | ||||
| @@ -1,63 +1,57 @@ | ||||
| #!/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 | ||||
|  | ||||
| xmake f --root --static=true -m release -y -v | ||||
| xmake --root -v subconverter | ||||
| cp "$(find build -name subconverter.exe -type f)" base/subconverter.exe | ||||
| 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 .. | ||||
|  | ||||
| python -m ensurepip | ||||
| python -m pip install gitpython | ||||
| python scripts/update_rules.py -c scripts/rules_config.conf | ||||
| mv base subconverter | ||||
|  | ||||
| set +xe | ||||
| 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 | ||||
|   | ||||
| @@ -1,7 +1,7 @@ | ||||
| import glob | ||||
| import os, sys | ||||
|  | ||||
| MAIN_IMAGE_NAME="tindy2013/subconverter" | ||||
| MAIN_IMAGE_NAME="asdlokj1qpi23/subconverter" | ||||
| TARGET_TAG="latest" if len(sys.argv) < 2 else sys.argv[1] | ||||
|  | ||||
| args=["docker manifest create {}:{}".format(MAIN_IMAGE_NAME, TARGET_TAG)] | ||||
|   | ||||
| @@ -1,5 +1,6 @@ | ||||
| #include <string> | ||||
| #include <vector> | ||||
| #include <iostream> | ||||
| #include <algorithm> | ||||
|  | ||||
| #include "handler/settings.h" | ||||
| @@ -17,6 +18,10 @@ | ||||
| #include "nodemanip.h" | ||||
| #include "subexport.h" | ||||
|  | ||||
| extern Settings global; | ||||
|  | ||||
| bool applyMatcher(const std::string &rule, std::string &real_rule, const Proxy &node); | ||||
|  | ||||
| int explodeConf(const std::string &filepath, std::vector<Proxy> &nodes) | ||||
| { | ||||
|     return explodeConfContent(fileGet(filepath), nodes); | ||||
| @@ -46,14 +51,13 @@ int addNodes(std::string link, std::vector<Proxy> &allNodes, int groupID, parse_ | ||||
|     link = replaceAllDistinct(link, "\"", ""); | ||||
|  | ||||
|     /// script:filepath,arg1,arg2,... | ||||
| #ifndef NO_JS_RUNTIME | ||||
|     if(authorized) script_safe_runner(parse_set.js_runtime, parse_set.js_context, [&](qjs::Context &ctx) | ||||
|     { | ||||
|         if(startsWith(link, "script:")) /// process subscription with script | ||||
|         { | ||||
|             writeLog(0, "Found script link. Start running...", LOG_LEVEL_INFO); | ||||
|             string_array args = split(link.substr(7), ","); | ||||
|             if(!args.empty()) | ||||
|             if(args.size() >= 1) | ||||
|             { | ||||
|                 std::string script = fileGet(args[0], false); | ||||
|                 try | ||||
| @@ -78,7 +82,7 @@ int addNodes(std::string link, std::vector<Proxy> &allNodes, int groupID, parse_ | ||||
|                         } | ||||
|                     } | ||||
|                 } | ||||
|                 catch(qjs::exception&) | ||||
|                 catch(qjs::exception) | ||||
|                 { | ||||
|                     script_print_stack(ctx); | ||||
|                 } | ||||
| @@ -100,13 +104,12 @@ int addNodes(std::string link, std::vector<Proxy> &allNodes, int groupID, parse_ | ||||
|                 duk_pop(ctx); /// pop err | ||||
|             } | ||||
|             */ | ||||
| #endif | ||||
|  | ||||
|     /// tag:group_name,link | ||||
|     if(startsWith(link, "tag:")) | ||||
|     { | ||||
|         string_size pos = link.find(','); | ||||
|         if(pos != std::string::npos) | ||||
|         string_size pos = link.find(","); | ||||
|         if(pos != link.npos) | ||||
|         { | ||||
|             custom_group = link.substr(4, pos - 4); | ||||
|             link.erase(0, pos + 1); | ||||
| @@ -175,7 +178,7 @@ int addNodes(std::string link, std::vector<Proxy> &allNodes, int groupID, parse_ | ||||
|             for(Proxy &x : nodes) | ||||
|             { | ||||
|                 x.GroupId = groupID; | ||||
|                 if(!custom_group.empty()) | ||||
|                 if(custom_group.size()) | ||||
|                     x.Group = custom_group; | ||||
|             } | ||||
|             copyNodes(nodes, allNodes); | ||||
| @@ -229,7 +232,7 @@ int addNodes(std::string link, std::vector<Proxy> &allNodes, int groupID, parse_ | ||||
|  | ||||
| bool chkIgnore(const Proxy &node, string_array &exclude_remarks, string_array &include_remarks) | ||||
| { | ||||
|     bool excluded, included; | ||||
|     bool excluded = false, included = false; | ||||
|     //std::string remarks = UTF8ToACP(node.remarks); | ||||
|     //std::string remarks = node.remarks; | ||||
|     //writeLog(LOG_TYPE_INFO, "Comparing exclude remarks..."); | ||||
| @@ -244,7 +247,7 @@ bool chkIgnore(const Proxy &node, string_array &exclude_remarks, string_array &i | ||||
|         else | ||||
|             return false; | ||||
|     }); | ||||
|     if(!include_remarks.empty()) | ||||
|     if(include_remarks.size() != 0) | ||||
|     { | ||||
|         //writeLog(LOG_TYPE_INFO, "Comparing include remarks..."); | ||||
|         included = std::any_of(include_remarks.cbegin(), include_remarks.cend(), [&node](const auto &x) | ||||
| @@ -270,7 +273,7 @@ bool chkIgnore(const Proxy &node, string_array &exclude_remarks, string_array &i | ||||
| void filterNodes(std::vector<Proxy> &nodes, string_array &exclude_remarks, string_array &include_remarks, int groupID) | ||||
| { | ||||
|     int node_index = 0; | ||||
|     auto iter = nodes.begin(); | ||||
|     std::vector<Proxy>::iterator iter = nodes.begin(); | ||||
|     while(iter != nodes.end()) | ||||
|     { | ||||
|         if(chkIgnore(*iter, exclude_remarks, include_remarks)) | ||||
| @@ -377,7 +380,6 @@ void nodeRename(Proxy &node, const RegexMatchConfigs &rename_array, extra_settin | ||||
|  | ||||
|     for(const RegexMatchConfig &x : rename_array) | ||||
|     { | ||||
| #ifndef NO_JS_RUNTIME | ||||
|         if(!x.Script.empty() && ext.authorized) | ||||
|         { | ||||
|             script_safe_runner(ext.js_runtime, ext.js_context, [&](qjs::Context &ctx) | ||||
| @@ -393,19 +395,19 @@ void nodeRename(Proxy &node, const RegexMatchConfigs &rename_array, extra_settin | ||||
|                     if(!returned_remark.empty()) | ||||
|                         remark = returned_remark; | ||||
|                 } | ||||
|                 catch (qjs::exception&) | ||||
|                 catch (qjs::exception) | ||||
|                 { | ||||
|                     script_print_stack(ctx); | ||||
|                 } | ||||
|             }, global.scriptCleanContext); | ||||
|             continue; | ||||
|         } | ||||
| #endif | ||||
|         if(applyMatcher(x.Match, real_rule, node) && !real_rule.empty()) | ||||
|         if(applyMatcher(x.Match, real_rule, node) && real_rule.size()) | ||||
|             remark = regReplace(remark, real_rule, x.Replace); | ||||
|     } | ||||
|     if(remark.empty()) | ||||
|         remark = original_remark; | ||||
|     return; | ||||
| } | ||||
|  | ||||
| std::string removeEmoji(const std::string &orig_remark) | ||||
| @@ -430,7 +432,6 @@ std::string addEmoji(const Proxy &node, const RegexMatchConfigs &emoji_array, ex | ||||
|  | ||||
|     for(const RegexMatchConfig &x : emoji_array) | ||||
|     { | ||||
| #ifndef NO_JS_RUNTIME | ||||
|         if(!x.Script.empty() && ext.authorized) | ||||
|         { | ||||
|             std::string result; | ||||
| @@ -447,7 +448,7 @@ std::string addEmoji(const Proxy &node, const RegexMatchConfigs &emoji_array, ex | ||||
|                     if(!ret.empty()) | ||||
|                         result = ret + " " + node.Remark; | ||||
|                 } | ||||
|                 catch (qjs::exception&) | ||||
|                 catch (qjs::exception) | ||||
|                 { | ||||
|                     script_print_stack(ctx); | ||||
|                 } | ||||
| @@ -456,10 +457,9 @@ std::string addEmoji(const Proxy &node, const RegexMatchConfigs &emoji_array, ex | ||||
|                 return result; | ||||
|             continue; | ||||
|         } | ||||
| #endif | ||||
|         if(x.Replace.empty()) | ||||
|             continue; | ||||
|         if(applyMatcher(x.Match, real_rule, node) && !real_rule.empty() && regFind(node.Remark, real_rule)) | ||||
|         if(applyMatcher(x.Match, real_rule, node) && real_rule.size() && regFind(node.Remark, real_rule)) | ||||
|             return x.Replace + " " + node.Remark; | ||||
|     } | ||||
|     return node.Remark; | ||||
| @@ -481,8 +481,7 @@ void preprocessNodes(std::vector<Proxy> &nodes, extra_settings &ext) | ||||
|     if(ext.sort_flag) | ||||
|     { | ||||
|         bool failed = true; | ||||
| #ifndef NO_JS_RUNTIME | ||||
|         if(!ext.sort_script.empty() && ext.authorized) | ||||
|         if(ext.sort_script.size() && ext.authorized) | ||||
|         { | ||||
|             std::string script = ext.sort_script; | ||||
|             if(startsWith(script, "path:")) | ||||
| @@ -504,13 +503,12 @@ void preprocessNodes(std::vector<Proxy> &nodes, extra_settings &ext) | ||||
|                     std::stable_sort(nodes.begin(), nodes.end(), comparer); | ||||
|                     failed = false; | ||||
|                 } | ||||
|                 catch(qjs::exception&) | ||||
|                 catch(qjs::exception) | ||||
|                 { | ||||
|                     script_print_stack(ctx); | ||||
|                 } | ||||
|             }, global.scriptCleanContext); | ||||
|         } | ||||
| #endif | ||||
|         if(failed) std::stable_sort(nodes.begin(), nodes.end(), [](const Proxy &a, const Proxy &b) | ||||
|         { | ||||
|             return a.Remark < b.Remark; | ||||
|   | ||||
										
											
												File diff suppressed because it is too large
												Load Diff
											
										
									
								
							| @@ -34,6 +34,7 @@ struct extra_settings | ||||
|     std::string quanx_dev_id; | ||||
|     tribool udp = tribool(); | ||||
|     tribool tfo = tribool(); | ||||
|     tribool xudp = tribool(); | ||||
|     tribool skip_cert_verify = tribool(); | ||||
|     tribool tls13 = tribool(); | ||||
|     bool clash_classical_ruleset = false; | ||||
| @@ -71,5 +72,5 @@ std::string proxyToQuan(std::vector<Proxy> &nodes, const std::string &base_conf, | ||||
| void proxyToQuan(std::vector<Proxy> &nodes, INIReader &ini, std::vector<RulesetContent> &ruleset_content_array, const ProxyGroupConfigs &extra_proxy_group, extra_settings &ext); | ||||
| std::string proxyToSSD(std::vector<Proxy> &nodes, std::string &group, std::string &userinfo, extra_settings &ext); | ||||
| std::string proxyToSingBox(std::vector<Proxy> &nodes, const std::string &base_conf, std::vector<RulesetContent> &ruleset_content_array, const ProxyGroupConfigs &extra_proxy_group, extra_settings &ext); | ||||
|  | ||||
| #endif // SUBEXPORT_H_INCLUDED | ||||
| void replaceAll(std::string& input, const std::string& search, const std::string& replace); | ||||
| #endif // SUBEXPORT_H_INCLUDED | ||||
| @@ -9,8 +9,7 @@ | ||||
| using String = std::string; | ||||
| using StringArray = std::vector<String>; | ||||
|  | ||||
| enum class ProxyType | ||||
| { | ||||
| enum class ProxyType { | ||||
|     Unknown, | ||||
|     Shadowsocks, | ||||
|     ShadowsocksR, | ||||
| @@ -20,36 +19,44 @@ enum class ProxyType | ||||
|     HTTP, | ||||
|     HTTPS, | ||||
|     SOCKS5, | ||||
|     WireGuard | ||||
|     WireGuard, | ||||
|     VLESS, | ||||
|     Hysteria, | ||||
|     Hysteria2 | ||||
| }; | ||||
|  | ||||
| inline String getProxyTypeName(ProxyType type) | ||||
| { | ||||
|     switch(type) | ||||
|     { | ||||
|     case ProxyType::Shadowsocks: | ||||
|         return "SS"; | ||||
|     case ProxyType::ShadowsocksR: | ||||
|         return "SSR"; | ||||
|     case ProxyType::VMess: | ||||
|         return "VMess"; | ||||
|     case ProxyType::Trojan: | ||||
|         return "Trojan"; | ||||
|     case ProxyType::Snell: | ||||
|         return "Snell"; | ||||
|     case ProxyType::HTTP: | ||||
|         return "HTTP"; | ||||
|     case ProxyType::HTTPS: | ||||
|         return "HTTPS"; | ||||
|     case ProxyType::SOCKS5: | ||||
|         return "SOCKS5"; | ||||
|     default: | ||||
|         return "Unknown"; | ||||
| inline String getProxyTypeName(ProxyType type) { | ||||
|     switch (type) { | ||||
|         case ProxyType::Shadowsocks: | ||||
|             return "SS"; | ||||
|         case ProxyType::ShadowsocksR: | ||||
|             return "SSR"; | ||||
|         case ProxyType::VMess: | ||||
|             return "VMess"; | ||||
|         case ProxyType::Trojan: | ||||
|             return "Trojan"; | ||||
|         case ProxyType::Snell: | ||||
|             return "Snell"; | ||||
|         case ProxyType::HTTP: | ||||
|             return "HTTP"; | ||||
|         case ProxyType::HTTPS: | ||||
|             return "HTTPS"; | ||||
|         case ProxyType::SOCKS5: | ||||
|             return "SOCKS5"; | ||||
|         case ProxyType::WireGuard: | ||||
|             return "WireGuard"; | ||||
|         case ProxyType::VLESS: | ||||
|             return "Vless"; | ||||
|         case ProxyType::Hysteria: | ||||
|             return "Hysteria"; | ||||
|         case ProxyType::Hysteria2: | ||||
|             return "Hysteria2"; | ||||
|         default: | ||||
|             return "Unknown"; | ||||
|     } | ||||
| } | ||||
|  | ||||
| struct Proxy | ||||
| { | ||||
| struct Proxy { | ||||
|     ProxyType Type = ProxyType::Unknown; | ||||
|     uint32_t Id = 0; | ||||
|     uint32_t GroupId = 0; | ||||
| @@ -81,6 +88,7 @@ struct Proxy | ||||
|     String QUICSecret; | ||||
|  | ||||
|     tribool UDP; | ||||
|     tribool XUDP; | ||||
|     tribool TCPFastOpen; | ||||
|     tribool AllowInsecure; | ||||
|     tribool TLS13; | ||||
| @@ -99,6 +107,19 @@ struct Proxy | ||||
|     uint16_t KeepAlive = 0; | ||||
|     String TestUrl; | ||||
|     String ClientId; | ||||
|  | ||||
|     String Auth; | ||||
|     String Alpn; | ||||
|     String UpMbps; | ||||
|     String DownMbps; | ||||
|     String Insecure; | ||||
|     String Fingerprint; | ||||
|     String OBFSPassword; | ||||
|     String GRPCServiceName; | ||||
|     String GRPCMode; | ||||
|     String ShortId; | ||||
|     String Flow; | ||||
|     bool FlowShow = false; | ||||
| }; | ||||
|  | ||||
| #define SS_DEFAULT_GROUP "SSProvider" | ||||
| @@ -109,5 +130,8 @@ struct Proxy | ||||
| #define TROJAN_DEFAULT_GROUP "TrojanProvider" | ||||
| #define SNELL_DEFAULT_GROUP "SnellProvider" | ||||
| #define WG_DEFAULT_GROUP "WireGuardProvider" | ||||
| #define XRAY_DEFAULT_GROUP "XRayProvider" | ||||
| #define HYSTERIA_DEFAULT_GROUP "HysteriaProvider" | ||||
| #define HYSTERIA2_DEFAULT_GROUP "Hysteria2Provider" | ||||
|  | ||||
| #endif // PROXY_H_INCLUDED | ||||
|   | ||||
										
											
												File diff suppressed because it is too large
												Load Diff
											
										
									
								
							| @@ -19,13 +19,15 @@ enum class ConfType | ||||
|     SUB, | ||||
|     Local | ||||
| }; | ||||
|  | ||||
| void hysteriaConstruct(Proxy &node, const std::string &group, const std::string &remarks, const std::string &add, const std::string &port, const std::string &type, const std::string &auth, const std::string &host, const std::string &up, const std::string &down, const std::string &alpn, const std::string &obfsParam, const std::string &insecure ,tribool udp = tribool(), tribool tfo = tribool(), tribool scv = tribool(), tribool tls13 = tribool()); | ||||
| void hysteria2Construct(Proxy &node, const std::string &group, const std::string &remarks, const std::string &add, const std::string &port, const std::string &password, const std::string &host, const std::string &up, const std::string &down, const std::string &alpn, const std::string &obfsParam, const std::string &obfsPassword, const std::string &insecure ,tribool udp = tribool(), tribool tfo = tribool(), tribool scv = tribool(), tribool tls13 = tribool()); | ||||
| void vlessConstruct(Proxy &node, const std::string &group, const std::string &remarks, const std::string &add, const std::string &port, const std::string &type, const std::string &id, const std::string &aid, const std::string &net, const std::string &cipher, const std::string &flow, const std::string &mode, const std::string &path, const std::string &host, const std::string &edge, const std::string &tls,const std::string &pkd, const std::string &sid, const std::string &fp, tribool udp = tribool(), tribool tfo = tribool(), tribool scv = tribool(), tribool tls13 = tribool()); | ||||
| void vmessConstruct(Proxy &node, const std::string &group, const std::string &remarks, const std::string &add, const std::string &port, const std::string &type, const std::string &id, const std::string &aid, const std::string &net, const std::string &cipher, const std::string &path, const std::string &host, const std::string &edge, const std::string &tls, const std::string &sni, tribool udp = tribool(), tribool tfo = tribool(), tribool scv = tribool(), tribool tls13 = tribool()); | ||||
| void ssrConstruct(Proxy &node, const std::string &group, const std::string &remarks, const std::string &server, const std::string &port, const std::string &protocol, const std::string &method, const std::string &obfs, const std::string &password, const std::string &obfsparam, const std::string &protoparam, tribool udp = tribool(), tribool tfo = tribool(), tribool scv = tribool()); | ||||
| void ssConstruct(Proxy &node, const std::string &group, const std::string &remarks, const std::string &server, const std::string &port, const std::string &password, const std::string &method, const std::string &plugin, const std::string &pluginopts, tribool udp = tribool(), tribool tfo = tribool(), tribool scv = tribool(), tribool tls13 = tribool()); | ||||
| void socksConstruct(Proxy &node, const std::string &group, const std::string &remarks, const std::string &server, const std::string &port, const std::string &username, const std::string &password, tribool udp = tribool(), tribool tfo = tribool(), tribool scv = tribool()); | ||||
| void httpConstruct(Proxy &node, const std::string &group, const std::string &remarks, const std::string &server, const std::string &port, const std::string &username, const std::string &password, bool tls, tribool tfo = tribool(), tribool scv = tribool(), tribool tls13 = tribool()); | ||||
| void trojanConstruct(Proxy &node, const std::string &group, const std::string &remarks, const std::string &server, const std::string &port, const std::string &password, const std::string &network, const std::string &host, const std::string &path, bool tlssecure, tribool udp = tribool(), tribool tfo = tribool(), tribool scv = tribool(), tribool tls13 = tribool()); | ||||
| void trojanConstruct(Proxy &node, const std::string &group, const std::string &remarks, const std::string &server, const std::string &port, const std::string &password, const std::string &network, const std::string &host, const std::string &path,const std::string &fp, bool tlssecure, tribool udp = tribool(), tribool tfo = tribool(), tribool scv = tribool(),  tribool tls13 = tribool()); | ||||
| void snellConstruct(Proxy &node, const std::string &group, const std::string &remarks, const std::string &server, const std::string &port, const std::string &password, const std::string &obfs, const std::string &host, uint16_t version = 0, tribool udp = tribool(), tribool tfo = tribool(), tribool scv = tribool()); | ||||
| void explodeVmess(std::string vmess, Proxy &node); | ||||
| void explodeSSR(std::string ssr, Proxy &node); | ||||
| @@ -33,8 +35,15 @@ void explodeSS(std::string ss, Proxy &node); | ||||
| void explodeTrojan(std::string trojan, Proxy &node); | ||||
| void explodeQuan(const std::string &quan, Proxy &node); | ||||
| void explodeStdVMess(std::string vmess, Proxy &node); | ||||
| void explodeStdVless(std::string vless, Proxy &node); | ||||
| void explodeStdHysteria(std::string hysteria, Proxy &node); | ||||
| void explodeStdHysteria2(std::string hysteria2, Proxy &node); | ||||
| void explodeShadowrocket(std::string kit, Proxy &node); | ||||
| void explodeKitsunebi(std::string kit, Proxy &node); | ||||
| void explodeVless(std::string vless, Proxy &node); | ||||
| void explodeHysteria(std::string hysteria, Proxy &node); | ||||
| void explodeHysteria2(std::string hysteria2, Proxy &node); | ||||
|  | ||||
| /// Parse a link | ||||
| void explode(const std::string &link, Proxy &node); | ||||
| void explodeSSD(std::string link, std::vector<Proxy> &nodes); | ||||
|   | ||||
| @@ -1,6 +1,6 @@ | ||||
| #ifndef VERSION_H_INCLUDED | ||||
| #define VERSION_H_INCLUDED | ||||
|  | ||||
| #define VERSION "v0.8.1" | ||||
| #define VERSION "v0.8.2" | ||||
|  | ||||
| #endif // VERSION_H_INCLUDED | ||||
|   | ||||
							
								
								
									
										63
									
								
								xmake.lua
									
									
									
									
									
								
							
							
						
						
									
										63
									
								
								xmake.lua
									
									
									
									
									
								
							| @@ -1,63 +0,0 @@ | ||||
| add_rules("mode.debug", "mode.release") | ||||
|  | ||||
| option("static") | ||||
|     set_default(false) | ||||
|     set_showmenu(true) | ||||
|     set_category("option") | ||||
|     set_description("Build static binary.") | ||||
| option_end() | ||||
|  | ||||
| add_requires("pcre2", "yaml-cpp", "rapidjson", "toml11") | ||||
| includes("xmake/libcron.lua") | ||||
| includes("xmake/yaml-cpp-static.lua") | ||||
| includes("xmake/quickjspp.lua") | ||||
| includes("xmake/curl-static.lua") | ||||
| add_requires("libcron", {system = false}) | ||||
| add_requires("yaml-cpp-static", {system = false}) | ||||
| add_requires("quickjspp", {system = false}) | ||||
| if not is_plat("macosx") and get_config("static") == true then | ||||
|     add_requires("curl-static", {system = false}) | ||||
| else | ||||
|     add_requires("libcurl") | ||||
| end | ||||
|  | ||||
| target("subconverter") | ||||
|     set_kind("binary") | ||||
|     if is_os("windows") then | ||||
|         add_syslinks("ws2_32", "wsock32") | ||||
|     end | ||||
|     if not is_os("macosx") and has_config("static") then | ||||
|         add_ldflags("-static") | ||||
|     end | ||||
|     add_files("src/**.cpp|lib/wrapper.cpp|server/webserver_libevent.cpp|script/script.cpp|generator/template/template_jinja2.cpp") | ||||
|     add_includedirs("src") | ||||
|     add_includedirs("include") | ||||
|     add_packages("pcre2", "rapidjson", "toml11", "libcron", "quickjspp") | ||||
|     if not is_plat("macosx") and get_config("static") == true then | ||||
|         add_packages("curl-static") | ||||
|     else | ||||
|         add_packages("libcurl") | ||||
|     end | ||||
|     if has_config("static") then | ||||
|         add_packages("yaml-cpp-static") | ||||
|     else | ||||
|         add_packages("yaml-cpp") | ||||
|     end | ||||
|     add_defines("CURL_STATICLIB") | ||||
|     add_defines("PCRE2_STATIC") | ||||
|     add_defines("YAML_CPP_STATIC_DEFINE") | ||||
|     add_cxxflags("-std=c++20") | ||||
|  | ||||
| target("subconverter_lib") | ||||
|     set_basename("subconverter") | ||||
|     set_kind("static") | ||||
|     add_files("src/**.cpp|handler/**.cpp|server/**.cpp|script/**.cpp|generator/template/template_jinja2.cpp") | ||||
|     add_includedirs("src") | ||||
|     add_includedirs("include") | ||||
|     add_packages("pcre2", "yaml-cpp", "rapidjson", "toml11") | ||||
|     add_defines("CURL_STATICLIB") | ||||
|     add_defines("PCRE2_STATIC") | ||||
|     add_defines("YAML_CPP_STATIC_DEFINE") | ||||
|     add_defines("NO_JS_RUNTIME") | ||||
|     add_defines("NO_WEBGET") | ||||
|     add_cxxflags("-std=c++20") | ||||
| @@ -1,31 +0,0 @@ | ||||
| package("curl-static") | ||||
|     add_deps("cmake") | ||||
|     add_versions("8.5.0", "7161cb17c01dcff1dc5bf89a18437d9d729f1ecd") | ||||
|     set_urls("https://github.com/curl/curl.git") | ||||
|  | ||||
|     if is_plat("macosx", "iphoneos") then | ||||
|         add_frameworks("Security", "CoreFoundation", "SystemConfiguration") | ||||
|     elseif is_plat("linux") then | ||||
|         add_deps("mbedtls") | ||||
|         add_syslinks("pthread") | ||||
|     elseif is_plat("windows", "mingw") then | ||||
|         add_syslinks("advapi32", "crypt32", "wldap32", "winmm", "ws2_32", "user32", "bcrypt") | ||||
|     end | ||||
|     add_deps("zlib") | ||||
|  | ||||
|     on_install(function (package) | ||||
|                 local configs = {} | ||||
|                 table.insert(configs, "-DCURL_USE_LIBSSH2=OFF") | ||||
|                 table.insert(configs, "-DHAVE_LIBIDN2=OFF") | ||||
|                 table.insert(configs, "-DCURL_USE_LIBPSL=OFF") | ||||
|                 table.insert(configs, "-DBUILD_CURL_EXE=OFF") | ||||
|                 table.insert(configs, "-DBUILD_TESTING=OFF") | ||||
|                 table.insert(configs, "-DCURL_USE_MBEDTLS=" .. (package:is_plat("linux") and "ON" or "OFF")) | ||||
|                 table.insert(configs, "-DCURL_USE_SCHANNEL=" .. (package:is_plat("windows") and "ON" or "OFF")) | ||||
|                 table.insert(configs, "-DHTTP_ONLY=ON") | ||||
|                 table.insert(configs, "-DCURL_USE_LIBSSH2=OFF") | ||||
|                 table.insert(configs, "-DCMAKE_BUILD_TYPE=" .. (package:debug() and "Debug" or "Release")) | ||||
|                 table.insert(configs, "-DBUILD_SHARED_LIBS=OFF") | ||||
|                 import("package.tools.cmake").install(package, configs) | ||||
|             end) | ||||
| package_end() | ||||
| @@ -1,13 +0,0 @@ | ||||
| package("libcron") | ||||
|     add_deps("cmake") | ||||
|     add_versions("1.3.1", "41f238ceb09d4179e7346d78584a0c978e5d0059") | ||||
|     set_urls("https://github.com/PerMalmberg/libcron.git") | ||||
|     on_install(function (package) | ||||
|             local configs = {} | ||||
|             io.replace("CMakeLists.txt", "add_subdirectory(test)", "", {plain = true}) | ||||
|             io.replace("CMakeLists.txt", "add_dependencies(cron_test libcron)", "", {plain = true}) | ||||
|             table.insert(configs, "-DCMAKE_BUILD_TYPE=" .. (package:debug() and "Debug" or "Release")) | ||||
|             table.insert(configs, "-DBUILD_SHARED_LIBS=" .. (package:config("shared") and "ON" or "OFF")) | ||||
|             import("package.tools.cmake").install(package, configs) | ||||
|         end) | ||||
| package_end() | ||||
| @@ -1,54 +0,0 @@ | ||||
| package("quickjspp") | ||||
|  | ||||
|     set_homepage("https://github.com/ftk/quickjspp") | ||||
|     set_description("QuickJS C++ wrapper") | ||||
|  | ||||
|     add_urls("https://github.com/ftk/quickjspp.git") | ||||
|     add_versions("2022.7.22", "9cee4b4d27271d54b95f6f42bfdc534ebeaaeb72") | ||||
|  | ||||
|     add_configs("shared", {description = "Build shared library.", default = false, type = "boolean", readonly = true}) | ||||
|  | ||||
|     add_includedirs("include", "include/quickjs") | ||||
|     add_linkdirs("lib/quickjs") | ||||
|     add_links("quickjs") | ||||
|  | ||||
|     add_deps("cmake") | ||||
|  | ||||
|     if is_plat("linux") then | ||||
|         add_syslinks("pthread", "dl", "m") | ||||
|     end | ||||
|  | ||||
|     on_install("linux", "macosx", "mingw", function (package) | ||||
|         local configs = {"-DBUILD_TESTING=OFF"} | ||||
|         -- TODO, disable lto, maybe we need do it better | ||||
|         io.replace("CMakeLists.txt", "set(CMAKE_INTERPROCEDURAL_OPTIMIZATION TRUE)", "", {plain = true}) | ||||
|         table.insert(configs, "-DCMAKE_BUILD_TYPE=" .. (package:debug() and "Debug" or "Release")) | ||||
|         import("package.tools.cmake").install(package, configs, {}) | ||||
|     end) | ||||
|  | ||||
|     on_test(function (package) | ||||
|         assert(package:check_cxxsnippets({test = [[ | ||||
|             #include <iostream> | ||||
|             void test() { | ||||
|                 using namespace qjs; | ||||
|                 Runtime runtime; | ||||
|                 Context context(runtime); | ||||
|                 auto rt = runtime.rt; | ||||
|                 auto ctx = context.ctx; | ||||
|                 js_std_init_handlers(rt); | ||||
|                 js_init_module_std(ctx, "std"); | ||||
|                 js_init_module_os(ctx, "os"); | ||||
|                 context.eval(R"xxx( | ||||
|                     import * as std from 'std'; | ||||
|                     import * as os from 'os'; | ||||
|                     globalThis.std = std; | ||||
|                     globalThis.os = os; | ||||
|                 )xxx", "<input>", JS_EVAL_TYPE_MODULE); | ||||
|  | ||||
|                 js_std_loop(ctx); | ||||
|                 js_std_free_handlers(rt); | ||||
|  | ||||
|             } | ||||
|         ]]}, {configs = {languages = "c++17"}, | ||||
|             includes = {"quickjspp.hpp","quickjs/quickjs-libc.h"}})) | ||||
|     end) | ||||
| @@ -1,11 +0,0 @@ | ||||
| package("yaml-cpp-static") | ||||
|     add_deps("cmake") | ||||
|     add_versions("0.8.0-SNAPSHOT", "eaf72053724814be3b99d38e292fca5797a57b7b") | ||||
|     set_urls("https://github.com/jbeder/yaml-cpp.git") | ||||
|     on_install(function (package) | ||||
|                 local configs = {} | ||||
|                 table.insert(configs, "-DCMAKE_BUILD_TYPE=" .. (package:debug() and "Debug" or "Release")) | ||||
|                 table.insert(configs, "-DBUILD_SHARED_LIBS=" .. (package:config("shared") and "ON" or "OFF")) | ||||
|                 import("package.tools.cmake").install(package, configs) | ||||
|             end) | ||||
| package_end() | ||||
		Reference in New Issue
	
	Block a user