stages: 2/*: Adjust options for build the ISO
[dragora.git] / recipes / shells / mksh / recipe
blob2f4000715f79965ac198e6318cd300f3b876441e
1 # Build recipe for mksh (and lksh).
3 # Copyright (c) 2017-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=mksh
21 version=R59c
22 release=3
24 # Define a category for the output of the package name
25 pkgcategory=shells
27 tarname=${program}-${version}.tgz
29 # Remote source(s)
30 fetch=https://www.mirbsd.org/MirOS/dist/mir/mksh/$tarname
32 description="
33 The MirBSD Korn Shell (version $version).
35 mksh is the MirBSD enhanced version of the Public Domain Korn shell
36 (pdksh), a Bourne-compatible shell which is largely similar to the
37 original AT&T Korn shell; mksh is the only pdksh derivate currently
38 being actively developed.  It includes bug fixes and feature
39 improvements, in order to produce a modern, robust shell good for
40 interactive and especially script use.
43 homepage=https://www.mirbsd.org/mksh.htm
44 license="The MirOS Licence, ISC, special terms for use the BSD daemon mascot"
46 # Limit package name to the program name
47 full_pkgname="${program}@${pkgcategory}"
49 # Source documentation
50 docsdir="${docdir}/${program}"
52 # Source directory name
53 srcdir=mksh
55 build()
57     # Create package structure
58     mkdir -p "${destdir}/etc/skel" \
59              "${destdir}/usr/bin"  \
60              "${destdir}/${mandir}/man1"
62     unpack "${tardir}/$tarname"
64     cd "$srcdir"
66     # Set sane permissions
67     chmod -R u+w,go-w,a+rX-s .
69     # Create a separate build directory
70     mkdir mksh-build lksh-build
72     # Build and install mksh
74     cd mksh-build
75     (
76         # Build and ignore tests for now in this version of mksh-r57
77         # (../mksh/check.t:xxx-stat-1 needs further work)
78         #sh ../Build.sh -r && ./test.sh
80         env CPPFLAGS="$QICPPFLAGS" CFLAGS="$QICFLAGS" \
81             LDFLAGS="$QILDFLAGS" LDSTATIC=-static \
82         sh ../Build.sh -r
83     )
85     cp -p mksh "${destdir}/usr/bin/"
86     chmod 755 "${destdir}/usr/bin/mksh"
88     #cp -p ../${srcdir}/dot.mkshrc "${destdir}/etc/skel/.mkshrc"
89     cp -p "${archive}/etc/skel/.mkshrc" "${destdir}/etc/skel/"
90     chmod 644 "${destdir}/etc/skel/.mkshrc"
92     # To manage (dot new) config file
93     touch "${destdir}/etc/skel/.graft-config"
95     cd ..
97     cp -p mksh.1 "${destdir}/${mandir}/man1/"
98     chmod 644 "${destdir}/${mandir}/man1/mksh.1"
100     # Build and install lksh (legacy)
102     cd lksh-build
103     (
104         # Build and ignore tests for now in this version of mksh-r57
105         # (../mksh/check.t:xxx-stat-1 needs further work)
106         #sh ../Build.sh -L -r && ./test.sh
108         env CPPFLAGS="$QICPPFLAGS -DMKSH_BINSHPOSIX" \
109             CFLAGS="$QICFLAGS" LDFLAGS="$QILDFLAGS" LDSTATIC=-static \
110         sh ../Build.sh -L -r
111     )
113     cp -p lksh "${destdir}/usr/bin/"
114     chmod 755 "${destdir}/usr/bin/lksh"
116     cd ..
118     cp -p lksh.1 "${destdir}/${mandir}/man1/"
119     chmod 644 "${destdir}/${mandir}/man1/lksh.1"
121     # Make symlink to compose the default shell
122     ( cd "${destdir}/usr/bin" && ln -sf lksh sh )
124     # Compress manual pages
125     if test -d "${destdir}/$mandir"
126     then
127         lzip -9 "${destdir}/${mandir}"/man?/*
128     fi
130     # Build and copy documentation
131     sh FAQ2HTML.sh
132     mkdir -p "${destdir}/$docsdir"
133     cp -p FAQ.htm "${destdir}/$docsdir"