website: update Free Electrons logo
[buildroot-gz.git] / package / perl / perl.mk
blob29b4455932b31ffd4692ed876352d5e9b7e5e048
1 ################################################################################
3 # perl
5 ################################################################################
7 # When updating the version here, also update support/scripts/scancpan
8 PERL_VERSION_MAJOR = 22
9 PERL_VERSION = 5.$(PERL_VERSION_MAJOR).2
10 PERL_SITE = http://www.cpan.org/src/5.0
11 PERL_SOURCE = perl-$(PERL_VERSION).tar.bz2
12 PERL_LICENSE = Artistic or GPLv1+
13 PERL_LICENSE_FILES = Artistic Copying README
14 PERL_INSTALL_STAGING = YES
16 PERL_CROSS_VERSION = 1.0.2
17 PERL_CROSS_BASE_VERSION = 5.$(PERL_VERSION_MAJOR).1
18 # DO NOT refactor with the github helper (the result is not the same)
19 PERL_CROSS_SITE = https://github.com/arsv/perl-cross/releases/download/$(PERL_CROSS_VERSION)
20 PERL_CROSS_SOURCE = perl-$(PERL_CROSS_BASE_VERSION)-cross-$(PERL_CROSS_VERSION).tar.gz
21 PERL_EXTRA_DOWNLOADS = $(PERL_CROSS_SITE)/$(PERL_CROSS_SOURCE)
23 PERL_CROSS_OLD_POD = perl$(subst .,,$(PERL_CROSS_BASE_VERSION))delta.pod
24 PERL_CROSS_NEW_POD = perl$(subst .,,$(PERL_VERSION))delta.pod
26 # We use the perlcross hack to cross-compile perl. It should
27 # be extracted over the perl sources, so we don't define that
28 # as a separate package. Instead, it is downloaded and extracted
29 # together with perl
30 define PERL_CROSS_EXTRACT
31 $(call suitable-extractor,$(PERL_CROSS_SOURCE)) $(DL_DIR)/$(PERL_CROSS_SOURCE) | \
32 $(TAR) --strip-components=1 -C $(@D) $(TAR_OPTIONS) -
33 endef
34 PERL_POST_EXTRACT_HOOKS += PERL_CROSS_EXTRACT
36 define PERL_CROSS_SET_POD
37 $(SED) s/$(PERL_CROSS_OLD_POD)/$(PERL_CROSS_NEW_POD)/g $(@D)/Makefile
38 endef
39 PERL_POST_PATCH_HOOKS += PERL_CROSS_SET_POD
41 ifeq ($(BR2_PACKAGE_BERKELEYDB),y)
42 PERL_DEPENDENCIES += berkeleydb
43 endif
44 ifeq ($(BR2_PACKAGE_GDBM),y)
45 PERL_DEPENDENCIES += gdbm
46 endif
48 # We have to override LD, because an external multilib toolchain ld is not
49 # wrapped to provide the required sysroot options.
50 PERL_CONF_OPTS = \
51 --target=$(GNU_TARGET_NAME) \
52 --target-tools-prefix=$(TARGET_CROSS) \
53 --prefix=/usr \
54 -Dld="$(TARGET_CC)" \
55 -Dccflags="$(TARGET_CFLAGS)" \
56 -Dldflags="$(TARGET_LDFLAGS) -lm" \
57 -Dmydomain="" \
58 -Dmyhostname="noname" \
59 -Dmyuname="Buildroot $(BR2_VERSION_FULL)" \
60 -Dosname=linux \
61 -Dosvers=$(LINUX_VERSION) \
62 -Dperladmin=root
64 ifeq ($(shell expr $(PERL_VERSION_MAJOR) % 2), 1)
65 PERL_CONF_OPTS += -Dusedevel
66 endif
68 ifeq ($(BR2_STATIC_LIBS),y)
69 PERL_CONF_OPTS += --all-static --no-dynaloader
70 endif
72 PERL_MODULES = $(call qstrip,$(BR2_PACKAGE_PERL_MODULES))
73 ifneq ($(PERL_MODULES),)
74 PERL_CONF_OPTS += --only-mod=$(subst $(space),$(comma),$(PERL_MODULES))
75 endif
77 define PERL_CONFIGURE_CMDS
78 (cd $(@D); HOSTCC='$(HOSTCC_NOCCACHE)' ./configure $(PERL_CONF_OPTS))
79 $(SED) 's/UNKNOWN-/Buildroot $(BR2_VERSION_FULL) /' $(@D)/patchlevel.h
80 endef
82 define PERL_BUILD_CMDS
83 $(MAKE1) -C $(@D) all
84 endef
86 define PERL_INSTALL_STAGING_CMDS
87 $(MAKE1) -C $(@D) DESTDIR="$(STAGING_DIR)" install.perl
88 endef
90 define PERL_INSTALL_TARGET_CMDS
91 $(MAKE1) -C $(@D) DESTDIR="$(TARGET_DIR)" install.perl
92 endef
94 HOST_PERL_CONF_OPTS = \
95 -des \
96 -Dprefix="$(HOST_DIR)/usr" \
97 -Dcc="$(HOSTCC)"
99 define HOST_PERL_CONFIGURE_CMDS
100 (cd $(@D); HOSTCC='$(HOSTCC_NOCCACHE)' ./Configure $(HOST_PERL_CONF_OPTS))
101 endef
103 define HOST_PERL_BUILD_CMDS
104 $(MAKE) -C $(@D)
105 endef
107 define HOST_PERL_INSTALL_CMDS
108 $(MAKE) -C $(@D) INSTALL_DEPENDENCE='' install
109 endef
111 $(eval $(generic-package))
112 $(eval $(host-generic-package))
114 define PERL_FINALIZE_TARGET
115 rm -rf $(TARGET_DIR)/usr/lib/perl5/$(PERL_VERSION)/pod
116 rm -rf $(TARGET_DIR)/usr/lib/perl5/$(PERL_VERSION)/$(PERL_ARCHNAME)/CORE
117 find $(TARGET_DIR)/usr/lib/perl5/ -name 'extralibs.ld' -print0 | xargs -0 rm -f
118 find $(TARGET_DIR)/usr/lib/perl5/ -name '*.bs' -print0 | xargs -0 rm -f
119 find $(TARGET_DIR)/usr/lib/perl5/ -name '.packlist' -print0 | xargs -0 rm -f
120 endef
121 PERL_TARGET_FINALIZE_HOOKS += PERL_FINALIZE_TARGET