mirror of
https://github.com/motioneye-project/motioneyeos.git
synced 2025-07-30 06:36:34 +00:00
perl: build with perlcross instead of qemu
The perlcross project makes it possible to properly cross-compile perl. It creates a host-miniperl that is configured for the target and uses that to cross-compile the perl modules. Unfortunately there are still a few hacks needed to make it work. Proper fixes can be developed and upstreamed later. Since there is no longer a dependency on qemu, it works on all architectures again. Also removed some config options: - BR2_PACKAGE_PERL_CUSTOM_INSTALL just allows a selection of modules; this can also be encoded by an empty BR2_PACKAGE_PERL_MODULES. - BR2_PACKAGE_PERL_DB_FILE and BR2_PACKAGE_PERL_GDBM_FILE can be derived automatically from the package configs. Signed-off-by: Arnout Vandecappelle (Essensium/Mind) <arnout@mind.be> Signed-off-by: Peter Korsgaard <jacmet@sunsite.dk>
This commit is contained in:
parent
062129c16e
commit
234fe44334
@ -1,12 +1,5 @@
|
|||||||
config BR2_PACKAGE_PERL
|
config BR2_PACKAGE_PERL
|
||||||
bool "perl"
|
bool "perl"
|
||||||
depends on !BR2_avr32
|
|
||||||
depends on !BR2_bfin
|
|
||||||
depends on !BR2_sh2
|
|
||||||
depends on !BR2_sh2a
|
|
||||||
depends on !BR2_sh3
|
|
||||||
depends on !BR2_sh3eb
|
|
||||||
depends on !BR2_sh64
|
|
||||||
help
|
help
|
||||||
Larry Wall's Practical Extraction and Report Language
|
Larry Wall's Practical Extraction and Report Language
|
||||||
An interpreted scripting language, known among some as "Unix's Swiss
|
An interpreted scripting language, known among some as "Unix's Swiss
|
||||||
@ -16,35 +9,18 @@ config BR2_PACKAGE_PERL
|
|||||||
|
|
||||||
if BR2_PACKAGE_PERL
|
if BR2_PACKAGE_PERL
|
||||||
|
|
||||||
config BR2_PACKAGE_PERL_CUSTOM_INSTALL
|
|
||||||
bool "custom install"
|
|
||||||
help
|
|
||||||
Don't use the full install target
|
|
||||||
Install only a selection of modules (like microperl).
|
|
||||||
|
|
||||||
config BR2_PACKAGE_PERL_MODULES
|
config BR2_PACKAGE_PERL_MODULES
|
||||||
string "additional modules"
|
string "custom module selection"
|
||||||
depends on BR2_PACKAGE_PERL_CUSTOM_INSTALL
|
|
||||||
help
|
help
|
||||||
List of space-separated perl modules to copy to the rootfs.
|
List of space-separated perl modules (without .pm) to copy to the
|
||||||
|
rootfs.
|
||||||
|
|
||||||
Examples: constant.pm Getopt/Std.pm Time/Local.pm
|
Examples: constant Getopt/Std Time/Local
|
||||||
|
|
||||||
Module dependencies are not automatic so check your needs.
|
Module dependencies on external libraries are not automatic so
|
||||||
|
check your needs.
|
||||||
|
|
||||||
config BR2_PACKAGE_PERL_DB_FILE
|
Leave empty for all modules (as far as the external libraries
|
||||||
bool "DB_File"
|
are available).
|
||||||
select BR2_PACKAGE_BERKELEYDB
|
|
||||||
help
|
|
||||||
Build the DB_File module.
|
|
||||||
|
|
||||||
config BR2_PACKAGE_PERL_GDBM_FILE
|
|
||||||
bool "GDBM_File"
|
|
||||||
select BR2_PACKAGE_GDBM
|
|
||||||
help
|
|
||||||
Build the GDBM_File module.
|
|
||||||
|
|
||||||
endif
|
endif
|
||||||
|
|
||||||
comment "perl requires an architecture supported by qemu"
|
|
||||||
depends on BR2_avr32 || BR2_bfin || BR2_sh2 || BR2_sh2a || BR2_sh3 || BR2_sh3eb || BR2_sh64
|
|
||||||
|
@ -12,7 +12,26 @@ PERL_LICENSE = Artistic
|
|||||||
PERL_LICENSE_FILES = Artistic
|
PERL_LICENSE_FILES = Artistic
|
||||||
PERL_INSTALL_STAGING = YES
|
PERL_INSTALL_STAGING = YES
|
||||||
|
|
||||||
PERL_DEPENDENCIES = host-qemu
|
PERL_CROSS_VERSION = 0.7
|
||||||
|
PERL_CROSS_SITE = http://download.berlios.de/perlcross
|
||||||
|
PERL_CROSS_SOURCE = perl-5.$(PERL_VERSION_MAJOR).0-cross-$(PERL_CROSS_VERSION).tar.gz
|
||||||
|
|
||||||
|
# We use the perlcross hack to cross-compile perl. It should
|
||||||
|
# be extracted over the perl sources, so we don't define that
|
||||||
|
# as a separate package. Instead, it is downloaded and extracted
|
||||||
|
# together with perl
|
||||||
|
|
||||||
|
define PERL_CROSS_DOWNLOAD
|
||||||
|
$(call DOWNLOAD,$(PERL_CROSS_SITE)/$(PERL_CROSS_SOURCE))
|
||||||
|
endef
|
||||||
|
PERL_POST_DOWNLOAD_HOOKS += PERL_CROSS_DOWNLOAD
|
||||||
|
|
||||||
|
define PERL_CROSS_EXTRACT
|
||||||
|
$(INFLATE$(suffix $(PERL_CROSS_SOURCE))) $(DL_DIR)/$(PERL_CROSS_SOURCE) | \
|
||||||
|
$(TAR) $(TAR_STRIP_COMPONENTS)=1 -C $(@D) $(TAR_OPTIONS) -
|
||||||
|
endef
|
||||||
|
PERL_POST_EXTRACT_HOOKS += PERL_CROSS_EXTRACT
|
||||||
|
|
||||||
ifeq ($(BR2_PACKAGE_BERKELEYDB),y)
|
ifeq ($(BR2_PACKAGE_BERKELEYDB),y)
|
||||||
PERL_DEPENDENCIES += berkeleydb
|
PERL_DEPENDENCIES += berkeleydb
|
||||||
endif
|
endif
|
||||||
@ -20,23 +39,31 @@ ifeq ($(BR2_PACKAGE_GDBM),y)
|
|||||||
PERL_DEPENDENCIES += gdbm
|
PERL_DEPENDENCIES += gdbm
|
||||||
endif
|
endif
|
||||||
|
|
||||||
PERL_CONF_OPT = -des \
|
# Normally, --mode=cross should automatically do the two steps
|
||||||
-Dusecrosscompile \
|
# below, but it doesn't work for some reason.
|
||||||
-Dtargetrun=$(QEMU_USER) \
|
PERL_HOST_CONF_OPT = \
|
||||||
-Dqemulib=$(STAGING_DIR) \
|
--mode=buildmini \
|
||||||
-Dar="$(TARGET_AR)" \
|
--target=$(GNU_TARGET_NAME) \
|
||||||
-Dcc="$(TARGET_CC)" \
|
--target-arch=$(GNU_TARGET_NAME) \
|
||||||
-Dcpp="$(TARGET_CC)" \
|
--set-target-name=$(GNU_TARGET_NAME)
|
||||||
-Dld="$(TARGET_LD)" \
|
|
||||||
-Dnm="$(TARGET_NM)" \
|
# We have to override LD, because an external multilib toolchain ld is not
|
||||||
-Dranlib="$(TARGET_RANLIB)" \
|
# wrapped to provide the required sysroot options. We also can't use ccache
|
||||||
-Dccflags="$(TARGET_CFLAGS)" \
|
# because the configure script doesn't support it.
|
||||||
-Dldflags="$(TARGET_LDFLAGS) -lgcc_s -lm" \
|
PERL_CONF_OPT = \
|
||||||
-Dlddlflags="-shared" \
|
--mode=target \
|
||||||
-Dlibc=$(STAGING_DIR)/lib/libc.so \
|
--target=$(GNU_TARGET_NAME) \
|
||||||
-Duseshrplib \
|
--target-tools-prefix=$(TARGET_CROSS) \
|
||||||
-Dprefix=/usr \
|
--prefix=/usr \
|
||||||
-Uoptimize
|
-Dld="$(TARGET_CC_NOCCACHE)" \
|
||||||
|
-A ccflags="$(TARGET_CFLAGS)" \
|
||||||
|
-A ldflags="$(TARGET_LDFLAGS) -lm" \
|
||||||
|
-A mydomain="" \
|
||||||
|
-A myhostname="$(BR2_TARGET_GENERIC_HOSTNAME)" \
|
||||||
|
-A myuname="Buildroot $(BR2_VERSION_FULL)" \
|
||||||
|
-A osname=linux \
|
||||||
|
-A osvers=$(LINUX_VERSION) \
|
||||||
|
-A perlamdin=root
|
||||||
|
|
||||||
ifeq ($(shell expr $(PERL_VERSION_MAJOR) % 2), 1)
|
ifeq ($(shell expr $(PERL_VERSION_MAJOR) % 2), 1)
|
||||||
PERL_CONF_OPT += -Dusedevel
|
PERL_CONF_OPT += -Dusedevel
|
||||||
@ -46,93 +73,39 @@ ifneq ($(BR2_LARGEFILE),y)
|
|||||||
PERL_CONF_OPT += -Uuselargefiles
|
PERL_CONF_OPT += -Uuselargefiles
|
||||||
endif
|
endif
|
||||||
|
|
||||||
|
PERL_MODULES = $(call qstrip,$(BR2_PACKAGE_PERL_MODULES))
|
||||||
|
ifneq ($(PERL_MODULES),)
|
||||||
|
PERL_CONF_OPT += --only-mod=$(subst $(space),$(comma),$(PERL_MODULES))
|
||||||
|
endif
|
||||||
|
|
||||||
define PERL_CONFIGURE_CMDS
|
define PERL_CONFIGURE_CMDS
|
||||||
rm -f $(@D)/config.sh
|
(cd $(@D); HOSTCC='$(HOSTCC_NOCACHE)' ./configure $(PERL_HOST_CONF_OPT))
|
||||||
(cd $(@D); ./Configure $(PERL_CONF_OPT))
|
(cd $(@D); ./configure $(PERL_CONF_OPT))
|
||||||
echo "# patched values" >>$(@D)/config.sh
|
|
||||||
$(SED) '/^myarchname=/d' \
|
|
||||||
-e '/^mydomain=/d' \
|
|
||||||
-e '/^myhostname=/d' \
|
|
||||||
-e '/^myuname=/d' \
|
|
||||||
-e '/^osname=/d' \
|
|
||||||
-e '/^osvers=/d' \
|
|
||||||
-e '/^perladmin=/d' \
|
|
||||||
$(@D)/config.sh
|
|
||||||
echo "myarchname='$(GNU_TARGET_NAME)'" >>$(@D)/config.sh
|
|
||||||
echo "mydomain=''" >>$(@D)/config.sh
|
|
||||||
echo "myhostname='$(BR2_TARGET_GENERIC_HOSTNAME)'" >>$(@D)/config.sh
|
|
||||||
echo "myuname='Buildroot $(BR2_VERSION_FULL)'" >>$(@D)/config.sh
|
|
||||||
echo "osname='linux'" >>$(@D)/config.sh
|
|
||||||
echo "osvers='$(BR2_LINUX_KERNEL_VERSION)'" >>$(@D)/config.sh
|
|
||||||
echo "perladmin='root'" >>$(@D)/config.sh
|
|
||||||
(cd $(@D); ./Configure -S)
|
|
||||||
cp $(@D)/config.h $(@D)/xconfig.h
|
|
||||||
$(SED) 's/UNKNOWN-/Buildroot $(BR2_VERSION_FULL) /' $(@D)/patchlevel.h
|
$(SED) 's/UNKNOWN-/Buildroot $(BR2_VERSION_FULL) /' $(@D)/patchlevel.h
|
||||||
endef
|
endef
|
||||||
|
|
||||||
|
# perlcross's miniperl_top forgets base, which is required by mktables.
|
||||||
|
# Instead of patching, it's easier to just set PERL5LIB
|
||||||
define PERL_BUILD_CMDS
|
define PERL_BUILD_CMDS
|
||||||
echo "#!/bin/sh" > $(@D)/Cross/miniperl
|
PERL5LIB=$(@D)/dist/base/lib $(MAKE1) -C $(@D) perl modules
|
||||||
echo "$(QEMU_USER) $(@D)/miniperl \"\$$@\"" >>$(@D)/Cross/miniperl
|
|
||||||
chmod +x $(@D)/Cross/miniperl
|
|
||||||
PERL_MM_OPT="PERL=$(@D)/Cross/miniperl" \
|
|
||||||
$(MAKE) -C $(@D) all
|
|
||||||
endef
|
endef
|
||||||
|
|
||||||
define PERL_INSTALL_STAGING_CMDS
|
define PERL_INSTALL_STAGING_CMDS
|
||||||
$(MAKE) INSTALL_DEPENDENCE= \
|
PERL5LIB=$(@D)/dist/base/lib $(MAKE1) -C $(@D) DESTDIR="$(STAGING_DIR)" install.perl
|
||||||
INSTALLFLAGS= \
|
|
||||||
DESTDIR="$(STAGING_DIR)" \
|
|
||||||
-C $(@D) install.perl
|
|
||||||
endef
|
endef
|
||||||
|
|
||||||
PERL_RUN_PERL = $(QEMU_USER) $(@D)/perl -Ilib
|
PERL_INSTALL_TARGET_GOALS = install.perl
|
||||||
PERL_ARCHNAME = $(shell $(PERL_RUN_PERL) -MConfig -e "print Config->{archname}")
|
ifeq ($(BR2_HAVE_DOCUMENTATION),y)
|
||||||
PERL_LIB = $(TARGET_DIR)/usr/lib/perl5/$(PERL_VERSION)
|
PERL_INSTALL_TARGET_GOALS += install.man
|
||||||
PERL_ARCHLIB = $(PERL_LIB)/$(PERL_ARCHNAME)
|
|
||||||
PERL_MODS = $(call qstrip,$(BR2_PACKAGE_PERL_MODULES))
|
|
||||||
# Minimal set of modules required for 'perl -V' to work
|
|
||||||
PERL_ARCH_MODS = Config.pm Config_git.pl Config_heavy.pl
|
|
||||||
PERL_BASE_MODS = strict.pm vars.pm warnings.pm warnings/register.pm
|
|
||||||
|
|
||||||
define PERL_INSTALL_MODULES
|
|
||||||
for i in $(PERL_ARCH_MODS); do \
|
|
||||||
$(INSTALL) -m 0644 -D $(@D)/lib/$$i $(PERL_ARCHLIB)/$$i; \
|
|
||||||
done
|
|
||||||
for i in $(PERL_BASE_MODS); do \
|
|
||||||
$(INSTALL) -m 0644 -D $(@D)/lib/$$i $(PERL_LIB)/$$i; \
|
|
||||||
done
|
|
||||||
for i in $(PERL_MODS); do \
|
|
||||||
j=`echo $$i|cut -d : -f 1` ; \
|
|
||||||
if [ -d $(@D)/lib/$$j ] ; then \
|
|
||||||
cp -af $(@D)/lib/$$j $(PERL_LIB) ; \
|
|
||||||
fi ; \
|
|
||||||
if [ -f $(@D)/lib/$$i ] ; then \
|
|
||||||
$(INSTALL) -m 0644 -D $(@D)/lib/$$i $(PERL_LIB)/$$i; \
|
|
||||||
fi ; \
|
|
||||||
done
|
|
||||||
# Remove test files
|
|
||||||
find $(PERL_LIB) -type f -name *.t -exec rm -f {} \;
|
|
||||||
endef
|
|
||||||
|
|
||||||
ifeq ($(BR2_PACKAGE_PERL_CUSTOM_INSTALL),y)
|
|
||||||
define PERL_INSTALL_TARGET_CMDS
|
|
||||||
$(INSTALL) -m 0755 -D $(@D)/perl $(TARGET_DIR)/usr/bin/perl
|
|
||||||
$(INSTALL) -m 0755 -D $(@D)/libperl.so $(PERL_ARCHLIB)/CORE/libperl.so
|
|
||||||
$(PERL_INSTALL_MODULES)
|
|
||||||
endef
|
|
||||||
else
|
|
||||||
define PERL_INSTALL_TARGET_CMDS
|
|
||||||
$(MAKE) INSTALL_DEPENDENCE= \
|
|
||||||
INSTALLFLAGS=-p \
|
|
||||||
DESTDIR="$(TARGET_DIR)" \
|
|
||||||
-C $(@D) install.perl
|
|
||||||
rm -f $(PERL_ARCHLIB)/CORE/*.h
|
|
||||||
find $(PERL_ARCHLIB) -type f -name *.bs -exec rm -f {} \;
|
|
||||||
endef
|
|
||||||
endif
|
endif
|
||||||
|
|
||||||
|
|
||||||
|
define PERL_INSTALL_TARGET_CMDS
|
||||||
|
PERL5LIB=$(@D)/dist/base/lib $(MAKE1) -C $(@D) DESTDIR="$(TARGET_DIR)" $(PERL_INSTALL_TARGET_GOALS)
|
||||||
|
endef
|
||||||
|
|
||||||
define PERL_CLEAN_CMDS
|
define PERL_CLEAN_CMDS
|
||||||
-$(MAKE) -C $(@D) clean
|
-$(MAKE1) -C $(@D) clean
|
||||||
endef
|
endef
|
||||||
|
|
||||||
$(eval $(generic-package))
|
$(eval $(generic-package))
|
||||||
|
Loading…
x
Reference in New Issue
Block a user