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