actions.py 2.5 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263
  1. #!/usr/bin/env python3
  2. # -*- coding: utf-8 -*-
  3. #
  4. # Licensed under the GNU General Public License, version 3.
  5. # See the file http://www.gnu.org/licenses/gpl.txt
  6. from inary.actionsapi import get
  7. from inary.actionsapi import autotools
  8. from inary.actionsapi import inarytools
  9. from inary.actionsapi import shelltools
  10. WorkDir="%s-%s/" % (get.srcNAME(), get.srcVERSION())
  11. inarytools.cflags.add("-fno-strict-aliasing")
  12. def setup():
  13. shelltools.cd("nss")
  14. shelltools.system('PATH="{}/path:$PATH" bash -x ./build.sh -v \
  15. --opt --system-sqlite --system-nspr --enable-libpkix --disable-tests'.format(get.srcDIR()))
  16. def build():
  17. shelltools.cd("nss")
  18. inarytools.dosed("coreconf/Linux.mk", " -shared ", " -Wl,-O1,--as-needed -shared ")
  19. if get.ARCH() == "x86_64":
  20. shelltools.export("USE_64", "1")
  21. shelltools.export("BUILD_OPT", "1")
  22. shelltools.export("NSS_ENABLE_ECC", "1")
  23. shelltools.export("NSS_USE_SYSTEM_SQLITE", "1")
  24. shelltools.export("NSPR_INCLUDE_DIR", "`nspr-config --includedir`")
  25. shelltools.export("NSPR_LIB_DIR", "`nspr-config --libdir`")
  26. shelltools.export("XCFLAGS", get.CFLAGS())
  27. # Use system zlib
  28. shelltools.export("PKG_CONFIG_ALLOW_SYSTEM_LIBS", "1")
  29. shelltools.export("PKG_CONFIG_ALLOW_SYSTEM_CFLAGS", "1")
  30. autotools.make("-C coreconf -j1")
  31. autotools.make("-C lib/dbm")
  32. autotools.make("-j1")
  33. def install():
  34. for binary in ["certutil","nss-config","pk12util", "*util", "shlibsign", "signtool", "signver", "ssltap"]:
  35. inarytools.insinto("/usr/bin","dist/Linux*/bin/%s" % binary, sym=False)
  36. for lib in ["*.a","*.chk","*.so"]:
  37. inarytools.insinto("/usr/lib","dist/Linux*/lib/%s" % lib, sym=False)
  38. # Headers
  39. for header in ["dist/private/nss/*.h","dist/public/nss/*.h"]:
  40. inarytools.insinto("/usr/include/nss", header, sym=False)
  41. # Drop executable bits from headers
  42. shelltools.chmod("%s/usr/include/nss/*.h" % get.installDIR(), mode=0o644)
  43. # Install nss-config and nss.pc
  44. inarytools.insinto("/usr/lib/pkgconfig", "nss/config/nss.pc")
  45. # create empty NSS database
  46. inarytools.dodir("/etc/pki/nssdb")
  47. shelltools.export("LD_LIBRARY_PATH", "%s/usr/lib/" % get.installDIR())
  48. shelltools.system("%s/usr/bin/modutil -force -dbdir \"sql:%s/etc/pki/nssdb\" -create" % (get.installDIR(), get.installDIR()))
  49. shelltools.chmod("%s/etc/pki/nssdb/*" % get.installDIR(), 0o644)
  50. shelltools.system('sed -i "s|%s||" %s/etc/pki/nssdb/*' % (get.installDIR(), get.installDIR()))