package/cross-ldd: new package

This commit introduces a new cross-ldd package which installs the
cross ldd implementation that comes from Crosstool-NG, and which can
be used like ldd, but when cross-compiling. We intend to use it as a
replacement of host-prelink-cross for our dracut package.

The cross-ldd from Crosstool-NG is in fact even recommended by the
Dracut documentation, in its docs/README.cross document:

   To support cross-compiled binaries, a different ldd variant is needed that
   works on those binaries. One such ldd script is found at
   https://gist.github.com/jerome-pouiller/c403786c1394f53f44a3b61214489e6f

This Github Gist in fact contains the xldd.in code from Crosstool-NG.

Our package downloads the full tarball of Crosstool-NG. We tried to
download only the script and the license file, but we couldn't figure
out a way of downloading them *and* have the version in the filename
to make sure that when doing an upgrade to a newer version, we
wouldn't have a clash between old/new files having the same name (and
causing conflicts with the hash verification). So in the end, we opted
for download the whole tarball.

Signed-off-by: Thomas Petazzoni <thomas.petazzoni@bootlin.com>
Signed-off-by: Romain Naour <romain.naour@smile.fr>
This commit is contained in:
Thomas Petazzoni
2025-01-08 23:43:14 +01:00
committed by Romain Naour
parent 012f03bd27
commit 2528672d39
3 changed files with 42 additions and 0 deletions

View File

@@ -3145,6 +3145,7 @@ F: package/cifs-utils/
F: package/cloop/
F: package/cmake/
F: package/cramfs/
F: package/cross-ldd/
F: package/dmidecode/
F: package/double-conversion/
F: package/flashrom/

View File

@@ -0,0 +1,4 @@
# From http://crosstool-ng.org/download/crosstool-ng/crosstool-ng-1.26.0.tar.xz.sha512
sha512 7834184ae5792fd347455f9f48fee826248dcb82d271954ed4304b1a18f63995ff8a2c3b817564dcf147ac7e16e02d779195b26d97eb57db27f1118a1837002a crosstool-ng-1.26.0.tar.xz
# Locally calculated
sha256 07bc0ccd386469c748c4cf6c8faca5667fbf8c4400386714287fa233acfd68ba COPYING

View File

@@ -0,0 +1,37 @@
################################################################################
#
# cross-ldd
#
################################################################################
CROSS_LDD_VERSION = 1.26.0
CROSS_LDD_SITE = http://crosstool-ng.org/download/crosstool-ng
CROSS_LDD_SOURCE = crosstool-ng-$(CROSS_LDD_VERSION).tar.xz
CROSS_LDD_LICENSE = GPL-2.0
CROSS_LDD_LICENSE_FILES = COPYING
ifeq ($(BR2_ARCH_IS_64),y)
CROSS_LDD_BITNESS = 64
else
CROSS_LDD_BITNESS = 32
endif
CROSS_LDD_TOOLS_PREFIX = $(patsubst %-,%,$(TARGET_CROSS))
define HOST_CROSS_LDD_CONFIGURE_CMDS
sed \
-e "s%@@CT_bash@@%/usr/bin/env bash%" \
-e "s%@@CT_VERSION@@%$(CROSS_LDD_VERSION)%" \
-e "s%@@CT_BITS@@%$(CROSS_LDD_BITNESS)%" \
-e "s%@@CT_sed@@%sed%" \
-e "s%@@CT_grep@@%grep%" \
-e "s%^prefix=.*%prefix=$(CROSS_LDD_TOOLS_PREFIX)%" \
$(@D)/scripts/xldd.in > \
$(@D)/scripts/xldd
endef
define HOST_CROSS_LDD_INSTALL_CMDS
$(INSTALL) -m 0755 -D $(@D)/scripts/xldd $(TARGET_CROSS)xldd
endef
$(eval $(host-generic-package))