mirror of
https://github.com/lwthiker/curl-impersonate.git
synced 2025-08-09 13:19:37 +00:00
Merge pull request #50 from lwthiker/macos_part1
macOS initial support attempt
This commit is contained in:
2
.github/workflows/build-and-test-make.yml
vendored
2
.github/workflows/build-and-test-make.yml
vendored
@@ -47,11 +47,13 @@ jobs:
|
|||||||
- name: Build the Chrome version of curl-impersonate
|
- name: Build the Chrome version of curl-impersonate
|
||||||
run: |
|
run: |
|
||||||
make chrome-build
|
make chrome-build
|
||||||
|
make chrome-checkbuild
|
||||||
make chrome-install
|
make chrome-install
|
||||||
|
|
||||||
- name: Build the Firefox version of curl-impersonate
|
- name: Build the Firefox version of curl-impersonate
|
||||||
run: |
|
run: |
|
||||||
make firefox-build
|
make firefox-build
|
||||||
|
make firefox-checkbuild
|
||||||
make firefox-install
|
make firefox-install
|
||||||
|
|
||||||
- name: Prepare the tests
|
- name: Prepare the tests
|
||||||
|
@@ -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 curl -o ${NGHTTP2_VERSION}.tar.bz2 -L ${NGHTTP2_URL}
|
||||||
RUN tar xf ${NGHTTP2_VERSION}.tar.bz2
|
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
|
# Compile nghttp2
|
||||||
RUN cd ${NGHTTP2_VERSION} && \
|
RUN cd ${NGHTTP2_VERSION} && \
|
||||||
./configure --with-pic && \
|
./configure --prefix=/build/${NGHTTP2_VERSION}/installed --with-pic --disable-shared && \
|
||||||
make && make install
|
make && make install
|
||||||
|
|
||||||
# Download curl.
|
# Download curl.
|
||||||
@@ -148,7 +142,7 @@ RUN cd ${CURL_VERSION} && \
|
|||||||
./configure --prefix=/build/install \
|
./configure --prefix=/build/install \
|
||||||
--enable-static \
|
--enable-static \
|
||||||
--disable-shared \
|
--disable-shared \
|
||||||
--with-nghttp2=/usr/local \
|
--with-nghttp2=/build/${NGHTTP2_VERSION}/installed \
|
||||||
--with-brotli=/build/brotli-${BROTLI_VERSION}/build/installed \
|
--with-brotli=/build/brotli-${BROTLI_VERSION}/build/installed \
|
||||||
{{#firefox}}
|
{{#firefox}}
|
||||||
--with-nss=/build/${NSS_VERSION}/dist/Release \
|
--with-nss=/build/${NSS_VERSION}/dist/Release \
|
||||||
@@ -173,12 +167,21 @@ RUN mkdir out && \
|
|||||||
{{/chrome}}
|
{{/chrome}}
|
||||||
strip 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
|
RUN rm -Rf /build/install
|
||||||
|
|
||||||
# Re-compile libcurl dynamically
|
# Re-compile libcurl dynamically
|
||||||
RUN cd ${CURL_VERSION} && \
|
RUN cd ${CURL_VERSION} && \
|
||||||
./configure --prefix=/build/install \
|
./configure --prefix=/build/install \
|
||||||
--with-nghttp2=/usr/local \
|
--with-nghttp2=/build/${NGHTTP2_VERSION}/installed \
|
||||||
--with-brotli=/build/brotli-${BROTLI_VERSION}/build/installed \
|
--with-brotli=/build/brotli-${BROTLI_VERSION}/build/installed \
|
||||||
{{#firefox}}
|
{{#firefox}}
|
||||||
--with-nss=/build/${NSS_VERSION}/dist/Release \
|
--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" && \
|
ln -s "libcurl-impersonate.so.$ver" "out/libcurl-impersonate.so" && \
|
||||||
strip "out/libcurl-impersonate.so.$ver"
|
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
|
# Wrapper scripts
|
||||||
{{#firefox}}
|
{{#firefox}}
|
||||||
COPY curl_ff* out/
|
COPY curl_ff* out/
|
||||||
|
31
INSTALL.md
31
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.
|
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
|
## Native build
|
||||||
Currently tested for Linux only. Work on porting to Mac is in progress.
|
|
||||||
|
### Linux (Ubuntu)
|
||||||
|
|
||||||
Install dependencies for building all the components:
|
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
|
sudo apt install python3-pip python-is-python3
|
||||||
pip install gyp-next
|
pip install gyp-next
|
||||||
export PATH="$PATH:~/.local/bin" # Add gyp to PATH
|
export PATH="$PATH:~/.local/bin" # Add gyp to PATH
|
||||||
# For the Chrome vesion only
|
# For the Chrome version only
|
||||||
sudo apt install golang-go
|
sudo apt install golang-go
|
||||||
```
|
```
|
||||||
|
|
||||||
@@ -63,6 +64,32 @@ curl-impersonate-ff https://www.wikipedia.org
|
|||||||
curl-impersonate-chrome 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
|
### Static compilation
|
||||||
To compile curl-impersonate statically with libcurl-impersonate, pass `--enable-static` to the `configure` script.
|
To compile curl-impersonate statically with libcurl-impersonate, pass `--enable-static` to the `configure` script.
|
||||||
|
|
||||||
|
53
Makefile.in
53
Makefile.in
@@ -45,38 +45,58 @@ help: ## Show this help message
|
|||||||
firefox-build: $(CURL_VERSION)/.firefox ## Build the Firefox version of curl-impersonate
|
firefox-build: $(CURL_VERSION)/.firefox ## Build the Firefox version of curl-impersonate
|
||||||
cd $(CURL_VERSION)
|
cd $(CURL_VERSION)
|
||||||
# Don't pass this Makefile's MAKEFLAGS
|
# Don't pass this Makefile's MAKEFLAGS
|
||||||
make MAKEFLAGS=
|
$(MAKE) MAKEFLAGS=
|
||||||
.PHONY: firefox-build
|
.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
|
firefox-install: ## Install the Firefox version of curl-impersonate after build
|
||||||
cd $(CURL_VERSION)
|
cd $(CURL_VERSION)
|
||||||
make install-exec MAKEFLAGS=
|
$(MAKE) install-exec MAKEFLAGS=
|
||||||
# Wrapper scripts for the Firefox version (e.g. 'curl_ff98')
|
# Wrapper scripts for the Firefox version (e.g. 'curl_ff98')
|
||||||
cp -f $(srcdir)/firefox/curl_ff* @bindir@
|
cp -f $(srcdir)/firefox/curl_ff* @bindir@
|
||||||
.PHONY: firefox-install
|
.PHONY: firefox-install
|
||||||
|
|
||||||
firefox-uninstall: ## Uninstall the Firefox version of curl-impersonate after 'make install'
|
firefox-uninstall: ## Uninstall the Firefox version of curl-impersonate after 'make install'
|
||||||
cd $(CURL_VERSION)
|
cd $(CURL_VERSION)
|
||||||
make uninstall MAKEFLAGS=
|
$(MAKE) uninstall MAKEFLAGS=
|
||||||
rm -Rf @bindir@/curl_ff*
|
rm -Rf @bindir@/curl_ff*
|
||||||
.PHONY: firefox-uninstall
|
.PHONY: firefox-uninstall
|
||||||
|
|
||||||
chrome-build: $(CURL_VERSION)/.chrome ## Build the Chrome version of curl-impersonate
|
chrome-build: $(CURL_VERSION)/.chrome ## Build the Chrome version of curl-impersonate
|
||||||
cd $(CURL_VERSION)
|
cd $(CURL_VERSION)
|
||||||
# Don't pass this Makefile's MAKEFLAGS
|
# Don't pass this Makefile's MAKEFLAGS
|
||||||
make MAKEFLAGS=
|
$(MAKE) MAKEFLAGS=
|
||||||
.PHONY: chrome-build
|
.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
|
chrome-install: ## Install the Chrome version of curl-impersonate after build
|
||||||
cd $(CURL_VERSION)
|
cd $(CURL_VERSION)
|
||||||
make install-exec MAKEFLAGS=
|
$(MAKE) install-exec MAKEFLAGS=
|
||||||
# Wrapper scripts for the Chrome version (e.g. 'curl_chrome99')
|
# 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@
|
cp -f $(srcdir)/chrome/curl_chrome* $(srcdir)/chrome/curl_edge* $(srcdir)/chrome/curl_safari* @bindir@
|
||||||
.PHONY: chrome-install
|
.PHONY: chrome-install
|
||||||
|
|
||||||
chrome-uninstall: ## Uninstall the Chrome version of curl-impersonate after 'make install'
|
chrome-uninstall: ## Uninstall the Chrome version of curl-impersonate after 'make install'
|
||||||
cd $(CURL_VERSION)
|
cd $(CURL_VERSION)
|
||||||
make uninstall MAKEFLAGS=
|
$(MAKE) uninstall MAKEFLAGS=
|
||||||
rm -Rf @bindir@/curl_chrome* @bindir@/curl_edge* @bindir@/curl_safari*
|
rm -Rf @bindir@/curl_chrome* @bindir@/curl_edge* @bindir@/curl_safari*
|
||||||
.PHONY: chrome-uninstall
|
.PHONY: chrome-uninstall
|
||||||
|
|
||||||
@@ -137,21 +157,12 @@ $(boringssl_static_libs): boringssl.zip boringssl/.patched
|
|||||||
$(NGHTTP2_VERSION).tar.bz2:
|
$(NGHTTP2_VERSION).tar.bz2:
|
||||||
curl -L $(NGHTTP2_URL) -o $(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_static_libs): $(NGHTTP2_VERSION).tar.bz2
|
||||||
$(NGHTTP2_VERSION)/.patched: $(srcdir)/firefox/patches/libnghttp2-*.patch
|
|
||||||
rm -Rf $(NGHTTP2_VERSION)
|
|
||||||
tar -xf $(NGHTTP2_VERSION).tar.bz2
|
tar -xf $(NGHTTP2_VERSION).tar.bz2
|
||||||
cd $(NGHTTP2_VERSION)
|
cd $(NGHTTP2_VERSION)
|
||||||
for p in $^; do patch -p1 < $$p; done
|
./configure --prefix=$(nghttp2_install_dir) --with-pic --disable-shared
|
||||||
# Re-generate the configure script
|
$(MAKE) MAKEFLAGS=
|
||||||
autoreconf -i && automake && autoconf
|
$(MAKE) install MAKEFLAGS=
|
||||||
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=
|
|
||||||
|
|
||||||
$(CURL_VERSION).tar.xz:
|
$(CURL_VERSION).tar.xz:
|
||||||
curl -L "https://curl.se/download/$(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 \
|
USE_CURL_SSLKEYLOGFILE=true \
|
||||||
CFLAGS="-I$(nss_install_dir)/../public/nss -I$(nss_install_dir)/include/nspr"
|
CFLAGS="-I$(nss_install_dir)/../public/nss -I$(nss_install_dir)/include/nspr"
|
||||||
# Remove possible leftovers from a previous compilation
|
# Remove possible leftovers from a previous compilation
|
||||||
make clean MAKEFLAGS=
|
$(MAKE) clean MAKEFLAGS=
|
||||||
touch .firefox
|
touch .firefox
|
||||||
# Remove the Chrome flag if it exists
|
# Remove the Chrome flag if it exists
|
||||||
rm -f .chrome
|
rm -f .chrome
|
||||||
@@ -207,7 +218,7 @@ $(CURL_VERSION)/.chrome: $(chrome_libs) $(CURL_VERSION).tar.xz $(CURL_VERSION)/.
|
|||||||
LIBS="-pthread" \
|
LIBS="-pthread" \
|
||||||
CFLAGS="-I$(boringssl_install_dir)"
|
CFLAGS="-I$(boringssl_install_dir)"
|
||||||
# Remove possible leftovers from a previous compilation
|
# Remove possible leftovers from a previous compilation
|
||||||
make clean MAKEFLAGS=
|
$(MAKE) clean MAKEFLAGS=
|
||||||
touch .chrome
|
touch .chrome
|
||||||
# Remove the Firefox flag if it exists
|
# Remove the Firefox flag if it exists
|
||||||
rm -f .firefox
|
rm -f .firefox
|
||||||
|
@@ -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 curl -o ${NGHTTP2_VERSION}.tar.bz2 -L ${NGHTTP2_URL}
|
||||||
RUN tar xf ${NGHTTP2_VERSION}.tar.bz2
|
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
|
# Compile nghttp2
|
||||||
RUN cd ${NGHTTP2_VERSION} && \
|
RUN cd ${NGHTTP2_VERSION} && \
|
||||||
./configure --with-pic && \
|
./configure --prefix=/build/${NGHTTP2_VERSION}/installed --with-pic --disable-shared && \
|
||||||
make && make install
|
make && make install
|
||||||
|
|
||||||
# Download curl.
|
# Download curl.
|
||||||
@@ -89,7 +83,7 @@ RUN cd ${CURL_VERSION} && \
|
|||||||
./configure --prefix=/build/install \
|
./configure --prefix=/build/install \
|
||||||
--enable-static \
|
--enable-static \
|
||||||
--disable-shared \
|
--disable-shared \
|
||||||
--with-nghttp2=/usr/local \
|
--with-nghttp2=/build/${NGHTTP2_VERSION}/installed \
|
||||||
--with-brotli=/build/brotli-${BROTLI_VERSION}/build/installed \
|
--with-brotli=/build/brotli-${BROTLI_VERSION}/build/installed \
|
||||||
--with-openssl=/build/boringssl/build \
|
--with-openssl=/build/boringssl/build \
|
||||||
LIBS="-pthread" \
|
LIBS="-pthread" \
|
||||||
@@ -102,12 +96,21 @@ RUN mkdir out && \
|
|||||||
ln -s curl-impersonate-chrome out/curl-impersonate && \
|
ln -s curl-impersonate-chrome out/curl-impersonate && \
|
||||||
strip 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
|
RUN rm -Rf /build/install
|
||||||
|
|
||||||
# Re-compile libcurl dynamically
|
# Re-compile libcurl dynamically
|
||||||
RUN cd ${CURL_VERSION} && \
|
RUN cd ${CURL_VERSION} && \
|
||||||
./configure --prefix=/build/install \
|
./configure --prefix=/build/install \
|
||||||
--with-nghttp2=/usr/local \
|
--with-nghttp2=/build/${NGHTTP2_VERSION}/installed \
|
||||||
--with-brotli=/build/brotli-${BROTLI_VERSION}/build/installed \
|
--with-brotli=/build/brotli-${BROTLI_VERSION}/build/installed \
|
||||||
--with-openssl=/build/boringssl/build \
|
--with-openssl=/build/boringssl/build \
|
||||||
LIBS="-pthread" \
|
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" && \
|
ln -s "libcurl-impersonate.so.$ver" "out/libcurl-impersonate.so" && \
|
||||||
strip "out/libcurl-impersonate.so.$ver"
|
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
|
# Wrapper scripts
|
||||||
COPY curl_chrome* curl_edge* curl_safari* out/
|
COPY curl_chrome* curl_edge* curl_safari* out/
|
||||||
RUN chmod +x out/curl_*
|
RUN chmod +x out/curl_*
|
||||||
|
@@ -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 curl -o ${NGHTTP2_VERSION}.tar.bz2 -L ${NGHTTP2_URL}
|
||||||
RUN tar xf ${NGHTTP2_VERSION}.tar.bz2
|
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
|
# Compile nghttp2
|
||||||
RUN cd ${NGHTTP2_VERSION} && \
|
RUN cd ${NGHTTP2_VERSION} && \
|
||||||
./configure --with-pic && \
|
./configure --prefix=/build/${NGHTTP2_VERSION}/installed --with-pic --disable-shared && \
|
||||||
make && make install
|
make && make install
|
||||||
|
|
||||||
# Download curl.
|
# Download curl.
|
||||||
@@ -86,7 +80,7 @@ RUN cd ${CURL_VERSION} && \
|
|||||||
./configure --prefix=/build/install \
|
./configure --prefix=/build/install \
|
||||||
--enable-static \
|
--enable-static \
|
||||||
--disable-shared \
|
--disable-shared \
|
||||||
--with-nghttp2=/usr/local \
|
--with-nghttp2=/build/${NGHTTP2_VERSION}/installed \
|
||||||
--with-brotli=/build/brotli-${BROTLI_VERSION}/build/installed \
|
--with-brotli=/build/brotli-${BROTLI_VERSION}/build/installed \
|
||||||
--with-openssl=/build/boringssl/build \
|
--with-openssl=/build/boringssl/build \
|
||||||
LIBS="-pthread" \
|
LIBS="-pthread" \
|
||||||
@@ -99,12 +93,21 @@ RUN mkdir out && \
|
|||||||
ln -s curl-impersonate-chrome out/curl-impersonate && \
|
ln -s curl-impersonate-chrome out/curl-impersonate && \
|
||||||
strip 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
|
RUN rm -Rf /build/install
|
||||||
|
|
||||||
# Re-compile libcurl dynamically
|
# Re-compile libcurl dynamically
|
||||||
RUN cd ${CURL_VERSION} && \
|
RUN cd ${CURL_VERSION} && \
|
||||||
./configure --prefix=/build/install \
|
./configure --prefix=/build/install \
|
||||||
--with-nghttp2=/usr/local \
|
--with-nghttp2=/build/${NGHTTP2_VERSION}/installed \
|
||||||
--with-brotli=/build/brotli-${BROTLI_VERSION}/build/installed \
|
--with-brotli=/build/brotli-${BROTLI_VERSION}/build/installed \
|
||||||
--with-openssl=/build/boringssl/build \
|
--with-openssl=/build/boringssl/build \
|
||||||
LIBS="-pthread" \
|
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" && \
|
ln -s "libcurl-impersonate.so.$ver" "out/libcurl-impersonate.so" && \
|
||||||
strip "out/libcurl-impersonate.so.$ver"
|
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
|
# Wrapper scripts
|
||||||
COPY curl_chrome* curl_edge* curl_safari* out/
|
COPY curl_chrome* curl_edge* curl_safari* out/
|
||||||
# Replace /bin/bash with /bin/ash
|
# Replace /bin/bash with /bin/ash
|
||||||
|
@@ -19,7 +19,7 @@ index 3e55230ee..e3ea22b96 100644
|
|||||||
# List of files required to generate VC IDE .dsp, .vcproj and .vcxproj files
|
# List of files required to generate VC IDE .dsp, .vcproj and .vcxproj files
|
||||||
include lib/Makefile.inc
|
include lib/Makefile.inc
|
||||||
diff --git a/configure.ac b/configure.ac
|
diff --git a/configure.ac b/configure.ac
|
||||||
index 63e320236..8c41e8501 100644
|
index 63e320236..86ab654c7 100644
|
||||||
--- a/configure.ac
|
--- a/configure.ac
|
||||||
+++ b/configure.ac
|
+++ b/configure.ac
|
||||||
@@ -1331,7 +1331,8 @@ if test X"$OPT_BROTLI" != Xno; then
|
@@ -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
|
if test -n "$PREFIX_BROTLI"; then
|
||||||
- LIB_BROTLI="-lbrotlidec"
|
- LIB_BROTLI="-lbrotlidec"
|
||||||
+ # curl-impersonate: Use static libbrotli
|
+ # 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
|
LD_BROTLI=-L${PREFIX_BROTLI}/lib$libsuff
|
||||||
CPP_BROTLI=-I${PREFIX_BROTLI}/include
|
CPP_BROTLI=-I${PREFIX_BROTLI}/include
|
||||||
DIR_BROTLI=${PREFIX_BROTLI}/lib$libsuff
|
DIR_BROTLI=${PREFIX_BROTLI}/lib$libsuff
|
||||||
|
@@ -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}
|
|
@@ -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 curl -o ${NGHTTP2_VERSION}.tar.bz2 -L ${NGHTTP2_URL}
|
||||||
RUN tar xf ${NGHTTP2_VERSION}.tar.bz2
|
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
|
# Compile nghttp2
|
||||||
RUN cd ${NGHTTP2_VERSION} && \
|
RUN cd ${NGHTTP2_VERSION} && \
|
||||||
./configure --with-pic && \
|
./configure --prefix=/build/${NGHTTP2_VERSION}/installed --with-pic --disable-shared && \
|
||||||
make && make install
|
make && make install
|
||||||
|
|
||||||
# Download curl.
|
# Download curl.
|
||||||
@@ -85,7 +79,7 @@ RUN cd ${CURL_VERSION} && \
|
|||||||
./configure --prefix=/build/install \
|
./configure --prefix=/build/install \
|
||||||
--enable-static \
|
--enable-static \
|
||||||
--disable-shared \
|
--disable-shared \
|
||||||
--with-nghttp2=/usr/local \
|
--with-nghttp2=/build/${NGHTTP2_VERSION}/installed \
|
||||||
--with-brotli=/build/brotli-${BROTLI_VERSION}/build/installed \
|
--with-brotli=/build/brotli-${BROTLI_VERSION}/build/installed \
|
||||||
--with-nss=/build/${NSS_VERSION}/dist/Release \
|
--with-nss=/build/${NSS_VERSION}/dist/Release \
|
||||||
CFLAGS="-I/build/${NSS_VERSION}/dist/public/nss -I/build/${NSS_VERSION}/dist/Release/include/nspr" \
|
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 && \
|
ln -s curl-impersonate-ff out/curl-impersonate && \
|
||||||
strip 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
|
RUN rm -Rf /build/install
|
||||||
|
|
||||||
# Re-compile libcurl dynamically
|
# Re-compile libcurl dynamically
|
||||||
RUN cd ${CURL_VERSION} && \
|
RUN cd ${CURL_VERSION} && \
|
||||||
./configure --prefix=/build/install \
|
./configure --prefix=/build/install \
|
||||||
--with-nghttp2=/usr/local \
|
--with-nghttp2=/build/${NGHTTP2_VERSION}/installed \
|
||||||
--with-brotli=/build/brotli-${BROTLI_VERSION}/build/installed \
|
--with-brotli=/build/brotli-${BROTLI_VERSION}/build/installed \
|
||||||
--with-nss=/build/${NSS_VERSION}/dist/Release \
|
--with-nss=/build/${NSS_VERSION}/dist/Release \
|
||||||
CFLAGS="-I/build/${NSS_VERSION}/dist/public/nss -I/build/${NSS_VERSION}/dist/Release/include/nspr" \
|
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" && \
|
ln -s "libcurl-impersonate.so.$ver" "out/libcurl-impersonate.so" && \
|
||||||
strip "out/libcurl-impersonate.so.$ver"
|
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
|
# Wrapper scripts
|
||||||
COPY curl_ff* out/
|
COPY curl_ff* out/
|
||||||
RUN chmod +x out/curl_*
|
RUN chmod +x out/curl_*
|
||||||
|
@@ -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 curl -o ${NGHTTP2_VERSION}.tar.bz2 -L ${NGHTTP2_URL}
|
||||||
RUN tar xf ${NGHTTP2_VERSION}.tar.bz2
|
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
|
# Compile nghttp2
|
||||||
RUN cd ${NGHTTP2_VERSION} && \
|
RUN cd ${NGHTTP2_VERSION} && \
|
||||||
./configure --with-pic && \
|
./configure --prefix=/build/${NGHTTP2_VERSION}/installed --with-pic --disable-shared && \
|
||||||
make && make install
|
make && make install
|
||||||
|
|
||||||
# Download curl.
|
# Download curl.
|
||||||
@@ -80,7 +74,7 @@ RUN cd ${CURL_VERSION} && \
|
|||||||
./configure --prefix=/build/install \
|
./configure --prefix=/build/install \
|
||||||
--enable-static \
|
--enable-static \
|
||||||
--disable-shared \
|
--disable-shared \
|
||||||
--with-nghttp2=/usr/local \
|
--with-nghttp2=/build/${NGHTTP2_VERSION}/installed \
|
||||||
--with-brotli=/build/brotli-${BROTLI_VERSION}/build/installed \
|
--with-brotli=/build/brotli-${BROTLI_VERSION}/build/installed \
|
||||||
--with-nss=/build/${NSS_VERSION}/dist/Release \
|
--with-nss=/build/${NSS_VERSION}/dist/Release \
|
||||||
CFLAGS="-I/build/${NSS_VERSION}/dist/public/nss -I/build/${NSS_VERSION}/dist/Release/include/nspr" \
|
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 && \
|
ln -s curl-impersonate-ff out/curl-impersonate && \
|
||||||
strip 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
|
RUN rm -Rf /build/install
|
||||||
|
|
||||||
# Re-compile libcurl dynamically
|
# Re-compile libcurl dynamically
|
||||||
RUN cd ${CURL_VERSION} && \
|
RUN cd ${CURL_VERSION} && \
|
||||||
./configure --prefix=/build/install \
|
./configure --prefix=/build/install \
|
||||||
--with-nghttp2=/usr/local \
|
--with-nghttp2=/build/${NGHTTP2_VERSION}/installed \
|
||||||
--with-brotli=/build/brotli-${BROTLI_VERSION}/build/installed \
|
--with-brotli=/build/brotli-${BROTLI_VERSION}/build/installed \
|
||||||
--with-nss=/build/${NSS_VERSION}/dist/Release \
|
--with-nss=/build/${NSS_VERSION}/dist/Release \
|
||||||
CFLAGS="-I/build/${NSS_VERSION}/dist/public/nss -I/build/${NSS_VERSION}/dist/Release/include/nspr" \
|
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" && \
|
ln -s "libcurl-impersonate.so.$ver" "out/libcurl-impersonate.so" && \
|
||||||
strip "out/libcurl-impersonate.so.$ver"
|
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
|
# Wrapper scripts
|
||||||
COPY curl_ff* out/
|
COPY curl_ff* out/
|
||||||
# Replace /bin/bash with /bin/ash
|
# Replace /bin/bash with /bin/ash
|
||||||
|
@@ -19,7 +19,7 @@ index 3e55230ee..90b504b5c 100644
|
|||||||
# List of files required to generate VC IDE .dsp, .vcproj and .vcxproj files
|
# List of files required to generate VC IDE .dsp, .vcproj and .vcxproj files
|
||||||
include lib/Makefile.inc
|
include lib/Makefile.inc
|
||||||
diff --git a/configure.ac b/configure.ac
|
diff --git a/configure.ac b/configure.ac
|
||||||
index 63e320236..238addfaa 100644
|
index 63e320236..40f67f137 100644
|
||||||
--- a/configure.ac
|
--- a/configure.ac
|
||||||
+++ b/configure.ac
|
+++ b/configure.ac
|
||||||
@@ -1331,7 +1331,8 @@ if test X"$OPT_BROTLI" != Xno; then
|
@@ -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
|
if test -n "$PREFIX_BROTLI"; then
|
||||||
- LIB_BROTLI="-lbrotlidec"
|
- LIB_BROTLI="-lbrotlidec"
|
||||||
+ # curl-impersonate: Use static libbrotli
|
+ # 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
|
LD_BROTLI=-L${PREFIX_BROTLI}/lib$libsuff
|
||||||
CPP_BROTLI=-I${PREFIX_BROTLI}/include
|
CPP_BROTLI=-I${PREFIX_BROTLI}/include
|
||||||
DIR_BROTLI=${PREFIX_BROTLI}/lib$libsuff
|
DIR_BROTLI=${PREFIX_BROTLI}/lib$libsuff
|
||||||
|
@@ -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}
|
|
Reference in New Issue
Block a user