[anjuta] project-wizard: bgo#591359 – Need an easier and intuitive way to create a shared library project



commit 8011f8099c97bdd5c98018ceb2611384f1dd179a
Author: Sunil Negi <vick ram79 yahoo com>
Date:   Tue Aug 11 11:13:05 2009 +0200

    project-wizard: bgo#591359 â?? Need an easier and intuitive way to create a shared library project

 configure.in                                       |    3 +
 plugins/project-wizard/templates/Makefile.am       |    5 +-
 plugins/project-wizard/templates/library.wiz       |  100 ++++++++++++++++++++
 .../project-wizard/templates/library/Makefile.am   |   10 ++
 .../templates/library/configure.ac.tpl             |   80 ++++++++++++++++
 .../project-wizard/templates/library/po/.cvsignore |    4 +
 .../templates/library/po/Makefile.am               |    5 +
 .../templates/library/po/POTFILES.in               |    4 +
 .../templates/library/src/Makefile.am              |    5 +
 .../templates/library/src/Makefile.am.tpl          |   32 ++++++
 plugins/project-wizard/templates/library/src/lib.c |   19 ++++
 plugins/project-wizard/templates/library/src/lib.h |   13 +++
 .../templates/library/src/library.pc.in            |   14 +++
 13 files changed, 292 insertions(+), 2 deletions(-)
---
diff --git a/configure.in b/configure.in
index 3cf5c67..64fb322 100644
--- a/configure.in
+++ b/configure.in
@@ -814,6 +814,9 @@ plugins/project-wizard/templates/licenses/Makefile
 plugins/project-wizard/templates/gnome-applet/Makefile
 plugins/project-wizard/templates/gnome-applet/src/Makefile
 plugins/project-wizard/templates/gnome-applet/po/Makefile
+plugins/project-wizard/templates/library/Makefile
+plugins/project-wizard/templates/library/src/Makefile
+plugins/project-wizard/templates/library/po/Makefile
 plugins/project-wizard/templates/m4/Makefile
 plugins/language-support-cpp-java/Makefile
 plugins/run-program/Makefile
diff --git a/plugins/project-wizard/templates/Makefile.am b/plugins/project-wizard/templates/Makefile.am
index 11ca20c..4555eee 100644
--- a/plugins/project-wizard/templates/Makefile.am
+++ b/plugins/project-wizard/templates/Makefile.am
@@ -1,7 +1,7 @@
 
 SUBDIRS = minimal terminal cpp gtk anjuta-plugin anjuta-plugin-vala \
 	gtkmm wxwin xlib xlib-dock gcj java gnome-applet\
-	python mkfile sdl licenses m4
+	python mkfile sdl library licenses m4
 
 wizard_filesdir = $(anjuta_data_dir)/project
 wizard_files_DATA = \
@@ -35,7 +35,8 @@ wizard_files_DATA = \
 	mkfile-logo.png \
 	sdl.wiz \
 	appwiz_sdl.png \
-	gnome-applet.wiz
+	gnome-applet.wiz \
+	library.wiz
 
 
 BUILT_SOURCES = translatable-strings.h extract-translatable-strings.pl
