You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

95 lines
2.3 KiB

  1. # This makefile simplifies perl module builds.
  2. #
  3. # Build environment
  4. HOST_PERL_PREFIX:=$(STAGING_DIR_HOST)/usr
  5. ifneq ($(CONFIG_USE_EGLIBC),)
  6. EXTRA_LIBS:=bsd
  7. EXTRA_LIBDIRS:=$(STAGING_DIR)/lib
  8. endif
  9. PERL_CMD:=$(STAGING_DIR_HOST)/usr/bin/perl5.20.0
  10. # Module install prefix
  11. PERL_SITELIB:=/usr/lib/perl5/5.20
  12. define perlmod/Configure
  13. (cd $(PKG_BUILD_DIR); \
  14. PERL_MM_USE_DEFAULT=1 \
  15. $(2) \
  16. $(PERL_CMD) Makefile.PL \
  17. $(1) \
  18. AR=ar \
  19. CC=$(GNU_TARGET_NAME)-gcc \
  20. CCFLAGS="$(TARGET_CFLAGS) $(TARGET_CPPFLAGS)" \
  21. CCCDLFLAGS=-fPIC \
  22. CCDLFLAGS=-Wl,-E \
  23. DLEXT=so \
  24. DLSRC=dl_dlopen.xs \
  25. EXE_EXT=" " \
  26. FULL_AR=$(GNU_TARGET_NAME)-ar \
  27. LD=$(GNU_TARGET_NAME)-gcc \
  28. LDDLFLAGS="-shared $(TARGET_LDFLAGS)" \
  29. LDFLAGS="$(EXTRA_LIBDIRS:%=-L%) $(EXTRA_LIBS:%=-l%) " \
  30. LIBC=" " \
  31. LIB_EXT=.a \
  32. OBJ_EXT=.o \
  33. OSNAME=linux \
  34. OSVERS=2.4.30 \
  35. RANLIB=: \
  36. SITELIBEXP=" " \
  37. SITEARCHEXP=" " \
  38. SO=so \
  39. VENDORARCHEXP=" " \
  40. VENDORLIBEXP=" " \
  41. SITEPREFIX=/usr \
  42. INSTALLPRIVLIB=$(PERL_SITELIB) \
  43. INSTALLSITELIB=$(PERL_SITELIB) \
  44. INSTALLVENDORLIB=" " \
  45. INSTALLARCHLIB=$(PERL_SITELIB) \
  46. INSTALLSITEARCH=$(PERL_SITELIB) \
  47. INSTALLVENDORARCH=" " \
  48. INSTALLBIN=/usr/bin \
  49. INSTALLSITEBIN=/usr/bin \
  50. INSTALLVENDORBIN=" " \
  51. INSTALLSCRIPT=/usr/bin \
  52. INSTALLSITESCRIPT=/usr/bin \
  53. INSTALLVENDORSCRIPT=" " \
  54. INSTALLMAN1DIR=/usr/man/man1 \
  55. INSTALLSITEMAN1DIR=/usr/man/man1 \
  56. INSTALLVENDORMAN1DIR=" " \
  57. INSTALLMAN3DIR=/usr/man/man3 \
  58. INSTALLSITEMAN3DIR=/usr/man/man3 \
  59. INSTALLVENDORMAN3DIR=" " \
  60. LINKTYPE=dynamic \
  61. DESTDIR=$(PKG_INSTALL_DIR) \
  62. );
  63. endef
  64. define perlmod/Compile
  65. PERL5LIB=$(PERL_LIB) \
  66. $(2) \
  67. $(MAKE) -C $(PKG_BUILD_DIR) \
  68. $(1) \
  69. install
  70. endef
  71. define perlmod/Install
  72. $(INSTALL_DIR) $(strip $(1))$(PERL_SITELIB)
  73. (cd $(PKG_INSTALL_DIR)$(PERL_SITELIB) && \
  74. rsync --relative -rlHp --itemize-changes \
  75. --exclude=\*.pod \
  76. --exclude=.packlist \
  77. $(addprefix --exclude=/,$(strip $(3))) \
  78. --prune-empty-dirs \
  79. $(strip $(2)) $(strip $(1))$(PERL_SITELIB))
  80. chmod -R u+w $(strip $(1))$(PERL_SITELIB)
  81. @echo "---> Stripping modules in: $(strip $(1))$(PERL_SITELIB)"
  82. find $(strip $(1))$(PERL_SITELIB) -name \*.pm -or -name \*.pl | \
  83. xargs -r sed -i \
  84. -e '/^=\(head\|pod\|item\|over\|back\)/,/^=cut/d' \
  85. -e '/^=\(head\|pod\|item\|over\|back\)/,$$$$d' \
  86. -e '/^#$$$$/d' \
  87. -e '/^#[^!"'"'"']/d'
  88. endef