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.

219 lines
7.5 KiB

  1. #
  2. # Copyright (C) 2006-2015 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. PKG_NAME:=perl
  9. PKG_VERSION:=5.22.0
  10. PKG_RELEASE:=0
  11. PKG_SOURCE_URL:=ftp://ftp.cpan.org/pub/CPAN/src/5.0 \
  12. http://www.cpan.org/src/5.0 \
  13. ftp://ftp.mpi-sb.mpg.de/pub/perl/CPAN/src/5.0 \
  14. http://ftp.mpi-sb.mpg.de/pub/perl/CPAN/src/5.0 \
  15. ftp://ftp.gmd.de/mirrors/CPAN/src/5.0 \
  16. http://ftp5.gwdg.de/pub/languages/perl/CPAN/src/ \
  17. ftp://ftp.funet.fi/pub/languages/perl/CPAN/src/5.0 \
  18. http://ftp.funet.fi/pub/languages/perl/CPAN/src/5.0
  19. PKG_SOURCE:=$(PKG_NAME)-$(PKG_VERSION).tar.gz
  20. PKG_MD5SUM:=e32cb6a8dda0084f2a43dac76318d68d
  21. PKG_LICENSE:=GPL-1.0+ Artistic-1.0-Perl
  22. PKG_LICENSE_FILES:=Copying Artistic README
  23. PKG_MAINTAINER:=Marcel Denia <naoir@gmx.net>
  24. # Build settings
  25. PKG_BUILD_DIR:=$(BUILD_DIR)/perl/$(PKG_NAME)-$(PKG_VERSION)
  26. HOST_BUILD_DIR:=$(BUILD_DIR_HOST)/perl/$(PKG_NAME)-$(PKG_VERSION)
  27. PKG_INSTALL:=1
  28. PKG_BUILD_DEPENDS:=perl/host
  29. PKG_BUILD_PARALLEL:=1
  30. HOST_BUILD_PARALLEL:=1
  31. # Variables used during configuration/build
  32. HOST_PERL_PREFIX:=$(STAGING_DIR_HOST)/usr
  33. ifneq ($(CONFIG_USE_GLIBC),)
  34. EXTRA_LIBS:=bsd
  35. EXTRA_LIBDIRS:=$(STAGING_DIR)/lib
  36. endif
  37. # Filter -g3, it will break Compress-Raw-Zlib
  38. TARGET_CFLAGS_PERL:=$(patsubst -g3,-g,$(TARGET_CFLAGS))
  39. TARGET_CPPFLAGS_PERL:=$(patsubst -g3,-g,$(TARGET_CPPFLAGS))
  40. # Handle threading
  41. ifdef CONFIG_PERL_THREADS
  42. PERL_CONFIG_SUFFIX:=-mt
  43. # uclibc doesn't provide crypt_r(). Enable crypt() usage for glibc builds only
  44. ifdef CONFIG_USE_GLIBC
  45. CRYPT_R_PROTO:=REENTRANT_PROTO_B_CCS
  46. CRYPT:=define
  47. else
  48. CRYPT_R_PROTO:=0
  49. CRYPT:=undef
  50. endif
  51. endif
  52. # A list of disabled tests
  53. # ExtUtils tests are disabled for now as we don't support building
  54. # native extensions on the target machine at the moment
  55. PERL_DISABLEDTESTS:=cpan/ExtUtils-Constant cpan/ExtUtils-MakeMaker
  56. # We're on Linux, so don't even package them
  57. PERL_DISABLEDTESTS+=cpan/Win32API-File cpan/Win32 ext/VMS-DCLsym ext/VMS-Filespec ext/VMS-Stdio ext/Win32CORE
  58. # NDBM and ODBM not supported
  59. PERL_DISABLEDTESTS+=ext/NDBM_File ext/ODBM_File
  60. include $(INCLUDE_DIR)/package.mk
  61. include $(INCLUDE_DIR)/host-build.mk
  62. include perlmod.mk
  63. define Package/perl
  64. SUBMENU:=Perl
  65. SECTION:=lang
  66. CATEGORY:=Languages
  67. TITLE:=The Perl intepreter
  68. URL:=http://www.perl.com/
  69. DEPENDS:=+USE_GLIBC:libbsd +PERL_THREADS:libpthread
  70. endef
  71. define Package/perl/description
  72. Perl is a stable, cross platform programming language.
  73. It is used for mission critical projects in the public and private sectors
  74. and is widely used to program web applications of all needs.
  75. endef
  76. define Package/perl/config
  77. source "$(SOURCE)/Config.in"
  78. endef
  79. # Static host perl
  80. define Host/Configure
  81. ( cd $(HOST_BUILD_DIR); ./Configure -der -Uusedl -Duserelocatableinc -Dprefix=$(HOST_PERL_PREFIX) $(if $(CONFIG_PERL_THREADS),-Dusethreads,))
  82. endef
  83. define Host/Install
  84. ( cd $(HOST_BUILD_DIR); ./miniperl installperl )
  85. $(INSTALL_DIR) $(HOST_PERL_PREFIX)/bin/
  86. $(CP) $(HOST_BUILD_DIR)/generate_uudmap $(HOST_PERL_PREFIX)/bin/
  87. # Link any possibly installed static extension in
  88. $(MAKE) -C $(HOST_BUILD_DIR)/relink clean || true
  89. ( cd $(HOST_BUILD_DIR)/relink && $(HOST_PERL_PREFIX)/bin/perl Makefile.PL )
  90. $(call perlmod/host/relink,$(HOST_BUILD_DIR)/relink)
  91. endef
  92. # Target perl
  93. define Build/Configure
  94. sed \
  95. -e 's!%%CC%%!$(TARGET_CC)!g' \
  96. -e 's!%%CFLAGS%%!$(TARGET_CFLAGS_PERL) $(TARGET_CPPFLAGS_PERL)!g' \
  97. -e 's!%%CPP%%!$(TARGET_CROSS)gcc -E!g' \
  98. -e 's!%%AR%%!$(TARGET_CROSS)ar!g' \
  99. -e 's!%%LD%%!$(TARGET_CROSS)gcc!g' \
  100. -e 's!%%LDFLAGS%%!-rdynamic $(TARGET_LDFLAGS)!g' \
  101. -e 's!%%LIBDIRS%%!$(STAGING_DIR)/lib $(STAGING_DIR)/usr/lib!g' \
  102. -e 's!%%INCDIRS%%!$(STAGING_DIR)/include $(STAGING_DIR)/usr/include!g' \
  103. -e 's!%%EXTRA_PERLLIBS%%!$(EXTRA_LIBS:%=-l%)!g' \
  104. -e 's!%%EXTRA_PERLLIBDIRS%%!$(EXTRA_LIBDIRS:%=-L%)!g' \
  105. -e 's!%%IPV6%%!$(if $($(CONFIG_IPV6)),define,undef)!g' \
  106. -e 's!%%HOSTMINIPERL%%!$(HOST_PERL_PREFIX)/bin/perl!g' \
  107. -e 's!%%CRYPT_R_PROTO%%!$(CRYPT_R_PROTO)!g' \
  108. -e 's!%%CRYPT%%!$(CRYPT)!g' \
  109. -e 's!%%HOSTGENERATE%%!$(HOST_PERL_PREFIX)/bin/generate_uudmap!g' \
  110. files/config.sh-$(patsubst i386,i486,$(ARCH))$(PERL_CONFIG_SUFFIX).in \
  111. > $(PKG_BUILD_DIR)/config.sh
  112. ifeq ($(CONFIG_USE_MUSL),y)
  113. sed -i \
  114. -e "s,\(d_stdio_ptr_lval=\)'define',\1'undef',g" \
  115. -e "s,\(d_stdio_ptr_lval_sets_cnt=\)'define',\1'undef',g" \
  116. -e "s,\(d_stdiobase=\)'define',\1'undef',g" \
  117. -e "s,\(d_stdstdio=\)'define',\1'undef',g" \
  118. -e "s,\(d_getnetbyname_r=\)'define',\1'undef',g" \
  119. -e "s,\(getprotobyname_r=\)'define',\1'undef',g" \
  120. -e "s,\(getpwent_r=\)'define',\1'undef',g" \
  121. -e "s,\(getservent_r=\)'define',\1'undef',g" \
  122. -e "s,\(gethostent_r=\)'define',\1'undef',g" \
  123. -e "s,\(getnetent_r=\)'define',\1'undef',g" \
  124. -e "s,\(getnetbyaddr_r=\)'define',\1'undef',g" \
  125. -e "s,\(getprotoent_r=\)'define',\1'undef',g" \
  126. -e "s,\(getprotobynumber_r=\)'define',\1'undef',g" \
  127. -e "s,\(getgrent_r=\)'define',\1'undef',g" \
  128. -e "s,\(i_fcntl=\)'undef',\1'define',g" \
  129. -e "s,\(h_fcntl=\)'false',\1'true',g" \
  130. -e "s,\(d_strerror_r=\)'define',\1'undef',g" \
  131. $(PKG_BUILD_DIR)/config.sh
  132. endif
  133. (cd $(PKG_BUILD_DIR) && ./Configure -S)
  134. install -m 0644 $(PKG_BUILD_DIR)/config.h $(PKG_BUILD_DIR)/xconfig.h
  135. endef
  136. define Build/Compile
  137. +$(MAKE) $(PKG_JOBS) -C $(PKG_BUILD_DIR)
  138. endef
  139. define Build/InstallDev
  140. $(INSTALL_DIR) $(1)/usr/lib/perl5/$(PERL_VERSION)
  141. $(CP) $(PKG_INSTALL_DIR)/usr/lib/perl5/$(PERL_VERSION) $(1)/usr/lib/perl5/
  142. endef
  143. define Package/perl/install
  144. $(INSTALL_DIR) $(1)/usr/bin
  145. $(INSTALL_BIN) $(PKG_INSTALL_DIR)/usr/bin/perl$(PKG_VERSION) $(1)/usr/bin
  146. ln -nsf perl$(PKG_VERSION) $(1)/usr/bin/perl
  147. $(INSTALL_DIR) $(1)/usr/lib/perl5/$(PERL_VERSION)/CORE
  148. $(CP) $(PKG_INSTALL_DIR)/usr/lib/perl5/$(PERL_VERSION)/CORE/libperl.so $(1)/usr/lib/perl5/$(PERL_VERSION)/CORE/
  149. endef
  150. $(eval $(call RequireCommand,rsync, \
  151. $(PKG_NAME) requires rsync installed on the host-system. \
  152. ))
  153. $(eval $(call BuildPackage,perl))
  154. $(eval $(call HostBuild))
  155. -include perlbase.mk
  156. # A helper package that includes all sort of supplementary files for tests
  157. define Package/perl-tests-common
  158. $(call Package/perlbase-template)
  159. TITLE:=Common test support files
  160. DEPENDS:=@PERL_TESTS
  161. endef
  162. define Package/perl-tests-common/install
  163. $(INSTALL_DIR) $(1)/$(PERL_TESTSDIR)
  164. $(INSTALL_DIR) $(1)/$(PERL_TESTSDIR)/Porting
  165. $(INSTALL_DIR) $(1)/$(PERL_TESTSDIR)/regen
  166. $(INSTALL_DIR) $(1)/usr/lib/perl5/$(PERL_VERSION)/XS
  167. $(INSTALL_DIR) $(1)/usr/lib/perl5/$(PERL_VERSION)/auto/XS
  168. $(INSTALL_DIR) $(1)/usr/lib/perl5/$(PERL_VERSION)/unicore
  169. $(CP) $(PKG_BUILD_DIR)/t $(1)/$(PERL_TESTSDIR)
  170. $(CP) $(PKG_BUILD_DIR)/Porting $(1)/$(PERL_TESTSDIR)
  171. $(CP) $(PKG_BUILD_DIR)/regen $(1)/$(PERL_TESTSDIR)
  172. $(CP) $(PKG_BUILD_DIR)/MANIFEST $(1)/$(PERL_TESTSDIR)
  173. $(CP) $(PKG_BUILD_DIR)/TestInit.pm $(1)/$(PERL_TESTSDIR)
  174. $(CP) $(PKG_BUILD_DIR)/vutil.c $(1)/$(PERL_TESTSDIR)
  175. $(CP) $(PKG_BUILD_DIR)/vxs.inc $(1)/$(PERL_TESTSDIR)
  176. $(CP) $(PKG_BUILD_DIR)/lib/XS $(1)/usr/lib/perl5/$(PERL_VERSION)/
  177. $(CP) $(PKG_BUILD_DIR)/lib/auto/XS $(1)/usr/lib/perl5/$(PERL_VERSION)/auto
  178. $(CP) $(PKG_BUILD_DIR)/lib/vmsish.pm $(1)/usr/lib/perl5/$(PERL_VERSION)/
  179. $(CP) $(PKG_BUILD_DIR)/lib/unicore/TestProp.pl $(1)/usr/lib/perl5/$(PERL_VERSION)/unicore
  180. $(CP) files/perl-run_tests.sh $(1)/$(PERL_TESTSDIR)/run_tests.sh
  181. sed \
  182. -e 's!%%PERL_DISABLEDTESTS%%!$(PERL_DISABLEDTESTS)!' \
  183. -e 's!%%PERL_VERSION%%!$(PERL_VERSION)!' \
  184. -i $(1)/$(PERL_TESTSDIR)/run_tests.sh
  185. $(CP) $(PKG_BUILD_DIR)/config_h.SH $(1)/$(PERL_TESTSDIR)
  186. $(CP) $(PKG_BUILD_DIR)/perl.h $(1)/$(PERL_TESTSDIR)
  187. endef
  188. $(eval $(call BuildPackage,perl-tests-common))