diff --git a/plugins/project-wizard/templates/library.wiz b/plugins/project-wizard/templates/library.wiz
new file mode 100644
index 0000000..4a7f45b
--- /dev/null
+++ b/plugins/project-wizard/templates/library.wiz
@@ -0,0 +1,100 @@
+<project-wizard>
+	<_name>Library</_name>
+	<_description>A shared or a static library project</_description>
+	<icon>terminal-logo.png</icon>
+	<category>C</category>
+	<required-program>automake</required-program>
+	<required-program>autoconf</required-program>
+	<required-program>make</required-program>
+</project-wizard>
+
+<page name="basic" _label="Basic information" _description="General Project Information">
+	<property type="string" name="Name" _label="Project Name:" _description="project name" default="foo" summary="yes" restriction="filename" mandatory="yes"/>
+	<property type="string" name="Author" _label="Author:" _description="" default="[+UserName+]" mandatory="yes"/>
+	<property type="string" name="Email" _label="Email address:" _description="" default="[+EmailAddress+]" mandatory="no"/>
+	<property type="string" name="Version" _label="Version:" default="0.1" mandatory="yes"/>
+</page>
+
+<page name="options" _label="Project options" _description="Options for project build system">
+	<property type="directory" name="Destination" _label="Destination:" _description="" default="[+AnjutaProjectDirectory+]/[+(string-downcase (get "Name"))+]" mandatory="yes" exist="no" summary="yes"/>
+	<property type="list" name="License" _label="License" _description="Select code license" default="GPL" editable="no">
+		<item name="GPL" _label="General Public License (GPL)"/>
+		<item name="LGPL" _label="Lesser General Public License (LGPL)"/>
+		<item name="BSD" _label="Berkeley Software Distribution License (BSD)"/>
+		<item name="None" _label="No license"/>
+	</property>
+	<property type="hidden" name="NameUpper" default="[+(string-upcase (get "Name"))+]"/>
+	<property type="hidden" name="NameLower" default="[+(string-downcase (get "Name"))+]"/>
+	<property type="hidden" name="NameCUpper" default="[+(string->c-name! (string-substitute (string-upcase (get "Name")) " " "_"))+]"/>
+	<property type="hidden" name="NameCLower" default="[+(string->c-name! (string-substitute (string-downcase (get "Name")) " " "_"))+]"/>
+	<property type="hidden" name="NameHLower" default="[+(string-substitute (string->c-name! (string-downcase (get "Name"))) " " "-")+]"/>
+	<property type="list" name="LibraryType" _label="Build library as" _description="Select library type to build" default="Both" editable="no">
+		<item name="Both" _label="Shared and Static library"/>
+		<item name="Shared" _label="Only Shared"/>
+		<item name="Static" _label="Only Static"/>
+	</property>
+	<property type="boolean" name="HaveLangCPP" _label="Add C++ support:" _description="Adds C++ support to the project so that C++ source files can be built" default="0"/>
+	<property type="boolean" name="HaveI18n" _label="Add internationalization:" _description="Adds support for internationalization so that your project can have translations in different languages" default="1"/>
+	<property type="boolean" name="HavePackage" _label="Configure external packages:" _description="Use pkg-config to add library support from other packages" default="0"/>
+</page>
+
+[+IF (=(get "HavePackage") "1")+]
+<page name="packages" _label="Configure external packages" _description="Configure external packages">
+	<property type="string" name="PackageModule1" _label="Require Package:" _description="Give a package name that your project require. You may also mention what is the required version of the package. For example, 'libgnomeui-2.0' or 'libgnomeui-2.0 &gt;= 2.2.0'" mandatory="yes"/>
+	<property type="string" name="PackageModule2" _label="Require Package:" _description="Give a package name that your project require. You may also mention what is the required version of the package. For example, 'libgnomeui-2.0' or 'libgnomeui-2.0 &gt;= 2.2.0'"/>
+	<property type="string" name="PackageModule3" _label="Require Package:" _description="Give a package name that your project require. You may also mention what is the required version of the package. For example, 'libgnomeui-2.0' or 'libgnomeui-2.0 &gt;= 2.2.0'"/>
+	<property type="string" name="PackageModule4" _label="Require Package:" _description="Give a package name that your project require. You may also mention what is the required version of the package. For example, 'libgnomeui-2.0' or 'libgnomeui-2.0 &gt;= 2.2.0'"/>
+	<property type="string" name="PackageModule5" _label="Require Package:" _description="Give a package name that your project require. You may also mention what is the required version of the package. For example, 'libgnomeui-2.0' or 'libgnomeui-2.0 &gt;= 2.2.0'"/>
+</page>
+[+ENDIF+]
+
+<content>
+	<directory source="terminal" destination="[+Destination+]">
+		<file source="AUTHORS"/>
+		<file source="ChangeLog"/>
+		<file source="Makefile.am.tpl" destination="Makefile.am"/>
+		<file source="NEWS"/>
+		<file source="README"/>
+		<file source="autogen.sh" executable="yes"/>
+		<file destination="lib[+NameHLower+].anjuta" source="project.anjuta"/>
+		<file source="cvsignore" destination=".cvsignore"/>
+		<directory source="src">
+			<file source="cvsignore" destination=".cvsignore"/>
+		</directory>
+		[+IF (=(get "HaveI18n") "1") +]
+		<directory source="po">
+			<file source="ChangeLog"/>
+			<file source="LINGUAS" />
+			<file source="cvsignore" destination=".cvsignore"/>
+		</directory>
+		[+ENDIF+]
+ 	</directory>
+	<directory source="library" destination="[+Destination+]">
+		<file source="configure.ac.tpl" destination="configure.ac"/>
+		<directory source="src">
+			<file source="Makefile.am.tpl" destination="Makefile.am"/>
+			<file source="library.pc.in" destination="lib[+NameHLower+]-[+Version+].pc.in"/>
+			<file source="lib.c"/>
+			<file source="lib.h" destination="[+NameHLower+].h"/>
+		</directory>
+		[+IF (=(get "HaveI18n") "1") +]
+		<directory source="po">
+			<file source="POTFILES.in"/>
+		</directory>
+		[+ENDIF+]
+	</directory>
+	<directory source="licenses" destination="[+Destination+]">
+		<file source="[+License+]" destination="COPYING"/>
+	</directory>
+	<directory source="minimal" destination="[+Destination+]">
+		<directory source="." destination=".anjuta">
+			<directory source="." destination="session">
+				<file source="anjuta.session"/>
+			</directory>
+		</directory>
+	</directory>
+</content>
+
+<action>
+	<open file="[+Destination+]/lib[+NameHLower+].anjuta"/>
+</action>
diff --git a/plugins/project-wizard/templates/library/Makefile.am b/plugins/project-wizard/templates/library/Makefile.am
new file mode 100644
index 0000000..c5ef0ce
--- /dev/null
+++ b/plugins/project-wizard/templates/library/Makefile.am
@@ -0,0 +1,10 @@
+
+SUBDIRS = src po
+
+wizard_filesdir = $(anjuta_data_dir)/project/library
+wizard_files_DATA = \
+        configure.ac.tpl
+
+EXTRA_DIST = $(wizard_files_DATA)
+
+-include $(top_srcdir)/git.mk
diff --git a/plugins/project-wizard/templates/library/configure.ac.tpl b/plugins/project-wizard/templates/library/configure.ac.tpl
new file mode 100644
index 0000000..4895d83
--- /dev/null
+++ b/plugins/project-wizard/templates/library/configure.ac.tpl
@@ -0,0 +1,80 @@
+[+ autogen5 template +]
+dnl Process this file with autoconf to produce a configure script.
+dnl Created by Anjuta application wizard.
+
+AC_INIT([+NameHLower+], [+Version+])
+
+AM_INIT_AUTOMAKE(AC_PACKAGE_NAME, AC_PACKAGE_VERSION)
+AC_CONFIG_HEADERS([config.h])
+AM_MAINTAINER_MODE
+
+AC_ISC_POSIX
+AC_PROG_CC
+AM_PROG_CC_STDC
+AC_HEADER_STDC
+
+[+IF (=(get "HaveLangCPP") "1")+]
+AC_PROG_CPP
+AC_PROG_CXX
+[+ENDIF+]
+
+[+IF (=(get "HaveI18n") "1")+]
+dnl ***************************************************************************
+dnl Internatinalization
+dnl ***************************************************************************
+GETTEXT_PACKAGE=[+NameHLower+]
+AC_SUBST(GETTEXT_PACKAGE)
+AC_DEFINE_UNQUOTED(GETTEXT_PACKAGE,"$GETTEXT_PACKAGE", [GETTEXT package name])
+AM_GLIB_GNU_GETTEXT
+IT_PROG_INTLTOOL([0.35.0])
+[+ENDIF+]
+
+[+CASE (get "LibraryType") +]
+[+ == "Static" +]AC_DISABLE_SHARED
+[+ == "Shared" +]AC_DISABLE_STATIC
+[+ESAC+]AM_PROG_LIBTOOL
+
+[+IF (=(get "HavePackage") "1")+]
+PKG_CHECK_MODULES([+NameCUpper+], [[+PackageModule1+] [+PackageModule2+] [+PackageModule3+] [+PackageModule4+] [+PackageModule5+]])
+[+ENDIF+]
+
+[+IF (=(get "HaveGtkDoc") "1")+]
+##################################################
+# Check for gtk-doc.
+##################################################
+AC_ARG_WITH(html-dir, [  --with-html-dir=PATH path to installed docs ])
+if test "x$with_html_dir" = "x" ; then
+  HTML_DIR='${datadir}/gtk-doc/html'
+else
+  HTML_DIR=$with_html_dir
+fi
+AC_SUBST(HTML_DIR)
+
+gtk_doc_min_version=1.0
+AC_MSG_CHECKING([gtk-doc version >= $gtk_doc_min_version])
+if pkg-config --atleast-version=$gtk_doc_min_version gtk-doc; then
+  AC_MSG_RESULT(yes)
+  GTKDOC=true
+else
+  AC_MSG_RESULT(no)
+  GTKDOC=false
+fi
+dnl Let people disable the gtk-doc stuff.
+AC_ARG_ENABLE(gtk-doc,
+              [  --enable-gtk-doc  Use gtk-doc to build documentation [default=auto]],
+	      enable_gtk_doc="$enableval", enable_gtk_doc=auto)
+if test x$enable_gtk_doc = xauto ; then
+  if test x$GTKDOC = xtrue ; then
+    enable_gtk_doc=yes
+  else
+    enable_gtk_doc=no
+  fi
+fi
+AM_CONDITIONAL(ENABLE_GTK_DOC, test x$enable_gtk_doc = xyes)
+[+ENDIF+]
+
+AC_OUTPUT([
+Makefile
+src/lib[+NameHLower+]-[+Version+].pc
+src/Makefile
+[+IF (=(get "HaveI18n") "1")+]po/Makefile.in[+ENDIF+]])
diff --git a/plugins/project-wizard/templates/library/po/.cvsignore b/plugins/project-wizard/templates/library/po/.cvsignore
new file mode 100644
index 0000000..759f8d2
--- /dev/null
+++ b/plugins/project-wizard/templates/library/po/.cvsignore
@@ -0,0 +1,4 @@
+Makefile
+Makefile.in
+*.plugin
+*.gladep
diff --git a/plugins/project-wizard/templates/library/po/Makefile.am b/plugins/project-wizard/templates/library/po/Makefile.am
new file mode 100644
index 0000000..f7aff5e
--- /dev/null
+++ b/plugins/project-wizard/templates/library/po/Makefile.am
@@ -0,0 +1,5 @@
+wizard_filesdir = $(anjuta_data_dir)/project/library/po
+wizard_files_DATA = POTFILES.in 
+EXTRA_DIST = $(wizard_files_DATA)
+
+-include $(top_srcdir)/git.mk
diff --git a/plugins/project-wizard/templates/library/po/POTFILES.in b/plugins/project-wizard/templates/library/po/POTFILES.in
new file mode 100644
index 0000000..4b6e196
--- /dev/null
+++ b/plugins/project-wizard/templates/library/po/POTFILES.in
@@ -0,0 +1,4 @@
+[+ autogen5 template +]
+# List of source files containing translatable strings.
+
+src/lib.c
diff --git a/plugins/project-wizard/templates/library/src/Makefile.am b/plugins/project-wizard/templates/library/src/Makefile.am
new file mode 100644
index 0000000..37339e2
--- /dev/null
+++ b/plugins/project-wizard/templates/library/src/Makefile.am
@@ -0,0 +1,5 @@
+wizard_filesdir = $(anjuta_data_dir)/project/library/src
+wizard_files_DATA = lib.c lib.h Makefile.am.tpl library.pc.in
+EXTRA_DIST = $(wizard_files_DATA)
+
+-include $(top_srcdir)/git.mk
diff --git a/plugins/project-wizard/templates/library/src/Makefile.am.tpl b/plugins/project-wizard/templates/library/src/Makefile.am.tpl
new file mode 100644
index 0000000..9b10dc0
--- /dev/null
+++ b/plugins/project-wizard/templates/library/src/Makefile.am.tpl
@@ -0,0 +1,32 @@
+[+ autogen5 template +]
+## Process this file with automake to produce Makefile.in
+
+## Created by Anjuta
+
+AM_CPPFLAGS = \
+	-DPACKAGE_LOCALE_DIR=\""$(prefix)/$(DATADIRNAME)/locale"\" \
+	-DPACKAGE_SRC_DIR=\""$(srcdir)"\" \
+	-DPACKAGE_DATA_DIR=\""$(datadir)"\" [+IF (=(get "HavePackage") "1")+]$([+NameCUpper+]_CFLAGS)[+ENDIF+]
+
+AM_CFLAGS =\
+	 -Wall\
+	 -g
+
+lib_LTLIBRARIES = lib[+NameHLower+].la
+
+
+lib[+NameHLower+]_la_SOURCES = \
+	lib.c
+
+lib[+NameCLower+]_la_LDFLAGS = 
+
+lib[+NameCLower+]_la_LIBADD = [+IF (=(get "HavePackage") "1")+]$([+NameCUpper+]_LIBS)[+ENDIF+]
+
+include_HEADERS = \
+	[+NameHLower+].h
+
+pkgconfigdir = $(libdir)/pkgconfig
+pkgconfig_DATA = lib[+NameHLower+]-[+Version+].pc
+
+EXTRA_DIST = \
+	lib[+NameHLower+]-[+Version+].pc.in
diff --git a/plugins/project-wizard/templates/library/src/lib.c b/plugins/project-wizard/templates/library/src/lib.c
new file mode 100644
index 0000000..910f8c2
--- /dev/null
+++ b/plugins/project-wizard/templates/library/src/lib.c
@@ -0,0 +1,19 @@
+[+ autogen5 template +]
+/* -*- Mode: C; indent-tabs-mode: t; c-basic-offset: 4; tab-width: 4 -*- */
+/*
+ * lib.c
+ * Copyright (C) [+Author+] [+(shell "date +%Y")+] <[+Email+]>
+ * 
+[+CASE (get "License") +]
+[+ == "BSD"  +][+(bsd  (get "Name") (get "Author") " * ")+]
+[+ == "LGPL" +][+(lgpl (get "Name") (get "Author") " * ")+]
+[+ == "GPL"  +][+(gpl  (get "Name")                " * ")+]
+[+ESAC+] */
+
+#include <stdio.h>
+
+int [+NameHLower+]_func(void)
+{
+	printf("Hello world\n");
+	return (0);
+}
diff --git a/plugins/project-wizard/templates/library/src/lib.h b/plugins/project-wizard/templates/library/src/lib.h
new file mode 100644
index 0000000..9eea75e
--- /dev/null
+++ b/plugins/project-wizard/templates/library/src/lib.h
@@ -0,0 +1,13 @@
+[+ autogen5 template +]
+/* -*- Mode: C; indent-tabs-mode: t; c-basic-offset: 4; tab-width: 4 -*- */
+/*
+ * lib.h
+ * Copyright (C) [+Author+] [+(shell "date +%Y")+] <[+Email+]>
+ * 
+[+CASE (get "License") +]
+[+ == "BSD"  +][+(bsd  (get "Name") (get "Author") " * ")+]
+[+ == "LGPL" +][+(lgpl (get "Name") (get "Author") " * ")+]
+[+ == "GPL"  +][+(gpl  (get "Name")                " * ")+]
+[+ESAC+] */
+
+int [+NameHLower+]_func (void);
diff --git a/plugins/project-wizard/templates/library/src/library.pc.in b/plugins/project-wizard/templates/library/src/library.pc.in
new file mode 100644
index 0000000..e3af0b0
--- /dev/null
+++ b/plugins/project-wizard/templates/library/src/library.pc.in
@@ -0,0 +1,14 @@
+[+ autogen5 template +]
+prefix= prefix@
+exec_prefix= exec_prefix@
+libdir= libdir@
+datarootdir= datarootdir@
+datadir= datadir@
+includedir= includedir@/lib[+NameHLower+]-[+Version+]
+
+Name: lib[+NameHLower+]
+Description: Sample library created by Anjuta project wizard.
+Version: @VERSION@
+Requires: 
+Libs: -L${libdir} -l[+NameHLower+]
+Cflags: -I${includedir}



[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]