diff --git a/.github/workflows/build-and-test-make.yml b/.github/workflows/build-and-test-make.yml index 44330352..8a15e688 100644 --- a/.github/workflows/build-and-test-make.yml +++ b/.github/workflows/build-and-test-make.yml @@ -47,11 +47,13 @@ jobs: - name: Build the Chrome version of curl-impersonate run: | make chrome-build + make chrome-checkbuild make chrome-install - name: Build the Firefox version of curl-impersonate run: | make firefox-build + make firefox-checkbuild make firefox-install - name: Prepare the tests diff --git a/Dockerfile.template b/Dockerfile.template index 6d50d5ba..ed93b0c3 100644 --- a/Dockerfile.template +++ b/Dockerfile.template @@ -120,15 +120,9 @@ ARG NGHTTP2_URL=https://github.com/nghttp2/nghttp2/releases/download/v1.46.0/ngh RUN curl -o ${NGHTTP2_VERSION}.tar.bz2 -L ${NGHTTP2_URL} RUN tar xf ${NGHTTP2_VERSION}.tar.bz2 -# Patch nghttp2 pkg config file to support static builds. -COPY patches/libnghttp2-*.patch ${NGHTTP2_VERSION}/ -RUN cd ${NGHTTP2_VERSION} && \ - for p in $(ls libnghttp2-*.patch); do patch -p1 < $p; done && \ - autoreconf -i && automake && autoconf - # Compile nghttp2 RUN cd ${NGHTTP2_VERSION} && \ - ./configure --with-pic && \ + ./configure --prefix=/build/${NGHTTP2_VERSION}/installed --with-pic --disable-shared && \ make && make install # Download curl. @@ -148,7 +142,7 @@ RUN cd ${CURL_VERSION} && \ ./configure --prefix=/build/install \ --enable-static \ --disable-shared \ - --with-nghttp2=/usr/local \ + --with-nghttp2=/build/${NGHTTP2_VERSION}/installed \ --with-brotli=/build/brotli-${BROTLI_VERSION}/build/installed \ {{#firefox}} --with-nss=/build/${NSS_VERSION}/dist/Release \ @@ -173,12 +167,21 @@ RUN mkdir out && \ {{/chrome}} strip out/curl-impersonate +# Verify that the resulting 'curl' has all the necessary features. +RUN ./out/curl-impersonate -V | grep -q zlib && \ + ./out/curl-impersonate -V | grep -q brotli && \ + ./out/curl-impersonate -V | grep -q nghttp2 && \ + ./out/curl-impersonate -V | grep -q -e NSS -e BoringSSL + +# Verify that the resulting 'curl' is really statically compiled +RUN ! (ldd ./out/curl-impersonate | grep -q -e libcurl -e nghttp2 -e brotli -e ssl -e crypto) + RUN rm -Rf /build/install # Re-compile libcurl dynamically RUN cd ${CURL_VERSION} && \ ./configure --prefix=/build/install \ - --with-nghttp2=/usr/local \ + --with-nghttp2=/build/${NGHTTP2_VERSION}/installed \ --with-brotli=/build/brotli-${BROTLI_VERSION}/build/installed \ {{#firefox}} --with-nss=/build/${NSS_VERSION}/dist/Release \ @@ -208,6 +211,10 @@ RUN ver=$(readlink -f curl-7.81.0/lib/.libs/libcurl-impersonate-chrome.so | sed ln -s "libcurl-impersonate.so.$ver" "out/libcurl-impersonate.so" && \ strip "out/libcurl-impersonate.so.$ver" +# Verify that the resulting 'libcurl' is really statically compiled against its +# dependencies. +RUN ! (ldd ./out/curl-impersonate | grep -q -e nghttp2 -e brotli -e ssl -e crypto) + # Wrapper scripts {{#firefox}} COPY curl_ff* out/ diff --git a/INSTALL.md b/INSTALL.md index 3f854223..cac475b2 100644 --- a/INSTALL.md +++ b/INSTALL.md @@ -9,7 +9,8 @@ There are currently two build options depending on your use case: 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. ## Native build -Currently tested for Linux only. Work on porting to Mac is in progress. + +### Linux (Ubuntu) Install dependencies for building all the components: ``` @@ -18,7 +19,7 @@ sudo apt install build-essential pkg-config cmake ninja-build curl autoconf auto sudo apt install python3-pip python-is-python3 pip install gyp-next export PATH="$PATH:~/.local/bin" # Add gyp to PATH -# For the Chrome vesion only +# For the Chrome version only sudo apt install golang-go ``` @@ -63,6 +64,32 @@ curl-impersonate-ff https://www.wikipedia.org curl-impersonate-chrome https://www.wikipedia.org ``` +### macOS +*macOS support is still a work in progress and currently supports the Chrome version only.* + +Install dependencies for building all the components: +``` +brew install pkg-config make cmake ninja autoconf automake libtool +# For the Chrome version only +brew install go +``` + +Generate the configure script: +``` +autoconf +``` + +Configure and compile: +``` +mkdir build && cd build +../configure +# Build and install the Chrome version +gmake chrome-build +sudo gmake chrome-install +# Optionally remove all the build files +cd ../ && rm -Rf build +``` + ### Static compilation To compile curl-impersonate statically with libcurl-impersonate, pass `--enable-static` to the `configure` script. diff --git a/Makefile.in b/Makefile.in index 2ba2d3dc..ef4c92d3 100644 --- a/Makefile.in +++ b/Makefile.in @@ -45,38 +45,58 @@ help: ## Show this help message firefox-build: $(CURL_VERSION)/.firefox ## Build the Firefox version of curl-impersonate cd $(CURL_VERSION) # Don't pass this Makefile's MAKEFLAGS - make MAKEFLAGS= + $(MAKE) MAKEFLAGS= .PHONY: firefox-build +firefox-checkbuild: ## Run basic checks on the built binary + cd $(CURL_VERSION) + # Make sure all needed features were compiled in + ./src/curl-impersonate-ff -V | grep -q zlib + ./src/curl-impersonate-ff -V | grep -q brotli + ./src/curl-impersonate-ff -V | grep -q nghttp2 + ./src/curl-impersonate-ff -V | grep -q NSS + $(info Build OK) +.PHONY: firefox-checkbuild + firefox-install: ## Install the Firefox version of curl-impersonate after build cd $(CURL_VERSION) - make install-exec MAKEFLAGS= + $(MAKE) install-exec MAKEFLAGS= # Wrapper scripts for the Firefox version (e.g. 'curl_ff98') cp -f $(srcdir)/firefox/curl_ff* @bindir@ .PHONY: firefox-install firefox-uninstall: ## Uninstall the Firefox version of curl-impersonate after 'make install' cd $(CURL_VERSION) - make uninstall MAKEFLAGS= + $(MAKE) uninstall MAKEFLAGS= rm -Rf @bindir@/curl_ff* .PHONY: firefox-uninstall chrome-build: $(CURL_VERSION)/.chrome ## Build the Chrome version of curl-impersonate cd $(CURL_VERSION) # Don't pass this Makefile's MAKEFLAGS - make MAKEFLAGS= + $(MAKE) MAKEFLAGS= .PHONY: chrome-build +chrome-checkbuild: ## Run basic checks on the built binary + cd $(CURL_VERSION) + # Make sure all needed features were compiled in + ./src/curl-impersonate-chrome -V | grep -q zlib + ./src/curl-impersonate-chrome -V | grep -q brotli + ./src/curl-impersonate-chrome -V | grep -q nghttp2 + ./src/curl-impersonate-chrome -V | grep -q BoringSSL + $(info Build OK) +.PHONY: chrome-checkbuild + chrome-install: ## Install the Chrome version of curl-impersonate after build cd $(CURL_VERSION) - make install-exec MAKEFLAGS= + $(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@ .PHONY: chrome-install chrome-uninstall: ## Uninstall the Chrome version of curl-impersonate after 'make install' cd $(CURL_VERSION) - make uninstall MAKEFLAGS= + $(MAKE) uninstall MAKEFLAGS= rm -Rf @bindir@/curl_chrome* @bindir@/curl_edge* @bindir@/curl_safari* .PHONY: chrome-uninstall @@ -137,21 +157,12 @@ $(boringssl_static_libs): boringssl.zip boringssl/.patched $(NGHTTP2_VERSION).tar.bz2: curl -L $(NGHTTP2_URL) -o $(NGHTTP2_VERSION).tar.bz2 -# Patch nghttp2 and use a dummy '.patched' file to mark it patched -$(NGHTTP2_VERSION)/.patched: $(srcdir)/firefox/patches/libnghttp2-*.patch - rm -Rf $(NGHTTP2_VERSION) +$(nghttp2_static_libs): $(NGHTTP2_VERSION).tar.bz2 tar -xf $(NGHTTP2_VERSION).tar.bz2 cd $(NGHTTP2_VERSION) - for p in $^; do patch -p1 < $$p; done - # Re-generate the configure script - autoreconf -i && automake && autoconf - touch .patched - -$(nghttp2_static_libs): $(NGHTTP2_VERSION).tar.bz2 $(NGHTTP2_VERSION)/.patched - cd $(NGHTTP2_VERSION) - ./configure --prefix=$(nghttp2_install_dir) --with-pic - make MAKEFLAGS= - make install MAKEFLAGS= + ./configure --prefix=$(nghttp2_install_dir) --with-pic --disable-shared + $(MAKE) MAKEFLAGS= + $(MAKE) install MAKEFLAGS= $(CURL_VERSION).tar.xz: curl -L "https://curl.se/download/$(CURL_VERSION).tar.xz" \ @@ -190,7 +201,7 @@ $(CURL_VERSION)/.firefox: $(firefox_libs) $(CURL_VERSION).tar.xz $(CURL_VERSION) USE_CURL_SSLKEYLOGFILE=true \ CFLAGS="-I$(nss_install_dir)/../public/nss -I$(nss_install_dir)/include/nspr" # Remove possible leftovers from a previous compilation - make clean MAKEFLAGS= + $(MAKE) clean MAKEFLAGS= touch .firefox # Remove the Chrome flag if it exists rm -f .chrome @@ -207,7 +218,7 @@ $(CURL_VERSION)/.chrome: $(chrome_libs) $(CURL_VERSION).tar.xz $(CURL_VERSION)/. LIBS="-pthread" \ CFLAGS="-I$(boringssl_install_dir)" # Remove possible leftovers from a previous compilation - make clean MAKEFLAGS= + $(MAKE) clean MAKEFLAGS= touch .chrome # Remove the Firefox flag if it exists rm -f .firefox diff --git a/chrome/Dockerfile b/chrome/Dockerfile index 0bb562b5..760bf55d 100644 --- a/chrome/Dockerfile +++ b/chrome/Dockerfile @@ -61,15 +61,9 @@ ARG NGHTTP2_URL=https://github.com/nghttp2/nghttp2/releases/download/v1.46.0/ngh RUN curl -o ${NGHTTP2_VERSION}.tar.bz2 -L ${NGHTTP2_URL} RUN tar xf ${NGHTTP2_VERSION}.tar.bz2 -# Patch nghttp2 pkg config file to support static builds. -COPY patches/libnghttp2-*.patch ${NGHTTP2_VERSION}/ -RUN cd ${NGHTTP2_VERSION} && \ - for p in $(ls libnghttp2-*.patch); do patch -p1 < $p; done && \ - autoreconf -i && automake && autoconf - # Compile nghttp2 RUN cd ${NGHTTP2_VERSION} && \ - ./configure --with-pic && \ + ./configure --prefix=/build/${NGHTTP2_VERSION}/installed --with-pic --disable-shared && \ make && make install # Download curl. @@ -89,7 +83,7 @@ RUN cd ${CURL_VERSION} && \ ./configure --prefix=/build/install \ --enable-static \ --disable-shared \ - --with-nghttp2=/usr/local \ + --with-nghttp2=/build/${NGHTTP2_VERSION}/installed \ --with-brotli=/build/brotli-${BROTLI_VERSION}/build/installed \ --with-openssl=/build/boringssl/build \ LIBS="-pthread" \ @@ -102,12 +96,21 @@ RUN mkdir out && \ ln -s curl-impersonate-chrome out/curl-impersonate && \ strip out/curl-impersonate +# Verify that the resulting 'curl' has all the necessary features. +RUN ./out/curl-impersonate -V | grep -q zlib && \ + ./out/curl-impersonate -V | grep -q brotli && \ + ./out/curl-impersonate -V | grep -q nghttp2 && \ + ./out/curl-impersonate -V | grep -q -e NSS -e BoringSSL + +# Verify that the resulting 'curl' is really statically compiled +RUN ! (ldd ./out/curl-impersonate | grep -q -e libcurl -e nghttp2 -e brotli -e ssl -e crypto) + RUN rm -Rf /build/install # Re-compile libcurl dynamically RUN cd ${CURL_VERSION} && \ ./configure --prefix=/build/install \ - --with-nghttp2=/usr/local \ + --with-nghttp2=/build/${NGHTTP2_VERSION}/installed \ --with-brotli=/build/brotli-${BROTLI_VERSION}/build/installed \ --with-openssl=/build/boringssl/build \ LIBS="-pthread" \ @@ -124,6 +127,10 @@ RUN ver=$(readlink -f curl-7.81.0/lib/.libs/libcurl-impersonate-chrome.so | sed ln -s "libcurl-impersonate.so.$ver" "out/libcurl-impersonate.so" && \ strip "out/libcurl-impersonate.so.$ver" +# Verify that the resulting 'libcurl' is really statically compiled against its +# dependencies. +RUN ! (ldd ./out/curl-impersonate | grep -q -e nghttp2 -e brotli -e ssl -e crypto) + # Wrapper scripts COPY curl_chrome* curl_edge* curl_safari* out/ RUN chmod +x out/curl_* diff --git a/chrome/Dockerfile.alpine b/chrome/Dockerfile.alpine index ae27d154..4f6e05e3 100644 --- a/chrome/Dockerfile.alpine +++ b/chrome/Dockerfile.alpine @@ -58,15 +58,9 @@ ARG NGHTTP2_URL=https://github.com/nghttp2/nghttp2/releases/download/v1.46.0/ngh RUN curl -o ${NGHTTP2_VERSION}.tar.bz2 -L ${NGHTTP2_URL} RUN tar xf ${NGHTTP2_VERSION}.tar.bz2 -# Patch nghttp2 pkg config file to support static builds. -COPY patches/libnghttp2-*.patch ${NGHTTP2_VERSION}/ -RUN cd ${NGHTTP2_VERSION} && \ - for p in $(ls libnghttp2-*.patch); do patch -p1 < $p; done && \ - autoreconf -i && automake && autoconf - # Compile nghttp2 RUN cd ${NGHTTP2_VERSION} && \ - ./configure --with-pic && \ + ./configure --prefix=/build/${NGHTTP2_VERSION}/installed --with-pic --disable-shared && \ make && make install # Download curl. @@ -86,7 +80,7 @@ RUN cd ${CURL_VERSION} && \ ./configure --prefix=/build/install \ --enable-static \ --disable-shared \ - --with-nghttp2=/usr/local \ + --with-nghttp2=/build/${NGHTTP2_VERSION}/installed \ --with-brotli=/build/brotli-${BROTLI_VERSION}/build/installed \ --with-openssl=/build/boringssl/build \ LIBS="-pthread" \ @@ -99,12 +93,21 @@ RUN mkdir out && \ ln -s curl-impersonate-chrome out/curl-impersonate && \ strip out/curl-impersonate +# Verify that the resulting 'curl' has all the necessary features. +RUN ./out/curl-impersonate -V | grep -q zlib && \ + ./out/curl-impersonate -V | grep -q brotli && \ + ./out/curl-impersonate -V | grep -q nghttp2 && \ + ./out/curl-impersonate -V | grep -q -e NSS -e BoringSSL + +# Verify that the resulting 'curl' is really statically compiled +RUN ! (ldd ./out/curl-impersonate | grep -q -e libcurl -e nghttp2 -e brotli -e ssl -e crypto) + RUN rm -Rf /build/install # Re-compile libcurl dynamically RUN cd ${CURL_VERSION} && \ ./configure --prefix=/build/install \ - --with-nghttp2=/usr/local \ + --with-nghttp2=/build/${NGHTTP2_VERSION}/installed \ --with-brotli=/build/brotli-${BROTLI_VERSION}/build/installed \ --with-openssl=/build/boringssl/build \ LIBS="-pthread" \ @@ -121,6 +124,10 @@ RUN ver=$(readlink -f curl-7.81.0/lib/.libs/libcurl-impersonate-chrome.so | sed ln -s "libcurl-impersonate.so.$ver" "out/libcurl-impersonate.so" && \ strip "out/libcurl-impersonate.so.$ver" +# Verify that the resulting 'libcurl' is really statically compiled against its +# dependencies. +RUN ! (ldd ./out/curl-impersonate | grep -q -e nghttp2 -e brotli -e ssl -e crypto) + # Wrapper scripts COPY curl_chrome* curl_edge* curl_safari* out/ # Replace /bin/bash with /bin/ash diff --git a/chrome/patches/curl-impersonate.patch b/chrome/patches/curl-impersonate.patch index 33de5398..fa77f320 100644 --- a/chrome/patches/curl-impersonate.patch +++ b/chrome/patches/curl-impersonate.patch @@ -19,7 +19,7 @@ index 3e55230ee..e3ea22b96 100644 # List of files required to generate VC IDE .dsp, .vcproj and .vcxproj files include lib/Makefile.inc diff --git a/configure.ac b/configure.ac -index 63e320236..8c41e8501 100644 +index 63e320236..86ab654c7 100644 --- a/configure.ac +++ b/configure.ac @@ -1331,7 +1331,8 @@ if test X"$OPT_BROTLI" != Xno; then @@ -28,7 +28,7 @@ index 63e320236..8c41e8501 100644 if test -n "$PREFIX_BROTLI"; then - LIB_BROTLI="-lbrotlidec" + # curl-impersonate: Use static libbrotli -+ LIB_BROTLI="-Wl,-Bstatic -lbrotlidec-static -lbrotlicommon-static -Wl,-Bdynamic" ++ LIB_BROTLI="-lbrotlidec-static -lbrotlicommon-static" LD_BROTLI=-L${PREFIX_BROTLI}/lib$libsuff CPP_BROTLI=-I${PREFIX_BROTLI}/include DIR_BROTLI=${PREFIX_BROTLI}/lib$libsuff diff --git a/chrome/patches/libnghttp2-pc.patch b/chrome/patches/libnghttp2-pc.patch deleted file mode 100644 index 0758b8b6..00000000 --- a/chrome/patches/libnghttp2-pc.patch +++ /dev/null @@ -1,8 +0,0 @@ ---- nghttp2-1.46.0-original/lib/libnghttp2.pc.in 2021-10-19 12:31:47.000000000 +0300 -+++ nghttp2-1.46.0/lib/libnghttp2.pc.in 2022-02-17 13:44:46.722604316 +0200 -@@ -31,3 +31,4 @@ - Version: @VERSION@ --Libs: -L${libdir} -lnghttp2 -+Libs: -L${libdir} -+Libs.private: -l:libnghttp2.a - Cflags: -I${includedir} diff --git a/firefox/Dockerfile b/firefox/Dockerfile index d1e5cc71..ee426b2e 100644 --- a/firefox/Dockerfile +++ b/firefox/Dockerfile @@ -57,15 +57,9 @@ ARG NGHTTP2_URL=https://github.com/nghttp2/nghttp2/releases/download/v1.46.0/ngh RUN curl -o ${NGHTTP2_VERSION}.tar.bz2 -L ${NGHTTP2_URL} RUN tar xf ${NGHTTP2_VERSION}.tar.bz2 -# Patch nghttp2 pkg config file to support static builds. -COPY patches/libnghttp2-*.patch ${NGHTTP2_VERSION}/ -RUN cd ${NGHTTP2_VERSION} && \ - for p in $(ls libnghttp2-*.patch); do patch -p1 < $p; done && \ - autoreconf -i && automake && autoconf - # Compile nghttp2 RUN cd ${NGHTTP2_VERSION} && \ - ./configure --with-pic && \ + ./configure --prefix=/build/${NGHTTP2_VERSION}/installed --with-pic --disable-shared && \ make && make install # Download curl. @@ -85,7 +79,7 @@ RUN cd ${CURL_VERSION} && \ ./configure --prefix=/build/install \ --enable-static \ --disable-shared \ - --with-nghttp2=/usr/local \ + --with-nghttp2=/build/${NGHTTP2_VERSION}/installed \ --with-brotli=/build/brotli-${BROTLI_VERSION}/build/installed \ --with-nss=/build/${NSS_VERSION}/dist/Release \ CFLAGS="-I/build/${NSS_VERSION}/dist/public/nss -I/build/${NSS_VERSION}/dist/Release/include/nspr" \ @@ -97,12 +91,21 @@ RUN mkdir out && \ ln -s curl-impersonate-ff out/curl-impersonate && \ strip out/curl-impersonate +# Verify that the resulting 'curl' has all the necessary features. +RUN ./out/curl-impersonate -V | grep -q zlib && \ + ./out/curl-impersonate -V | grep -q brotli && \ + ./out/curl-impersonate -V | grep -q nghttp2 && \ + ./out/curl-impersonate -V | grep -q -e NSS -e BoringSSL + +# Verify that the resulting 'curl' is really statically compiled +RUN ! (ldd ./out/curl-impersonate | grep -q -e libcurl -e nghttp2 -e brotli -e ssl -e crypto) + RUN rm -Rf /build/install # Re-compile libcurl dynamically RUN cd ${CURL_VERSION} && \ ./configure --prefix=/build/install \ - --with-nghttp2=/usr/local \ + --with-nghttp2=/build/${NGHTTP2_VERSION}/installed \ --with-brotli=/build/brotli-${BROTLI_VERSION}/build/installed \ --with-nss=/build/${NSS_VERSION}/dist/Release \ CFLAGS="-I/build/${NSS_VERSION}/dist/public/nss -I/build/${NSS_VERSION}/dist/Release/include/nspr" \ @@ -118,6 +121,10 @@ RUN ver=$(readlink -f curl-7.81.0/lib/.libs/libcurl-impersonate-ff.so | sed 's/. ln -s "libcurl-impersonate.so.$ver" "out/libcurl-impersonate.so" && \ strip "out/libcurl-impersonate.so.$ver" +# Verify that the resulting 'libcurl' is really statically compiled against its +# dependencies. +RUN ! (ldd ./out/curl-impersonate | grep -q -e nghttp2 -e brotli -e ssl -e crypto) + # Wrapper scripts COPY curl_ff* out/ RUN chmod +x out/curl_* diff --git a/firefox/Dockerfile.alpine b/firefox/Dockerfile.alpine index 4bcb214d..e8563044 100644 --- a/firefox/Dockerfile.alpine +++ b/firefox/Dockerfile.alpine @@ -52,15 +52,9 @@ ARG NGHTTP2_URL=https://github.com/nghttp2/nghttp2/releases/download/v1.46.0/ngh RUN curl -o ${NGHTTP2_VERSION}.tar.bz2 -L ${NGHTTP2_URL} RUN tar xf ${NGHTTP2_VERSION}.tar.bz2 -# Patch nghttp2 pkg config file to support static builds. -COPY patches/libnghttp2-*.patch ${NGHTTP2_VERSION}/ -RUN cd ${NGHTTP2_VERSION} && \ - for p in $(ls libnghttp2-*.patch); do patch -p1 < $p; done && \ - autoreconf -i && automake && autoconf - # Compile nghttp2 RUN cd ${NGHTTP2_VERSION} && \ - ./configure --with-pic && \ + ./configure --prefix=/build/${NGHTTP2_VERSION}/installed --with-pic --disable-shared && \ make && make install # Download curl. @@ -80,7 +74,7 @@ RUN cd ${CURL_VERSION} && \ ./configure --prefix=/build/install \ --enable-static \ --disable-shared \ - --with-nghttp2=/usr/local \ + --with-nghttp2=/build/${NGHTTP2_VERSION}/installed \ --with-brotli=/build/brotli-${BROTLI_VERSION}/build/installed \ --with-nss=/build/${NSS_VERSION}/dist/Release \ CFLAGS="-I/build/${NSS_VERSION}/dist/public/nss -I/build/${NSS_VERSION}/dist/Release/include/nspr" \ @@ -92,12 +86,21 @@ RUN mkdir out && \ ln -s curl-impersonate-ff out/curl-impersonate && \ strip out/curl-impersonate +# Verify that the resulting 'curl' has all the necessary features. +RUN ./out/curl-impersonate -V | grep -q zlib && \ + ./out/curl-impersonate -V | grep -q brotli && \ + ./out/curl-impersonate -V | grep -q nghttp2 && \ + ./out/curl-impersonate -V | grep -q -e NSS -e BoringSSL + +# Verify that the resulting 'curl' is really statically compiled +RUN ! (ldd ./out/curl-impersonate | grep -q -e libcurl -e nghttp2 -e brotli -e ssl -e crypto) + RUN rm -Rf /build/install # Re-compile libcurl dynamically RUN cd ${CURL_VERSION} && \ ./configure --prefix=/build/install \ - --with-nghttp2=/usr/local \ + --with-nghttp2=/build/${NGHTTP2_VERSION}/installed \ --with-brotli=/build/brotli-${BROTLI_VERSION}/build/installed \ --with-nss=/build/${NSS_VERSION}/dist/Release \ CFLAGS="-I/build/${NSS_VERSION}/dist/public/nss -I/build/${NSS_VERSION}/dist/Release/include/nspr" \ @@ -113,6 +116,10 @@ RUN ver=$(readlink -f curl-7.81.0/lib/.libs/libcurl-impersonate-ff.so | sed 's/. ln -s "libcurl-impersonate.so.$ver" "out/libcurl-impersonate.so" && \ strip "out/libcurl-impersonate.so.$ver" +# Verify that the resulting 'libcurl' is really statically compiled against its +# dependencies. +RUN ! (ldd ./out/curl-impersonate | grep -q -e nghttp2 -e brotli -e ssl -e crypto) + # Wrapper scripts COPY curl_ff* out/ # Replace /bin/bash with /bin/ash diff --git a/firefox/patches/curl-impersonate.patch b/firefox/patches/curl-impersonate.patch index 3d817944..d89fc1ce 100644 --- a/firefox/patches/curl-impersonate.patch +++ b/firefox/patches/curl-impersonate.patch @@ -19,7 +19,7 @@ index 3e55230ee..90b504b5c 100644 # List of files required to generate VC IDE .dsp, .vcproj and .vcxproj files include lib/Makefile.inc diff --git a/configure.ac b/configure.ac -index 63e320236..238addfaa 100644 +index 63e320236..40f67f137 100644 --- a/configure.ac +++ b/configure.ac @@ -1331,7 +1331,8 @@ if test X"$OPT_BROTLI" != Xno; then @@ -28,7 +28,7 @@ index 63e320236..238addfaa 100644 if test -n "$PREFIX_BROTLI"; then - LIB_BROTLI="-lbrotlidec" + # curl-impersonate: Use static libbrotli -+ LIB_BROTLI="-Wl,-Bstatic -lbrotlidec-static -lbrotlicommon-static -Wl,-Bdynamic" ++ LIB_BROTLI="-lbrotlidec-static -lbrotlicommon-static" LD_BROTLI=-L${PREFIX_BROTLI}/lib$libsuff CPP_BROTLI=-I${PREFIX_BROTLI}/include DIR_BROTLI=${PREFIX_BROTLI}/lib$libsuff diff --git a/firefox/patches/libnghttp2-pc.patch b/firefox/patches/libnghttp2-pc.patch deleted file mode 100644 index 0758b8b6..00000000 --- a/firefox/patches/libnghttp2-pc.patch +++ /dev/null @@ -1,8 +0,0 @@ ---- nghttp2-1.46.0-original/lib/libnghttp2.pc.in 2021-10-19 12:31:47.000000000 +0300 -+++ nghttp2-1.46.0/lib/libnghttp2.pc.in 2022-02-17 13:44:46.722604316 +0200 -@@ -31,3 +31,4 @@ - Version: @VERSION@ --Libs: -L${libdir} -lnghttp2 -+Libs: -L${libdir} -+Libs.private: -l:libnghttp2.a - Cflags: -I${includedir}