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