Skip to content

curl-impersonate: A special build of curl that can impersonate Chrome & Firefox

Change nghttp2 link flags to support macOS

lwthikerd7ed859ad003
diff --git a/Dockerfile.template b/Dockerfile.template
index 6d50d5b..ae2d4aa 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 \
@@ -178,7 +172,7 @@ 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 \
diff --git a/Makefile.in b/Makefile.in
index e21b046..1b7ba46 100644
--- a/Makefile.in
+++ b/Makefile.in
@@ -137,19 +137,10 @@ $(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
+ ./configure --prefix=$(nghttp2_install_dir) --with-pic --disable-shared
$(MAKE) MAKEFLAGS=
$(MAKE) install MAKEFLAGS=
diff --git a/chrome/Dockerfile b/chrome/Dockerfile
index 0bb562b..b55e918 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" \
@@ -107,7 +101,7 @@ 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" \
diff --git a/chrome/Dockerfile.alpine b/chrome/Dockerfile.alpine
index ae27d15..7d439db 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" \
@@ -104,7 +98,7 @@ 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" \
diff --git a/chrome/patches/libnghttp2-pc.patch b/chrome/patches/libnghttp2-pc.patch
deleted file mode 100644
index 0758b8b..0000000
--- 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 d1e5cc7..9f35e39 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" \
@@ -102,7 +96,7 @@ 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" \
diff --git a/firefox/Dockerfile.alpine b/firefox/Dockerfile.alpine
index 4bcb214..b2c7a4f 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" \
@@ -97,7 +91,7 @@ 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" \
diff --git a/firefox/patches/libnghttp2-pc.patch b/firefox/patches/libnghttp2-pc.patch
deleted file mode 100644
index 0758b8b..0000000
--- 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}