etc: Enable a tty for a serial port by default.
[dragora.git] / recipes / tools / qi / recipe
blob00389f251dbbe319fae37c460c33e37a83922f7e
1 # Build recipe for qi.
3 # Copyright (c) 2017-2024 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=qi
21 version=2.12
22 arch=noarch
23 release=1
25 # Define a category for the output of the package name
26 pkgcategory=tools
28 tarname=${program}-${version}.tar.lz
30 # Remote source(s)
31 fetch="
32  https://dragora.mirror.garr.it/current/sources/$tarname
33  rsync://rsync.dragora.org/current/sources/$tarname
36 description="
37 A user-friendly package manager (version $version).
39 Qi is a simple but well-integrated package manager.  It can create,
40 install, remove, and upgrade software packages.  Qi produces binary
41 packages using recipes, which are files containing specific instructions
42 to build each package from source.  Qi can manage multiple packages
43 under a single directory hierarchy.  This method allows to maintain a
44 set of packages and multiple versions of them.  This means that Qi could
45 be used as the main package manager or complement the existing one.
47 Qi offers a friendly command line interface, a global configuration
48 file, a simple recipe layout to deploy software packages; also works
49 with binary packages in parallel, speeding up installations and packages
50 in production.  The format used for packages is a simplified and safer
51 variant of POSIX pax archive compressed in lzip format.
53 Qi is a modern (POSIX-compliant) shell script released under the
54 terms of the GNU General Public License.  There are only two major
55 dependencies for the magic: graft(1) and tarlz(1), the rest is expected
56 to be found in any Unix-like system.
59 homepage=https://www.dragora.org
60 license=GPLv3+
62 # Source documentation
63 docs="AUTHORS COPYING CREDITS NEWS README.md doc/example.order doc/recipe*"
64 docsdir="${docdir}/${program}"
66 # Limit package name to the program name
67 full_pkgname="${program}@${pkgcategory}"
69 build()
71     # Figure out architecture name for default package names in Dragora 3+
72     #
73     # See git_tree/targets/ for 'package_arch' on it.
74     #
75     case $(gcc -dumpmachine) in
76     aarch64-*)
77         package_arch=arm64
78         ;;
79     arm-*-musleabi)
80         package_arch=armfp
81         ;;
82     arm-*-musleabihf)
83         package_arch=armhf
84         ;;
85     armv7hl-*-musleabihf)
86         package_arch=armhl
87         ;;
88     *x32-*)
89         package_arch=x32
90         ;;
91     x86_64-*)
92         package_arch=amd64
93         ;;
94     powerpc64le-*)
95         package_arch=ppc64le
96         ;;
97     esac
99     unpack "${tardir}/$tarname"
101     cd "$srcdir"
103     # Set sane permissions
104     chmod -R u+w,go-w,a+rX-s .
106     ./configure \
107      --prefix=/usr \
108      --libexecdir=/usr/libexec \
109      --bindir=/usr/bin \
110      --sbindir=/usr/sbin \
111      --sysconfdir=/etc \
112      --localstatedir=/var \
113      --infodir=/usr/share/info \
114      --mandir=/usr/share/man \
115      --docdir=/usr/share/doc \
116      --packagedir=/usr/pkg \
117      --targetdir=/ \
118      --arch="${package_arch:-$(uname -m)}" \
119      --qi-cflags="$QICFLAGS" \
120      --qi-cxxflags="$QICXXFLAGS" \
121      --qi-ldflags="$QILDFLAGS" \
122      --qi-cppflags="$QICPPFLAGS"
124     unset -v package_arch
125     make -j${jobs} DESTDIR="$destdir" install
127     ln -s qi "${destdir}/usr/bin/dragora-qi"
129     # Copy the config file used in the temporary system
130     if test -r /tools/etc/qirc && test ! -e /etc/qirc
131     then
132         cp -p /tools/etc/qirc "${destdir}/etc/"
133         cp -p /tools/etc/qirc "${destdir}/etc/qirc.bak"
134         chmod 644 "${destdir}"/etc/qirc*
135     fi
137     # Manage dot new file(s)
138     touch "${destdir}/etc/.graft-config"
140     # Compress and copy source documents
142     rm -f "${destdir}/${infodir}/dir"
143     lzip -9 "${destdir}/${infodir}/qi.info" \
144             "${destdir}/${mandir}/man1/qi.1"
146     mkdir -p "${destdir}/$docsdir"
147     cp -p $docs "${destdir}/$docsdir"