[anjuta] project-wizard: Add a project template for a library written in Vala



commit 2398461a4ef27b645009431c26406d86d0b79901
Author: Yannick Inizan <inizan yannick gmail com>
Date:   Thu Jan 2 21:31:23 2014 +0100

    project-wizard: Add a project template for a library written in Vala

 configure.ac                                       |    3 +
 plugins/project-wizard/templates/Makefile.am       |    3 +-
 .../project-wizard/templates/vala-library.wiz.in   |   95 ++++++++++++++++++++
 .../templates/vala-library/Makefile.am             |    7 ++
 .../templates/vala-library/configure.ac.tpl        |   80 ++++++++++++++++
 .../templates/vala-library/po/Makefile.am          |    4 +
 .../templates/vala-library/po/POTFILES.in          |    4 +
 .../templates/vala-library/src/Makefile.am         |    4 +
 .../templates/vala-library/src/Makefile.am.tpl     |   62 +++++++++++++
 .../templates/vala-library/src/lib.vala            |   14 +++
 .../templates/vala-library/src/library.deps.tpl    |    5 +
 .../templates/vala-library/src/library.pc.in       |   14 +++
 12 files changed, 294 insertions(+), 1 deletions(-)
---
diff --git a/configure.ac b/configure.ac
index 2e878bb..d70dc06 100644
--- a/configure.ac
+++ b/configure.ac
@@ -931,6 +931,9 @@ plugins/project-wizard/templates/directory/Makefile
 plugins/project-wizard/templates/m4/Makefile
 plugins/project-wizard/templates/gnome-shell-extension/Makefile
 plugins/project-wizard/templates/gnome-shell-extension/src/Makefile
+plugins/project-wizard/templates/vala-library/Makefile
+plugins/project-wizard/templates/vala-library/src/Makefile
+plugins/project-wizard/templates/vala-library/po/Makefile
 plugins/am-project/Makefile
 plugins/am-project/tests/atlocal
 plugins/am-project/tests/Makefile
diff --git a/plugins/project-wizard/templates/Makefile.am b/plugins/project-wizard/templates/Makefile.am
index 5e776c7..901765b 100644
--- a/plugins/project-wizard/templates/Makefile.am
+++ b/plugins/project-wizard/templates/Makefile.am
@@ -2,7 +2,7 @@
 SUBDIRS = minimal terminal cpp gtk gtkapplication anjuta-plugin \
        gtkmm wxwin xlib xlib-dock gcj java pygtk \
        python mkfile sdl library directory m4 js_minimal \
-       vala-gtk gnome-shell-extension
+       vala-gtk gnome-shell-extension vala-library
 
 template_in_files = \
        minimal.wiz.in \
@@ -26,6 +26,7 @@ template_in_files = \
        library.wiz.in \
        vala-gtk.wiz.in \
        gnome-shell-extension.wiz.in \
+       vala-library.wiz.in \
        licenses.tpl.in
 
 wizard_filesdir = $(anjuta_data_dir)/templates
