diff --git a/.github/workflows/build-and-test-make.yml b/.github/workflows/build-and-test-make.yml index cf96dfec..3ca182d2 100644 --- a/.github/workflows/build-and-test-make.yml +++ b/.github/workflows/build-and-test-make.yml @@ -4,6 +4,8 @@ on: push: branches: - main + tags: + - "v*.*.*" pull_request: branches: - main @@ -23,9 +25,11 @@ jobs: - os: ubuntu-20.04 capture_interface: eth0 make: make + release_name: x86_64-linux-gnu - os: macos-11 capture_interface: en0 make: gmake + release_name: x86_64-macos steps: - uses: actions/setup-python@v3 @@ -143,4 +147,34 @@ jobs: cd tests # sudo is needed for capturing packets python_bin=$(which python3) - sudo $python_bin -m pytest . --log-cli-level DEBUG --install-dir ${{ runner.temp}}/install --capture-interface ${{ matrix.capture_interface }} + sudo $python_bin -m pytest . --log-cli-level DEBUG --install-dir ${{ runner.temp }}/install --capture-interface ${{ matrix.capture_interface }} + + # If it's a tag, create a release and upload the binaries. + # For that we recompile curl-impersonate statically. + - name: Recompile statically for release assets + if: startsWith(github.ref, 'refs/tags/') + run: | + ${{ matrix.make }} chrome-clean + ${{ matrix.make }} firefox-clean + rm -Rf ${{ runner.temp }}/install + mkdir ${{ runner.temp }}/install + ./configure --prefix=${{ runner.temp }}/install --enable-static + ${{ matrix.make }} chrome-build + ${{ matrix.make }} chrome-checkbuild + ${{ matrix.make }} chrome-install-strip + ${{ matrix.make }} firefox-build + ${{ matrix.make }} firefox-checkbuild + ${{ matrix.make }} firefox-install-strip + + - name: Create tar release files + if: startsWith(github.ref, 'refs/tags/') + run: | + cd ${{ runner.temp }}/install/bin + tar -c -z -f ${{ runner.temp }}/curl-impersonate-${{ github.ref_name }}.${{ matrix.release_name }}.tar.gz curl-impersonate-ff curl-impersonate-chrome curl_* + echo "release_file=${{ runner.temp }}/curl-impersonate-${{ github.ref_name }}.${{ matrix.release_name }}.tar.gz" >> $GITHUB_ENV + + - name: Upload release files + uses: softprops/action-gh-release@v1 + if: startsWith(github.ref, 'refs/tags/') + with: + files: ${{ env.release_file }} diff --git a/Makefile.in b/Makefile.in index 871c68fa..3d4aaa02 100644 --- a/Makefile.in +++ b/Makefile.in @@ -64,15 +64,31 @@ firefox-install: ## Install the Firefox version of curl-impersonate after build cd $(CURL_VERSION) $(MAKE) install-exec MAKEFLAGS= # Wrapper scripts for the Firefox version (e.g. 'curl_ff98') - cp -f $(srcdir)/firefox/curl_ff* @bindir@ + install $(srcdir)/firefox/curl_ff* @bindir@ .PHONY: firefox-install +firefox-install-strip: ## Like 'firefox-install', but strip binaries for smaller size + cd $(CURL_VERSION) + $(MAKE) install-exec MAKEFLAGS= + # We could have used 'install-strip' but then the docs would be installed as well. + # Instead strip manually. + strip @bindir@/curl-impersonate-ff + # Wrapper scripts for the Firefox version (e.g. 'curl_ff98') + install $(srcdir)/firefox/curl_ff* @bindir@ +.PHONY: firefox-install-strip + firefox-uninstall: ## Uninstall the Firefox version of curl-impersonate after 'make install' cd $(CURL_VERSION) $(MAKE) uninstall MAKEFLAGS= rm -Rf @bindir@/curl_ff* .PHONY: firefox-uninstall +firefox-clean: ## Clean build artifacts of the Firefox version. Use after re-running './configure' + cd $(CURL_VERSION) + $(MAKE) clean MAKEFLAGS= + rm -f .firefox +.PHONY: firefox-clean + chrome-build: $(CURL_VERSION)/.chrome ## Build the Chrome version of curl-impersonate cd $(CURL_VERSION) # Don't pass this Makefile's MAKEFLAGS @@ -93,16 +109,32 @@ chrome-install: ## Install the Chrome version of curl-impersonate after build cd $(CURL_VERSION) $(MAKE) install-exec MAKEFLAGS= # Wrapper scripts for the Chrome version (e.g. 'curl_chrome99') - cp -f $(srcdir)/chrome/curl_chrome* $(srcdir)/chrome/curl_edge* $(srcdir)/chrome/curl_safari* @bindir@ + install $(srcdir)/chrome/curl_chrome* $(srcdir)/chrome/curl_edge* $(srcdir)/chrome/curl_safari* @bindir@ .PHONY: chrome-install +chrome-install-strip: ## Like 'chrome-install', but strip binaries for smaller size + cd $(CURL_VERSION) + $(MAKE) install-exec MAKEFLAGS= + # We could have used 'install-strip' but then the docs would be installed as well. + # Instead strip manually. + strip @bindir@/curl-impersonate-chrome + # Wrapper scripts for the Chrome version (e.g. 'curl_chrome99') + install $(srcdir)/chrome/curl_chrome* $(srcdir)/chrome/curl_edge* $(srcdir)/chrome/curl_safari* @bindir@ +.PHONY: chrome-install-strip + chrome-uninstall: ## Uninstall the Chrome version of curl-impersonate after 'make install' cd $(CURL_VERSION) $(MAKE) uninstall MAKEFLAGS= rm -Rf @bindir@/curl_chrome* @bindir@/curl_edge* @bindir@/curl_safari* .PHONY: chrome-uninstall -clean: ## Remove build artifacts +chrome-clean: ## Clean build artifacts of the Chrome version. Use after re-running './configure' + cd $(CURL_VERSION) + $(MAKE) clean MAKEFLAGS= + rm -f .chrome +.PHONY: chrome-clean + +clean: ## Remove all build artifacts, including dependencies rm -Rf brotli-$(BROTLI_VERSION).tar.gz brotli-$(BROTLI_VERSION) rm -Rf $(NSS_VERSION).tar.gz $(NSS_VERSION) rm -Rf boringssl.zip boringssl diff --git a/README.md b/README.md index d57569eb..92f761c4 100644 --- a/README.md +++ b/README.md @@ -51,6 +51,11 @@ See [Advanced usage](#Advanced-usage) for more options. ## Installation There are two versions of `curl-impersonate` for technical reasons. The **chrome** version is used to impersonate Chrome, Edge and Safari. The **firefox** version is used to impersonate Firefox. +### Pre-compiled binaries +Pre-compiled binaries for Linux and macOS (Intel) are available at the [GitHub releases](https://github.com/lwthiker/curl-impersonate/releases) page. + +These binaries are statically compiled with libcurl(-impersonate) for ease of use. If you wish to use libcurl-impersonate, please build from source. + ### Building from source See [INSTALL.md](INSTALL.md).