recipe 4.2 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144
  1. # Build recipe for nss.
  2. #
  3. # Copyright (c) 2021-2022 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=nss
  19. version=3_86
  20. pkgversion=$(echo $version | tr _ .)
  21. release=1
  22. # Define a category for the output of the package name
  23. pkgcategory=networking
  24. tarname=${program}-${pkgversion}.tar.gz
  25. # Remote source(s)
  26. fetch=https://ftp.mozilla.org/pub/security/nss/releases/NSS_${version}_RTM/src/$tarname
  27. description="
  28. Network security services.
  29. Network Security Services (NSS) is a set of libraries designed to
  30. support cross-platform development of security-enabled client and
  31. server applications. Applications built with NSS can support
  32. SSL v3, TLS, PKCS #5, PKCS #7, PKCS #11, PKCS #12, S/MIME,
  33. X.509 v3 certificates, and other security standards.
  34. "
  35. homepage=https://developer.mozilla.org/en-US/docs/Mozilla/Projects/NSS
  36. license="MPL v2.0, GPLv2+"
  37. # Source documentation
  38. docs="COPYING readme.md"
  39. docsdir="${docdir}/${program}-${pkgversion}"
  40. # Set 'srcdir' using previous 'pkgversion' variable
  41. srcdir=${program}-${pkgversion}
  42. build()
  43. {
  44. unpack "${tardir}/$tarname"
  45. cd "${srcdir}/nss"
  46. # Apply a patch for build thanks to "Beyond Linux From Scratch"
  47. patch -Np2 -i "${worktree}/patches/nss/nss-3.74-standalone-1.patch"
  48. # Set sane permissions
  49. chmod -R u+w,go-w,a+rX-s .
  50. # Set specific options for the architecture
  51. case $arch in
  52. amd64 | x32 )
  53. arch_options='USE_64=1'
  54. ;;
  55. i586)
  56. arch_options='USE_64=0'
  57. ;;
  58. esac
  59. unset -v CFLAGS CXXFLAGS
  60. make -j${jobs} BUILD_OPT=1 \
  61. NSS_DISABLE_GTESTS=1 \
  62. NSPR_INCLUDE_DIR=/usr/include/nspr \
  63. USE_SYSTEM_ZLIB=1 \
  64. ZLIB_LIBS=-lz \
  65. NSS_ENABLE_WERROR=0 \
  66. NSS_USE_SYSTEM_SQLITE=1 \
  67. $arch_options
  68. unset -v arch_options
  69. # Proceed to install the software files
  70. cd ../dist
  71. mkdir -v -p "${destdir}/usr/lib${libSuffix}" \
  72. "${destdir}/usr/include/nss" \
  73. "${destdir}/usr/bin" \
  74. "${destdir}/usr/lib${libSuffix}/pkgconfig"
  75. install -v -p -m755 Linux*/lib/*.so "${destdir}/usr/lib${libSuffix}"
  76. install -v -p -m644 Linux*/lib/*.chk "${destdir}/usr/lib${libSuffix}"
  77. install -v -p -m644 Linux*/lib/libcrmf.a "${destdir}/usr/lib${libSuffix}"
  78. cp -v -pRL public/nss/* "${destdir}/usr/include/nss"
  79. cp -v -pRL private/nss/* "${destdir}/usr/include/nss"
  80. chmod 644 "${destdir}"/usr/include/nss/*
  81. for file in certutil cmsutil crlutil derdump modutil pk12util pp \
  82. signtool signver ssltap vfychain vfyserv nss-config ; \
  83. do
  84. install -v -p -m755 Linux*/bin/${file} "${destdir}/usr/bin"
  85. done
  86. unset -v file
  87. install -v -p -m644 Linux*/lib/pkgconfig/nss.pc \
  88. "${destdir}/usr/lib${libSuffix}/pkgconfig"
  89. # Strip remaining binaries and libraries
  90. find "$destdir" -type f | xargs file | \
  91. awk '/ELF/ && /executable/ || /shared object/' | \
  92. cut -f 1 -d : | xargs strip --strip-unneeded 2> /dev/null || true
  93. strip --strip-debug "${destdir}/usr/lib${libSuffix}"/*.a
  94. cd ../nss
  95. mkdir -v -p "${destdir}/${mandir}/man1"
  96. cp -v -p doc/nroff/*.1 "${destdir}/${mandir}/man1"
  97. chmod 644 "${destdir}/${mandir}"/man1/*
  98. # Compress and link man pages (if needed)
  99. if test -d "${destdir}/$mandir"
  100. then
  101. (
  102. cd "${destdir}/$mandir"
  103. find . -type f -exec lzip -9 {} +
  104. find . -type l | while read -r file
  105. do
  106. ln -sf "$(readlink -- "$file").lz" "${file}.lz"
  107. rm -- "$file"
  108. done
  109. )
  110. fi
  111. # Copy documentation
  112. mkdir -v -p "${destdir}/$docsdir"
  113. cp -v -p $docs "${destdir}/$docsdir"
  114. }