Skip to content

Commit

Permalink
Disable extraneous linking in released binaries
Browse files Browse the repository at this point in the history
Libraries present on the CI runner system might affect the released
binaries. Specifically, the MacOS runner in GitHub has librtsp, libidn2
and zstd installed, which makes curl link against them.

Explicitly disable these linking, as we want to keep the precompiled
binaries in our releases with minimal requirements. A user wishing to
use these specific features can build from source on a system with these
libraries present.
  • Loading branch information
lwthiker committed Mar 2, 2024
1 parent 45a364b commit c8465c1
Show file tree
Hide file tree
Showing 6 changed files with 41 additions and 14 deletions.
3 changes: 2 additions & 1 deletion .github/workflows/build-and-test-make.yml
Original file line number Diff line number Diff line change
Expand Up @@ -105,7 +105,8 @@ jobs:
if: matrix.arch == 'x86_64'
run: |
mkdir ${{ runner.temp }}/install
./configure --prefix=${{ runner.temp }}/install
./configure --prefix=${{ runner.temp }}/install \
CURL_CONFIG_FLAGS="--disable-rtsp --without-libidn2 --without-zstd"
# When cross compiling a more complicated configuration is needed, since
# curl's configure script can't figure out where some files and libraries
Expand Down
9 changes: 9 additions & 0 deletions INSTALL.md
Original file line number Diff line number Diff line change
Expand Up @@ -134,6 +134,15 @@ cd ../ && rm -Rf build

To compile curl-impersonate statically with libcurl-impersonate, pass `--enable-static` to the `configure` script.

### Configuring curl's build

You might want to configure the underlying curl build to your needs.
To do that, use the `CURL_CONFIG_FLAGS` variable. These flags will be passed down to curl's `configure` script:

```sh
../configure CURL_CONFIG_FLAGS="--disable-rtsp"
```

### A note about the Firefox version

The Firefox version compiles a static version of nss, Firefox's TLS library.
Expand Down
9 changes: 7 additions & 2 deletions Makefile.in
Original file line number Diff line number Diff line change
Expand Up @@ -57,6 +57,9 @@ CC = @CC@
CXX = @CXX@
STRIP = @STRIP@

# Additional flags to be passed down to curl's configure script during build.
CURL_CONFIG_FLAGS = @CURL_CONFIG_FLAGS@

