|
| 1 | +#!/bin/bash |
| 2 | + |
| 3 | +export CFLAGS=-"O2" |
| 4 | +export CXXFLAGS="-O2" |
| 5 | +set -e |
| 6 | +URL=https://archive.apache.org/dist/httpd/httpd-2.4.57.tar.bz2 |
| 7 | +TAR=$(echo $URL | sed -r 's|(.*)/||') |
| 8 | +DIR=$(echo $TAR | sed 's|.tar.*||g') |
| 9 | +PACKAGE=apache |
| 10 | +# Thanks LFS for systemd units |
| 11 | +BLFS_SYSTEMD_VER=20220720 |
| 12 | +# User check |
| 13 | +getent passwd apache > /dev/null |
| 14 | + |
| 15 | +if [ $? -eq 0 ]; then |
| 16 | + : |
| 17 | +else |
| 18 | + groupadd -g 25 apache && |
| 19 | + useradd -c "Apache Server" -d /srv/www -g apache \ |
| 20 | + -s /bin/false -u 25 apache |
| 21 | +fi |
| 22 | +# Get Package |
| 23 | + |
| 24 | +cd /blfs/builds |
| 25 | +wget $URL |
| 26 | +wget https://www.linuxfromscratch.org/patches/blfs/svn/httpd-2.4.57-blfs_layout-1.patch |
| 27 | +tar -xvf $TAR |
| 28 | +cd $DIR |
| 29 | + |
| 30 | +# Build |
| 31 | + |
| 32 | +patch -Np1 -i ../httpd-2.4.57-blfs_layout-1.patch && |
| 33 | + |
| 34 | +sed '/dir.*CFG_PREFIX/s@^@#@' -i support/apxs.in && |
| 35 | + |
| 36 | +sed -e '/HTTPD_ROOT/s:${ap_prefix}:/etc/httpd:' \ |
| 37 | + -e '/SERVER_CONFIG_FILE/s:${rel_sysconfdir}/::' \ |
| 38 | + -e '/AP_TYPES_CONFIG_FILE/s:${rel_sysconfdir}/::' \ |
| 39 | + -i configure && |
| 40 | + |
| 41 | +./configure --enable-authnz-fcgi \ |
| 42 | + --enable-layout=BLFS \ |
| 43 | + --enable-mods-shared="all cgi" \ |
| 44 | + --enable-mpms-shared=all \ |
| 45 | + --enable-suexec=shared \ |
| 46 | + --with-apr=/usr/bin/apr-1-config \ |
| 47 | + --with-apr-util=/usr/bin/apu-1-config \ |
| 48 | + --with-suexec-bin=/usr/lib/httpd/suexec \ |
| 49 | + --with-suexec-caller=apache \ |
| 50 | + --with-suexec-docroot=/srv/www \ |
| 51 | + --with-suexec-logfile=/var/log/httpd/suexec.log \ |
| 52 | + --with-suexec-uidmin=100 \ |
| 53 | + --with-suexec-userdir=public_html |
| 54 | + |
| 55 | +make -j22 |
| 56 | + |
| 57 | + |
| 58 | +# Install |
| 59 | +sudo make DESTDIR=/pkgs/$PACKAGE install |
| 60 | +mv -v /pkgs/$PACKAGE/usr/sbin/suexec /pkgs/$PACKAGE/usr/lib/httpd/suexec && |
| 61 | +chgrp apache /pkgs/$PACKAGE/usr/lib/httpd/suexec && |
| 62 | +chmod 4754 /pkgs/$PACKAGE/usr/lib/httpd/suexec |
| 63 | + |
| 64 | +echo "groupadd -g 25 apache && |
| 65 | +useradd -c "Apache Server" -d /srv/www -g apache \ |
| 66 | + -s /bin/false -u 25 apache" > /pkgs/$PACKAGE/postinst |
| 67 | +cd /pkgs |
| 68 | + |
| 69 | + |
| 70 | + |
| 71 | +sudo echo "apr-util nghttp2 openssl pcre2 zlib" > /pkgs/$PACKAGE/depends |
| 72 | +sudo echo "" > /pkgs/$PACKAGE/make-depends |
| 73 | +sudo tar -cvzpf $PACKAGE.tar.xz $PACKAGE |
| 74 | +sudo cp $PACKAGE.tar.xz /finished |
| 75 | + |
| 76 | + |
| 77 | +cd /blfs/builds |
| 78 | +sudo rm -r $DIR |
| 79 | + |
| 80 | + |
0 commit comments