forked from Mirrors/flatpak-builder
builder: Add CPPFLAGS similar to the existing flags
parent
f4281aacb1
commit
f4d8f5680b
|
@ -39,6 +39,7 @@ struct BuilderOptions
|
|||
gboolean strip;
|
||||
gboolean no_debuginfo;
|
||||
char *cflags;
|
||||
char *cppflags;
|
||||
char *cxxflags;
|
||||
char *ldflags;
|
||||
char *prefix;
|
||||
|
@ -61,6 +62,7 @@ G_DEFINE_TYPE_WITH_CODE (BuilderOptions, builder_options, G_TYPE_OBJECT,
|
|||
enum {
|
||||
PROP_0,
|
||||
PROP_CFLAGS,
|
||||
PROP_CPPFLAGS,
|
||||
PROP_CXXFLAGS,
|
||||
PROP_LDFLAGS,
|
||||
PROP_PREFIX,
|
||||
|
@ -81,6 +83,7 @@ builder_options_finalize (GObject *object)
|
|||
|
||||
g_free (self->cflags);
|
||||
g_free (self->cxxflags);
|
||||
g_free (self->cppflags);
|
||||
g_free (self->ldflags);
|
||||
g_free (self->prefix);
|
||||
g_strfreev (self->env);
|
||||
|
@ -105,6 +108,10 @@ builder_options_get_property (GObject *object,
|
|||
g_value_set_string (value, self->cflags);
|
||||
break;
|
||||
|
||||
case PROP_CPPFLAGS:
|
||||
g_value_set_string (value, self->cppflags);
|
||||
break;
|
||||
|
||||
case PROP_CXXFLAGS:
|
||||
g_value_set_string (value, self->cxxflags);
|
||||
break;
|
||||
|
@ -167,6 +174,11 @@ builder_options_set_property (GObject *object,
|
|||
self->cxxflags = g_value_dup_string (value);
|
||||
break;
|
||||
|
||||
case PROP_CPPFLAGS:
|
||||
g_clear_pointer (&self->cppflags, g_free);
|
||||
self->cppflags = g_value_dup_string (value);
|
||||
break;
|
||||
|
||||
case PROP_LDFLAGS:
|
||||
g_clear_pointer (&self->ldflags, g_free);
|
||||
self->ldflags = g_value_dup_string (value);
|
||||
|
@ -237,6 +249,13 @@ builder_options_class_init (BuilderOptionsClass *klass)
|
|||
"",
|
||||
NULL,
|
||||
G_PARAM_READWRITE));
|
||||
g_object_class_install_property (object_class,
|
||||
PROP_CPPFLAGS,
|
||||
g_param_spec_string ("cppflags",
|
||||
"",
|
||||
"",
|
||||
NULL,
|
||||
G_PARAM_READWRITE));
|
||||
g_object_class_install_property (object_class,
|
||||
PROP_LDFLAGS,
|
||||
g_param_spec_string ("ldflags",
|
||||
|
@ -552,6 +571,12 @@ builder_options_get_cxxflags (BuilderOptions *self, BuilderContext *context)
|
|||
return builder_options_get_flags (self, context, G_STRUCT_OFFSET (BuilderOptions, cxxflags));
|
||||
}
|
||||
|
||||
const char *
|
||||
builder_options_get_cppflags (BuilderOptions *self, BuilderContext *context)
|
||||
{
|
||||
return builder_options_get_flags (self, context, G_STRUCT_OFFSET (BuilderOptions, cppflags));
|
||||
}
|
||||
|
||||
const char *
|
||||
builder_options_get_ldflags (BuilderOptions *self, BuilderContext *context)
|
||||
{
|
||||
|
@ -616,7 +641,7 @@ builder_options_get_env (BuilderOptions *self, BuilderContext *context)
|
|||
GList *l;
|
||||
int i;
|
||||
char **envp = NULL;
|
||||
const char *cflags, *cxxflags, *ldflags;
|
||||
const char *cflags, *cppflags, *cxxflags, *ldflags;
|
||||
|
||||
for (l = options; l != NULL; l = l->next)
|
||||
{
|
||||
|
@ -652,6 +677,10 @@ builder_options_get_env (BuilderOptions *self, BuilderContext *context)
|
|||
if (cflags)
|
||||
envp = g_environ_setenv (envp, "CFLAGS", cflags, FALSE);
|
||||
|
||||
cppflags = builder_options_get_cppflags (self, context);
|
||||
if (cppflags)
|
||||
envp = g_environ_setenv (envp, "CPPFLAGS", cxxflags, FALSE);
|
||||
|
||||
cxxflags = builder_options_get_cxxflags (self, context);
|
||||
if (cxxflags)
|
||||
envp = g_environ_setenv (envp, "CXXFLAGS", cxxflags, FALSE);
|
||||
|
@ -744,6 +773,7 @@ builder_options_checksum (BuilderOptions *self,
|
|||
builder_cache_checksum_str (cache, BUILDER_OPTION_CHECKSUM_VERSION);
|
||||
builder_cache_checksum_str (cache, self->cflags);
|
||||
builder_cache_checksum_str (cache, self->cxxflags);
|
||||
builder_cache_checksum_compat_str (cache, self->cppflags);
|
||||
builder_cache_checksum_str (cache, self->ldflags);
|
||||
builder_cache_checksum_str (cache, self->prefix);
|
||||
builder_cache_checksum_strv (cache, self->env);
|
||||
|
|
|
@ -215,6 +215,10 @@
|
|||
<term><option>cflags</option> (string)</term>
|
||||
<listitem><para>This is set in the environment variable CFLAGS during the build. Multiple specifications of this (in e.g. per-arch area) are concatinated with spaces inbetween.</para></listitem>
|
||||
</varlistentry>
|
||||
<varlistentry>
|
||||
<term><option>cppflags</option> (string)</term>
|
||||
<listitem><para>This is set in the environment variable CPPFLAGS during the build. Multiple specifications of this (in e.g. per-arch area) are concatinated with spaces inbetween.</para></listitem>
|
||||
</varlistentry>
|
||||
<varlistentry>
|
||||
<term><option>cxxflags</option> (string)</term>
|
||||
<listitem><para>This is set in the environment variable CXXFLAGS during the build. Multiple specifications of this (in e.g. per-arch area) are concatinated with spaces inbetween.</para></listitem>
|
||||
|
|
Loading…
Reference in New Issue