3 # Slackware build script for darkhttpd
5 # Yth | Pont-en-Royans, France | yth@ythogtha.org
7 # Copyright 2015-2016 Leonard Schmidt <lems@gmx.net>
10 # Redistribution and use of this script, with or without modification, is
11 # permitted provided that the following conditions are met:
13 # 1. Redistributions of this script must retain the above copyright
14 # notice, this list of conditions and the following disclaimer.
16 # THIS SOFTWARE IS PROVIDED BY THE AUTHOR "AS IS" AND ANY EXPRESS OR IMPLIED
17 # WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF
18 # MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO
19 # EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
20 # SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
21 # PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS;
22 # OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY,
23 # WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR
24 # OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF
25 # ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
27 # SlackBuild script for darkhttpd
28 # ===========================
29 # By: r1w1s1 (https://fosstodon.org/@r1w1s1)
31 # Descr: When you need a web server in a hurry.
32 # URL: https://unix4lyfe.org/darkhttpd/
34 # v1.16.0: Initial build Yth
35 # v1.16.0: 10/jan/2025 by r1w1s1 - add rc start file and default file with parameters.
37 cd $
(dirname $0) ; CWD
=$
(pwd)
40 VERSION
=${VERSION:-1.16}
43 PKGTYPE
=${PKGTYPE:-tgz}
45 if [ -z "$ARCH" ]; then
46 case "$( uname -m )" in
49 *) ARCH
=$
( uname
-m ) ;;
53 # If the variable PRINT_PACKAGE_NAME is set, then this script will report what
54 # the name of the created package would be, and then exit. This information
55 # could be useful to other scripts.
56 if [ ! -z "${PRINT_PACKAGE_NAME}" ]; then
57 echo "$PRGNAM-$VERSION-$ARCH-$BUILD$TAG.$PKGTYPE"
62 PKG
=$TMP/package-
$PRGNAM
63 OUTPUT
=${OUTPUT:-/tmp}
65 if [ "$ARCH" = "i586" ]; then
66 SLKCFLAGS
="-O2 -march=i586 -mtune=i686"
68 elif [ "$ARCH" = "i686" ]; then
69 SLKCFLAGS
="-O2 -march=i686 -mtune=i686"
71 elif [ "$ARCH" = "x86_64" ]; then
82 mkdir
-p $TMP $PKG $OUTPUT
84 rm -rf $PRGNAM-$VERSION
85 tar xvf
$CWD/$PRGNAM-$VERSION.
tar.gz
89 \
( -perm 777 -o -perm 775 -o -perm 750 -o -perm 711 -o -perm 555 \
90 -o -perm 511 \
) -exec chmod 755 {} \
; -o \
91 \
( -perm 666 -o -perm 664 -o -perm 640 -o -perm 600 -o -perm 444 \
92 -o -perm 440 -o -perm 400 \
) -exec chmod 644 {} \
;
97 install -m755 darkhttpd
$PKG/usr
/bin
/
99 find $PKG -print0 |
xargs -0 file |
grep -e "executable" -e "shared object" |
grep ELF \
100 | cut
-f 1 -d : |
xargs strip
--strip-unneeded 2> /dev
/null || true
102 # Install init script:
103 mkdir
-p $PKG/etc
/rc.d
104 cp -a $CWD/rc.darkhttpd
$PKG/etc
/rc.d
/rc.darkhttpd.new
105 chmod 644 $PKG/etc
/rc.d
/rc.darkhttpd.new
107 # Install default options file for darkhttpd:
108 mkdir
-p $PKG/etc
/default
109 cat $CWD/default.darkhttpd
> $PKG/etc
/default
/darkhttpd.new
111 mkdir
-p $PKG/usr
/doc
/$PRGNAM-$VERSION
112 cp -a README
* $PKG/usr
/doc
/$PRGNAM-$VERSION
113 cat $CWD/$PRGNAM.SlackBuild
> $PKG/usr
/doc
/$PRGNAM-$VERSION/$PRGNAM.SlackBuild
115 # Install simple index.html
116 mkdir
-p $PKG/srv
/static
117 cp -a $CWD/index.html
$PKG/srv
/static
118 chown apache
:apache
$PKG/srv
/static
/index.html
120 # Install license (from Arch Linux' PKGBUILD)
121 head -n 18 darkhttpd.c
> $PKG/usr
/doc
/$PRGNAM-$VERSION/LICENSE
123 mkdir
-p $PKG/install
124 zcat
$CWD/doinst.sh.gz
> $PKG/install
/doinst.sh
125 cat $CWD/slack-desc
> $PKG/install
/slack-desc
128 /sbin
/makepkg
-l y
-c n
$OUTPUT/$PRGNAM-$VERSION-$ARCH-$BUILD$TAG.
$PKGTYPE