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