recipe 3.6 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136
  1. # Build recipe for mksh (and lksh).
  2. #
  3. # Copyright (c) 2017-2021, 2023 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. # Exit immediately on any error
  17. set -e
  18. program=mksh
  19. version=R59c
  20. release=4
  21. # Define a category for the output of the package name
  22. pkgcategory=shells
  23. tarname=${program}-${version}.tgz
  24. # Remote source(s)
  25. fetch=http://www.mirbsd.org/MirOS/dist/mir/mksh/$tarname
  26. description="
  27. The MirBSD Korn Shell (version $version).
  28. mksh is the MirBSD enhanced version of the Public Domain Korn shell
  29. (pdksh), a Bourne-compatible shell which is largely similar to the
  30. original AT&T Korn shell; mksh is the only pdksh derivate currently
  31. being actively developed. It includes bug fixes and feature
  32. improvements, in order to produce a modern, robust shell good for
  33. interactive and especially script use.
  34. "
  35. homepage=https://www.mirbsd.org/mksh.htm
  36. license="The MirOS Licence, ISC, special terms for use the BSD daemon mascot"
  37. # Limit package name to the program name
  38. full_pkgname="${program}@${pkgcategory}"
  39. # Source documentation
  40. docsdir="${docdir}/${program}"
  41. # Source directory name
  42. srcdir=mksh
  43. build()
  44. {
  45. # Create package structure
  46. mkdir -p "${destdir}/etc/skel" \
  47. "${destdir}/usr/bin" \
  48. "${destdir}/${mandir}/man1"
  49. unpack "${tardir}/$tarname"
  50. cd "$srcdir"
  51. # Set sane permissions
  52. chmod -R u+w,go-w,a+rX-s .
  53. # Create a separate build directory
  54. mkdir mksh-build lksh-build
  55. # Build and install mksh
  56. cd mksh-build
  57. (
  58. # Build and ignore tests for now in this version of mksh-r57
  59. # (../mksh/check.t:xxx-stat-1 needs further work)
  60. #sh ../Build.sh -r && ./test.sh
  61. env CPPFLAGS="$QICPPFLAGS" CFLAGS="$QICFLAGS" \
  62. LDFLAGS="$QILDFLAGS" LDSTATIC=-static \
  63. sh ../Build.sh -r
  64. )
  65. cp -p mksh "${destdir}/usr/bin/"
  66. chmod 755 "${destdir}/usr/bin/mksh"
  67. #cp -p ../${srcdir}/dot.mkshrc "${destdir}/etc/skel/.mkshrc"
  68. cp -p "${archive}/etc/skel/.mkshrc" "${destdir}/etc/skel/"
  69. chmod 644 "${destdir}/etc/skel/.mkshrc"
  70. # To manage (dot new) config file
  71. touch "${destdir}/etc/skel/.graft-config"
  72. cd ..
  73. cp -p mksh.1 "${destdir}/${mandir}/man1/"
  74. chmod 644 "${destdir}/${mandir}/man1/mksh.1"
  75. # Build and install lksh (legacy)
  76. cd lksh-build
  77. (
  78. # Build and ignore tests for now in this version of mksh-r57
  79. # (../mksh/check.t:xxx-stat-1 needs further work)
  80. #sh ../Build.sh -L -r && ./test.sh
  81. env CPPFLAGS="$QICPPFLAGS -DMKSH_BINSHPOSIX" \
  82. CFLAGS="$QICFLAGS" LDFLAGS="$QILDFLAGS" LDSTATIC=-static \
  83. sh ../Build.sh -L -r
  84. )
  85. cp -p lksh "${destdir}/usr/bin/"
  86. chmod 755 "${destdir}/usr/bin/lksh"
  87. cd ..
  88. cp -p lksh.1 "${destdir}/${mandir}/man1/"
  89. chmod 644 "${destdir}/${mandir}/man1/lksh.1"
  90. # Make symlink to compose the default shell
  91. ( cd "${destdir}/usr/bin" && ln -sf lksh sh )
  92. # Compress manual pages
  93. if test -d "${destdir}/$mandir"
  94. then
  95. lzip -9 "${destdir}/${mandir}"/man?/*
  96. fi
  97. # Build and copy documentation
  98. sh FAQ2HTML.sh
  99. mkdir -p "${destdir}/$docsdir"
  100. cp -p FAQ.htm "${destdir}/$docsdir"
  101. }