board/csky: fixup gdb instructions in readme.txt
[buildroot-gz.git] / package / perl / perl.mk
blobb407e05698fed9f5eedc12401fe0d5677e5de9fd
1 ################################################################################
3 # perl
5 ################################################################################
7 # When updating the version here, also update support/scripts/scancpan
8 PERL_VERSION_MAJOR = 24
9 PERL_VERSION = 5.$(PERL_VERSION_MAJOR).1
10 PERL_SITE = http://www.cpan.org/src/5.0
11 PERL_SOURCE = perl-$(PERL_VERSION).tar.xz
12 PERL_LICENSE = Artistic or GPLv1+
13 PERL_LICENSE_FILES = Artistic Copying README
14 PERL_INSTALL_STAGING = YES
16 PERL_CROSS_VERSION = 1.1.4
17 # DO NOT refactor with the github helper (the result is not the same)
18 PERL_CROSS_SITE = https://github.com/arsv/perl-cross/releases/download/$(PERL_CROSS_VERSION)
19 PERL_CROSS_SOURCE = perl-cross-$(PERL_CROSS_VERSION).tar.gz
20 PERL_EXTRA_DOWNLOADS = $(PERL_CROSS_SITE)/$(PERL_CROSS_SOURCE)
22 # We use the perlcross hack to cross-compile perl. It should
23 # be extracted over the perl sources, so we don't define that
24 # as a separate package. Instead, it is downloaded and extracted
25 # together with perl
26 define PERL_CROSS_EXTRACT
27 $(call suitable-extractor,$(PERL_CROSS_SOURCE)) $(DL_DIR)/$(PERL_CROSS_SOURCE) | \
28 $(TAR) --strip-components=1 -C $(@D) $(TAR_OPTIONS) -
29 endef
30 PERL_POST_EXTRACT_HOOKS += PERL_CROSS_EXTRACT
32 # Even though perl is not an autotools-package, it uses config.sub and
33 # config.guess. Up-to-date versions of these files may be needed to build perl
34 # on newer host architectures, so we borrow the hook which updates them from the
35 # autotools infrastructure.
36 PERL_POST_PATCH_HOOKS += UPDATE_CONFIG_HOOK
38 ifeq ($(BR2_PACKAGE_BERKELEYDB),y)
39 PERL_DEPENDENCIES += berkeleydb
40 endif
41 ifeq ($(BR2_PACKAGE_GDBM),y)
42 PERL_DEPENDENCIES += gdbm
43 endif
45 # We have to override LD, because an external multilib toolchain ld is not
46 # wrapped to provide the required sysroot options.
47 PERL_CONF_OPTS = \
48 --target=$(GNU_TARGET_NAME) \
49 --target-tools-prefix=$(TARGET_CROSS) \
50 --prefix=/usr \
51 -Dld="$(TARGET_CC)" \
52 -Dccflags="$(TARGET_CFLAGS)" \
53 -Dldflags="$(TARGET_LDFLAGS) -lm" \
54 -Dmydomain="" \
55 -Dmyhostname="noname" \
56 -Dmyuname="Buildroot $(BR2_VERSION_FULL)" \
57 -Dosname=linux \
58 -Dosvers=$(LINUX_VERSION) \
59 -Dperladmin=root
61 ifeq ($(shell expr $(PERL_VERSION_MAJOR) % 2), 1)
62 PERL_CONF_OPTS += -Dusedevel
63 endif
65 ifeq ($(BR2_STATIC_LIBS),y)
66 PERL_CONF_OPTS += --all-static --no-dynaloader
67 endif
69 PERL_MODULES = $(call qstrip,$(BR2_PACKAGE_PERL_MODULES))
70 ifneq ($(PERL_MODULES),)
71 PERL_CONF_OPTS += --only-mod=$(subst $(space),$(comma),$(PERL_MODULES))
72 endif
74 define PERL_CONFIGURE_CMDS
75 (cd $(@D); $(TARGET_MAKE_ENV) HOSTCC='$(HOSTCC_NOCCACHE)' \
76 ./configure $(PERL_CONF_OPTS))
77 $(SED) 's/UNKNOWN-/Buildroot $(BR2_VERSION_FULL) /' $(@D)/patchlevel.h
78 endef
80 define PERL_BUILD_CMDS
81 $(TARGET_MAKE_ENV) $(MAKE1) -C $(@D) all
82 endef
84 define PERL_INSTALL_STAGING_CMDS
85 $(TARGET_MAKE_ENV) $(MAKE1) -C $(@D) DESTDIR="$(STAGING_DIR)" install.perl install.sym
86 endef
88 define PERL_INSTALL_TARGET_CMDS
89 $(TARGET_MAKE_ENV) $(MAKE1) -C $(@D) DESTDIR="$(TARGET_DIR)" install.perl install.sym
90 endef
92 HOST_PERL_CONF_OPTS = \
93 -des \
94 -Dprefix="$(HOST_DIR)/usr" \
95 -Dcc="$(HOSTCC)"
97 define HOST_PERL_CONFIGURE_CMDS
98 (cd $(@D); $(HOST_MAKE_ENV) HOSTCC='$(HOSTCC_NOCCACHE)' \
99 ./Configure $(HOST_PERL_CONF_OPTS))
100 endef
102 define HOST_PERL_BUILD_CMDS
103 $(HOST_MAKE_ENV) $(MAKE) -C $(@D)
104 endef
106 define HOST_PERL_INSTALL_CMDS
107 $(HOST_MAKE_ENV) $(MAKE) -C $(@D) INSTALL_DEPENDENCE='' install
108 endef
110 $(eval $(generic-package))
111 $(eval $(host-generic-package))
113 define PERL_FINALIZE_TARGET
114 rm -rf $(TARGET_DIR)/usr/lib/perl5/$(PERL_VERSION)/pod
115 rm -rf $(TARGET_DIR)/usr/lib/perl5/$(PERL_VERSION)/$(PERL_ARCHNAME)/CORE
116 find $(TARGET_DIR)/usr/lib/perl5/ -name 'extralibs.ld' -print0 | xargs -0 rm -f
117 find $(TARGET_DIR)/usr/lib/perl5/ -name '*.bs' -print0 | xargs -0 rm -f
118 find $(TARGET_DIR)/usr/lib/perl5/ -name '.packlist' -print0 | xargs -0 rm -f
119 endef
120 PERL_TARGET_FINALIZE_HOOKS += PERL_FINALIZE_TARGET