summaryrefslogtreecommitdiff
path: root/builder
diff options
context:
space:
mode:
authorTristan Van Berkom <tristan.vanberkom@codethink.co.uk>2016-04-30 22:43:39 +0100
committerAlexander Larsson <alexl@redhat.com>2016-05-02 08:46:52 +0200
commitaa69c1afefd732627c01f53ef335cc04d4d8d8c1 (patch)
tree5723f7b293da4888e63eac08bccef4d27ce61686 /builder
parent126d805e9033cb4b8ef00b39ae7282577325f70f (diff)
downloadxdg-app-aa69c1afefd732627c01f53ef335cc04d4d8d8c1.tar.gz
xdg-app-builder: Add --arch command line option
This is only useful for building for architectures which are compatible with the build host, e.g. building i686 binaries on an x86_64 build host.
Diffstat (limited to 'builder')
-rw-r--r--builder/builder-manifest.c10
-rw-r--r--builder/xdg-app-builder-main.c5
2 files changed, 13 insertions, 2 deletions
diff --git a/builder/builder-manifest.c b/builder/builder-manifest.c
index f75b305..f47a140 100644
--- a/builder/builder-manifest.c
+++ b/builder/builder-manifest.c
@@ -836,14 +836,18 @@ builder_manifest_start (BuilderManifest *self,
BuilderContext *context,
GError **error)
{
- self->sdk_commit = xdg_app (NULL, "info", "--show-commit", self->sdk,
+ g_autofree char *arch_option;
+
+ arch_option = g_strdup_printf ("--arch=%s", builder_context_get_arch (context));
+
+ self->sdk_commit = xdg_app (NULL, "info", arch_option, "--show-commit", self->sdk,
builder_manifest_get_runtime_version (self), NULL);
if (self->sdk_commit == NULL)
return xdg_app_fail (error, "Unable to find sdk %s version %s",
self->sdk,
builder_manifest_get_runtime_version (self));
- self->runtime_commit = xdg_app (NULL, "info", "--show-commit", self->runtime,
+ self->runtime_commit = xdg_app (NULL, "info", arch_option, "--show-commit", self->runtime,
builder_manifest_get_runtime_version (self), NULL);
if (self->runtime_commit == NULL)
return xdg_app_fail (error, "Unable to find runtime %s version %s",
@@ -905,6 +909,7 @@ builder_manifest_init_app_dir (BuilderManifest *self,
for (i = 0; self->tags[i] != NULL; i++)
g_ptr_array_add (args, g_strdup_printf ("--tag=%s", self->tags[i]));
}
+ g_ptr_array_add (args, g_strdup_printf ("--arch=%s", builder_context_get_arch (context)));
g_ptr_array_add (args, g_file_get_path (app_dir));
g_ptr_array_add (args, g_strdup (self->id));
g_ptr_array_add (args, g_strdup (self->sdk));
@@ -1751,6 +1756,7 @@ builder_manifest_create_platform (BuilderManifest *self,
g_ptr_array_add (args, g_strdup ("--update"));
g_ptr_array_add (args, g_strdup ("--writable-sdk"));
g_ptr_array_add (args, g_strdup ("--sdk-dir=platform"));
+ g_ptr_array_add (args, g_strdup_printf ("--arch=%s", builder_context_get_arch (context)));
for (i = 0; self->platform_extensions != NULL && self->platform_extensions[i] != NULL; i++)
{
diff --git a/builder/xdg-app-builder-main.c b/builder/xdg-app-builder-main.c
index b2fa2f5..2107347 100644
--- a/builder/xdg-app-builder-main.c
+++ b/builder/xdg-app-builder-main.c
@@ -44,6 +44,7 @@ static gboolean opt_ccache;
static gboolean opt_require_changes;
static gboolean opt_keep_build_dirs;
static gboolean opt_force_clean;
+static char *opt_arch;
static char *opt_repo;
static char *opt_subject;
static char *opt_body;
@@ -53,6 +54,7 @@ static char **opt_key_ids;
static GOptionEntry entries[] = {
{ "verbose", 'v', 0, G_OPTION_ARG_NONE, &opt_verbose, "Print debug information during command processing", NULL },
{ "version", 0, 0, G_OPTION_ARG_NONE, &opt_version, "Print version information and exit", NULL },
+ { "arch", 0, 0, G_OPTION_ARG_STRING, &opt_arch, "Architecture to build for (must be host compatible)", "ARCH" },
{ "run", 0, 0, G_OPTION_ARG_NONE, &opt_run, "Run a command in the build directory", NULL },
{ "ccache", 0, 0, G_OPTION_ARG_NONE, &opt_ccache, "Use ccache", NULL },
{ "disable-cache", 0, 0, G_OPTION_ARG_NONE, &opt_disable_cache, "Disable cache", NULL },
@@ -230,6 +232,9 @@ main (int argc,
builder_context_set_keep_build_dirs (build_context, opt_keep_build_dirs);
+ if (opt_arch)
+ builder_context_set_arch (build_context, opt_arch);
+
if (opt_ccache &&
!builder_context_enable_ccache (build_context, &error))
{