recipe 3.6 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130
  1. # Build recipe for mksh and lksh.
  2. #
  3. # Copyright (c) 2017-2019 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=R57
  18. release=3
  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. # Limit package name to the program name
  36. full_pkgname=$program
  37. # Source documentation
  38. docsdir="${docdir}/${program}"
  39. # Source directory name
  40. srcdir=mksh
  41. build()
  42. {
  43. set -e
  44. # Create package structure
  45. mkdir -p "${destdir}/etc/skel" \
  46. "${destdir}/usr/bin" \
  47. "${destdir}/${mandir}/man1"
  48. unpack "${tardir}/$tarname"
  49. cd "$srcdir"
  50. # Set sane permissions
  51. chmod -R u+w,go-w,a+rX-s .
  52. # Create a separate build directory
  53. rm -rf ../mksh-build ../lksh-build
  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 ../${srcdir}/Build.sh -r && ./test.sh
  61. env CFLAGS="$QICFLAGS" LDFLAGS="$QILDFLAGS" LDSTATIC=-static \
  62. sh ../${srcdir}/Build.sh -r
  63. )
  64. cp -p mksh "${destdir}/usr/bin/"
  65. chmod 755 "${destdir}/usr/bin/mksh"
  66. #cp -p ../${srcdir}/dot.mkshrc "${destdir}/etc/skel/.mkshrc"
  67. cp -p "${archive}/etc/skel/.mkshrc" "${destdir}/etc/skel/"
  68. chmod 644 "${destdir}/etc/skel/.mkshrc"
  69. # To manage (dot new) config file
  70. touch "${destdir}/etc/skel/.graft-config"
  71. cp -p ../${srcdir}/mksh.1 "${destdir}/${mandir}/man1/"
  72. chmod 644 "${destdir}/${mandir}/man1/mksh.1"
  73. # Build and install lksh (legacy)
  74. cd ../lksh-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 ../${srcdir}/Build.sh -L -r && ./test.sh
  79. env CPPFLAGS="$CPPFLAGS -DMKSH_BINSHPOSIX" \
  80. CFLAGS="$QICFLAGS" LDFLAGS="$QILDFLAGS" LDSTATIC=-static \
  81. sh ../${srcdir}/Build.sh -L -r
  82. )
  83. cp -p lksh "${destdir}/usr/bin/"
  84. chmod 755 "${destdir}/usr/bin/lksh"
  85. cp -p ../${srcdir}/lksh.1 "${destdir}/${mandir}/man1/"
  86. chmod 644 "${destdir}/${mandir}/man1/lksh.1"
  87. # Make symlink to compose the default shell
  88. ( cd "${destdir}/usr/bin" && ln -sf lksh sh )
  89. # Compress manual pages
  90. if test -d "${destdir}/$mandir"
  91. then
  92. lzip -9 "${destdir}/${mandir}"/man?/*
  93. fi
  94. # Delete temporary build directories
  95. cd -- "$TMPDIR"
  96. rm -rf ./mksh-build ./lksh-build
  97. }