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