diff --git a/plugins/project-wizard/templates/vala-library.wiz.in 
b/plugins/project-wizard/templates/vala-library.wiz.in
new file mode 100644
index 0000000..2973777
--- /dev/null
+++ b/plugins/project-wizard/templates/vala-library.wiz.in
@@ -0,0 +1,95 @@
+<project-template>
+       <project-wizard>
+               <_name>Library</_name>
+               <_description>A shared or a static library project</_description>
+               <icon>terminal-logo.png</icon>
+               <category>Vala</category>
+               <order>2</order>
+               <required-program>automake</required-program>
+               <required-program>autoconf</required-program>
+               <required-program>make</required-program>
+               <required-program>valac</required-program>      
+               <required-package>glib-2.0</required-package>
+               <required-package>gobject-2.0</required-package>
+       </project-wizard>
+       
+       <page name="basic" _label="Basic information" _description="General Project Information">
+               <property type="string" name="Name" _label="Project Name:" _description="project name" 
default="libfoo" 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"/>
+               [+INCLUDE "licenses.tpl"+]
+               <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-append (if (~~* (get "Name") 
"[0-9]") "_" "") (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="hidden" name="HavePackage" default="1"/>
+               <property type="hidden" name="PackageModule1" default="gobject-2.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="HavePackageExtra" _label="Configure external packages:" 
_description="Use pkg-config to add library support from other packages" default="0"/>
+               <property type="boolean" name="HaveWindowsSupport" _label="Add Windows support:" 
_description="Adds support for building on Windows platforms" default="0"/>
+       </page>
+       
+       [+IF (=(get "HavePackageExtra") "1")+]
+       <page name="packages" _label="Configure external packages" _description="Configure external packages">
+               <property type="package" 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'" mandatory="yes"/>
+       </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 source="project.anjuta" destination="[+NameHLower+].anjuta"/>
+                       [+IF (=(get "HaveI18n") "1") +]
+                       <directory source="po">
+                               <file source="ChangeLog"/>
+                               <file source="LINGUAS"/>
+                       </directory>
+                       [+ENDIF+]
+               </directory>
+               <directory source="vala-library" destination="[+Destination+]">
+                       <file source="configure.ac.tpl" destination="configure.ac"/>
+                       <directory source="src">
+                               <file source="lib.vala" destination="[+NameHLower+].vala" />
+                               <file source="Makefile.am.tpl" destination="Makefile.am"/>
+                               <file source="library.pc.in" destination="[+NameHLower+]-[+Version+].pc.in"/>
+                               <file source="library.deps.tpl" 
destination="[+NameHLower+]-[+Version+].deps"/>
+                       </directory>
+                       [+IF (=(get "HaveI18n") "1") +]
+                       <directory source="po">
+                               <file source="POTFILES.in"/>
+                       </directory>
+                       [+ENDIF+]
+               </directory>
+               <directory source="licenses" destination="[+Destination+]">
+                       <file source="[+License+].txt" 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+]/[+NameHLower+].anjuta"/>
+       </action>
+</project-template>
+
diff --git a/plugins/project-wizard/templates/vala-library/Makefile.am 
b/plugins/project-wizard/templates/vala-library/Makefile.am
new file mode 100644
index 0000000..07d797f
--- /dev/null
+++ b/plugins/project-wizard/templates/vala-library/Makefile.am
@@ -0,0 +1,7 @@
+
+SUBDIRS = po src
+
+wizard_filesdir = $(anjuta_data_dir)/templates/vala-library
+dist_wizard_files_DATA = configure.ac.tpl
+
+-include $(top_srcdir)/git.mk
diff --git a/plugins/project-wizard/templates/vala-library/configure.ac.tpl 
b/plugins/project-wizard/templates/vala-library/configure.ac.tpl
new file mode 100644
index 0000000..30e1900
--- /dev/null
+++ b/plugins/project-wizard/templates/vala-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+])
+
+AC_CONFIG_HEADERS([config.h])
+
+AM_INIT_AUTOMAKE([1.11])
+
+AM_SILENT_RULES([yes])
+
+AC_PROG_CC
+
+AM_PROG_AR
+
+AM_PROG_VALAC
+
+[+IF (=(get "HaveI18n") "1")+]
+dnl ***************************************************************************
+dnl Internationalization
+dnl ***************************************************************************
+IT_PROG_INTLTOOL([0.35.0])
+
+GETTEXT_PACKAGE=[+NameHLower+]
+AC_SUBST(GETTEXT_PACKAGE)
+AC_DEFINE_UNQUOTED(GETTEXT_PACKAGE,"$GETTEXT_PACKAGE", [GETTEXT package name])
+AM_GLIB_GNU_GETTEXT
+[+ENDIF+]
+
+[+IF (=(get "HaveWindowsSupport") "1")+]
+dnl ***************************************************************************
+dnl Check for Windows
+dnl ***************************************************************************
+AC_CANONICAL_HOST
+
+case $host_os in
+  *mingw*)
+    platform_win32=yes
+    native_win32=yes
+    ;;
+  pw32* | *cygwin*)
+    platform_win32=yes
+    native_win32=no
+    ;;
+  *)
+    platform_win32=no
+    native_win32=no
+    ;;
+esac
+AM_CONDITIONAL(PLATFORM_WIN32, test x"$platform_win32" = "xyes")
+AM_CONDITIONAL(NATIVE_WIN32, test x"$native_win32" = "xyes")[+
+ENDIF+]
+
+[+CASE (get "LibraryType") +]
+[+ == "Static" +]AC_DISABLE_SHARED
+[+ == "Shared" +]AC_DISABLE_STATIC
+[+ESAC+][+
+IF (=(get "HaveWindowsSupport") "1")+]
+LT_INIT([win32-dll])[+
+ELSE+]
+LT_INIT[+
+ENDIF+]
+
+[+IF (=(get "HavePackage") "1")+]
+pkg_modules="[+PackageModule1+] [+PackageModule2+]"
+AC_SUBST(pkg_modules)
+PKG_CHECK_MODULES([+NameCUpper+], [[+PackageModule1+] [+PackageModule2+]])
+
+[+ENDIF+]
+
+[+IF (=(get "HaveGtkDoc") "1")+]
+GTK_DOC_CHECK([1.0])
+[+ENDIF+]
+
+AC_OUTPUT([
+Makefile
+src/[+NameHLower+]-[+Version+].pc
+src/Makefile
+[+IF (=(get "HaveI18n") "1")+]po/Makefile.in[+ENDIF+]])
diff --git a/plugins/project-wizard/templates/vala-library/po/Makefile.am 
b/plugins/project-wizard/templates/vala-library/po/Makefile.am
new file mode 100644
index 0000000..4784d2c
--- /dev/null
+++ b/plugins/project-wizard/templates/vala-library/po/Makefile.am
@@ -0,0 +1,4 @@
+wizard_filesdir = $(anjuta_data_dir)/templates/vala-library/po
+dist_wizard_files_DATA = POTFILES.in
+
+-include $(top_srcdir)/git.mk
diff --git a/plugins/project-wizard/templates/vala-library/po/POTFILES.in 
b/plugins/project-wizard/templates/vala-library/po/POTFILES.in
new file mode 100644
index 0000000..335a043
--- /dev/null
+++ b/plugins/project-wizard/templates/vala-library/po/POTFILES.in
@@ -0,0 +1,4 @@
+[+ autogen5 template +]
+# List of source files containing translatable strings.
+
+src/[+NameHLower+].vala
diff --git a/plugins/project-wizard/templates/vala-library/src/Makefile.am 
b/plugins/project-wizard/templates/vala-library/src/Makefile.am
new file mode 100644
index 0000000..7c857f2
--- /dev/null
+++ b/plugins/project-wizard/templates/vala-library/src/Makefile.am
@@ -0,0 +1,4 @@
+wizard_filesdir = $(anjuta_data_dir)/templates/vala-library/src
+dist_wizard_files_DATA = library.deps.tpl library.pc.in lib.vala Makefile.am.tpl
+
+-include $(top_srcdir)/git.mk
diff --git a/plugins/project-wizard/templates/vala-library/src/Makefile.am.tpl 
b/plugins/project-wizard/templates/vala-library/src/Makefile.am.tpl
new file mode 100644
index 0000000..0037908
--- /dev/null
+++ b/plugins/project-wizard/templates/vala-library/src/Makefile.am.tpl
@@ -0,0 +1,62 @@
+[+ autogen5 template +]
+[+
+(define prefix_if_missing
+        (lambda
+                (name prefix)
+                (string-append
+                         (if
+                                (==* (get name) prefix)
+                                ""
+                                prefix
+                        )
+                        (get name)
+                )
+        )
+)
++]## Process this file with automake to produce Makefile.in
+
+## Created by Anjuta
+
+AM_CPPFLAGS = \
+       -DPACKAGE_LOCALE_DIR=\""$(localedir)"\" \
+       -DPACKAGE_SRC_DIR=\""$(srcdir)"\" \
+       -DPACKAGE_DATA_DIR=\""$(pkgdatadir)"\"[+IF (=(get "HavePackage") "1")+] \
+       $([+NameCUpper+]_CFLAGS)[+ENDIF+]
+
+AM_CFLAGS =\
+        -Wall\
+        -g
+
+lib_LTLIBRARIES = [+(prefix_if_missing "NameHLower" "lib")+].la
+
+vapidir = $(datadir)/vala/vapi
+dist_vapi_DATA = [+NameHLower+]-[+Version+].vapi [+NameHLower+]-[+Version+].deps
+
+[+(prefix_if_missing "NameCLower" "lib")+]_la_SOURCES = [+NameHLower+].vala
+
+[+(prefix_if_missing "NameCLower" "lib")+]_la_LDFLAGS = 
+       
+[+(prefix_if_missing "NameCLower" "lib")+]_la_VALAFLAGS = [+IF (not (= (get "PackageModule2") ""))+] --pkg 
[+(string-substitute (get "PackageModule2") " " " --pkg ")+] [+ENDIF+] \
+       --library [+NameHLower+]-[+Version+] --vapi [+NameHLower+]-[+Version+].vapi -H [+NameHLower+].h
+
+[+(prefix_if_missing "NameCLower" "lib")+]_la_LIBADD = [+IF (=(get "HavePackage") 
"1")+]$([+NameCUpper+]_LIBS)[+ENDIF+]
+
+[+IF (=(get "HaveWindowsSupport") "1")+]
+if PLATFORM_WIN32
+[+(prefix_if_missing "NameCLower" "lib")+]_la_LDFLAGS += -no-undefined
+endif
+
+if NATIVE_WIN32
+[+(prefix_if_missing "NameCLower" "lib")+]_la_LDFLAGS += -export-dynamic
+endif[+
+ENDIF+]
+
+[+NameHLower+]includedir = $(includedir)/[+NameHLower+]-[+Version+]
+[+NameHLower+]include_HEADERS = \
+       [+NameHLower+].h
+
+pkgconfigdir = $(libdir)/pkgconfig
+pkgconfig_DATA = [+NameHLower+]-[+Version+].pc
+
+EXTRA_DIST = \
+       [+NameHLower+]-[+Version+].pc.in
diff --git a/plugins/project-wizard/templates/vala-library/src/lib.vala 
b/plugins/project-wizard/templates/vala-library/src/lib.vala
new file mode 100644
index 0000000..b083eca
--- /dev/null
+++ b/plugins/project-wizard/templates/vala-library/src/lib.vala
@@ -0,0 +1,14 @@
+namespace Lib {
+       public class Foo : Object
+       {
+               public int add (int a, int b)
+               {
+                       return a + b;
+               }
+
+               public int mux (int a, int b)
+               {
+                       return a * b;
+               }
+       }
+}
diff --git a/plugins/project-wizard/templates/vala-library/src/library.deps.tpl 
b/plugins/project-wizard/templates/vala-library/src/library.deps.tpl
new file mode 100644
index 0000000..792e969
--- /dev/null
+++ b/plugins/project-wizard/templates/vala-library/src/library.deps.tpl
@@ -0,0 +1,5 @@
+[+ autogen5 template +]
+[+IF (=(get "HavePackage") "1")+]
+[+(string-substitute (get "PackageModule1") " " "\n")+]
+[+(string-substitute (get "PackageModule2") " " "\n")+]
+[+ENDIF+]
diff --git a/plugins/project-wizard/templates/vala-library/src/library.pc.in 
b/plugins/project-wizard/templates/vala-library/src/library.pc.in
new file mode 100644
index 0000000..230fb01
--- /dev/null
+++ b/plugins/project-wizard/templates/vala-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@/[+NameHLower+]-[+Version+]
+
+Name: [+NameHLower+]
+Description: Sample library created by Anjuta project wizard.
+Version: @VERSION@
+Requires: @pkg_modules@
+Libs: -L${libdir} -l[+NameHLower+]
+Cflags: -I${includedir}


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