recipes: Adjust 'docsdir' variable to be consistent with the current recipe format
[dragora.git] / recipes / networking / lpppd / recipe
blobfa217208552186c79db5331e38332b09431359ec
1 # Build recipe for lpppd (a fork of ppp).
3 # Copyright (c) 2019-2021 Matias Fonzo, <selk@dragora.org>.
5 # Licensed under the Apache License, Version 2.0 (the "License");
6 # you may not use this file except in compliance with the License.
7 # You may obtain a copy of the License at
9 #    http://www.apache.org/licenses/LICENSE-2.0
11 # Unless required by applicable law or agreed to in writing, software
12 # distributed under the License is distributed on an "AS IS" BASIS,
13 # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
14 # See the License for the specific language governing permissions and
15 # limitations under the License.
17 # Exit immediately on any error
18 set -e
20 program=lpppd
21 version=20210106_7454257
22 release=1
24 # Define a category for the output of the package name
25 pkgcategory=networking
27 tarname=${program}-${version}.tar.lz
29 # Remote source(s)
30 fetch="
31  https://dragora.mirror.garr.it/current/sources/$tarname
32  rsync://rsync.dragora.org/current/sources/$tarname
35 description="
36 PPP daemon and associated utilities.
38 The lpppd package is a fork based on Paul Mackerras' PPP:
40   Targets glibc, musl libc and uClibc.
41   Collecting patches from various sources.
42   Use CMake build system.
43   Support for non-Linux systems removed.
44   Legacy protocol and library support removed.
45   Some general code modernization.
46   Building of plugins not supported at this time.
49 homepage=https://github.com/snickl/lpppd
50 license="GPLv2+ | Public domain, BSD-style notices"
52 # Source documentation
53 docs="CHANGELOG.md FAQ PLUGINS README* SETUP"
54 docsdir="${docdir}/${program}-${version}"
56 build()
58     unpack "${tardir}/$tarname"
60     cd "$srcdir"
62     mkdir BUILD
63     cd BUILD
65     cmake \
66      -DCMAKE_C_FLAGS_RELEASE:STRING="$QICFLAGS -fPIC -Wall -fno-strict-aliasing" \
67      -DCMAKE_EXE_LINKER_FLAGS:STRING="$QILDFLAGS"  \
68      -DCMAKE_INSTALL_PREFIX=/usr                   \
69      -DCMAKE_BUILD_TYPE=Release                    \
70      -DCMAKE_VERBOSE_MAKEFILE=ON                   \
71      -DOPTION_LPPPD_INET6=ON                       \
72      -DOPTION_LPPPD_PPPD_FILTER=ON                 \
73      -DOPTION_LPPPD_PPPD_MULTILINK=ON              \
74      -G Ninja ..
76     ninja -j${jobs}
77     DESTDIR="$destdir" ninja -j${jobs} install
79     cd ..
81     # Include pppd headers to expose rp-pppoe plugins
82     mkdir -p "${destdir}/usr/include/pppd"
83     for file in pppd/*.h
84     do
85         cp -p $file "${destdir}/usr/include/pppd"/
86         chmod 644 "${destdir}/usr/include/pppd/${file##*/}"
87     done
88     unset -v file
90     mkdir -p "${destdir}/usr/include/net"
91     cp -p include/net/ppp_defs.h "${destdir}/usr/include/net"/
92     chmod 644  "${destdir}/usr/include/net/ppp_defs.h"
94     # Add configuration files
95     mkdir -p "${destdir}/etc/ppp/peers"
96     for file in etc.ppp/*
97     do
98         cp -p $file "${destdir}/etc/ppp"/
99         chmod 644 "${destdir}/etc/ppp/${file##*/}"
100     done
101     unset -v file
103     chmod 600 "${destdir}"/etc/ppp/*-secrets*
104     touch "${destdir}/etc/ppp/.graft-config"
106     # Include scripts
107     for file in plog poff pon
108     do
109         cp -p scripts/${file} "${destdir}/usr/sbin"/
110         chmod 755 "${destdir}/usr/sbin/$file"
111     done
112     unset -v file
114     # Include manual page for pon
115     mkdir -p "${destdir}/${mandir}/man1"
116     cp -p scripts/pon.1 "${destdir}/${mandir}/man1"/
118     # Compress and link man pages (if needed)
119     if test -d "${destdir}/$mandir"
120     then
121         (
122             cd "${destdir}/$mandir"
123             find . -type f -exec lzip -9 {} +
124             find . -type l | while read -r file
125             do
126                 ln -sf "$(readlink -- "$file").lz" "${file}.lz"
127                 rm -- "$file"
128             done
129         )
130     fi
132     # Copy documentation
133     mkdir -p "${destdir}/$docsdir"
134     cp -p $docs "${destdir}/$docsdir"