2015-11-16 15:23:23 +00:00
|
|
|
/* builder-options.c
|
|
|
|
*
|
|
|
|
* Copyright (C) 2015 Red Hat, Inc
|
|
|
|
*
|
|
|
|
* This file is free software; you can redistribute it and/or modify it
|
|
|
|
* under the terms of the GNU Lesser General Public License as
|
2015-11-26 13:50:21 +00:00
|
|
|
* published by the Free Software Foundation; either version 2 of the
|
2015-11-16 15:23:23 +00:00
|
|
|
* License, or (at your option) any later version.
|
|
|
|
*
|
|
|
|
* This file is distributed in the hope that it will be useful, but
|
|
|
|
* WITHOUT ANY WARRANTY; without even the implied warranty of
|
|
|
|
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
|
|
|
|
* Lesser General Public License for more details.
|
|
|
|
*
|
2015-11-26 13:50:21 +00:00
|
|
|
* You should have received a copy of the GNU Lesser General Public License
|
2015-11-16 15:23:23 +00:00
|
|
|
* along with this program. If not, see <http://www.gnu.org/licenses/>.
|
|
|
|
*
|
|
|
|
* Authors:
|
|
|
|
* Alexander Larsson <alexl@redhat.com>
|
|
|
|
*/
|
|
|
|
|
|
|
|
#include "config.h"
|
|
|
|
|
|
|
|
#include <string.h>
|
|
|
|
#include <fcntl.h>
|
|
|
|
#include <stdio.h>
|
|
|
|
#include <string.h>
|
|
|
|
#include <stdlib.h>
|
|
|
|
#include <sys/statfs.h>
|
|
|
|
|
|
|
|
#include "builder-options.h"
|
|
|
|
#include "builder-context.h"
|
|
|
|
#include "builder-utils.h"
|
|
|
|
|
2016-05-06 14:03:27 +00:00
|
|
|
struct BuilderOptions
|
|
|
|
{
|
|
|
|
GObject parent;
|
|
|
|
|
|
|
|
gboolean strip;
|
|
|
|
gboolean no_debuginfo;
|
2017-10-05 15:59:24 +00:00
|
|
|
gboolean no_debuginfo_compression;
|
2016-05-06 14:03:27 +00:00
|
|
|
char *cflags;
|
2017-05-22 06:50:18 +00:00
|
|
|
char *cppflags;
|
2016-05-06 14:03:27 +00:00
|
|
|
char *cxxflags;
|
2017-03-14 09:26:22 +00:00
|
|
|
char *ldflags;
|
2017-09-06 17:47:12 +00:00
|
|
|
char *append_path;
|
|
|
|
char *append_ld_library_path;
|
2016-05-06 14:03:27 +00:00
|
|
|
char *prefix;
|
|
|
|
char **env;
|
|
|
|
char **build_args;
|
|
|
|
char **config_opts;
|
2017-09-22 15:07:22 +00:00
|
|
|
char **make_args;
|
|
|
|
char **make_install_args;
|
2015-11-16 15:23:23 +00:00
|
|
|
GHashTable *arch;
|
|
|
|
};
|
|
|
|
|
2016-05-06 14:03:27 +00:00
|
|
|
typedef struct
|
|
|
|
{
|
2015-11-16 15:23:23 +00:00
|
|
|
GObjectClass parent_class;
|
|
|
|
} BuilderOptionsClass;
|
|
|
|
|
|
|
|
static void serializable_iface_init (JsonSerializableIface *serializable_iface);
|
|
|
|
|
|
|
|
G_DEFINE_TYPE_WITH_CODE (BuilderOptions, builder_options, G_TYPE_OBJECT,
|
|
|
|
G_IMPLEMENT_INTERFACE (JSON_TYPE_SERIALIZABLE, serializable_iface_init));
|
|
|
|
|
|
|
|
enum {
|
|
|
|
PROP_0,
|
|
|
|
PROP_CFLAGS,
|
2017-05-22 06:50:18 +00:00
|
|
|
PROP_CPPFLAGS,
|
2015-11-16 15:23:23 +00:00
|
|
|
PROP_CXXFLAGS,
|
2017-03-14 09:26:22 +00:00
|
|
|
PROP_LDFLAGS,
|
2015-12-15 18:28:14 +00:00
|
|
|
PROP_PREFIX,
|
2015-11-16 15:23:23 +00:00
|
|
|
PROP_ENV,
|
2016-01-08 17:01:35 +00:00
|
|
|
PROP_STRIP,
|
|
|
|
PROP_NO_DEBUGINFO,
|
2017-10-05 15:59:24 +00:00
|
|
|
PROP_NO_DEBUGINFO_COMPRESSION,
|
2015-11-16 15:23:23 +00:00
|
|
|
PROP_ARCH,
|
|
|
|
PROP_BUILD_ARGS,
|
2016-04-14 17:30:47 +00:00
|
|
|
PROP_CONFIG_OPTS,
|
2017-09-22 15:07:22 +00:00
|
|
|
PROP_MAKE_ARGS,
|
|
|
|
PROP_MAKE_INSTALL_ARGS,
|
2017-09-06 17:47:12 +00:00
|
|
|
PROP_APPEND_PATH,
|
|
|
|
PROP_APPEND_LD_LIBRARY_PATH,
|
2015-11-16 15:23:23 +00:00
|
|
|
LAST_PROP
|
|
|
|
};
|
|
|
|
|
|
|
|
|
|
|
|
static void
|
|
|
|
builder_options_finalize (GObject *object)
|
|
|
|
{
|
2016-05-06 14:03:27 +00:00
|
|
|
BuilderOptions *self = (BuilderOptions *) object;
|
2015-11-16 15:23:23 +00:00
|
|
|
|
|
|
|
g_free (self->cflags);
|
|
|
|
g_free (self->cxxflags);
|
2017-05-22 06:50:18 +00:00
|
|
|
g_free (self->cppflags);
|
2017-03-14 09:26:22 +00:00
|
|
|
g_free (self->ldflags);
|
2017-09-06 17:47:12 +00:00
|
|
|
g_free (self->append_path);
|
|
|
|
g_free (self->append_ld_library_path);
|
2015-12-15 18:28:14 +00:00
|
|
|
g_free (self->prefix);
|
2015-11-16 15:23:23 +00:00
|
|
|
g_strfreev (self->env);
|
|
|
|
g_strfreev (self->build_args);
|
2016-04-14 17:30:47 +00:00
|
|
|
g_strfreev (self->config_opts);
|
2017-09-22 15:07:22 +00:00
|
|
|
g_strfreev (self->make_args);
|
|
|
|
g_strfreev (self->make_install_args);
|
2016-07-28 19:51:02 +00:00
|
|
|
g_hash_table_destroy (self->arch);
|
2015-11-16 15:23:23 +00:00
|
|
|
|
|
|
|
G_OBJECT_CLASS (builder_options_parent_class)->finalize (object);
|
|
|
|
}
|
|
|
|
|
|
|
|
static void
|
|
|
|
builder_options_get_property (GObject *object,
|
2016-05-06 14:03:27 +00:00
|
|
|
guint prop_id,
|
|
|
|
GValue *value,
|
|
|
|
GParamSpec *pspec)
|
2015-11-16 15:23:23 +00:00
|
|
|
{
|
|
|
|
BuilderOptions *self = BUILDER_OPTIONS (object);
|
|
|
|
|
|
|
|
switch (prop_id)
|
|
|
|
{
|
|
|
|
case PROP_CFLAGS:
|
|
|
|
g_value_set_string (value, self->cflags);
|
|
|
|
break;
|
|
|
|
|
2017-05-22 06:50:18 +00:00
|
|
|
case PROP_CPPFLAGS:
|
|
|
|
g_value_set_string (value, self->cppflags);
|
|
|
|
break;
|
|
|
|
|
2015-11-16 15:23:23 +00:00
|
|
|
case PROP_CXXFLAGS:
|
|
|
|
g_value_set_string (value, self->cxxflags);
|
|
|
|
break;
|
|
|
|
|
2017-03-14 09:26:22 +00:00
|
|
|
case PROP_LDFLAGS:
|
|
|
|
g_value_set_string (value, self->ldflags);
|
|
|
|
break;
|
|
|
|
|
2017-09-06 17:47:12 +00:00
|
|
|
case PROP_APPEND_PATH:
|
|
|
|
g_value_set_string (value, self->append_path);
|
|
|
|
break;
|
|
|
|
|
|
|
|
case PROP_APPEND_LD_LIBRARY_PATH:
|
|
|
|
g_value_set_string (value, self->append_ld_library_path);
|
|
|
|
break;
|
|
|
|
|
2015-12-15 18:28:14 +00:00
|
|
|
case PROP_PREFIX:
|
|
|
|
g_value_set_string (value, self->prefix);
|
|
|
|
break;
|
|
|
|
|
2015-11-16 15:23:23 +00:00
|
|
|
case PROP_ENV:
|
|
|
|
g_value_set_boxed (value, self->env);
|
|
|
|
break;
|
|
|
|
|
|
|
|
case PROP_ARCH:
|
|
|
|
g_value_set_boxed (value, self->arch);
|
|
|
|
break;
|
|
|
|
|
|
|
|
case PROP_BUILD_ARGS:
|
|
|
|
g_value_set_boxed (value, self->build_args);
|
|
|
|
break;
|
|
|
|
|
2016-04-14 17:30:47 +00:00
|
|
|
case PROP_CONFIG_OPTS:
|
|
|
|
g_value_set_boxed (value, self->config_opts);
|
|
|
|
break;
|
|
|
|
|
2017-09-22 15:07:22 +00:00
|
|
|
case PROP_MAKE_ARGS:
|
|
|
|
g_value_set_boxed (value, self->make_args);
|
|
|
|
break;
|
|
|
|
|
|
|
|
case PROP_MAKE_INSTALL_ARGS:
|
|
|
|
g_value_set_boxed (value, self->make_install_args);
|
|
|
|
break;
|
|
|
|
|
2016-01-08 17:01:35 +00:00
|
|
|
case PROP_STRIP:
|
|
|
|
g_value_set_boolean (value, self->strip);
|
|
|
|
break;
|
|
|
|
|
|
|
|
case PROP_NO_DEBUGINFO:
|
|
|
|
g_value_set_boolean (value, self->no_debuginfo);
|
|
|
|
break;
|
|
|
|
|
2017-10-05 15:59:24 +00:00
|
|
|
case PROP_NO_DEBUGINFO_COMPRESSION:
|
|
|
|
g_value_set_boolean (value, self->no_debuginfo_compression);
|
|
|
|
break;
|
|
|
|
|
2015-11-16 15:23:23 +00:00
|
|
|
default:
|
|
|
|
G_OBJECT_WARN_INVALID_PROPERTY_ID (object, prop_id, pspec);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
static void
|
|
|
|
builder_options_set_property (GObject *object,
|
2016-05-06 14:03:27 +00:00
|
|
|
guint prop_id,
|
|
|
|
const GValue *value,
|
|
|
|
GParamSpec *pspec)
|
2015-11-16 15:23:23 +00:00
|
|
|
{
|
|
|
|
BuilderOptions *self = BUILDER_OPTIONS (object);
|
|
|
|
gchar **tmp;
|
|
|
|
|
|
|
|
switch (prop_id)
|
|
|
|
{
|
|
|
|
case PROP_CFLAGS:
|
|
|
|
g_clear_pointer (&self->cflags, g_free);
|
|
|
|
self->cflags = g_value_dup_string (value);
|
|
|
|
break;
|
|
|
|
|
|
|
|
case PROP_CXXFLAGS:
|
|
|
|
g_clear_pointer (&self->cxxflags, g_free);
|
|
|
|
self->cxxflags = g_value_dup_string (value);
|
|
|
|
break;
|
|
|
|
|
2017-05-22 06:50:18 +00:00
|
|
|
case PROP_CPPFLAGS:
|
|
|
|
g_clear_pointer (&self->cppflags, g_free);
|
|
|
|
self->cppflags = g_value_dup_string (value);
|
|
|
|
break;
|
|
|
|
|
2017-03-14 09:26:22 +00:00
|
|
|
case PROP_LDFLAGS:
|
|
|
|
g_clear_pointer (&self->ldflags, g_free);
|
|
|
|
self->ldflags = g_value_dup_string (value);
|
|
|
|
break;
|
|
|
|
|
2017-09-06 17:47:12 +00:00
|
|
|
case PROP_APPEND_PATH:
|
|
|
|
g_clear_pointer (&self->append_path, g_free);
|
|
|
|
self->append_path = g_value_dup_string (value);
|
|
|
|
break;
|
|
|
|
|
|
|
|
case PROP_APPEND_LD_LIBRARY_PATH:
|
|
|
|
g_clear_pointer (&self->append_ld_library_path, g_free);
|
|
|
|
self->append_ld_library_path = g_value_dup_string (value);
|
|
|
|
break;
|
|
|
|
|
2015-12-15 18:28:14 +00:00
|
|
|
case PROP_PREFIX:
|
|
|
|
g_clear_pointer (&self->prefix, g_free);
|
|
|
|
self->prefix = g_value_dup_string (value);
|
|
|
|
break;
|
|
|
|
|
2015-11-16 15:23:23 +00:00
|
|
|
case PROP_ENV:
|
|
|
|
tmp = self->env;
|
|
|
|
self->env = g_strdupv (g_value_get_boxed (value));
|
|
|
|
g_strfreev (tmp);
|
|
|
|
break;
|
|
|
|
|
|
|
|
case PROP_ARCH:
|
|
|
|
g_hash_table_destroy (self->arch);
|
|
|
|
/* NOTE: This takes ownership of the hash table! */
|
|
|
|
self->arch = g_value_dup_boxed (value);
|
|
|
|
break;
|
|
|
|
|
|
|
|
case PROP_BUILD_ARGS:
|
|
|
|
tmp = self->build_args;
|
|
|
|
self->build_args = g_strdupv (g_value_get_boxed (value));
|
|
|
|
g_strfreev (tmp);
|
|
|
|
break;
|
|
|
|
|
2016-04-14 17:30:47 +00:00
|
|
|
case PROP_CONFIG_OPTS:
|
|
|
|
tmp = self->config_opts;
|
|
|
|
self->config_opts = g_strdupv (g_value_get_boxed (value));
|
|
|
|
g_strfreev (tmp);
|
|
|
|
break;
|
|
|
|
|
2017-09-22 15:07:22 +00:00
|
|
|
case PROP_MAKE_ARGS:
|
|
|
|
tmp = self->make_args;
|
|
|
|
self->make_args = g_strdupv (g_value_get_boxed (value));
|
|
|
|
g_strfreev (tmp);
|
|
|
|
break;
|
|
|
|
|
|
|
|
case PROP_MAKE_INSTALL_ARGS:
|
|
|
|
tmp = self->make_install_args;
|
|
|
|
self->make_install_args = g_strdupv (g_value_get_boxed (value));
|
|
|
|
g_strfreev (tmp);
|
|
|
|
break;
|
|
|
|
|
2016-01-08 17:01:35 +00:00
|
|
|
case PROP_STRIP:
|
|
|
|
self->strip = g_value_get_boolean (value);
|
|
|
|
break;
|
|
|
|
|
|
|
|
case PROP_NO_DEBUGINFO:
|
|
|
|
self->no_debuginfo = g_value_get_boolean (value);
|
|
|
|
break;
|
|
|
|
|
2017-10-05 15:59:24 +00:00
|
|
|
case PROP_NO_DEBUGINFO_COMPRESSION:
|
|
|
|
self->no_debuginfo_compression = g_value_get_boolean (value);
|
|
|
|
break;
|
|
|
|
|
2015-11-16 15:23:23 +00:00
|
|
|
default:
|
|
|
|
G_OBJECT_WARN_INVALID_PROPERTY_ID (object, prop_id, pspec);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
static void
|
|
|
|
builder_options_class_init (BuilderOptionsClass *klass)
|
|
|
|
{
|
|
|
|
GObjectClass *object_class = G_OBJECT_CLASS (klass);
|
|
|
|
|
|
|
|
object_class->finalize = builder_options_finalize;
|
|
|
|
object_class->get_property = builder_options_get_property;
|
|
|
|
object_class->set_property = builder_options_set_property;
|
|
|
|
|
|
|
|
g_object_class_install_property (object_class,
|
|
|
|
PROP_CFLAGS,
|
|
|
|
g_param_spec_string ("cflags",
|
|
|
|
"",
|
|
|
|
"",
|
|
|
|
NULL,
|
|
|
|
G_PARAM_READWRITE));
|
|
|
|
g_object_class_install_property (object_class,
|
|
|
|
PROP_CXXFLAGS,
|
|
|
|
g_param_spec_string ("cxxflags",
|
|
|
|
"",
|
|
|
|
"",
|
|
|
|
NULL,
|
|
|
|
G_PARAM_READWRITE));
|
2017-05-22 06:50:18 +00:00
|
|
|
g_object_class_install_property (object_class,
|
|
|
|
PROP_CPPFLAGS,
|
|
|
|
g_param_spec_string ("cppflags",
|
|
|
|
"",
|
|
|
|
"",
|
|
|
|
NULL,
|
|
|
|
G_PARAM_READWRITE));
|
2017-03-14 09:26:22 +00:00
|
|
|
g_object_class_install_property (object_class,
|
|
|
|
PROP_LDFLAGS,
|
|
|
|
g_param_spec_string ("ldflags",
|
|
|
|
"",
|
|
|
|
"",
|
|
|
|
NULL,
|
|
|
|
G_PARAM_READWRITE));
|
2017-09-06 17:47:12 +00:00
|
|
|
g_object_class_install_property (object_class,
|
|
|
|
PROP_APPEND_PATH,
|
|
|
|
g_param_spec_string ("append-path",
|
|
|
|
"",
|
|
|
|
"",
|
|
|
|
NULL,
|
|
|
|
G_PARAM_READWRITE));
|
|
|
|
g_object_class_install_property (object_class,
|
|
|
|
PROP_APPEND_LD_LIBRARY_PATH,
|
|
|
|
g_param_spec_string ("append-ld-library-path",
|
|
|
|
"",
|
|
|
|
"",
|
|
|
|
NULL,
|
|
|
|
G_PARAM_READWRITE));
|
2015-12-15 18:28:14 +00:00
|
|
|
g_object_class_install_property (object_class,
|
|
|
|
PROP_PREFIX,
|
|
|
|
g_param_spec_string ("prefix",
|
|
|
|
"",
|
|
|
|
"",
|
|
|
|
NULL,
|
|
|
|
G_PARAM_READWRITE));
|
2015-11-16 15:23:23 +00:00
|
|
|
g_object_class_install_property (object_class,
|
|
|
|
PROP_ENV,
|
|
|
|
g_param_spec_boxed ("env",
|
|
|
|
"",
|
|
|
|
"",
|
|
|
|
G_TYPE_STRV,
|
|
|
|
G_PARAM_READWRITE));
|
|
|
|
g_object_class_install_property (object_class,
|
|
|
|
PROP_ARCH,
|
|
|
|
g_param_spec_boxed ("arch",
|
|
|
|
"",
|
|
|
|
"",
|
|
|
|
G_TYPE_HASH_TABLE,
|
|
|
|
G_PARAM_READWRITE));
|
|
|
|
g_object_class_install_property (object_class,
|
|
|
|
PROP_BUILD_ARGS,
|
|
|
|
g_param_spec_boxed ("build-args",
|
|
|
|
"",
|
|
|
|
"",
|
|
|
|
G_TYPE_STRV,
|
|
|
|
G_PARAM_READWRITE));
|
2016-04-14 17:30:47 +00:00
|
|
|
g_object_class_install_property (object_class,
|
|
|
|
PROP_CONFIG_OPTS,
|
|
|
|
g_param_spec_boxed ("config-opts",
|
|
|
|
"",
|
|
|
|
"",
|
|
|
|
G_TYPE_STRV,
|
|
|
|
G_PARAM_READWRITE));
|
2017-09-22 15:07:22 +00:00
|
|
|
g_object_class_install_property (object_class,
|
|
|
|
PROP_MAKE_ARGS,
|
|
|
|
g_param_spec_boxed ("make-args",
|
|
|
|
"",
|
|
|
|
"",
|
|
|
|
G_TYPE_STRV,
|
|
|
|
G_PARAM_READWRITE));
|
|
|
|
g_object_class_install_property (object_class,
|
|
|
|
PROP_MAKE_INSTALL_ARGS,
|
|
|
|
g_param_spec_boxed ("make-install-args",
|
|
|
|
"",
|
|
|
|
"",
|
|
|
|
G_TYPE_STRV,
|
|
|
|
G_PARAM_READWRITE));
|
2016-01-08 17:01:35 +00:00
|
|
|
g_object_class_install_property (object_class,
|
|
|
|
PROP_STRIP,
|
|
|
|
g_param_spec_boolean ("strip",
|
|
|
|
"",
|
|
|
|
"",
|
|
|
|
FALSE,
|
|
|
|
G_PARAM_READWRITE));
|
|
|
|
g_object_class_install_property (object_class,
|
2016-04-14 17:28:08 +00:00
|
|
|
PROP_NO_DEBUGINFO,
|
2016-01-08 17:01:35 +00:00
|
|
|
g_param_spec_boolean ("no-debuginfo",
|
|
|
|
"",
|
|
|
|
"",
|
|
|
|
FALSE,
|
|
|
|
G_PARAM_READWRITE));
|
2017-10-05 15:59:24 +00:00
|
|
|
g_object_class_install_property (object_class,
|
|
|
|
PROP_NO_DEBUGINFO_COMPRESSION,
|
|
|
|
g_param_spec_boolean ("no-debuginfo-compression",
|
|
|
|
"",
|
|
|
|
"",
|
|
|
|
FALSE,
|
|
|
|
G_PARAM_READWRITE));
|
2015-11-16 15:23:23 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
static void
|
|
|
|
builder_options_init (BuilderOptions *self)
|
|
|
|
{
|
|
|
|
self->arch = g_hash_table_new_full (g_str_hash, g_str_equal, g_free, g_object_unref);
|
|
|
|
}
|
|
|
|
|
2015-12-09 09:33:54 +00:00
|
|
|
static JsonNode *
|
|
|
|
builder_options_serialize_property (JsonSerializable *serializable,
|
|
|
|
const gchar *property_name,
|
|
|
|
const GValue *value,
|
|
|
|
GParamSpec *pspec)
|
|
|
|
{
|
|
|
|
if (strcmp (property_name, "arch") == 0)
|
|
|
|
{
|
|
|
|
BuilderOptions *self = BUILDER_OPTIONS (serializable);
|
|
|
|
JsonNode *retval = NULL;
|
|
|
|
|
|
|
|
if (self->arch && g_hash_table_size (self->arch) > 0)
|
|
|
|
{
|
|
|
|
JsonObject *object;
|
|
|
|
GHashTableIter iter;
|
|
|
|
gpointer key, value;
|
|
|
|
|
|
|
|
object = json_object_new ();
|
|
|
|
|
|
|
|
g_hash_table_iter_init (&iter, self->arch);
|
|
|
|
while (g_hash_table_iter_next (&iter, &key, &value))
|
|
|
|
{
|
|
|
|
JsonNode *child = json_gobject_serialize (value);
|
2016-05-06 14:03:27 +00:00
|
|
|
json_object_set_member (object, (char *) key, child);
|
2015-12-09 09:33:54 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
retval = json_node_init_object (json_node_alloc (), object);
|
|
|
|
json_object_unref (object);
|
|
|
|
}
|
|
|
|
|
|
|
|
return retval;
|
|
|
|
}
|
|
|
|
else if (strcmp (property_name, "env") == 0)
|
|
|
|
{
|
|
|
|
BuilderOptions *self = BUILDER_OPTIONS (serializable);
|
|
|
|
JsonNode *retval = NULL;
|
|
|
|
|
|
|
|
if (self->env && g_strv_length (self->env) > 0)
|
|
|
|
{
|
|
|
|
JsonObject *object;
|
|
|
|
int i;
|
|
|
|
|
|
|
|
object = json_object_new ();
|
|
|
|
|
|
|
|
for (i = 0; self->env[i] != NULL; i++)
|
|
|
|
{
|
|
|
|
JsonNode *str = json_node_new (JSON_NODE_VALUE);
|
|
|
|
const char *equal;
|
|
|
|
g_autofree char *member = NULL;
|
|
|
|
|
|
|
|
equal = strchr (self->env[i], '=');
|
|
|
|
if (equal)
|
|
|
|
{
|
|
|
|
json_node_set_string (str, equal + 1);
|
|
|
|
member = g_strndup (self->env[i], equal - self->env[i]);
|
|
|
|
}
|
|
|
|
else
|
|
|
|
{
|
|
|
|
json_node_set_string (str, "");
|
|
|
|
member = g_strdup (self->env[i]);
|
|
|
|
}
|
|
|
|
|
|
|
|
json_object_set_member (object, member, str);
|
|
|
|
}
|
|
|
|
|
|
|
|
retval = json_node_init_object (json_node_alloc (), object);
|
|
|
|
json_object_unref (object);
|
|
|
|
}
|
|
|
|
|
|
|
|
return retval;
|
|
|
|
}
|
|
|
|
else
|
2016-05-06 14:03:27 +00:00
|
|
|
{
|
|
|
|
return json_serializable_default_serialize_property (serializable,
|
|
|
|
property_name,
|
|
|
|
value,
|
|
|
|
pspec);
|
|
|
|
}
|
2015-12-09 09:33:54 +00:00
|
|
|
}
|
|
|
|
|
2015-11-16 15:23:23 +00:00
|
|
|
static gboolean
|
|
|
|
builder_options_deserialize_property (JsonSerializable *serializable,
|
2016-05-06 14:03:27 +00:00
|
|
|
const gchar *property_name,
|
|
|
|
GValue *value,
|
|
|
|
GParamSpec *pspec,
|
|
|
|
JsonNode *property_node)
|
2015-11-16 15:23:23 +00:00
|
|
|
{
|
|
|
|
if (strcmp (property_name, "arch") == 0)
|
|
|
|
{
|
|
|
|
if (JSON_NODE_TYPE (property_node) == JSON_NODE_NULL)
|
|
|
|
{
|
|
|
|
g_value_set_boxed (value, NULL);
|
|
|
|
return TRUE;
|
|
|
|
}
|
|
|
|
else if (JSON_NODE_TYPE (property_node) == JSON_NODE_OBJECT)
|
|
|
|
{
|
|
|
|
JsonObject *object = json_node_get_object (property_node);
|
|
|
|
g_autoptr(GHashTable) hash = g_hash_table_new_full (g_str_hash, g_str_equal, g_free, g_object_unref);
|
|
|
|
g_autoptr(GList) members = NULL;
|
|
|
|
GList *l;
|
|
|
|
|
|
|
|
members = json_object_get_members (object);
|
|
|
|
for (l = members; l != NULL; l = l->next)
|
|
|
|
{
|
|
|
|
const char *member_name = l->data;
|
|
|
|
JsonNode *val;
|
|
|
|
GObject *option;
|
|
|
|
|
|
|
|
val = json_object_get_member (object, member_name);
|
|
|
|
option = json_gobject_deserialize (BUILDER_TYPE_OPTIONS, val);
|
|
|
|
if (option == NULL)
|
|
|
|
return FALSE;
|
|
|
|
|
|
|
|
g_hash_table_insert (hash, g_strdup (member_name), option);
|
|
|
|
}
|
|
|
|
|
|
|
|
g_value_set_boxed (value, hash);
|
|
|
|
return TRUE;
|
|
|
|
}
|
|
|
|
|
|
|
|
return FALSE;
|
|
|
|
}
|
|
|
|
else if (strcmp (property_name, "env") == 0)
|
|
|
|
{
|
|
|
|
if (JSON_NODE_TYPE (property_node) == JSON_NODE_NULL)
|
|
|
|
{
|
|
|
|
g_value_set_boxed (value, NULL);
|
|
|
|
return TRUE;
|
|
|
|
}
|
|
|
|
else if (JSON_NODE_TYPE (property_node) == JSON_NODE_OBJECT)
|
|
|
|
{
|
|
|
|
JsonObject *object = json_node_get_object (property_node);
|
|
|
|
g_autoptr(GPtrArray) env = g_ptr_array_new_with_free_func (g_free);
|
|
|
|
g_autoptr(GList) members = NULL;
|
|
|
|
GList *l;
|
|
|
|
|
|
|
|
members = json_object_get_members (object);
|
|
|
|
for (l = members; l != NULL; l = l->next)
|
|
|
|
{
|
|
|
|
const char *member_name = l->data;
|
|
|
|
JsonNode *val;
|
|
|
|
const char *val_str;
|
|
|
|
|
|
|
|
val = json_object_get_member (object, member_name);
|
|
|
|
val_str = json_node_get_string (val);
|
|
|
|
if (val_str == NULL)
|
|
|
|
return FALSE;
|
|
|
|
|
|
|
|
g_ptr_array_add (env, g_strdup_printf ("%s=%s", member_name, val_str));
|
|
|
|
}
|
|
|
|
|
|
|
|
g_ptr_array_add (env, NULL);
|
2016-11-28 16:23:38 +00:00
|
|
|
g_value_take_boxed (value, g_ptr_array_free (g_steal_pointer (&env), FALSE));
|
2015-11-16 15:23:23 +00:00
|
|
|
return TRUE;
|
|
|
|
}
|
|
|
|
|
|
|
|
return FALSE;
|
|
|
|
}
|
|
|
|
else
|
2016-05-06 14:03:27 +00:00
|
|
|
{
|
|
|
|
return json_serializable_default_deserialize_property (serializable,
|
|
|
|
property_name,
|
|
|
|
value,
|
|
|
|
pspec, property_node);
|
|
|
|
}
|
2015-11-16 15:23:23 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
static void
|
|
|
|
serializable_iface_init (JsonSerializableIface *serializable_iface)
|
|
|
|
{
|
2015-12-09 09:33:54 +00:00
|
|
|
serializable_iface->serialize_property = builder_options_serialize_property;
|
2015-11-16 15:23:23 +00:00
|
|
|
serializable_iface->deserialize_property = builder_options_deserialize_property;
|
2017-04-19 18:17:54 +00:00
|
|
|
serializable_iface->find_property = builder_serializable_find_property_with_error;
|
2015-11-16 15:23:23 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
static GList *
|
2016-05-06 14:03:27 +00:00
|
|
|
get_arched_options (BuilderOptions *self, BuilderContext *context)
|
2015-11-16 15:23:23 +00:00
|
|
|
{
|
|
|
|
GList *options = NULL;
|
|
|
|
const char *arch = builder_context_get_arch (context);
|
|
|
|
BuilderOptions *arch_options;
|
|
|
|
|
2017-03-14 09:37:12 +00:00
|
|
|
options = g_list_prepend (options, self);
|
|
|
|
|
2015-11-16 15:23:23 +00:00
|
|
|
arch_options = g_hash_table_lookup (self->arch, arch);
|
|
|
|
if (arch_options)
|
|
|
|
options = g_list_prepend (options, arch_options);
|
|
|
|
|
|
|
|
return options;
|
|
|
|
}
|
|
|
|
|
|
|
|
static GList *
|
2016-05-06 14:03:27 +00:00
|
|
|
get_all_options (BuilderOptions *self, BuilderContext *context)
|
2015-11-16 15:23:23 +00:00
|
|
|
{
|
|
|
|
GList *options = NULL;
|
|
|
|
BuilderOptions *global_options = builder_context_get_options (context);
|
|
|
|
|
|
|
|
if (self)
|
|
|
|
options = get_arched_options (self, context);
|
|
|
|
|
|
|
|
if (global_options && global_options != self)
|
|
|
|
options = g_list_concat (options, get_arched_options (global_options, context));
|
|
|
|
|
|
|
|
return options;
|
|
|
|
}
|
|
|
|
|
2017-03-14 09:53:38 +00:00
|
|
|
static const char *
|
|
|
|
builder_options_get_flags (BuilderOptions *self, BuilderContext *context, size_t field_offset)
|
2015-11-16 15:23:23 +00:00
|
|
|
{
|
|
|
|
g_autoptr(GList) options = get_all_options (self, context);
|
|
|
|
GList *l;
|
2017-03-14 09:53:38 +00:00
|
|
|
GString *flags = NULL;
|
|
|
|
|
|
|
|
/* Last command flag wins, so reverse order */
|
|
|
|
options = g_list_reverse (options);
|
2015-11-16 15:23:23 +00:00
|
|
|
|
|
|
|
for (l = options; l != NULL; l = l->next)
|
|
|
|
{
|
|
|
|
BuilderOptions *o = l->data;
|
2017-03-14 09:53:38 +00:00
|
|
|
const char *flag = G_STRUCT_MEMBER (const char *, o, field_offset);
|
|
|
|
|
|
|
|
if (flag)
|
|
|
|
{
|
|
|
|
if (flags == NULL)
|
|
|
|
flags = g_string_new ("");
|
|
|
|
|
|
|
|
if (flags->len > 0)
|
|
|
|
g_string_append_c (flags, ' ');
|
|
|
|
|
|
|
|
g_string_append (flags, flag);
|
|
|
|
}
|
2015-11-16 15:23:23 +00:00
|
|
|
}
|
|
|
|
|
2017-03-14 09:53:38 +00:00
|
|
|
if (flags)
|
|
|
|
return g_string_free (flags, FALSE);
|
|
|
|
|
2015-11-16 15:23:23 +00:00
|
|
|
return NULL;
|
|
|
|
}
|
|
|
|
|
|
|
|
const char *
|
2017-03-14 09:53:38 +00:00
|
|
|
builder_options_get_cflags (BuilderOptions *self, BuilderContext *context)
|
2015-11-16 15:23:23 +00:00
|
|
|
{
|
2017-03-14 09:53:38 +00:00
|
|
|
return builder_options_get_flags (self, context, G_STRUCT_OFFSET (BuilderOptions, cflags));
|
|
|
|
}
|
2015-11-16 15:23:23 +00:00
|
|
|
|
2017-03-14 09:53:38 +00:00
|
|
|
const char *
|
|
|
|
builder_options_get_cxxflags (BuilderOptions *self, BuilderContext *context)
|
|
|
|
{
|
|
|
|
return builder_options_get_flags (self, context, G_STRUCT_OFFSET (BuilderOptions, cxxflags));
|
2015-11-16 15:23:23 +00:00
|
|
|
}
|
|
|
|
|
2017-05-22 06:50:18 +00:00
|
|
|
const char *
|
|
|
|
builder_options_get_cppflags (BuilderOptions *self, BuilderContext *context)
|
|
|
|
{
|
|
|
|
return builder_options_get_flags (self, context, G_STRUCT_OFFSET (BuilderOptions, cppflags));
|
|
|
|
}
|
|
|
|
|
2017-03-14 09:26:22 +00:00
|
|
|
const char *
|
|
|
|
builder_options_get_ldflags (BuilderOptions *self, BuilderContext *context)
|
|
|
|
{
|
2017-03-14 09:53:38 +00:00
|
|
|
return builder_options_get_flags (self, context, G_STRUCT_OFFSET (BuilderOptions, ldflags));
|
2017-03-14 09:26:22 +00:00
|
|
|
}
|
|
|
|
|
2017-09-06 17:47:12 +00:00
|
|
|
static char *
|
|
|
|
builder_options_get_appended_path (BuilderOptions *self, BuilderContext *context, const char *initial_value, size_t field_offset)
|
|
|
|
{
|
|
|
|
g_autoptr(GList) options = get_all_options (self, context);
|
|
|
|
GList *l;
|
|
|
|
GString *path_list = NULL;
|
|
|
|
|
|
|
|
if (initial_value)
|
|
|
|
path_list = g_string_new (initial_value);
|
|
|
|
|
|
|
|
for (l = options; l != NULL; l = l->next)
|
|
|
|
{
|
|
|
|
BuilderOptions *o = l->data;
|
|
|
|
const char *append = G_STRUCT_MEMBER (const char *, o, field_offset);
|
|
|
|
|
|
|
|
if (append)
|
|
|
|
{
|
|
|
|
if (path_list == NULL)
|
|
|
|
path_list = g_string_new ("");
|
|
|
|
|
|
|
|
if (path_list->len > 0)
|
|
|
|
g_string_append_c (path_list, ':');
|
|
|
|
|
|
|
|
g_string_append (path_list, append);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
if (path_list)
|
|
|
|
return g_string_free (path_list, FALSE);
|
|
|
|
|
|
|
|
return NULL;
|
|
|
|
}
|
|
|
|
|
|
|
|
static char **
|
|
|
|
builder_options_update_ld_path (BuilderOptions *self, BuilderContext *context, char **envp)
|
|
|
|
{
|
|
|
|
g_autofree char *path = NULL;
|
|
|
|
const char *old = NULL;
|
|
|
|
|
|
|
|
old = g_environ_getenv (envp, "LD_LIBRARY_PATH");
|
|
|
|
if (old == NULL)
|
|
|
|
old = "/app/lib";
|
|
|
|
|
|
|
|
path = builder_options_get_appended_path (self, context, old,
|
|
|
|
G_STRUCT_OFFSET (BuilderOptions, append_ld_library_path));
|
|
|
|
if (path)
|
|
|
|
envp = g_environ_setenv (envp, "LD_LIBRARY_PATH", path, TRUE);
|
|
|
|
|
|
|
|
return envp;
|
|
|
|
}
|
|
|
|
|
|
|
|
static char **
|
|
|
|
builder_options_update_path (BuilderOptions *self, BuilderContext *context, char **envp)
|
|
|
|
{
|
|
|
|
g_autofree char *path = NULL;
|
|
|
|
path = builder_options_get_appended_path (self, context,
|
|
|
|
g_environ_getenv (envp, "PATH"),
|
|
|
|
G_STRUCT_OFFSET (BuilderOptions, append_path));
|
|
|
|
if (path)
|
|
|
|
envp = g_environ_setenv (envp, "PATH", path, TRUE);
|
|
|
|
return envp;
|
|
|
|
}
|
|
|
|
|
2015-12-15 18:28:14 +00:00
|
|
|
const char *
|
|
|
|
builder_options_get_prefix (BuilderOptions *self, BuilderContext *context)
|
|
|
|
{
|
|
|
|
g_autoptr(GList) options = get_all_options (self, context);
|
|
|
|
GList *l;
|
|
|
|
|
|
|
|
for (l = options; l != NULL; l = l->next)
|
|
|
|
{
|
|
|
|
BuilderOptions *o = l->data;
|
|
|
|
if (o->prefix)
|
|
|
|
return o->prefix;
|
|
|
|
}
|
|
|
|
|
2016-01-18 10:43:02 +00:00
|
|
|
if (builder_context_get_build_runtime (context))
|
|
|
|
return "/usr";
|
|
|
|
|
2015-12-15 18:28:14 +00:00
|
|
|
return "/app";
|
|
|
|
}
|
|
|
|
|
2016-01-08 17:01:35 +00:00
|
|
|
gboolean
|
|
|
|
builder_options_get_strip (BuilderOptions *self, BuilderContext *context)
|
|
|
|
{
|
|
|
|
g_autoptr(GList) options = get_all_options (self, context);
|
|
|
|
GList *l;
|
|
|
|
|
|
|
|
for (l = options; l != NULL; l = l->next)
|
|
|
|
{
|
|
|
|
BuilderOptions *o = l->data;
|
|
|
|
if (o->strip)
|
|
|
|
return TRUE;
|
|
|
|
}
|
|
|
|
|
|
|
|
return FALSE;
|
|
|
|
}
|
|
|
|
|
|
|
|
gboolean
|
|
|
|
builder_options_get_no_debuginfo (BuilderOptions *self, BuilderContext *context)
|
|
|
|
{
|
|
|
|
g_autoptr(GList) options = get_all_options (self, context);
|
|
|
|
GList *l;
|
|
|
|
|
|
|
|
for (l = options; l != NULL; l = l->next)
|
|
|
|
{
|
|
|
|
BuilderOptions *o = l->data;
|
|
|
|
if (o->no_debuginfo)
|
|
|
|
return TRUE;
|
|
|
|
}
|
|
|
|
|
|
|
|
return FALSE;
|
|
|
|
}
|
|
|
|
|
2017-10-05 15:59:24 +00:00
|
|
|
gboolean
|
|
|
|
builder_options_get_no_debuginfo_compression (BuilderOptions *self, BuilderContext *context)
|
|
|
|
{
|
|
|
|
g_autoptr(GList) options = get_all_options (self, context);
|
|
|
|
GList *l;
|
|
|
|
|
|
|
|
for (l = options; l != NULL; l = l->next)
|
|
|
|
{
|
|
|
|
BuilderOptions *o = l->data;
|
|
|
|
if (o->no_debuginfo_compression)
|
|
|
|
return TRUE;
|
|
|
|
}
|
|
|
|
|
|
|
|
return FALSE;
|
|
|
|
}
|
|
|
|
|
2015-11-16 15:23:23 +00:00
|
|
|
char **
|
|
|
|
builder_options_get_env (BuilderOptions *self, BuilderContext *context)
|
|
|
|
{
|
|
|
|
g_autoptr(GList) options = get_all_options (self, context);
|
|
|
|
GList *l;
|
|
|
|
int i;
|
|
|
|
char **envp = NULL;
|
2017-05-22 06:50:18 +00:00
|
|
|
const char *cflags, *cppflags, *cxxflags, *ldflags;
|
2015-11-16 15:23:23 +00:00
|
|
|
|
|
|
|
for (l = options; l != NULL; l = l->next)
|
|
|
|
{
|
|
|
|
BuilderOptions *o = l->data;
|
|
|
|
|
|
|
|
if (o->env)
|
|
|
|
{
|
|
|
|
for (i = 0; o->env[i] != NULL; i++)
|
|
|
|
{
|
|
|
|
const char *line = o->env[i];
|
|
|
|
const char *eq = strchr (line, '=');
|
|
|
|
const char *value = "";
|
|
|
|
g_autofree char *key = NULL;
|
|
|
|
|
|
|
|
if (eq)
|
|
|
|
{
|
|
|
|
key = g_strndup (line, eq - line);
|
|
|
|
value = eq + 1;
|
|
|
|
}
|
|
|
|
else
|
2016-05-06 14:03:27 +00:00
|
|
|
{
|
|
|
|
key = g_strdup (key);
|
|
|
|
}
|
2015-11-16 15:23:23 +00:00
|
|
|
|
|
|
|
envp = g_environ_setenv (envp, key, value, FALSE);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2016-02-17 08:10:05 +00:00
|
|
|
envp = builder_context_extend_env (context, envp);
|
|
|
|
|
|
|
|
cflags = builder_options_get_cflags (self, context);
|
|
|
|
if (cflags)
|
2017-05-22 06:40:21 +00:00
|
|
|
envp = g_environ_setenv (envp, "CFLAGS", cflags, FALSE);
|
2016-02-17 08:10:05 +00:00
|
|
|
|
2017-05-22 06:50:18 +00:00
|
|
|
cppflags = builder_options_get_cppflags (self, context);
|
|
|
|
if (cppflags)
|
2017-06-06 19:09:16 +00:00
|
|
|
envp = g_environ_setenv (envp, "CPPFLAGS", cppflags, FALSE);
|
2017-05-22 06:50:18 +00:00
|
|
|
|
2016-02-17 08:10:05 +00:00
|
|
|
cxxflags = builder_options_get_cxxflags (self, context);
|
|
|
|
if (cxxflags)
|
2017-05-22 06:40:21 +00:00
|
|
|
envp = g_environ_setenv (envp, "CXXFLAGS", cxxflags, FALSE);
|
2016-02-17 08:10:05 +00:00
|
|
|
|
2017-03-14 09:26:22 +00:00
|
|
|
ldflags = builder_options_get_ldflags (self, context);
|
|
|
|
if (ldflags)
|
2017-05-22 06:40:21 +00:00
|
|
|
envp = g_environ_setenv (envp, "LDFLAGS", ldflags, FALSE);
|
2017-03-14 09:26:22 +00:00
|
|
|
|
2017-09-06 17:47:12 +00:00
|
|
|
envp = builder_options_update_path (self, context, envp);
|
|
|
|
envp = builder_options_update_ld_path (self, context, envp);
|
|
|
|
|
2016-02-17 08:10:05 +00:00
|
|
|
return envp;
|
2015-11-16 15:23:23 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
char **
|
|
|
|
builder_options_get_build_args (BuilderOptions *self,
|
2016-08-22 15:23:32 +00:00
|
|
|
BuilderContext *context,
|
|
|
|
GError **error)
|
2015-11-16 15:23:23 +00:00
|
|
|
{
|
|
|
|
g_autoptr(GList) options = get_all_options (self, context);
|
|
|
|
GList *l;
|
|
|
|
int i;
|
|
|
|
g_autoptr(GPtrArray) array = g_ptr_array_new_with_free_func (g_free);
|
|
|
|
|
|
|
|
/* Last argument wins, so reverse the list for per-module to win */
|
|
|
|
options = g_list_reverse (options);
|
|
|
|
|
|
|
|
for (l = options; l != NULL; l = l->next)
|
|
|
|
{
|
|
|
|
BuilderOptions *o = l->data;
|
|
|
|
|
|
|
|
if (o->build_args)
|
|
|
|
{
|
|
|
|
for (i = 0; o->build_args[i] != NULL; i++)
|
|
|
|
g_ptr_array_add (array, g_strdup (o->build_args[i]));
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2016-08-22 15:23:32 +00:00
|
|
|
if (array->len > 0 && builder_context_get_sandboxed (context))
|
|
|
|
{
|
|
|
|
g_set_error (error, G_IO_ERROR, G_IO_ERROR_FAILED, "Can't specify build-args in sandboxed build");
|
|
|
|
return NULL;
|
|
|
|
}
|
|
|
|
|
2015-11-16 15:23:23 +00:00
|
|
|
g_ptr_array_add (array, NULL);
|
|
|
|
|
2016-05-06 14:03:27 +00:00
|
|
|
return (char **) g_ptr_array_free (g_steal_pointer (&array), FALSE);
|
2015-11-16 15:23:23 +00:00
|
|
|
}
|
|
|
|
|
2017-09-22 15:07:22 +00:00
|
|
|
static char **
|
|
|
|
builder_options_get_strv (BuilderOptions *self,
|
|
|
|
BuilderContext *context,
|
|
|
|
char **base,
|
|
|
|
size_t field_offset)
|
2016-04-14 17:30:47 +00:00
|
|
|
{
|
|
|
|
g_autoptr(GList) options = get_all_options (self, context);
|
|
|
|
GList *l;
|
|
|
|
int i;
|
|
|
|
g_autoptr(GPtrArray) array = g_ptr_array_new_with_free_func (g_free);
|
|
|
|
|
|
|
|
/* Last argument wins, so reverse the list for per-module to win */
|
|
|
|
options = g_list_reverse (options);
|
|
|
|
|
2017-09-22 15:07:22 +00:00
|
|
|
/* Start by adding the base values */
|
|
|
|
if (base)
|
2016-04-14 17:30:47 +00:00
|
|
|
{
|
2017-09-22 15:07:22 +00:00
|
|
|
for (i = 0; base[i] != NULL; i++)
|
|
|
|
g_ptr_array_add (array, g_strdup (base[i]));
|
2016-04-14 17:30:47 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
for (l = options; l != NULL; l = l->next)
|
|
|
|
{
|
|
|
|
BuilderOptions *o = l->data;
|
2017-09-22 15:07:22 +00:00
|
|
|
char **strv = G_STRUCT_MEMBER (char **, o, field_offset);
|
2016-04-14 17:30:47 +00:00
|
|
|
|
2017-09-22 15:07:22 +00:00
|
|
|
if (strv)
|
2016-04-14 17:30:47 +00:00
|
|
|
{
|
2017-09-22 15:07:22 +00:00
|
|
|
for (i = 0; strv[i] != NULL; i++)
|
|
|
|
g_ptr_array_add (array, g_strdup (strv[i]));
|
2016-04-14 17:30:47 +00:00
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
g_ptr_array_add (array, NULL);
|
|
|
|
|
2016-05-06 14:03:27 +00:00
|
|
|
return (char **) g_ptr_array_free (g_steal_pointer (&array), FALSE);
|
2016-04-14 17:30:47 +00:00
|
|
|
}
|
|
|
|
|
2017-09-22 15:07:22 +00:00
|
|
|
char **
|
|
|
|
builder_options_get_config_opts (BuilderOptions *self,
|
|
|
|
BuilderContext *context,
|
|
|
|
char **base_opts)
|
|
|
|
{
|
|
|
|
return builder_options_get_strv (self, context, base_opts, G_STRUCT_OFFSET (BuilderOptions, config_opts));
|
|
|
|
}
|
|
|
|
|
|
|
|
char **
|
|
|
|
builder_options_get_make_args (BuilderOptions *self,
|
|
|
|
BuilderContext *context,
|
|
|
|
char **base_args)
|
|
|
|
{
|
|
|
|
return builder_options_get_strv (self, context, base_args, G_STRUCT_OFFSET (BuilderOptions, make_args));
|
|
|
|
}
|
|
|
|
|
|
|
|
char **
|
|
|
|
builder_options_get_make_install_args (BuilderOptions *self,
|
|
|
|
BuilderContext *context,
|
|
|
|
char **base_args)
|
|
|
|
{
|
|
|
|
return builder_options_get_strv (self, context, base_args, G_STRUCT_OFFSET (BuilderOptions, make_install_args));
|
|
|
|
}
|
|
|
|
|
2015-11-16 15:23:23 +00:00
|
|
|
void
|
|
|
|
builder_options_checksum (BuilderOptions *self,
|
|
|
|
BuilderCache *cache,
|
|
|
|
BuilderContext *context)
|
|
|
|
{
|
|
|
|
BuilderOptions *arch_options;
|
|
|
|
|
|
|
|
builder_cache_checksum_str (cache, BUILDER_OPTION_CHECKSUM_VERSION);
|
|
|
|
builder_cache_checksum_str (cache, self->cflags);
|
|
|
|
builder_cache_checksum_str (cache, self->cxxflags);
|
2017-09-22 15:10:06 +00:00
|
|
|
builder_cache_checksum_str (cache, self->cppflags);
|
2017-03-14 09:26:22 +00:00
|
|
|
builder_cache_checksum_str (cache, self->ldflags);
|
2015-12-15 18:28:14 +00:00
|
|
|
builder_cache_checksum_str (cache, self->prefix);
|
2015-11-16 15:23:23 +00:00
|
|
|
builder_cache_checksum_strv (cache, self->env);
|
|
|
|
builder_cache_checksum_strv (cache, self->build_args);
|
2016-04-14 17:30:47 +00:00
|
|
|
builder_cache_checksum_strv (cache, self->config_opts);
|
2017-09-22 15:07:22 +00:00
|
|
|
builder_cache_checksum_strv (cache, self->make_args);
|
|
|
|
builder_cache_checksum_strv (cache, self->make_install_args);
|
2016-01-08 17:01:35 +00:00
|
|
|
builder_cache_checksum_boolean (cache, self->strip);
|
|
|
|
builder_cache_checksum_boolean (cache, self->no_debuginfo);
|
2017-10-05 15:59:24 +00:00
|
|
|
builder_cache_checksum_compat_boolean (cache, self->no_debuginfo_compression);
|
2015-11-16 15:23:23 +00:00
|
|
|
|
|
|
|
arch_options = g_hash_table_lookup (self->arch, builder_context_get_arch (context));
|
|
|
|
if (arch_options)
|
|
|
|
builder_options_checksum (arch_options, cache, context);
|
|
|
|
}
|