Initial Commit
- initial default booting image
This commit is contained in:
@@ -0,0 +1,150 @@
|
||||
From c912e9bb8d5be414fda74b2019deb2a6d2d041a0 Mon Sep 17 00:00:00 2001
|
||||
From: Thomas Petazzoni <thomas.petazzoni@bootlin.com>
|
||||
Date: Sun, 16 Dec 2018 11:52:18 +0100
|
||||
Subject: [PATCH] Only prefix with the sysroot a subset of variables
|
||||
|
||||
The standard logic of pkg-config is to prefix all absolute paths by
|
||||
the sysroot defined in PKG_CONFIG_SYSROOT_DIR. However, while some
|
||||
paths (like includedir, libdir, and paths used in -L and -I options)
|
||||
indeed need to be prefixed by the sysroot, it is not necessarily the
|
||||
case for paths that are used on the target. If they get prefixed by
|
||||
the sysroot, the runtime path on the target is incorrect.
|
||||
|
||||
Unfortunately, pkg-config doesn't have a sense of which path needs to
|
||||
be prefixed by the sysroot, and which path should not be prefixed by
|
||||
the sysroot.
|
||||
|
||||
So, let's simply have a whitelist of paths that should be prefixed:
|
||||
g_ir_scanner, g_ir_compiler, g_ir_generate, includedir, libdir, mapdir,
|
||||
pkgdatadir and sdkdir. This list of variables was collected over years of
|
||||
Buildroot development. All other paths are not prefixed by the sysroot.
|
||||
|
||||
Signed-off-by: Thomas Petazzoni <thomas.petazzoni@bootlin.com>
|
||||
[Updated to include gobject-introspection paths]
|
||||
Signed-off-by: Adam Duskett <aduskett@gmail.com>
|
||||
[Dropped the pkgdatadir path]
|
||||
Signed-off-by: Thomas Devoogdt <thomas@devoogdt.com>
|
||||
---
|
||||
libpkgconf/tuple.c | 64 ++++++++++++++++++++++++++++++++--------------
|
||||
1 file changed, 45 insertions(+), 19 deletions(-)
|
||||
|
||||
diff --git a/libpkgconf/tuple.c b/libpkgconf/tuple.c
|
||||
index 83f6a47..d56fcec 100644
|
||||
--- a/libpkgconf/tuple.c
|
||||
+++ b/libpkgconf/tuple.c
|
||||
@@ -178,6 +178,20 @@ dequote(const char *value)
|
||||
return buf;
|
||||
}
|
||||
|
||||
+static char *
|
||||
+pkgconf_tuple_parse_sysroot(const pkgconf_client_t *client, pkgconf_list_t *vars, const char *value, unsigned int flags, bool add_sysroot);
|
||||
+
|
||||
+const char *sysrooted_keys[] = {
|
||||
+ "g_ir_scanner",
|
||||
+ "g_ir_compiler",
|
||||
+ "g_ir_generate",
|
||||
+ "includedir",
|
||||
+ "libdir",
|
||||
+ "mapdir",
|
||||
+ "sdkdir",
|
||||
+ NULL,
|
||||
+};
|
||||
+
|
||||
static const char *
|
||||
find_sysroot(const pkgconf_client_t *client, pkgconf_list_t *vars)
|
||||
{
|
||||
@@ -237,14 +251,20 @@ pkgconf_tuple_add(const pkgconf_client_t *client, pkgconf_list_t *list, const ch
|
||||
{
|
||||
char *dequote_value;
|
||||
pkgconf_tuple_t *tuple = calloc(1, sizeof(pkgconf_tuple_t));
|
||||
+ bool add_sysroot = false;
|
||||
+ int i;
|
||||
|
||||
pkgconf_tuple_find_delete(list, key);
|
||||
|
||||
dequote_value = dequote(value);
|
||||
|
||||
+ for (i = 0; sysrooted_keys[i] != NULL; i++)
|
||||
+ if (!strcmp(key, sysrooted_keys[i]))
|
||||
+ add_sysroot = true;
|
||||
+
|
||||
tuple->key = strdup(key);
|
||||
if (parse)
|
||||
- tuple->value = pkgconf_tuple_parse(client, list, dequote_value, flags);
|
||||
+ tuple->value = pkgconf_tuple_parse_sysroot(client, list, dequote_value, flags, add_sysroot);
|
||||
else
|
||||
tuple->value = strdup(dequote_value);
|
||||
|
||||
@@ -294,22 +314,8 @@ pkgconf_tuple_find(const pkgconf_client_t *client, pkgconf_list_t *list, const c
|
||||
return NULL;
|
||||
}
|
||||
|
||||
-/*
|
||||
- * !doc
|
||||
- *
|
||||
- * .. c:function:: char *pkgconf_tuple_parse(const pkgconf_client_t *client, pkgconf_list_t *vars, const char *value, unsigned int flags)
|
||||
- *
|
||||
- * Parse an expression for variable substitution.
|
||||
- *
|
||||
- * :param pkgconf_client_t* client: The pkgconf client object to access.
|
||||
- * :param pkgconf_list_t* list: The variable list to search for variables (along side the global variable list).
|
||||
- * :param char* value: The ``key=value`` string to parse.
|
||||
- * :param uint flags: Any flags to consider while parsing.
|
||||
- * :return: the variable data with any variables substituted
|
||||
- * :rtype: char *
|
||||
- */
|
||||
-char *
|
||||
-pkgconf_tuple_parse(const pkgconf_client_t *client, pkgconf_list_t *vars, const char *value, unsigned int flags)
|
||||
+static char *
|
||||
+pkgconf_tuple_parse_sysroot(const pkgconf_client_t *client, pkgconf_list_t *vars, const char *value, unsigned int flags, bool add_sysroot)
|
||||
{
|
||||
char buf[PKGCONF_BUFSIZE];
|
||||
const char *ptr;
|
||||
@@ -318,7 +324,7 @@ pkgconf_tuple_parse(const pkgconf_client_t *client, pkgconf_list_t *vars, const
|
||||
if (!(client->flags & PKGCONF_PKG_PKGF_FDO_SYSROOT_RULES) &&
|
||||
(!(flags & PKGCONF_PKG_PROPF_UNINSTALLED) || (client->flags & PKGCONF_PKG_PKGF_PKGCONF1_SYSROOT_RULES)))
|
||||
{
|
||||
- if (*value == '/' && client->sysroot_dir != NULL && strncmp(value, client->sysroot_dir, strlen(client->sysroot_dir)))
|
||||
+ if (add_sysroot && *value == '/' && client->sysroot_dir != NULL && strncmp(value, client->sysroot_dir, strlen(client->sysroot_dir)))
|
||||
bptr += pkgconf_strlcpy(buf, client->sysroot_dir, sizeof buf);
|
||||
}
|
||||
|
||||
@@ -381,7 +387,7 @@ pkgconf_tuple_parse(const pkgconf_client_t *client, pkgconf_list_t *vars, const
|
||||
{
|
||||
size_t nlen;
|
||||
|
||||
- parsekv = pkgconf_tuple_parse(client, vars, kv, flags);
|
||||
+ parsekv = pkgconf_tuple_parse_sysroot(client, vars, kv, flags, add_sysroot);
|
||||
nlen = pkgconf_strlcpy(bptr, parsekv, remain);
|
||||
free(parsekv);
|
||||
|
||||
@@ -432,6 +438,26 @@ pkgconf_tuple_parse(const pkgconf_client_t *client, pkgconf_list_t *vars, const
|
||||
return strdup(buf);
|
||||
}
|
||||
|
||||
+/*
|
||||
+ * !doc
|
||||
+ *
|
||||
+ * .. c:function:: char *pkgconf_tuple_parse(const pkgconf_client_t *client, pkgconf_list_t *vars, const char *value, unsigned int flags)
|
||||
+ *
|
||||
+ * Parse an expression for variable substitution.
|
||||
+ *
|
||||
+ * :param pkgconf_client_t* client: The pkgconf client object to access.
|
||||
+ * :param pkgconf_list_t* list: The variable list to search for variables (along side the global variable list).
|
||||
+ * :param char* value: The ``key=value`` string to parse.
|
||||
+ * :param uint flags: Any flags to consider while parsing.
|
||||
+ * :return: the variable data with any variables substituted
|
||||
+ * :rtype: char *
|
||||
+ */
|
||||
+char *
|
||||
+pkgconf_tuple_parse(const pkgconf_client_t *client, pkgconf_list_t *vars, const char *value, unsigned int flags)
|
||||
+{
|
||||
+ return pkgconf_tuple_parse_sysroot(client, vars, value, flags, true);
|
||||
+}
|
||||
+
|
||||
/*
|
||||
* !doc
|
||||
*
|
||||
--
|
||||
2.43.0
|
||||
|
||||
10
package/pkgconf/Config.in
Normal file
10
package/pkgconf/Config.in
Normal file
@@ -0,0 +1,10 @@
|
||||
config BR2_PACKAGE_PKGCONF
|
||||
bool "pkgconf"
|
||||
help
|
||||
pkgconf is a program which helps to configure compiler and
|
||||
linker flags for development frameworks. It is similar to
|
||||
pkg-config, but was written from scratch in the summer of
|
||||
2011 to replace pkg-config, which now needs itself to build
|
||||
itself
|
||||
|
||||
http://pkgconf.org/
|
||||
10
package/pkgconf/Config.in.host
Normal file
10
package/pkgconf/Config.in.host
Normal file
@@ -0,0 +1,10 @@
|
||||
config BR2_PACKAGE_HOST_PKGCONF
|
||||
bool "host pkgconf"
|
||||
help
|
||||
pkgconf is a program which helps to configure compiler and
|
||||
linker flags for development frameworks. It is similar to
|
||||
pkg-config, but was written from scratch in the summer of
|
||||
2011 to replace pkg-config, which now needs itself to build
|
||||
itself
|
||||
|
||||
https://github.com/pkgconf/pkgconf
|
||||
12
package/pkgconf/pkg-config.in
Normal file
12
package/pkgconf/pkg-config.in
Normal file
@@ -0,0 +1,12 @@
|
||||
#!/bin/sh
|
||||
PKGCONFDIR=$(dirname $0)
|
||||
DEFAULT_PKG_CONFIG_LIBDIR=${PKGCONFDIR}/../@STAGING_SUBDIR@/usr/lib/pkgconfig:${PKGCONFDIR}/../@STAGING_SUBDIR@/usr/share/pkgconfig
|
||||
DEFAULT_PKG_CONFIG_SYSROOT_DIR=${PKGCONFDIR}/../@STAGING_SUBDIR@
|
||||
DEFAULT_PKG_CONFIG_SYSTEM_INCLUDE_PATH=${PKGCONFDIR}/../@STAGING_SUBDIR@/usr/include
|
||||
DEFAULT_PKG_CONFIG_SYSTEM_LIBRARY_PATH=${PKGCONFDIR}/../@STAGING_SUBDIR@/usr/lib
|
||||
|
||||
PKG_CONFIG_LIBDIR=${PKG_CONFIG_LIBDIR:-${DEFAULT_PKG_CONFIG_LIBDIR}} \
|
||||
PKG_CONFIG_SYSROOT_DIR=${PKG_CONFIG_SYSROOT_DIR:-${DEFAULT_PKG_CONFIG_SYSROOT_DIR}} \
|
||||
PKG_CONFIG_SYSTEM_INCLUDE_PATH=${PKG_CONFIG_SYSTEM_INCLUDE_PATH:-${DEFAULT_PKG_CONFIG_SYSTEM_INCLUDE_PATH}} \
|
||||
PKG_CONFIG_SYSTEM_LIBRARY_PATH=${PKG_CONFIG_SYSTEM_LIBRARY_PATH:-${DEFAULT_PKG_CONFIG_SYSTEM_LIBRARY_PATH}} \
|
||||
exec ${PKGCONFDIR}/pkgconf --keep-system-libs @STATIC@ "$@"
|
||||
3
package/pkgconf/pkgconf.hash
Normal file
3
package/pkgconf/pkgconf.hash
Normal file
@@ -0,0 +1,3 @@
|
||||
# Locally calculated
|
||||
sha256 3a9080ac51d03615e7c1910a0a2a8df08424892b5f13b0628a204d3fcce0ea8b pkgconf-2.3.0.tar.xz
|
||||
sha256 07ee94b50a41ee3fc4e13a9b9c60b26fc28488494c465639f7e5f07a3952ec04 COPYING
|
||||
53
package/pkgconf/pkgconf.mk
Normal file
53
package/pkgconf/pkgconf.mk
Normal file
@@ -0,0 +1,53 @@
|
||||
################################################################################
|
||||
#
|
||||
# pkgconf
|
||||
#
|
||||
################################################################################
|
||||
|
||||
PKGCONF_VERSION = 2.3.0
|
||||
PKGCONF_SITE = https://distfiles.ariadne.space/pkgconf
|
||||
PKGCONF_SOURCE = pkgconf-$(PKGCONF_VERSION).tar.xz
|
||||
PKGCONF_LICENSE = pkgconf license
|
||||
PKGCONF_LICENSE_FILES = COPYING
|
||||
PKGCONF_CPE_ID_VENDOR = pkgconf
|
||||
|
||||
# The package is a dependency to ccache so ccache cannot be a dependency
|
||||
HOST_PKGCONF_ADD_CCACHE_DEPENDENCY = NO
|
||||
|
||||
# We are a ccache dependency, so we can't use ccache
|
||||
HOST_PKGCONF_CONF_ENV = \
|
||||
CC="$(HOSTCC_NOCCACHE)" \
|
||||
CXX="$(HOSTCXX_NOCCACHE)"
|
||||
|
||||
PKG_CONFIG_HOST_BINARY = $(HOST_DIR)/bin/pkg-config
|
||||
|
||||
define PKGCONF_LINK_PKGCONFIG
|
||||
ln -sf pkgconf $(TARGET_DIR)/usr/bin/pkg-config
|
||||
endef
|
||||
|
||||
define HOST_PKGCONF_INSTALL_WRAPPER
|
||||
$(INSTALL) -m 0755 -D package/pkgconf/pkg-config.in \
|
||||
$(HOST_DIR)/bin/pkg-config
|
||||
$(SED) 's,@STAGING_SUBDIR@,$(STAGING_SUBDIR),g' \
|
||||
$(HOST_DIR)/bin/pkg-config
|
||||
endef
|
||||
|
||||
define HOST_PKGCONF_STATIC
|
||||
$(SED) 's,@STATIC@,--static,' $(HOST_DIR)/bin/pkg-config
|
||||
endef
|
||||
|
||||
define HOST_PKGCONF_SHARED
|
||||
$(SED) 's,@STATIC@,,' $(HOST_DIR)/bin/pkg-config
|
||||
endef
|
||||
|
||||
PKGCONF_POST_INSTALL_TARGET_HOOKS += PKGCONF_LINK_PKGCONFIG
|
||||
HOST_PKGCONF_POST_INSTALL_HOOKS += HOST_PKGCONF_INSTALL_WRAPPER
|
||||
|
||||
ifeq ($(BR2_STATIC_LIBS),y)
|
||||
HOST_PKGCONF_POST_INSTALL_HOOKS += HOST_PKGCONF_STATIC
|
||||
else
|
||||
HOST_PKGCONF_POST_INSTALL_HOOKS += HOST_PKGCONF_SHARED
|
||||
endif
|
||||
|
||||
$(eval $(autotools-package))
|
||||
$(eval $(host-autotools-package))
|
||||
Reference in New Issue
Block a user