# Auto-generate Makefile help.
# Borrowed from https://marmelab.com/blog/2016/02/29/auto-documented-makefile.html
help: ## Show this help message
Expand Down Expand Up @@ -360,7 +363,8 @@ $(CURL_VERSION)/.firefox: $(firefox_libs) $(CURL_VERSION).tar.xz $(CURL_VERSION)
# If the user provided the --host flag to our configure script
# (for cross compilation), then pass it on to curl.
{ \
config_flags="--prefix=@prefix@"; \
config_flags="$(CURL_CONFIG_FLAGS)"; \
config_flags+=" --prefix=@prefix@"; \
config_flags+=" --with-nghttp2=$(nghttp2_install_dir)"; \
config_flags+=" --with-brotli=$(brotli_install_dir)"; \
config_flags+=" --with-nss=$(nss_install_dir) --with-nss-deprecated"; \
Expand Down Expand Up @@ -401,7 +405,8 @@ $(CURL_VERSION)/.chrome: $(chrome_libs) $(CURL_VERSION).tar.xz $(CURL_VERSION)/.
# If the user provided the --host flag to our configure script
# (for cross compilation), then pass it on to curl.
{ \
config_flags="--prefix=@prefix@"; \
config_flags="$(CURL_CONFIG_FLAGS)"; \
config_flags="$$config_flags --prefix=@prefix@"; \
config_flags="$$config_flags --with-nghttp2=$(nghttp2_install_dir)"; \
config_flags="$$config_flags --with-brotli=$(brotli_install_dir)"; \
config_flags="$$config_flags --with-openssl=$(boringssl_install_dir)"; \
Expand Down
6 changes: 5 additions & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -74,12 +74,16 @@ More documentation is available in the [docs/](docs/README.md) directory.
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. Before you use them you need to install nss (Firefox's TLS library) and CA certificates:
Pre-compiled binaries for Linux and macOS (Intel) are available at the [GitHub releases](https://github.com/lwthiker/curl-impersonate/releases) page.
Before you use them you need to install nss (Firefox's TLS library) and CA certificates:
* Ubuntu - `sudo apt install libnss3 nss-plugin-pem ca-certificates`
* Red Hat/Fedora/CentOS - `yum install nss nss-pem ca-certificates`
* Archlinux - `pacman -S nss ca-certificates`
* macOS - `brew install nss ca-certificates`

Also ensure you have zlib installed on your system.
zlib is almost always present, but on some minimal systems it might be missing.

The pre-compiled binaries contain libcurl-impersonate and a statically compiled curl-impersonate for ease of use.

The pre-compiled Linux binaries are built for Ubuntu systems. On other distributions if you have errors with certificate verification you may have to tell curl where to find the CA certificates. For example:
Expand Down
26 changes: 16 additions & 10 deletions configure
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
#! /bin/sh
# Guess values for system-dependent variables and create Makefiles.
# Generated by GNU Autoconf 2.71 for curl-impersonate 0.5.0.
# Generated by GNU Autoconf 2.71 for curl-impersonate 0.6.0.
#
# Report bugs to <[email protected]>.
#
Expand Down Expand Up @@ -610,15 +610,16 @@ MAKEFLAGS=
# Identity of this package.
PACKAGE_NAME='curl-impersonate'
PACKAGE_TARNAME='curl-impersonate'
PACKAGE_VERSION='0.5.0'
PACKAGE_STRING='curl-impersonate 0.5.0'
PACKAGE_VERSION='0.6.0'
PACKAGE_STRING='curl-impersonate 0.6.0'
PACKAGE_BUGREPORT='[email protected]'
PACKAGE_URL=''

ac_subst_vars='LTLIBOBJS
LIBOBJS
ninja
cmake
CURL_CONFIG_FLAGS
with_libnssckbi
with_ca_path
with_ca_bundle
Expand Down Expand Up @@ -701,7 +702,8 @@ LIBS
CPPFLAGS
CXX
CXXFLAGS
CCC'
CCC
CURL_CONFIG_FLAGS'


# Initialize some variables set by options.
Expand Down Expand Up @@ -1250,7 +1252,7 @@ if test "$ac_init_help" = "long"; then
# Omit some internal or obsolete options to make the list less imposing.
# This message is too long to be a string in the A/UX 3.1 sh.
cat <<_ACEOF
\`configure' configures curl-impersonate 0.5.0 to adapt to many kinds of systems.
\`configure' configures curl-impersonate 0.6.0 to adapt to many kinds of systems.
Usage: $0 [OPTION]... [VAR=VALUE]...
Expand Down Expand Up @@ -1317,7 +1319,7 @@ fi

if test -n "$ac_init_help"; then
case $ac_init_help in
short | recursive ) echo "Configuration of curl-impersonate 0.5.0:";;
short | recursive ) echo "Configuration of curl-impersonate 0.6.0:";;
esac
cat <<\_ACEOF
Expand Down Expand Up @@ -1354,6 +1356,8 @@ Some influential environment variables:
you have headers in a nonstandard directory <include dir>
CXX C++ compiler command
CXXFLAGS C++ compiler flags
CURL_CONFIG_FLAGS
"configuration flags to be passed down to curls 'configure'"
Use these variables to override the choices made by `configure' or to help
it to find libraries and programs with nonstandard names/locations.
Expand Down Expand Up @@ -1422,7 +1426,7 @@ fi
test -n "$ac_init_help" && exit $ac_status
if $ac_init_version; then
cat <<\_ACEOF
curl-impersonate configure 0.5.0
curl-impersonate configure 0.6.0
generated by GNU Autoconf 2.71
Copyright (C) 2021 Free Software Foundation, Inc.
Expand Down Expand Up @@ -1584,7 +1588,7 @@ cat >config.log <<_ACEOF
This file contains any messages produced by compilers while
running configure, to aid debugging if configure makes a mistake.
It was created by curl-impersonate $as_me 0.5.0, which was
It was created by curl-impersonate $as_me 0.6.0, which was
generated by GNU Autoconf 2.71. Invocation command line was
$ $0$ac_configure_args_raw
Expand Down Expand Up @@ -4223,6 +4227,8 @@ else $as_nop
fi
# BoringSSL requires cmake 3.5+, which is sometimes available under
# "cmake3" instead of "cmake"
for ac_prog in cmake3 cmake
Expand Down Expand Up @@ -4859,7 +4865,7 @@ cat >>$CONFIG_STATUS <<\_ACEOF || ac_write_fail=1
# report actual input values of CONFIG_FILES etc. instead of their
# values after options handling.
ac_log="
This file was extended by curl-impersonate $as_me 0.5.0, which was
This file was extended by curl-impersonate $as_me 0.6.0, which was
generated by GNU Autoconf 2.71. Invocation command line was
CONFIG_FILES = $CONFIG_FILES
Expand Down Expand Up @@ -4914,7 +4920,7 @@ ac_cs_config_escaped=`printf "%s\n" "$ac_cs_config" | sed "s/^ //; s/'/'\\\\\\\\
cat >>$CONFIG_STATUS <<_ACEOF || ac_write_fail=1
ac_cs_config='$ac_cs_config_escaped'
ac_cs_version="\\
curl-impersonate config.status 0.5.0
curl-impersonate config.status 0.6.0
configured by $0, generated by GNU Autoconf 2.71,
with options \\"\$ac_cs_config\\"
Expand Down
2 changes: 2 additions & 0 deletions configure.ac
Original file line number Diff line number Diff line change
Expand Up @@ -67,6 +67,8 @@ AC_ARG_WITH([libnssckbi],
[AC_SUBST([with_libnssckbi], ["$withval"])],
[AC_SUBST([with_libnssckbi], [""])])

AC_ARG_VAR([CURL_CONFIG_FLAGS], ["configuration flags to be passed down to curls 'configure'"])

# BoringSSL requires cmake 3.5+, which is sometimes available under
# "cmake3" instead of "cmake"
AC_CHECK_PROGS([cmake], [cmake3 cmake])
Expand Down

0 comments on commit c8465c1

Please sign in to comment.