From 92a13e2dfa4cfbf97eb841ef61aa982360cb3822 Mon Sep 17 00:00:00 2001 From: Karen Arutyunov Date: Fri, 23 Jun 2023 13:30:38 +0300 Subject: Add apache2 headers dir auto-detection and configurations for building with system packages --- INSTALL | 36 ++++++++++++++++++++---------------- build/root.build | 31 ++++++++++++++++++++++++++----- manifest | 20 ++++++++++++++++++-- tests/submit/submit-git.testscript | 6 +++++- 4 files changed, 69 insertions(+), 24 deletions(-) diff --git a/INSTALL b/INSTALL index 34aa1a7..77d30c0 100644 --- a/INSTALL +++ b/INSTALL @@ -77,33 +77,37 @@ d) Unless you already have the build2 toolchain, install it by following 3. Build and Install brep -Normally the only extra information that you need to provide on this step is -the location of the Apache2 headers (httpd.h, etc). Below are their locations -for some distributions: - -Debian/Ubuntu: /usr/include/apache2 -Fedora/RHEL: /usr/include/httpd -FreeBSD: /usr/local/include/apache24 - -You can also use the Apache2 apxs utility to obtain this information as shown -below. - $ mkdir brep $ cd brep -$ bpkg create \ - cc \ - config.cc.poptions="-I$(apxs -q includedir)" \ - config.bin.rpath=$HOME/install/lib \ +$ bpkg create \ + cc \ + config.bin.rpath=$HOME/install/lib \ config.install.root=$HOME/install $ bpkg add https://pkg.cppget.org/1/alpha $ bpkg fetch -$ bpkg build brep ?sys:libapr1/* ?sys:libapreq2/* ?sys:libpq/* +$ bpkg build brep ?sys:libapr1 ?sys:libapreq2 ?sys:libpq $ bpkg install brep $ cd .. # Back to brep home. +Note that by default the location of the Apache2 headers (httpd.h, etc) is +detected automatically, using the Apache2 apxs utility. Below are their +locations for some distributions: + +Debian/Ubuntu: /usr/include/apache2 +Fedora/RHEL: /usr/include/httpd +FreeBSD: /usr/local/include/apache24 + +To disable this functionality and specify the location explicitly, you can +configure brep in the development mode and specify the respective preprocessor +option by, for example, adding the following configuration variables to the +above bpkg-build command: + +config.brep.develop=true +config.cc.poptions="-I..." + 4. Create PostgreSQL User and Databases diff --git a/build/root.build b/build/root.build index 11c109f..a6b088e 100644 --- a/build/root.build +++ b/build/root.build @@ -1,6 +1,10 @@ # file : build/root.build # license : MIT; see accompanying LICENSE file +config [bool] config.brep.develop ?= false + +develop = $config.brep.develop + cxx.std = latest using cxx @@ -54,9 +58,26 @@ tests/{libue libul}{*}: bin.whole = false # test.target = $cxx.target -# Extract the copyright notice from the LICENSE file. +# Omit the rest during the skeleton load. # -copyright = $process.run_regex( \ - cat $src_root/LICENSE, \ - 'Copyright \(c\) (.+) \(see the AUTHORS and LEGAL files\)\.', \ - '\1') +if ($build.mode != 'skeleton') +{ + # Unless we are in the develop mode, detect the Apache2 headers location + # automatically and add the respective preprocessor option. + # + if! $develop + { + apache2_includedir = [dir_path] $process.run(apxs -q 'INCLUDEDIR') + + config [config.report] apache2_includedir + + cxx.poptions += "-I$apache2_includedir" + } + + # Extract the copyright notice from the LICENSE file. + # + copyright = $process.run_regex( \ + cat $src_root/LICENSE, \ + 'Copyright \(c\) (.+) \(see the AUTHORS and LEGAL files\)\.', \ + '\1') +} diff --git a/manifest b/manifest index a9b9b06..faf43ab 100644 --- a/manifest +++ b/manifest @@ -13,8 +13,6 @@ doc-url: https://build2.org/doc.xhtml src-url: https://git.build2.org/cgit/brep/tree/ email: users@build2.org build-warning-email: builds@build2.org -builds: linux freebsd ; Only supports Linux and FreeBSD. -builds: -linux -freebsd ; Requires system packages. requires: c++14 requires: postgresql >= 9.0 requires: apache2 ; Including development files (httpd.h header, etc). @@ -34,3 +32,21 @@ depends: libbpkg [0.16.0-a.0.1 0.16.0-a.1) depends: libbbot [0.16.0-a.0.1 0.16.0-a.1) depends: libbutl.bash [0.16.0-a.0.1 0.16.0-a.1) depends: bpkg-util [0.16.0-a.0.1 0.16.0-a.1) + +# This package dependens on platform-specific implementation libraries that +# are (currently) not packaged and need to come from the system package +# manager. It also requires rsync for tests. +# +builds: none + +debian-builds: sys +debian-build-exclude: linux_debian_12-** ; libapreq2 not available +debian-build-include: linux_debian*-** +debian-build-include: linux_ubuntu*-** +debian-build-exclude: ** +debian-build-config: sys:apache2-dev ?sys:libapr1 ?sys:libapreq2 ?sys:libpq sys:rsync + +fedora-builds: sys +fedora-build-include: linux_fedora*-** +fedora-build-exclude: ** +fedora-build-config: sys:httpd-devel ?sys:libapr1 ?sys:libapreq2 ?sys:libpq sys:rsync diff --git a/tests/submit/submit-git.testscript b/tests/submit/submit-git.testscript index ec87637..5197afc 100644 --- a/tests/submit/submit-git.testscript +++ b/tests/submit/submit-git.testscript @@ -21,7 +21,11 @@ clone_root_ref = [cmdline] cp --no-cleanup -r $root_ref ./ &ref.git/*** +mkdir --no-cleanup $root_ref +$g -C $root_ref init --bare &ref.git/*** -+$g clone $root_ref $root_ref_dir &ref/*** +# Convert specific warnings to infos as we expect them to appear. This, in +# particular, prevents bbot workers to set task result status to warning. +# ++git clone $root_ref $root_ref_dir &ref/*** 2>&1 | \ + sed -e 's/warning: (.*cloned an empty repository.*)/info: \1/' >&2 2>! +cat <=$root_ref_dir/submit.config.bash sections[alpha]=1/alpha -- cgit v1.1