Fix build system to work on Red Hat-based systems

Tweak the curl-impersonate build system to make it work on Red Hat
based systems such as CentOS, Fedora and Amazon Linux.

* Change the Makefile to be more portable with different bash versions.
* Detect whether cmake is 'cmake' or 'cmake3', and whether ninja is
'ninja' or 'ninja-build'.
* Explicitly tell brotli to put its libraries in 'lib' dir, otherwise it
might put them in 'lib64' where curl doesn't find them.
* Add instructions for building curl-impersonate from source on Red Hat
based systems.
This commit is contained in:
lwthiker
2022-05-20 15:52:30 +03:00
parent 82bca6dab7
commit 41986464c4
3 changed files with 45 additions and 7 deletions
+27 -1
View File
@@ -10,7 +10,7 @@ There are two versions of `curl-impersonate` for technical reasons. The **chrome
## Native build
### Linux (Ubuntu)
### Ubuntu
Install dependencies for building all the components:
```
@@ -64,6 +64,32 @@ curl-impersonate-ff https://www.wikipedia.org
curl-impersonate-chrome https://www.wikipedia.org
```
### Red Hat based (CentOS/Fedora/Amazon Linux)
Install dependencies:
```
yum groupinstall "Development Tools"
yum install cmake cmake3 python3 python3-pip
# Install Ninja. This may depend on your system.
yum install ninja-build
# OR
pip3 install ninja
```
For the Firefox version, install NSS and gyp:
```
yum install nss nss-pem
pip3 install gyp-next
```
For the Chrome version, install Go.
You may need to follow the [Go installation instructions](https://go.dev/doc/install) if it's not packaged for your system:
```
yum install golang
```
Then follow the 'Ubuntu' instructions for the actual build.
### macOS
Install dependencies for building all the components:
```
+12 -6
View File
@@ -3,7 +3,7 @@
SHELL := bash
.ONESHELL:
.SHELLFLAGS := -eu -o pipefail -c
.SHELLFLAGS := -euc
.DELETE_ON_ERROR:
MAKEFLAGS += --warn-undefined-variables
MAKEFLAGS += --no-builtin-rules
@@ -150,8 +150,11 @@ $(brotli_static_libs): brotli-$(BROTLI_VERSION).tar.gz
cd brotli-$(BROTLI_VERSION)
mkdir -p out
cd out
cmake -DCMAKE_BUILD_TYPE=Release -DCMAKE_INSTALL_PREFIX=./installed ..
cmake --build . --config Release --target install
@cmake@ -DCMAKE_BUILD_TYPE=Release \
-DCMAKE_INSTALL_PREFIX=./installed \
-DCMAKE_INSTALL_LIBDIR=lib \
..
@cmake@ --build . --config Release --target install
$(NSS_VERSION).tar.gz:
@@ -181,8 +184,8 @@ boringssl/.patched: $(srcdir)/chrome/patches/boringssl-*.patch
$(boringssl_static_libs): boringssl.zip boringssl/.patched
mkdir -p $(boringssl_install_dir)
cd $(boringssl_install_dir)
cmake -DCMAKE_BUILD_TYPE=Release -DCMAKE_POSITION_INDEPENDENT_CODE=on -GNinja ..
ninja
@cmake@ -DCMAKE_BUILD_TYPE=Release -DCMAKE_POSITION_INDEPENDENT_CODE=on -GNinja ..
@ninja@
# Fix the directory structure so that curl can compile against it.
# See https://everything.curl.dev/source/build/tls/boringssl
mkdir -p lib
@@ -197,7 +200,10 @@ $(NGHTTP2_VERSION).tar.bz2:
$(nghttp2_static_libs): $(NGHTTP2_VERSION).tar.bz2
tar -xf $(NGHTTP2_VERSION).tar.bz2
cd $(NGHTTP2_VERSION)
./configure --prefix=$(nghttp2_install_dir) --with-pic --disable-shared
./configure --prefix=$(nghttp2_install_dir) \
--with-pic \
--disable-shared \
--disable-python-bindings
$(MAKE) MAKEFLAGS=
$(MAKE) install MAKEFLAGS=
+6
View File
@@ -6,6 +6,12 @@ AC_ARG_ENABLE([static],
[AC_SUBST([curl_configure_options], ["--enable-static --disable-shared"])],
[])
# BoringSSL requires cmake 3.5+, which is sometimes available under
# "cmake3" instead of "cmake"
AC_CHECK_PROGS([cmake], [cmake3 cmake])
AC_CHECK_PROGS([ninja], [ninja ninja-build])
AC_CONFIG_FILES([Makefile])
AC_OUTPUT