1 # Build recipe for mksh and lksh.
3 # Copyright (c) 2017-2018 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.
21 # Set 'outdir' for a nice and well-organized output directory
22 outdir="${outdir}/${arch}/shells"
24 tarname=${program}-${version}.tgz
27 fetch=http://www.mirbsd.org/MirOS/dist/mir/mksh/$tarname
30 The MirBSD Korn Shell.
32 mksh is the MirBSD enhanced version of the Public Domain Korn shell
33 (pdksh), a Bourne-compatible shell which is largely similar to the
34 original AT&T Korn shell; mksh is the only pdksh derivate currently
35 being actively developed. It includes bug fixes and feature
36 improvements, in order to produce a modern, robust shell good for
37 interactive and especially script use.
40 homepage=http://www.mirbsd.org/mksh.htm
41 license="The MirOS Licence, ISC, special terms for use the BSD daemon mascot"
43 # Source documentation
44 docsdir="${docdir}/${program}-${version}"
46 # Source directory name
53 # Create package structure first
54 mkdir -p "${destdir}/etc/skel" \
55 "${destdir}/usr/bin" \
56 "${destdir}/${mandir}/man1"
58 unpack "${tardir}/$tarname"
62 # Set sane permissions
63 chmod -R u+w,go-w,a+rX-s .
65 # Create a separate build directory
66 rm -rf ../mksh-build ../lksh-build
67 mkdir ../mksh-build ../lksh-build
69 # Build and install mksh
73 env CFLAGS="$QICFLAGS" LDFLAGS="$QILDFLAGS" LDSTATIC=-static \
74 sh ../${srcdir}/Build.sh -r && ./test.sh
77 cp -p mksh "${destdir}/usr/bin/"
78 chmod 755 "${destdir}/usr/bin/mksh"
80 #cp -p ../${srcdir}/dot.mkshrc "${destdir}/etc/skel/.mkshrc"
81 cp -p "${archive}/etc/skel/.mkshrc" "${destdir}/etc/skel/"
82 chmod 644 "${destdir}/etc/skel/.mkshrc"
84 # To manage (dot new) config file
85 touch "${destdir}/etc/skel/.graft-config"
87 cp -p ../${srcdir}/mksh.1 "${destdir}/${mandir}/man1/"
88 chmod 644 "${destdir}/${mandir}/man1/mksh.1"
90 # Build and install lksh (legacy)
94 env CPPFLAGS="$CPPFLAGS -DMKSH_BINSHPOSIX" \
95 CFLAGS="$QICFLAGS" LDFLAGS="$QILDFLAGS" LDSTATIC=-static \
96 sh ../${srcdir}/Build.sh -L -r && ./test.sh
99 cp -p lksh "${destdir}/usr/bin/"
100 chmod 755 "${destdir}/usr/bin/lksh"
102 cp -p ../${srcdir}/lksh.1 "${destdir}/${mandir}/man1/"
103 chmod 644 "${destdir}/${mandir}/man1/mksh.1"
105 # Make symlink to compose the default shell
106 ( cd "${destdir}/usr/bin" && ln -sf lksh sh )
108 # Compress manual pages
109 if test -d "${destdir}/$mandir"
111 lzip -9 "${destdir}/${mandir}"/man?/*
114 # Delete temporary build directories
116 rm -rf ./mksh-build ./lksh-build