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.

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