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
+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=