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