recipe 3.2 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119
  1. # Build recipe for mksh and lksh.
  2. #
  3. # Copyright (c) 2017-2018 Matias Fonzo, <selk@dragora.org>.
  4. #
  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
  8. #
  9. # http://www.apache.org/licenses/LICENSE-2.0
  10. #
  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.
  16. program=mksh
  17. version=R56c
  18. release=1
  19. # Set 'outdir' for a nice and well-organized output directory
  20. outdir="${outdir}/${arch}/shells"
  21. tarname=${program}-${version}.tgz
  22. # Remote source(s)
  23. fetch=http://www.mirbsd.org/MirOS/dist/mir/mksh/$tarname
  24. description="
  25. The MirBSD Korn Shell.
  26. mksh is the MirBSD enhanced version of the Public Domain Korn shell
  27. (pdksh), a Bourne-compatible shell which is largely similar to the
  28. original AT&T Korn shell; mksh is the only pdksh derivate currently
  29. being actively developed. It includes bug fixes and feature
  30. improvements, in order to produce a modern, robust shell good for
  31. interactive and especially script use.
  32. "
  33. homepage=http://www.mirbsd.org/mksh.htm
  34. license="The MirOS Licence, ISC, special terms for use the BSD daemon mascot"
  35. # Source documentation
  36. docsdir="${docdir}/${program}-${version}"
  37. # Source directory name
  38. srcdir=mksh
  39. build()
  40. {
  41. set -e
  42. # Create package structure first
  43. mkdir -p "${destdir}/etc/skel" \
  44. "${destdir}/usr/bin" \
  45. "${destdir}/${mandir}/man1"
  46. unpack "${tardir}/$tarname"
  47. cd "$srcdir"
  48. # Set sane permissions
  49. chmod -R u+w,go-w,a+rX-s .
  50. # Create a separate build directory
  51. rm -rf ../mksh-build ../lksh-build
  52. mkdir ../mksh-build ../lksh-build
  53. # Build and install mksh
  54. cd ../mksh-build
  55. (
  56. env CFLAGS="$QICFLAGS" LDFLAGS="$QILDFLAGS" LDSTATIC=-static \
  57. sh ../${srcdir}/Build.sh -r && ./test.sh
  58. )
  59. cp -p mksh "${destdir}/usr/bin/"
  60. chmod 755 "${destdir}/usr/bin/mksh"
  61. #cp -p ../${srcdir}/dot.mkshrc "${destdir}/etc/skel/.mkshrc"
  62. cp -p "${archive}/etc/skel/.mkshrc" "${destdir}/etc/skel/"
  63. chmod 644 "${destdir}/etc/skel/.mkshrc"
  64. # To manage (dot new) config file
  65. touch "${destdir}/etc/skel/.graft-config"
  66. cp -p ../${srcdir}/mksh.1 "${destdir}/${mandir}/man1/"
  67. chmod 644 "${destdir}/${mandir}/man1/mksh.1"
  68. # Build and install lksh (legacy)
  69. cd ../lksh-build
  70. (
  71. env CPPFLAGS="$CPPFLAGS -DMKSH_BINSHPOSIX" \
  72. CFLAGS="$QICFLAGS" LDFLAGS="$QILDFLAGS" LDSTATIC=-static \
  73. sh ../${srcdir}/Build.sh -L -r && ./test.sh
  74. )
  75. cp -p lksh "${destdir}/usr/bin/"
  76. chmod 755 "${destdir}/usr/bin/lksh"
  77. cp -p ../${srcdir}/lksh.1 "${destdir}/${mandir}/man1/"
  78. chmod 644 "${destdir}/${mandir}/man1/mksh.1"
  79. # Make symlink to compose the default shell
  80. ( cd "${destdir}/usr/bin" && ln -sf lksh sh )
  81. # Compress manual pages
  82. if test -d "${destdir}/$mandir"
  83. then
  84. lzip -9 "${destdir}/${mandir}"/man?/*
  85. fi
  86. # Delete temporary build directories
  87. cd -- "$TMPDIR"
  88. rm -rf ./mksh-build ./lksh-build
  89. }