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.

127 lines
3.0 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/host/relink
  13. rm -f $(1)/Makefile.aperl
  14. $(MAKE) -C $(1) perl
  15. $(CP) $(1)/perl $(PERL_CMD)
  16. $(CP) $(1)/perl $(STAGING_DIR_HOST)/usr/bin/perl
  17. endef
  18. define perlmod/host/Configure
  19. (cd $(HOST_BUILD_DIR); \
  20. PERL_MM_USE_DEFAULT=1 \
  21. $(2) \
  22. $(PERL_CMD) Makefile.PL \
  23. $(1) \
  24. );
  25. endef
  26. define perlmod/host/Compile
  27. $(2) \
  28. $(MAKE) -C $(HOST_BUILD_DIR) \
  29. $(1) \
  30. install
  31. endef
  32. define perlmod/host/Install
  33. $(2) \
  34. $(MAKE) -C $(HOST_BUILD_DIR) \
  35. $(1) \
  36. install
  37. $(call perlmod/host/relink,$(HOST_BUILD_DIR))
  38. endef
  39. define perlmod/Configure
  40. (cd $(PKG_BUILD_DIR); \
  41. PERL_MM_USE_DEFAULT=1 \
  42. $(2) \
  43. $(PERL_CMD) Makefile.PL \
  44. $(1) \
  45. AR=ar \
  46. CC=$(GNU_TARGET_NAME)-gcc \
  47. CCFLAGS="$(TARGET_CFLAGS) $(TARGET_CPPFLAGS)" \
  48. CCCDLFLAGS=-fPIC \
  49. CCDLFLAGS=-Wl,-E \
  50. DLEXT=so \
  51. DLSRC=dl_dlopen.xs \
  52. EXE_EXT=" " \
  53. FULL_AR=$(GNU_TARGET_NAME)-ar \
  54. LD=$(GNU_TARGET_NAME)-gcc \
  55. LDDLFLAGS="-shared $(TARGET_LDFLAGS)" \
  56. LDFLAGS="$(EXTRA_LIBDIRS:%=-L%) $(EXTRA_LIBS:%=-l%) " \
  57. LIBC=" " \
  58. LIB_EXT=.a \
  59. OBJ_EXT=.o \
  60. OSNAME=linux \
  61. OSVERS=2.4.30 \
  62. RANLIB=: \
  63. SITELIBEXP=" " \
  64. SITEARCHEXP=" " \
  65. SO=so \
  66. VENDORARCHEXP=" " \
  67. VENDORLIBEXP=" " \
  68. SITEPREFIX=/usr \
  69. INSTALLPRIVLIB=$(PERL_SITELIB) \
  70. INSTALLSITELIB=$(PERL_SITELIB) \
  71. INSTALLVENDORLIB=" " \
  72. INSTALLARCHLIB=$(PERL_SITELIB) \
  73. INSTALLSITEARCH=$(PERL_SITELIB) \
  74. INSTALLVENDORARCH=" " \
  75. INSTALLBIN=/usr/bin \
  76. INSTALLSITEBIN=/usr/bin \
  77. INSTALLVENDORBIN=" " \
  78. INSTALLSCRIPT=/usr/bin \
  79. INSTALLSITESCRIPT=/usr/bin \
  80. INSTALLVENDORSCRIPT=" " \
  81. INSTALLMAN1DIR=/usr/man/man1 \
  82. INSTALLSITEMAN1DIR=/usr/man/man1 \
  83. INSTALLVENDORMAN1DIR=" " \
  84. INSTALLMAN3DIR=/usr/man/man3 \
  85. INSTALLSITEMAN3DIR=/usr/man/man3 \
  86. INSTALLVENDORMAN3DIR=" " \
  87. LINKTYPE=dynamic \
  88. DESTDIR=$(PKG_INSTALL_DIR) \
  89. );
  90. sed 's!^PERL_INC = .*!PERL_INC = $(STAGING_DIR)/usr/lib/perl5/5.20/CORE/!' -i $(PKG_BUILD_DIR)/Makefile
  91. endef
  92. define perlmod/Compile
  93. PERL5LIB=$(PERL_LIB) \
  94. $(2) \
  95. $(MAKE) -C $(PKG_BUILD_DIR) \
  96. $(1) \
  97. install
  98. endef
  99. define perlmod/Install
  100. $(INSTALL_DIR) $(strip $(1))$(PERL_SITELIB)
  101. (cd $(PKG_INSTALL_DIR)$(PERL_SITELIB) && \
  102. rsync --relative -rlHp --itemize-changes \
  103. --exclude=\*.pod \
  104. --exclude=.packlist \
  105. $(addprefix --exclude=/,$(strip $(3))) \
  106. --prune-empty-dirs \
  107. $(strip $(2)) $(strip $(1))$(PERL_SITELIB))
  108. chmod -R u+w $(strip $(1))$(PERL_SITELIB)
  109. @echo "---> Stripping modules in: $(strip $(1))$(PERL_SITELIB)"
  110. find $(strip $(1))$(PERL_SITELIB) -name \*.pm -or -name \*.pl | \
  111. xargs -r sed -i \
  112. -e '/^=\(head\|pod\|item\|over\|back\|encoding\)/,/^=cut/d' \
  113. -e '/^=\(head\|pod\|item\|over\|back\|encoding\)/,$$$$d' \
  114. -e '/^#$$$$/d' \
  115. -e '/^#[^!"'"'"']/d'
  116. endef