[anjuta] am-project: Allow to create libtool modules
- From: Sebastien Granjoux <sgranjoux src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [anjuta] am-project: Allow to create libtool modules
- Date: Sun, 12 Feb 2012 20:56:36 +0000 (UTC)
commit 6043171bb75927aac98d919ee68b913665e35be1
Author: SÃbastien Granjoux <seb sfo free fr>
Date: Sun Feb 12 21:49:28 2012 +0100
am-project: Allow to create libtool modules
Modules are still not recognized when the project is loaded though.
libanjuta/anjuta-project.h | 1 +
.../C/autotools-project-target-type.page | 12 +-
plugins/am-project/am-project-private.h | 3 +-
plugins/am-project/am-project.c | 36 ++++-
plugins/am-project/am-properties.c | 202 ++++++++++++++++++++
plugins/am-project/am-properties.h | 2 +
plugins/am-project/am-writer.c | 4 +-
plugins/am-project/amp-group.c | 1 +
plugins/am-project/amp-module.c | 2 +
plugins/am-project/amp-target.c | 10 +
10 files changed, 266 insertions(+), 7 deletions(-)
---
diff --git a/libanjuta/anjuta-project.h b/libanjuta/anjuta-project.h
index 813a385..0db71dd 100644
--- a/libanjuta/anjuta-project.h
+++ b/libanjuta/anjuta-project.h
@@ -110,6 +110,7 @@ typedef enum
ANJUTA_PROJECT_GENMARSHAL,
ANJUTA_PROJECT_SCRIPT,
ANJUTA_PROJECT_ROOT_GROUP,
+ ANJUTA_PROJECT_LT_MODULE,
ANJUTA_PROJECT_PROXY = 1 << 16,
ANJUTA_PROJECT_PROJECT = 1 << 17,
ANJUTA_PROJECT_PRIMARY = 1 << 18,
diff --git a/manuals/anjuta-manual/C/autotools-project-target-type.page b/manuals/anjuta-manual/C/autotools-project-target-type.page
index bd78219..99997cd 100644
--- a/manuals/anjuta-manual/C/autotools-project-target-type.page
+++ b/manuals/anjuta-manual/C/autotools-project-target-type.page
@@ -20,7 +20,7 @@
<terms>
<item>
- <title>Shared Library</title>
+ <title>Shared Library (Libtool)</title>
<p>It represents a library shared by several programs which is linked
at run time. It is the most common kind of libraries on Linux.
It is called dynamic link library on Windows.</p>
@@ -28,7 +28,15 @@
and has the '.la' extension.</p>
</item>
<item>
- <title>Static Library</title>
+ <title>Module (Libtool)</title>
+ <p>It represents a library, often named a plugin, linked at run time
+ explicitely by the program itself.
+ It is used to only load the code corresponding to the used features.</p>
+ <p>It uses the Libtool package. Its name does not need the 'lib'
+ prefix but must have the '.la' extension.</p>
+ </item>
+ <item>
+ <title>Static Library (Libtool)</title>
<p>It represents a library linked with the program at compile time.
Only the function used are kept inside the generated executable.</p>
<p>It uses the Libtool package. Its name must start with 'lib'
diff --git a/plugins/am-project/am-project-private.h b/plugins/am-project/am-project-private.h
index d61019a..f40357c 100644
--- a/plugins/am-project/am-project-private.h
+++ b/plugins/am-project/am-project-private.h
@@ -33,7 +33,8 @@ typedef enum {
AM_PROPERTY_IN_MAKEFILE = 1 << 1,
AM_PROPERTY_DIRECTORY = 1 << 2, /* Directory property (having dir suffix) */
AM_PROPERTY_DISABLE_FOLLOWING = 1 << 3, /* Disable following property if true */
- AM_PROPERTY_COMPILATION_FLAG = 1 << 4 /* Target compilation flags, need a specific object */
+ AM_PROPERTY_COMPILATION_FLAG = 1 << 4, /* Target compilation flags, need a specific object */
+ AM_PROPERTY_MANDATORY_VALUE = 1 << 5, /* Value is set by default when the node is created */
} AmpPropertyFlag;
diff --git a/plugins/am-project/am-project.c b/plugins/am-project/am-project.c
index ce88876..131b03e 100644
--- a/plugins/am-project/am-project.c
+++ b/plugins/am-project/am-project.c
@@ -121,7 +121,15 @@ static AmpNodeInfo AmpNodeInformations[] = {
NULL},
{{ANJUTA_PROJECT_TARGET | ANJUTA_PROJECT_PRIMARY | ANJUTA_PROJECT_SHAREDLIB,
- N_("Shared Library"),
+ N_("Shared Library (libtool)"),
+ "application/x-sharedlib",
+ "autotools-project-target-edit"},
+ AM_TOKEN__LTLIBRARIES,
+ "LTLIBRARIES",
+ "lib"},
+
+ {{ANJUTA_PROJECT_TARGET | ANJUTA_PROJECT_PRIMARY | ANJUTA_PROJECT_LT_MODULE,
+ N_("Module (Libtool)"),
"application/x-sharedlib",
"autotools-project-target-edit"},
AM_TOKEN__LTLIBRARIES,
@@ -129,7 +137,7 @@ static AmpNodeInfo AmpNodeInformations[] = {
"lib"},
{{ANJUTA_PROJECT_TARGET | ANJUTA_PROJECT_PRIMARY | ANJUTA_PROJECT_STATICLIB,
- N_("Static Library"),
+ N_("Static Library (Libtool)"),
"application/x-archive",
"autotools-project-target-edit"},
AM_TOKEN__LIBRARIES,
@@ -2196,6 +2204,30 @@ amp_add_work (PmJob *job)
gboolean ok;
ok = amp_node_write (AMP_NODE (job->node), parent, AMP_PROJECT (job->user_data), &job->error);
+ /* Add new node properties if existing */
+ if (ok)
+ {
+ GList *item;
+
+ for (item = anjuta_project_node_get_properties (ANJUTA_PROJECT_NODE (job->node)); item != NULL; item = g_list_next (item))
+ {
+ AnjutaProjectProperty *property = (AnjutaProjectProperty *)item->data;
+ gint flags;
+
+ flags = ((AmpPropertyInfo *)property->info)->flags;
+ if (flags & AM_PROPERTY_IN_CONFIGURE)
+ {
+ ok = ok && amp_project_update_ac_property (AMP_PROJECT (job->user_data), property);
+ }
+ else if (flags & AM_PROPERTY_IN_MAKEFILE)
+ {
+ if (((AnjutaProjectPropertyInfo *)property->info)->flags & ANJUTA_PROJECT_PROPERTY_READ_WRITE)
+ {
+ ok = ok && amp_project_update_am_property (AMP_PROJECT (job->user_data), job->node, property);
+ }
+ }
+ }
+ }
return ok;
}
diff --git a/plugins/am-project/am-properties.c b/plugins/am-project/am-properties.c
index 93452b7..24b259a 100644
--- a/plugins/am-project/am-properties.c
+++ b/plugins/am-project/am-properties.c
@@ -842,6 +842,182 @@ static AmpPropertyInfo AmpLibraryTargetProperties[] = {
{}
};
+
+static GList* AmpModuleTargetPropertyList = NULL;
+
+static AmpPropertyInfo AmpModuleTargetProperties[] = {
+ {
+ {"NOINST",
+ N_("Do not install:"),
+ ANJUTA_PROJECT_PROPERTY_BOOLEAN,
+ ANJUTA_PROJECT_PROPERTY_READ_WRITE | ANJUTA_PROJECT_PROPERTY_STATIC,
+ N_("Build but do not install the target.")},
+ AM_TOKEN__PROGRAMS, 3, "noinst_",
+ AM_PROPERTY_IN_MAKEFILE | AM_PROPERTY_DISABLE_FOLLOWING,
+ "0"
+ },
+ {
+ {"INSTALLDIR",
+ N_("Installation directory:"),
+ ANJUTA_PROJECT_PROPERTY_STRING,
+ ANJUTA_PROJECT_PROPERTY_READ_WRITE | ANJUTA_PROJECT_PROPERTY_STATIC,
+ N_("It has to be a standard directory or a custom one defined in group properties.")},
+ AM_TOKEN__PROGRAMS, 6, "lib",
+ AM_PROPERTY_IN_MAKEFILE | AM_PROPERTY_DIRECTORY
+ },
+ {
+ {"LDFLAGS",
+ N_("Linker flags:"),
+ ANJUTA_PROJECT_PROPERTY_LIST,
+ ANJUTA_PROJECT_PROPERTY_READ_WRITE | ANJUTA_PROJECT_PROPERTY_STATIC,
+ N_("Additional linker flags for this target.")},
+ AM_TOKEN_TARGET_LDFLAGS, 0, "_LDFLAGS",
+ AM_PROPERTY_IN_MAKEFILE | AM_PROPERTY_MANDATORY_VALUE,
+ "-module -avoid-version"
+ },
+ {
+ {"LIBADD",
+ N_("Libraries:"),
+ ANJUTA_PROJECT_PROPERTY_LIST,
+ ANJUTA_PROJECT_PROPERTY_READ_WRITE | ANJUTA_PROJECT_PROPERTY_STATIC,
+ N_("Additional libraries for this target.")},
+ AM_TOKEN_TARGET_LIBADD, 0, "_LIBADD",
+ AM_PROPERTY_IN_MAKEFILE
+ },
+ {
+ {"CPPFLAGS",
+ N_("C preprocessor flags:"),
+ ANJUTA_PROJECT_PROPERTY_LIST,
+ ANJUTA_PROJECT_PROPERTY_READ_WRITE | ANJUTA_PROJECT_PROPERTY_STATIC,
+ N_("Additional C preprocessor flags for this target.")},
+ AM_TOKEN_TARGET_CPPFLAGS, 0, "_CPPFLAGS",
+ AM_PROPERTY_IN_MAKEFILE | AM_PROPERTY_COMPILATION_FLAG
+ },
+ {
+ {"CFLAGS",
+ N_("C compiler flags:"),
+ ANJUTA_PROJECT_PROPERTY_LIST,
+ ANJUTA_PROJECT_PROPERTY_READ_WRITE | ANJUTA_PROJECT_PROPERTY_STATIC,
+ N_("Additional C compiler flags for this target.")},
+ AM_TOKEN_TARGET_CFLAGS, 0, "_CFLAGS",
+ AM_PROPERTY_IN_MAKEFILE | AM_PROPERTY_COMPILATION_FLAG
+ },
+ {
+ {"CXXFLAGS",
+ N_("C++ compiler flags:"),
+ ANJUTA_PROJECT_PROPERTY_LIST,
+ ANJUTA_PROJECT_PROPERTY_READ_WRITE | ANJUTA_PROJECT_PROPERTY_STATIC,
+ N_("Additional C++ compiler flags for this target.")},
+ AM_TOKEN_TARGET_CXXFLAGS, 0, "_CXXFLAGS",
+ AM_PROPERTY_IN_MAKEFILE | AM_PROPERTY_COMPILATION_FLAG
+ },
+ {
+ {"JAVAFLAGS",
+ N_("Java compiler flags:"),
+ ANJUTA_PROJECT_PROPERTY_LIST,
+ ANJUTA_PROJECT_PROPERTY_READ_WRITE | ANJUTA_PROJECT_PROPERTY_STATIC,
+ N_("Additional Java compiler flags for this target.")},
+ AM_TOKEN_TARGET_JAVACFLAGS, 0, "_JAVACFLAGS",
+ AM_PROPERTY_IN_MAKEFILE | AM_PROPERTY_COMPILATION_FLAG
+ },
+ {
+ {"VALAFLAGS",
+ N_("Vala compiler flags:"),
+ ANJUTA_PROJECT_PROPERTY_LIST,
+ ANJUTA_PROJECT_PROPERTY_READ_WRITE | ANJUTA_PROJECT_PROPERTY_STATIC,
+ N_("Additional Vala compiler flags for this target.")},
+ AM_TOKEN_TARGET_VALAFLAGS,0, "_VALAFLAGS",
+ AM_PROPERTY_IN_MAKEFILE | AM_PROPERTY_COMPILATION_FLAG
+ },
+ {
+ {"FCFLAGS",
+ N_("Fortran compiler flags:"),
+ ANJUTA_PROJECT_PROPERTY_LIST,
+ ANJUTA_PROJECT_PROPERTY_READ_WRITE | ANJUTA_PROJECT_PROPERTY_STATIC,
+ N_("Additional Fortran compiler flags for this target.")},
+ AM_TOKEN_TARGET_FCFLAGS, 0, "_FCFLAGS",
+ AM_PROPERTY_IN_MAKEFILE | AM_PROPERTY_COMPILATION_FLAG
+ },
+ {
+ {"OBJCFLAGS",
+ N_("Objective C compiler flags:"),
+ ANJUTA_PROJECT_PROPERTY_LIST,
+ ANJUTA_PROJECT_PROPERTY_READ_WRITE | ANJUTA_PROJECT_PROPERTY_STATIC,
+ N_("Additional Objective C compiler flags for this target.")},
+ AM_TOKEN_TARGET_OBJCFLAGS, 0, "_OBJCFLAGS",
+ AM_PROPERTY_IN_MAKEFILE | AM_PROPERTY_COMPILATION_FLAG
+ },
+ {
+ {"LFLAGS",
+ N_("Lex/Flex flags:"),
+ ANJUTA_PROJECT_PROPERTY_LIST,
+ ANJUTA_PROJECT_PROPERTY_READ_WRITE | ANJUTA_PROJECT_PROPERTY_STATIC,
+ N_("Additional Lex or Flex lexical analyser generator flags for this target.")},
+ AM_TOKEN_TARGET_LFLAGS, 0, "_LFLAGS",
+ AM_PROPERTY_IN_MAKEFILE | AM_PROPERTY_COMPILATION_FLAG
+ },
+ {
+ {"YFLAGS",
+ N_("Yacc/Bison flags:"),
+ ANJUTA_PROJECT_PROPERTY_LIST,
+ ANJUTA_PROJECT_PROPERTY_READ_WRITE | ANJUTA_PROJECT_PROPERTY_STATIC,
+ N_("Additional Yacc or Bison parser generator flags for this target.")},
+ AM_TOKEN_TARGET_YFLAGS, 0, "_YFLAGS",
+ AM_PROPERTY_IN_MAKEFILE | AM_PROPERTY_COMPILATION_FLAG
+ },
+ {
+ {"EXTRA_DIST",
+ N_("Additional dependencies:"),
+ ANJUTA_PROJECT_PROPERTY_LIST,
+ ANJUTA_PROJECT_PROPERTY_READ_WRITE | ANJUTA_PROJECT_PROPERTY_STATIC,
+ N_("Additional dependencies for this target.")},
+ AM_TOKEN_TARGET_DEPENDENCIES, 0, "EXTRA_DIST",
+ AM_PROPERTY_IN_MAKEFILE
+ },
+ {
+ {"DIST",
+ N_("Include in distribution:"),
+ ANJUTA_PROJECT_PROPERTY_BOOLEAN,
+ ANJUTA_PROJECT_PROPERTY_READ_WRITE | ANJUTA_PROJECT_PROPERTY_STATIC,
+ N_("Include this target in the distributed package.")},
+ AM_TOKEN__PROGRAMS, 2, "nodist_",
+ AM_PROPERTY_IN_MAKEFILE,
+ "1"
+ },
+ {
+ {"CHECK",
+ N_("Build for check only:"),
+ ANJUTA_PROJECT_PROPERTY_BOOLEAN,
+ ANJUTA_PROJECT_PROPERTY_READ_WRITE | ANJUTA_PROJECT_PROPERTY_STATIC,
+ N_("Build this target only when running automatic tests.")},
+ AM_TOKEN__PROGRAMS, 4, "check_",
+ AM_PROPERTY_IN_MAKEFILE,
+ "0"
+ },
+ {
+ {"NOTRANS",
+ N_("Do not use prefix:"),
+ ANJUTA_PROJECT_PROPERTY_BOOLEAN,
+ ANJUTA_PROJECT_PROPERTY_READ_WRITE | ANJUTA_PROJECT_PROPERTY_STATIC,
+ N_("Do not rename the target with an optional prefix, used to avoid overwritting system program. ")},
+ AM_TOKEN__PROGRAMS, 1, "notrans_",
+ AM_PROPERTY_IN_MAKEFILE,
+ "0"
+ },
+ {
+ {"NOBASE",
+ N_("Keep target path:"),
+ ANJUTA_PROJECT_PROPERTY_BOOLEAN,
+ ANJUTA_PROJECT_PROPERTY_READ_WRITE | ANJUTA_PROJECT_PROPERTY_STATIC,
+ N_("Keep relative target path for installing it. "
+ "By example if you have a program subdir/app installed in bin directory it will be installed in bin/subdir/app not in bin/app.")},
+ AM_TOKEN__PROGRAMS, 0, "nobase_",
+ AM_PROPERTY_IN_MAKEFILE,
+ "0"
+ },
+ {}
+};
+
static GList* AmpLibraryTargetPropertyList = NULL;
@@ -1431,6 +1607,30 @@ amp_node_property_add_flags (AnjutaProjectNode *node, const gchar *id, const gch
return prop;
}
+/* Add mandatory properties to a new node */
+gboolean
+amp_node_property_add_mandatory (AnjutaProjectNode *node)
+{
+ GList *item;
+ gboolean added = FALSE;
+
+ for (item = anjuta_project_node_get_properties_info (node); item != NULL; item = g_list_next (item))
+ {
+ AmpPropertyInfo *info = (AmpPropertyInfo *)item->data;
+
+ /* FIXME: Does not support map property */
+ if ((info->flags & AM_PROPERTY_MANDATORY_VALUE) && (info->value != NULL) && (info->base.type != ANJUTA_PROJECT_PROPERTY_MAP))
+ {
+ AnjutaProjectProperty *new_prop;
+
+ new_prop = amp_property_new (NULL, 0, 0, info->value, NULL);
+ anjuta_project_node_insert_property (node, (AnjutaProjectPropertyInfo *)info, new_prop);
+ added = TRUE;
+ }
+ }
+
+ return added;
+}
/* Get property list
@@ -1458,6 +1658,8 @@ amp_get_target_property_list (AnjutaProjectNodeType type)
case ANJUTA_PROJECT_SHAREDLIB:
case ANJUTA_PROJECT_STATICLIB:
return amp_create_property_list (&AmpLibraryTargetPropertyList, AmpLibraryTargetProperties);
+ case ANJUTA_PROJECT_LT_MODULE:
+ return amp_create_property_list (&AmpModuleTargetPropertyList, AmpModuleTargetProperties);
case ANJUTA_PROJECT_MAN:
return amp_create_property_list (&AmpManTargetPropertyList, AmpManTargetProperties);
case ANJUTA_PROJECT_DATA:
diff --git a/plugins/am-project/am-properties.h b/plugins/am-project/am-properties.h
index 34c7369..81b3888 100644
--- a/plugins/am-project/am-properties.h
+++ b/plugins/am-project/am-properties.h
@@ -45,6 +45,8 @@ gboolean amp_node_property_has_flags (AnjutaProjectNode *node, const gchar *id,
AnjutaProjectProperty *amp_node_property_remove_flags (AnjutaProjectNode *node, const gchar *id, const gchar *value);
AnjutaProjectProperty *amp_node_property_add_flags (AnjutaProjectNode *node, const gchar *id, const gchar *value);
+gboolean amp_node_property_add_mandatory (AnjutaProjectNode *node);
+
GList* amp_get_project_property_list (void);
GList* amp_get_group_property_list (void);
GList* amp_get_target_property_list (AnjutaProjectNodeType type);
diff --git a/plugins/am-project/am-writer.c b/plugins/am-project/am-writer.c
index 26b5ff1..5462e0e 100644
--- a/plugins/am-project/am-writer.c
+++ b/plugins/am-project/am-writer.c
@@ -885,6 +885,7 @@ amp_target_node_create_token (AmpProject *project, AmpTargetNode *target, GErro
{
case ANJUTA_PROJECT_SHAREDLIB:
case ANJUTA_PROJECT_STATICLIB:
+ case ANJUTA_PROJECT_LT_MODULE:
case ANJUTA_PROJECT_PROGRAM:
amp_target_add_in_list (project, args, ANJUTA_PROJECT_NODE (target), after, prev);
break;
@@ -1612,8 +1613,7 @@ gboolean amp_project_update_am_property (AmpProject *project, AnjutaProjectNode
group = anjuta_project_node_parent_type (node, ANJUTA_PROJECT_GROUP);
}
- if ((property->value == NULL) ||
- (g_strcmp0 (property->info->default_value->value, property->value) == 0))
+ if (property->value == NULL)
{
/* Remove property */
if (((AmpPropertyInfo *)property->info)->token_type == AM_TOKEN__PROGRAMS)
diff --git a/plugins/am-project/amp-group.c b/plugins/am-project/amp-group.c
index 3d0ec82..3e8d31e 100644
--- a/plugins/am-project/amp-group.c
+++ b/plugins/am-project/amp-group.c
@@ -97,6 +97,7 @@ project_load_group_module (AmpProject *project, AmpGroupNode *group)
break;
case ANJUTA_PROJECT_TARGET | ANJUTA_PROJECT_STATICLIB:
case ANJUTA_PROJECT_TARGET | ANJUTA_PROJECT_SHAREDLIB:
+ case ANJUTA_PROJECT_TARGET | ANJUTA_PROJECT_LT_MODULE:
prop = amp_node_get_property_from_token (target, AM_TOKEN_TARGET_LIBADD, 0);
break;
default:
diff --git a/plugins/am-project/amp-module.c b/plugins/am-project/amp-module.c
index e248d54..879f3b2 100644
--- a/plugins/am-project/amp-module.c
+++ b/plugins/am-project/amp-module.c
@@ -142,6 +142,7 @@ amp_module_node_write (AmpNode *node, AmpNode *amp_parent, AmpProject *project,
break;
case ANJUTA_PROJECT_TARGET | ANJUTA_PROJECT_STATICLIB:
case ANJUTA_PROJECT_TARGET | ANJUTA_PROJECT_SHAREDLIB:
+ case ANJUTA_PROJECT_TARGET | ANJUTA_PROJECT_LT_MODULE:
target_lib = amp_node_get_property_info_from_token (parent, AM_TOKEN_TARGET_LIBADD, 0);
break;
default:
@@ -240,6 +241,7 @@ amp_module_node_erase (AmpNode *node, AmpNode *amp_parent, AmpProject *project,
break;
case ANJUTA_PROJECT_TARGET | ANJUTA_PROJECT_STATICLIB:
case ANJUTA_PROJECT_TARGET | ANJUTA_PROJECT_SHAREDLIB:
+ case ANJUTA_PROJECT_TARGET | ANJUTA_PROJECT_LT_MODULE:
target_lib = amp_node_get_property_info_from_token (parent, AM_TOKEN_TARGET_LIBADD, 0);
break;
default:
diff --git a/plugins/am-project/amp-target.c b/plugins/am-project/amp-target.c
index 3a092ac..9d6a5a5 100644
--- a/plugins/am-project/amp-target.c
+++ b/plugins/am-project/amp-target.c
@@ -345,6 +345,8 @@ amp_target_node_new (const gchar *name, AnjutaProjectNodeType type, const gchar
node->install = g_strdup (install);
node->flags = flags;
+ amp_node_property_add_mandatory (ANJUTA_PROJECT_NODE (node));
+
return node;
}
@@ -399,6 +401,14 @@ amp_target_node_new_valid (const gchar *name, AnjutaProjectNodeType type, const
return NULL;
}
}
+ else if ((type & ANJUTA_PROJECT_ID_MASK) == ANJUTA_PROJECT_LT_MODULE) {
+ if (strlen (basename) < 4 ||
+ strcmp (&basename[strlen(basename) - 3], ".la") != 0) {
+ error_set (error, IANJUTA_PROJECT_ERROR_VALIDATION_FAILED,
+ _("Module target name must be of the form 'xxx.la'"));
+ return NULL;
+ }
+ }
return amp_target_node_new (name, type, install, flags);
}
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]