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
24 # Define a category for the output of the package name
27 tarname=${program}-${version}.tgz
30 fetch=http://www.mirbsd.org/MirOS/dist/mir/mksh/$tarname
33 The MirBSD Korn Shell.
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=http://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
49 # Source documentation
50 docsdir="${docdir}/${program}"
52 # Source directory name
57 # Create package structure
58 mkdir -p "${destdir}/etc/skel" \
59 "${destdir}/usr/bin" \
60 "${destdir}/${mandir}/man1"
62 unpack "${tardir}/$tarname"
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
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 CFLAGS="$QICFLAGS" LDFLAGS="$QILDFLAGS" LDSTATIC=-static \
84 cp -p mksh "${destdir}/usr/bin/"
85 chmod 755 "${destdir}/usr/bin/mksh"
87 #cp -p ../${srcdir}/dot.mkshrc "${destdir}/etc/skel/.mkshrc"
88 cp -p "${archive}/etc/skel/.mkshrc" "${destdir}/etc/skel/"
89 chmod 644 "${destdir}/etc/skel/.mkshrc"
91 # To manage (dot new) config file
92 touch "${destdir}/etc/skel/.graft-config"
96 cp -p mksh.1 "${destdir}/${mandir}/man1/"
97 chmod 644 "${destdir}/${mandir}/man1/mksh.1"
99 # Build and install lksh (legacy)
103 # Build and ignore tests for now in this version of mksh-r57
104 # (../mksh/check.t:xxx-stat-1 needs further work)
105 #sh ../Build.sh -L -r && ./test.sh
107 env CPPFLAGS="$CPPFLAGS -DMKSH_BINSHPOSIX" \
108 CFLAGS="$QICFLAGS" LDFLAGS="$QILDFLAGS" LDSTATIC=-static \
112 cp -p lksh "${destdir}/usr/bin/"
113 chmod 755 "${destdir}/usr/bin/lksh"
117 cp -p lksh.1 "${destdir}/${mandir}/man1/"
118 chmod 644 "${destdir}/${mandir}/man1/lksh.1"
120 # Make symlink to compose the default shell
121 ( cd "${destdir}/usr/bin" && ln -sf lksh sh )
123 # Compress manual pages
124 if test -d "${destdir}/$mandir"
126 lzip -9 "${destdir}/${mandir}"/man?/*
129 # Build and copy documentation
131 mkdir -p "${destdir}${docsdir}"
132 cp -p FAQ.htm "${destdir}${docsdir}"