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.

96 lines
2.4 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. sed 's!^PERL_INC = .*!PERL_INC = $(STAGING_DIR)/usr/lib/perl5/5.20/CORE/!' -i $(PKG_BUILD_DIR)/Makefile
  64. endef
  65. define perlmod/Compile
  66. PERL5LIB=$(PERL_LIB) \
  67. $(2) \
  68. $(MAKE) -C $(PKG_BUILD_DIR) \
  69. $(1) \
  70. install
  71. endef
  72. define perlmod/Install
  73. $(INSTALL_DIR) $(strip $(1))$(PERL_SITELIB)
  74. (cd $(PKG_INSTALL_DIR)$(PERL_SITELIB) && \
  75. rsync --relative -rlHp --itemize-changes \
  76. --exclude=\*.pod \
  77. --exclude=.packlist \
  78. $(addprefix --exclude=/,$(strip $(3))) \
  79. --prune-empty-dirs \
  80. $(strip $(2)) $(strip $(1))$(PERL_SITELIB))
  81. chmod -R u+w $(strip $(1))$(PERL_SITELIB)
  82. @echo "---> Stripping modules in: $(strip $(1))$(PERL_SITELIB)"
  83. find $(strip $(1))$(PERL_SITELIB) -name \*.pm -or -name \*.pl | \
  84. xargs -r sed -i \
  85. -e '/^=\(head\|pod\|item\|over\|back\|encoding\)/,/^=cut/d' \
  86. -e '/^=\(head\|pod\|item\|over\|back\|encoding\)/,$$$$d' \
  87. -e '/^#$$$$/d' \
  88. -e '/^#[^!"'"'"']/d'
  89. endef