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.

189 lines
6.9 KiB

  1. #
  2. # Copyright (C) 2006-2018 OpenWrt.org
  3. #
  4. # This is free software, licensed under the GNU General Public License v2.
  5. # See /LICENSE for more information.
  6. #
  7. include $(TOPDIR)/rules.mk
  8. include perlver.mk
  9. PKG_NAME:=perl
  10. PKG_VERSION:=$(PERL_VERSION)
  11. PKG_RELEASE:=3
  12. PKG_SOURCE_URL:=\
  13. https://cpan.metacpan.org/src/5.0 \
  14. https://cpan.uib.no/src/5.0 \
  15. https://mirrors.rit.edu/CPAN/src/5.0 \
  16. https://mirror.transip.net/CPAN/src/5.0 \
  17. https://mirrors.sonic.net/cpan/src/5.0 \
  18. https://www.cpan.org/src/5.0
  19. PKG_SOURCE:=$(PKG_NAME)-$(PKG_VERSION).tar.xz
  20. PKG_HASH:=fea7162d4cca940a387f0587b93f6737d884bf74d8a9d7cfd978bc12cd0b202d
  21. PKG_LICENSE:=GPL-1.0-or-later Artistic-1.0-Perl
  22. PKG_LICENSE_FILES:=Copying Artistic README
  23. PKG_MAINTAINER:=Marcel Denia <naoir@gmx.net>, \
  24. Philip Prindeville <philipp@redfish-solutions.com>
  25. PKG_CPE_ID:=cpe:/a:perl:perl
  26. # Build settings
  27. PKG_BUILD_DIR:=$(BUILD_DIR)/perl/$(PKG_NAME)-$(PKG_VERSION)
  28. HOST_BUILD_DIR:=$(BUILD_DIR_HOST)/perl/$(PKG_NAME)-$(PKG_VERSION)
  29. PKG_INSTALL:=1
  30. PKG_BUILD_DEPENDS:=perl/host
  31. PKG_BUILD_PARALLEL:=1
  32. HOST_BUILD_PARALLEL:=1
  33. # Variables used during configuration/build
  34. HOST_PERL_PREFIX:=$(STAGING_DIR_HOSTPKG)/usr
  35. # Filter -g3, it will break Compress-Raw-Zlib
  36. TARGET_CFLAGS_PERL:=$(patsubst -g3,-g,$(TARGET_CFLAGS))
  37. TARGET_CPPFLAGS_PERL:=$(patsubst -g3,-g,$(TARGET_CPPFLAGS))
  38. # A list of disabled tests
  39. # ExtUtils tests are disabled for now as we don't support building
  40. # native extensions on the target machine at the moment
  41. PERL_DISABLEDTESTS:=cpan/ExtUtils-Constant cpan/ExtUtils-MakeMaker
  42. # We're on Linux, so don't even package them
  43. PERL_DISABLEDTESTS+=cpan/Win32API-File cpan/Win32 ext/VMS-DCLsym ext/VMS-Filespec ext/VMS-Stdio ext/Win32CORE os2/
  44. # NDBM and ODBM not supported
  45. PERL_DISABLEDTESTS+=ext/NDBM_File ext/ODBM_File
  46. include $(INCLUDE_DIR)/package.mk
  47. include $(INCLUDE_DIR)/host-build.mk
  48. include perlmod.mk
  49. define Package/perl
  50. SUBMENU:=Perl
  51. SECTION:=lang
  52. CATEGORY:=Languages
  53. TITLE:=The Perl intepreter
  54. URL:=http://www.perl.com/
  55. DEPENDS:=+USE_GLIBC:libbsd +PERL_THREADS:libpthread @!arc
  56. endef
  57. define Package/perl/description
  58. Perl is a stable, cross platform programming language.
  59. It is used for mission critical projects in the public and private sectors
  60. and is widely used to program web applications of all needs.
  61. endef
  62. define Package/perl/config
  63. source "$(SOURCE)/Config.in"
  64. endef
  65. # Static host perl
  66. define Host/Configure
  67. ( cd $(HOST_BUILD_DIR); ./Configure -der -Uusedl -Duserelocatableinc -Dprefix=$(HOST_PERL_PREFIX) $(if $(CONFIG_PERL_THREADS),-Dusethreads,))
  68. endef
  69. define Host/Install
  70. ( cd $(HOST_BUILD_DIR); ./miniperl installperl )
  71. $(INSTALL_DIR) $(HOST_PERL_PREFIX)/bin/
  72. $(CP) $(HOST_BUILD_DIR)/generate_uudmap $(HOST_PERL_PREFIX)/bin/
  73. # Link any possibly installed static extension in
  74. $(MAKE) -C $(HOST_BUILD_DIR)/relink clean || true
  75. ( cd $(HOST_BUILD_DIR)/relink && $(HOST_PERL_PREFIX)/bin/perl Makefile.PL )
  76. $(call perlmod/host/relink,$(HOST_BUILD_DIR)/relink)
  77. endef
  78. # Target perl
  79. define Build/Configure
  80. $(PERL_CMD) files/perlconfig.pl -Dowrt:target_cc='$(TARGET_CC)' \
  81. -Dowrt:gccversion=$(CONFIG_GCC_VERSION) \
  82. -Dowrt:target_cross='$(TARGET_CROSS)' \
  83. -Dowrt:cflags='$(TARGET_CFLAGS_PERL) $(TARGET_CPPFLAGS_PERL)' \
  84. -Dowrt:ldflags='$(TARGET_LDFLAGS)' \
  85. -Dowrt:libc=$(subst uClibc,uclibc,$(CONFIG_LIBC)) \
  86. -Dowrt:ipv6=$(if $($(CONFIG_IPV6)),define,undef) \
  87. -Dowrt:threads=$(if $(CONFIG_PERL_THREADS),yes,no) \
  88. -Dowrt:staging_dir='$(STAGING_DIR)' \
  89. -Dowrt:host_perl_prefix='$(HOST_PERL_PREFIX)' \
  90. files/version.config \
  91. files/base.config \
  92. files/$(patsubst i386,i486,$(ARCH)).config \
  93. files/architecture.config \
  94. files/signal.config \
  95. files/threads.config \
  96. files/libc.config \
  97. files/misc.config \
  98. > $(PKG_BUILD_DIR)/config.sh
  99. (cd $(PKG_BUILD_DIR) && ./Configure -S)
  100. install -m 0644 $(PKG_BUILD_DIR)/config.h $(PKG_BUILD_DIR)/xconfig.h
  101. endef
  102. define Build/Compile
  103. +$(MAKE) $(PKG_JOBS) -C $(PKG_BUILD_DIR)
  104. endef
  105. ifeq ($(CONFIG_arc),)
  106. define Build/InstallDev
  107. $(INSTALL_DIR) $(1)/usr/lib/perl5/$(PERL_VERSION)
  108. $(CP) $(PKG_INSTALL_DIR)/usr/lib/perl5/$(PERL_VERSION) $(1)/usr/lib/perl5/
  109. endef
  110. endif
  111. define Package/perl/install
  112. $(INSTALL_DIR) $(1)/usr/bin
  113. $(INSTALL_BIN) $(PKG_INSTALL_DIR)/usr/bin/perl$(PKG_VERSION) $(1)/usr/bin
  114. ln -nsf perl$(PKG_VERSION) $(1)/usr/bin/perl
  115. $(INSTALL_DIR) $(1)/usr/lib/perl5/$(PERL_VERSION)/CORE
  116. $(CP) $(PKG_INSTALL_DIR)/usr/lib/perl5/$(PERL_VERSION)/CORE/libperl.so $(1)/usr/lib/perl5/$(PERL_VERSION)/CORE/
  117. endef
  118. $(eval $(call RequireCommand,rsync, \
  119. $(PKG_NAME) requires rsync installed on the host-system. \
  120. ))
  121. $(eval $(call BuildPackage,perl))
  122. $(eval $(call HostBuild))
  123. -include perlbase.mk
  124. # A helper package that includes all sort of supplementary files for tests
  125. define Package/perl-tests-common
  126. $(call Package/perlbase-template)
  127. TITLE:=Common test support files
  128. DEPENDS:=@PERL_TESTS
  129. endef
  130. define Package/perl-tests-common/install
  131. $(INSTALL_DIR) $(1)/$(PERL_TESTSDIR)
  132. $(INSTALL_DIR) $(1)/$(PERL_TESTSDIR)/Porting
  133. $(INSTALL_DIR) $(1)/$(PERL_TESTSDIR)/regen
  134. $(INSTALL_DIR) $(1)/$(PERL_TESTSDIR)/lib
  135. $(INSTALL_DIR) $(1)/usr/lib/perl5/$(PERL_VERSION)/XS
  136. $(INSTALL_DIR) $(1)/usr/lib/perl5/$(PERL_VERSION)/auto/XS
  137. $(INSTALL_DIR) $(1)/usr/lib/perl5/$(PERL_VERSION)/unicore
  138. $(CP) $(PKG_BUILD_DIR)/t $(1)/$(PERL_TESTSDIR)
  139. $(CP) $(PKG_BUILD_DIR)/Porting $(1)/$(PERL_TESTSDIR)
  140. $(CP) $(PKG_BUILD_DIR)/regen $(1)/$(PERL_TESTSDIR)
  141. $(CP) $(PKG_BUILD_DIR)/MANIFEST $(1)/$(PERL_TESTSDIR)
  142. $(CP) $(PKG_BUILD_DIR)/TestInit.pm $(1)/$(PERL_TESTSDIR)
  143. $(CP) $(PKG_BUILD_DIR)/vutil.c $(1)/$(PERL_TESTSDIR)
  144. $(CP) $(PKG_BUILD_DIR)/vxs.inc $(1)/$(PERL_TESTSDIR)
  145. $(CP) $(PKG_BUILD_DIR)/lib/XS $(1)/usr/lib/perl5/$(PERL_VERSION)/
  146. $(CP) $(PKG_BUILD_DIR)/lib/auto/XS $(1)/usr/lib/perl5/$(PERL_VERSION)/auto
  147. $(CP) $(PKG_BUILD_DIR)/lib/vmsish.pm $(1)/usr/lib/perl5/$(PERL_VERSION)/
  148. $(CP) $(PKG_BUILD_DIR)/lib/vmsish.t $(1)/$(PERL_TESTSDIR)/lib
  149. $(CP) $(PKG_BUILD_DIR)/lib/Internals.t $(1)/$(PERL_TESTSDIR)/lib
  150. $(CP) $(PKG_BUILD_DIR)/lib/unicore/TestProp.pl $(1)/usr/lib/perl5/$(PERL_VERSION)/unicore
  151. $(CP) files/perl-run_tests.sh $(1)/$(PERL_TESTSDIR)/run_tests.sh
  152. sed \
  153. -e 's!%%PERL_DISABLEDTESTS%%!$(PERL_DISABLEDTESTS)!' \
  154. -e 's!%%PERL_VERSION%%!$(PERL_VERSION)!' \
  155. -i $(1)/$(PERL_TESTSDIR)/run_tests.sh
  156. $(CP) $(PKG_BUILD_DIR)/config_h.SH $(1)/$(PERL_TESTSDIR)
  157. $(CP) $(PKG_BUILD_DIR)/perl.h $(1)/$(PERL_TESTSDIR)
  158. endef
  159. $(eval $(call BuildPackage,perl-tests-common))