diff options
author | Daniel Elstner <danielk@openismus.com> | 2009-08-04 23:04:54 +0200 |
---|---|---|
committer | Daniel Elstner <danielk@openismus.com> | 2009-08-04 23:40:45 +0200 |
commit | c50cd3befea539761a8960d4dfca8bef684694ed (patch) | |
tree | 8bf976b50b51fdb1ec95e7bfaacb9d868cb6ed25 | |
download | mm-common-c50cd3befea539761a8960d4dfca8bef684694ed.tar.gz |
Create mm-common module
-rw-r--r-- | .gitignore | 13 | ||||
-rw-r--r-- | AUTHORS | 1 | ||||
-rw-r--r-- | COPYING | 339 | ||||
-rw-r--r-- | ChangeLog | 2 | ||||
-rw-r--r-- | MAINTAINERS | 7 | ||||
-rw-r--r-- | Makefile.am | 43 | ||||
-rw-r--r-- | NEWS | 0 | ||||
-rw-r--r-- | README | 6 | ||||
-rwxr-xr-x | autogen.sh | 6 | ||||
-rw-r--r-- | build/compile-binding.am | 60 | ||||
-rw-r--r-- | build/dist-changelog.am | 32 | ||||
-rw-r--r-- | build/doc-reference.am | 146 | ||||
-rw-r--r-- | build/generate-binding.am | 76 | ||||
-rw-r--r-- | configure.ac | 28 | ||||
-rw-r--r-- | macros/mm-doc.m4 | 158 | ||||
-rw-r--r-- | macros/mm-module.m4 | 67 | ||||
-rw-r--r-- | macros/mm-pkg.m4 | 40 | ||||
-rw-r--r-- | macros/mm-warnings.m4 | 94 | ||||
-rw-r--r-- | mm-common.doap | 25 | ||||
-rw-r--r-- | util/doc-install.pl | 207 | ||||
-rw-r--r-- | util/doc-postprocess.pl | 81 | ||||
-rw-r--r-- | util/mm-common-prepare.in | 89 | ||||
-rw-r--r-- | util/tagfile-to-devhelp2.xsl | 79 |
23 files changed, 1599 insertions, 0 deletions
diff --git a/.gitignore b/.gitignore new file mode 100644 index 0000000..033fd19 --- /dev/null +++ b/.gitignore @@ -0,0 +1,13 @@ +/INSTALL +/Makefile +/Makefile.in +/aclocal.m4 +/autom4te.cache +/config.log +/config.status +/configure +/configure.lineno +/install-sh +/missing +/mm-common-*.tar.* +/util/mm-common-prepare @@ -0,0 +1 @@ +Daniel Elstner <daniel.kitta@gmail.com> @@ -0,0 +1,339 @@ + GNU GENERAL PUBLIC LICENSE + Version 2, June 1991 + + Copyright (C) 1989, 1991 Free Software Foundation, Inc., + 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA + Everyone is permitted to copy and distribute verbatim copies + of this license document, but changing it is not allowed. + + Preamble + + The licenses for most software are designed to take away your +freedom to share and change it. By contrast, the GNU General Public +License is intended to guarantee your freedom to share and change free +software--to make sure the software is free for all its users. This +General Public License applies to most of the Free Software +Foundation's software and to any other program whose authors commit to +using it. (Some other Free Software Foundation software is covered by +the GNU Lesser General Public License instead.) You can apply it to +your programs, too. + + When we speak of free software, we are referring to freedom, not +price. Our General Public Licenses are designed to make sure that you +have the freedom to distribute copies of free software (and charge for +this service if you wish), that you receive source code or can get it +if you want it, that you can change the software or use pieces of it +in new free programs; and that you know you can do these things. + + To protect your rights, we need to make restrictions that forbid +anyone to deny you these rights or to ask you to surrender the rights. +These restrictions translate to certain responsibilities for you if you +distribute copies of the software, or if you modify it. + + For example, if you distribute copies of such a program, whether +gratis or for a fee, you must give the recipients all the rights that +you have. You must make sure that they, too, receive or can get the +source code. And you must show them these terms so they know their +rights. + + We protect your rights with two steps: (1) copyright the software, and +(2) offer you this license which gives you legal permission to copy, +distribute and/or modify the software. + + Also, for each author's protection and ours, we want to make certain +that everyone understands that there is no warranty for this free +software. If the software is modified by someone else and passed on, we +want its recipients to know that what they have is not the original, so +that any problems introduced by others will not reflect on the original +authors' reputations. + + Finally, any free program is threatened constantly by software +patents. We wish to avoid the danger that redistributors of a free +program will individually obtain patent licenses, in effect making the +program proprietary. To prevent this, we have made it clear that any +patent must be licensed for everyone's free use or not licensed at all. + + The precise terms and conditions for copying, distribution and +modification follow. + + GNU GENERAL PUBLIC LICENSE + TERMS AND CONDITIONS FOR COPYING, DISTRIBUTION AND MODIFICATION + + 0. This License applies to any program or other work which contains +a notice placed by the copyright holder saying it may be distributed +under the terms of this General Public License. The "Program", below, +refers to any such program or work, and a "work based on the Program" +means either the Program or any derivative work under copyright law: +that is to say, a work containing the Program or a portion of it, +either verbatim or with modifications and/or translated into another +language. (Hereinafter, translation is included without limitation in +the term "modification".) Each licensee is addressed as "you". + +Activities other than copying, distribution and modification are not +covered by this License; they are outside its scope. The act of +running the Program is not restricted, and the output from the Program +is covered only if its contents constitute a work based on the +Program (independent of having been made by running the Program). +Whether that is true depends on what the Program does. + + 1. You may copy and distribute verbatim copies of the Program's +source code as you receive it, in any medium, provided that you +conspicuously and appropriately publish on each copy an appropriate +copyright notice and disclaimer of warranty; keep intact all the +notices that refer to this License and to the absence of any warranty; +and give any other recipients of the Program a copy of this License +along with the Program. + +You may charge a fee for the physical act of transferring a copy, and +you may at your option offer warranty protection in exchange for a fee. + + 2. You may modify your copy or copies of the Program or any portion +of it, thus forming a work based on the Program, and copy and +distribute such modifications or work under the terms of Section 1 +above, provided that you also meet all of these conditions: + + a) You must cause the modified files to carry prominent notices + stating that you changed the files and the date of any change. + + b) You must cause any work that you distribute or publish, that in + whole or in part contains or is derived from the Program or any + part thereof, to be licensed as a whole at no charge to all third + parties under the terms of this License. + + c) If the modified program normally reads commands interactively + when run, you must cause it, when started running for such + interactive use in the most ordinary way, to print or display an + announcement including an appropriate copyright notice and a + notice that there is no warranty (or else, saying that you provide + a warranty) and that users may redistribute the program under + these conditions, and telling the user how to view a copy of this + License. (Exception: if the Program itself is interactive but + does not normally print such an announcement, your work based on + the Program is not required to print an announcement.) + +These requirements apply to the modified work as a whole. If +identifiable sections of that work are not derived from the Program, +and can be reasonably considered independent and separate works in +themselves, then this License, and its terms, do not apply to those +sections when you distribute them as separate works. But when you +distribute the same sections as part of a whole which is a work based +on the Program, the distribution of the whole must be on the terms of +this License, whose permissions for other licensees extend to the +entire whole, and thus to each and every part regardless of who wrote it. + +Thus, it is not the intent of this section to claim rights or contest +your rights to work written entirely by you; rather, the intent is to +exercise the right to control the distribution of derivative or +collective works based on the Program. + +In addition, mere aggregation of another work not based on the Program +with the Program (or with a work based on the Program) on a volume of +a storage or distribution medium does not bring the other work under +the scope of this License. + + 3. You may copy and distribute the Program (or a work based on it, +under Section 2) in object code or executable form under the terms of +Sections 1 and 2 above provided that you also do one of the following: + + a) Accompany it with the complete corresponding machine-readable + source code, which must be distributed under the terms of Sections + 1 and 2 above on a medium customarily used for software interchange; or, + + b) Accompany it with a written offer, valid for at least three + years, to give any third party, for a charge no more than your + cost of physically performing source distribution, a complete + machine-readable copy of the corresponding source code, to be + distributed under the terms of Sections 1 and 2 above on a medium + customarily used for software interchange; or, + + c) Accompany it with the information you received as to the offer + to distribute corresponding source code. (This alternative is + allowed only for noncommercial distribution and only if you + received the program in object code or executable form with such + an offer, in accord with Subsection b above.) + +The source code for a work means the preferred form of the work for +making modifications to it. For an executable work, complete source +code means all the source code for all modules it contains, plus any +associated interface definition files, plus the scripts used to +control compilation and installation of the executable. However, as a +special exception, the source code distributed need not include +anything that is normally distributed (in either source or binary +form) with the major components (compiler, kernel, and so on) of the +operating system on which the executable runs, unless that component +itself accompanies the executable. + +If distribution of executable or object code is made by offering +access to copy from a designated place, then offering equivalent +access to copy the source code from the same place counts as +distribution of the source code, even though third parties are not +compelled to copy the source along with the object code. + + 4. You may not copy, modify, sublicense, or distribute the Program +except as expressly provided under this License. Any attempt +otherwise to copy, modify, sublicense or distribute the Program is +void, and will automatically terminate your rights under this License. +However, parties who have received copies, or rights, from you under +this License will not have their licenses terminated so long as such +parties remain in full compliance. + + 5. You are not required to accept this License, since you have not +signed it. However, nothing else grants you permission to modify or +distribute the Program or its derivative works. These actions are +prohibited by law if you do not accept this License. Therefore, by +modifying or distributing the Program (or any work based on the +Program), you indicate your acceptance of this License to do so, and +all its terms and conditions for copying, distributing or modifying +the Program or works based on it. + + 6. Each time you redistribute the Program (or any work based on the +Program), the recipient automatically receives a license from the +original licensor to copy, distribute or modify the Program subject to +these terms and conditions. You may not impose any further +restrictions on the recipients' exercise of the rights granted herein. +You are not responsible for enforcing compliance by third parties to +this License. + + 7. If, as a consequence of a court judgment or allegation of patent +infringement or for any other reason (not limited to patent issues), +conditions are imposed on you (whether by court order, agreement or +otherwise) that contradict the conditions of this License, they do not +excuse you from the conditions of this License. If you cannot +distribute so as to satisfy simultaneously your obligations under this +License and any other pertinent obligations, then as a consequence you +may not distribute the Program at all. For example, if a patent +license would not permit royalty-free redistribution of the Program by +all those who receive copies directly or indirectly through you, then +the only way you could satisfy both it and this License would be to +refrain entirely from distribution of the Program. + +If any portion of this section is held invalid or unenforceable under +any particular circumstance, the balance of the section is intended to +apply and the section as a whole is intended to apply in other +circumstances. + +It is not the purpose of this section to induce you to infringe any +patents or other property right claims or to contest validity of any +such claims; this section has the sole purpose of protecting the +integrity of the free software distribution system, which is +implemented by public license practices. Many people have made +generous contributions to the wide range of software distributed +through that system in reliance on consistent application of that +system; it is up to the author/donor to decide if he or she is willing +to distribute software through any other system and a licensee cannot +impose that choice. + +This section is intended to make thoroughly clear what is believed to +be a consequence of the rest of this License. + + 8. If the distribution and/or use of the Program is restricted in +certain countries either by patents or by copyrighted interfaces, the +original copyright holder who places the Program under this License +may add an explicit geographical distribution limitation excluding +those countries, so that distribution is permitted only in or among +countries not thus excluded. In such case, this License incorporates +the limitation as if written in the body of this License. + + 9. The Free Software Foundation may publish revised and/or new versions +of the General Public License from time to time. Such new versions will +be similar in spirit to the present version, but may differ in detail to +address new problems or concerns. + +Each version is given a distinguishing version number. If the Program +specifies a version number of this License which applies to it and "any +later version", you have the option of following the terms and conditions +either of that version or of any later version published by the Free +Software Foundation. If the Program does not specify a version number of +this License, you may choose any version ever published by the Free Software +Foundation. + + 10. If you wish to incorporate parts of the Program into other free +programs whose distribution conditions are different, write to the author +to ask for permission. For software which is copyrighted by the Free +Software Foundation, write to the Free Software Foundation; we sometimes +make exceptions for this. Our decision will be guided by the two goals +of preserving the free status of all derivatives of our free software and +of promoting the sharing and reuse of software generally. + + NO WARRANTY + + 11. BECAUSE THE PROGRAM IS LICENSED FREE OF CHARGE, THERE IS NO WARRANTY +FOR THE PROGRAM, TO THE EXTENT PERMITTED BY APPLICABLE LAW. EXCEPT WHEN +OTHERWISE STATED IN WRITING THE COPYRIGHT HOLDERS AND/OR OTHER PARTIES +PROVIDE THE PROGRAM "AS IS" WITHOUT WARRANTY OF ANY KIND, EITHER EXPRESSED +OR IMPLIED, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF +MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE. THE ENTIRE RISK AS +TO THE QUALITY AND PERFORMANCE OF THE PROGRAM IS WITH YOU. SHOULD THE +PROGRAM PROVE DEFECTIVE, YOU ASSUME THE COST OF ALL NECESSARY SERVICING, +REPAIR OR CORRECTION. + + 12. IN NO EVENT UNLESS REQUIRED BY APPLICABLE LAW OR AGREED TO IN WRITING +WILL ANY COPYRIGHT HOLDER, OR ANY OTHER PARTY WHO MAY MODIFY AND/OR +REDISTRIBUTE THE PROGRAM AS PERMITTED ABOVE, BE LIABLE TO YOU FOR DAMAGES, +INCLUDING ANY GENERAL, SPECIAL, INCIDENTAL OR CONSEQUENTIAL DAMAGES ARISING +OUT OF THE USE OR INABILITY TO USE THE PROGRAM (INCLUDING BUT NOT LIMITED +TO LOSS OF DATA OR DATA BEING RENDERED INACCURATE OR LOSSES SUSTAINED BY +YOU OR THIRD PARTIES OR A FAILURE OF THE PROGRAM TO OPERATE WITH ANY OTHER +PROGRAMS), EVEN IF SUCH HOLDER OR OTHER PARTY HAS BEEN ADVISED OF THE +POSSIBILITY OF SUCH DAMAGES. + + END OF TERMS AND CONDITIONS + + How to Apply These Terms to Your New Programs + + If you develop a new program, and you want it to be of the greatest +possible use to the public, the best way to achieve this is to make it +free software which everyone can redistribute and change under these terms. + + To do so, attach the following notices to the program. It is safest +to attach them to the start of each source file to most effectively +convey the exclusion of warranty; and each file should have at least +the "copyright" line and a pointer to where the full notice is found. + + <one line to give the program's name and a brief idea of what it does.> + Copyright (C) <year> <name of author> + + This program is free software; you can redistribute it and/or modify + it under the terms of the GNU General Public License as published by + the Free Software Foundation; either version 2 of the License, or + (at your option) any later version. + + This program 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 General Public License for more details. + + You should have received a copy of the GNU General Public License along + with this program; if not, write to the Free Software Foundation, Inc., + 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA. + +Also add information on how to contact you by electronic and paper mail. + +If the program is interactive, make it output a short notice like this +when it starts in an interactive mode: + + Gnomovision version 69, Copyright (C) year name of author + Gnomovision comes with ABSOLUTELY NO WARRANTY; for details type `show w'. + This is free software, and you are welcome to redistribute it + under certain conditions; type `show c' for details. + +The hypothetical commands `show w' and `show c' should show the appropriate +parts of the General Public License. Of course, the commands you use may +be called something other than `show w' and `show c'; they could even be +mouse-clicks or menu items--whatever suits your program. + +You should also get your employer (if you work as a programmer) or your +school, if any, to sign a "copyright disclaimer" for the program, if +necessary. Here is a sample; alter the names: + + Yoyodyne, Inc., hereby disclaims all copyright interest in the program + `Gnomovision' (which makes passes at compilers) written by James Hacker. + + <signature of Ty Coon>, 1 April 1989 + Ty Coon, President of Vice + +This General Public License does not permit incorporating your program into +proprietary programs. If your program is a subroutine library, you may +consider it more useful to permit linking proprietary applications with the +library. If this is what you want to do, use the GNU Lesser General +Public License instead of this License. diff --git a/ChangeLog b/ChangeLog new file mode 100644 index 0000000..08cdadb --- /dev/null +++ b/ChangeLog @@ -0,0 +1,2 @@ +The ChangeLog is auto-generated when releasing. If you +are seeing this, use 'git log' for a detailed list of changes. diff --git a/MAINTAINERS b/MAINTAINERS new file mode 100644 index 0000000..8786cc1 --- /dev/null +++ b/MAINTAINERS @@ -0,0 +1,7 @@ +Daniel Elstner +Email: daniel.kitta@gmail.com +Userid: daniel + +Murray Cumming +Email: murrayc@murrayc.com +Userid: murrayc diff --git a/Makefile.am b/Makefile.am new file mode 100644 index 0000000..d4cb173 --- /dev/null +++ b/Makefile.am @@ -0,0 +1,43 @@ +## Copyright (c) 2009 Openismus GmbH <http://www.openismus.com/> +## +## This file is part of mm-common. +## +## mm-common is free software: you can redistribute it and/or modify +## it under the terms of the GNU General Public License as published +## by the Free Software Foundation, either version 2 of the License, +## or (at your option) any later version. +## +## mm-common 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 General Public License for more details. +## +## You should have received a copy of the GNU General Public License +## along with mm-common. If not, see <http://www.gnu.org/licenses/>. + +ACLOCAL_AMFLAGS = ${ACLOCAL_FLAGS} + +bin_SCRIPTS = util/mm-common-prepare + +build_supportdir = $(pkgdatadir)/build +dist_build_support_DATA = \ + build/compile-binding.am \ + build/dist-changelog.am \ + build/doc-reference.am \ + build/generate-binding.am + +aclocal_macrodir = $(datadir)/aclocal +dist_aclocal_macro_DATA = \ + macros/mm-doc.m4 \ + macros/mm-module.m4 \ + macros/mm-pkg.m4 \ + macros/mm-warnings.m4 + +dist_noinst_DATA = \ + util/doc-install.pl \ + util/doc-postprocess.pl \ + util/tagfile-to-devhelp2.xsl + +dist_noinst_SCRIPTS = autogen.sh + +include $(top_srcdir)/build/dist-changelog.am @@ -0,0 +1,6 @@ +The mm-common module provides the build infrastructure and utilities +shared among the GNOME C++ binding libraries. It is only a required +dependency for building the C++ bindings from the version control +repository. It is not required for building tarball releases. + +This module is part of the GNOME C++ bindings effort <http://www.gtkmm.org/>. diff --git a/autogen.sh b/autogen.sh new file mode 100755 index 0000000..ed45c1b --- /dev/null +++ b/autogen.sh @@ -0,0 +1,6 @@ +#! /bin/sh -e +test -n "$srcdir" || srcdir=`dirname "$0"` +test -n "$srcdir" || srcdir=. + +autoreconf --force --install "$srcdir" +test -n "$NOCONFIGURE" || "$srcdir/configure" --enable-maintainer-mode "$@" diff --git a/build/compile-binding.am b/build/compile-binding.am new file mode 100644 index 0000000..962d537 --- /dev/null +++ b/build/compile-binding.am @@ -0,0 +1,60 @@ +## Copyright (c) 2009 Daniel Elstner <daniel.kitta@gmail.com> +## +## This file is part of mm-common. +## +## mm-common is free software: you can redistribute it and/or modify +## it under the terms of the GNU General Public License as published +## by the Free Software Foundation, either version 2 of the License, +## or (at your option) any later version. +## +## mm-common 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 General Public License for more details. +## +## You should have received a copy of the GNU General Public License +## along with mm-common. If not, see <http://www.gnu.org/licenses/>. + +## Parameters: lib_LTLIBRARIES +## Overrides: binding_name, binding_basedir, binding_modulename +## Files: files_built_cc, files_built_h, files_built_ph, +## files_extra_cc, files_extra_h +## Output: binding_sources, binding_includes, binding_cppflags + +# The name of the binding module. Usually identical to the name of the +# directory where the generated sources and include files live. +binding_name ?= $(notdir $(subdir)) + +# The parent directory of the src/ and libmm/ directories. +# Usually the same as the C library name. +binding_basedir ?= $(patsubst %/,%,$(dir $(subdir))) + +# The library name of the binding, possibly including an API version suffix. +# Depending on the module, the "lib" prefix may or may not be included. +binding_modulename ?= $(patsubst lib%,$(binding_libprefix)%,$(basename $(lib_LTLIBRARIES))) + +# Try to work out whether the binding's module name includes a "lib" prefix. +binding_libprefix = $(if $(binding_name:lib%=),,lib) + +# Files to be listed in the module's _SOURCES variable. +binding_sources = $(files_built_cc) $(files_extra_cc) + +# Default include directories and preprocessor flags. +binding_includes = -I.. $(if $(srcdir:.=),-I$(top_srcdir)/$(binding_basedir)) -I$(top_builddir) +binding_cppflags = -DG_LOG_DOMAIN=\""$(binding_name)"\" + +# Installation directories for header files. +binding_includedir = $(includedir)/$(binding_modulename)/$(binding_name) +binding_privatedir = $(binding_includedir)/private + +# List of installed header files. +binding_include_HEADERS = $(files_built_h) $(files_extra_h) +binding_private_HEADERS = $(files_built_ph) + +# Delete built sources on make maintainer-clean. +binding_built_sources = $(files_built_cc) $(files_built_h) $(files_built_ph) +MAINTAINERCLEANFILES = $(binding_built_sources) $(addprefix $(srcdir)/,$(binding_built_sources)) + +# Instruct GNU make to delete the targets of a rule after it failed, in +# order to avoid the complication of handling that situation manually. +.DELETE_ON_ERROR: diff --git a/build/dist-changelog.am b/build/dist-changelog.am new file mode 100644 index 0000000..7c9e905 --- /dev/null +++ b/build/dist-changelog.am @@ -0,0 +1,32 @@ +## Copyright (c) 2009 Daniel Elstner <daniel.kitta@gmail.com> +## +## This file is part of mm-common. +## +## mm-common is free software: you can redistribute it and/or modify +## it under the terms of the GNU General Public License as published +## by the Free Software Foundation, either version 2 of the License, +## or (at your option) any later version. +## +## mm-common 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 General Public License for more details. +## +## You should have received a copy of the GNU General Public License +## along with mm-common. If not, see <http://www.gnu.org/licenses/>. + +if MAINTAINER_MODE +dist-hook: dist-changelog +else +dist-hook: +endif + +.PHONY: dist-changelog + +dist-changelog: $(top_srcdir)/.git/HEAD + @if git --git-dir="$(top_srcdir)/.git" --work-tree="$(top_srcdir)" \ + log --date=short --pretty='format:%cd %an <%ae>%n%n%s%n%n%b' \ + | sed -e '/^[12]...-[01].-[0123]. [^<>]* <[^<>]*>$$/ b' \ + -e 's/^[ ]*/ /;s/[ ]*$$//' >.ChangeLog.tmp; \ + then mv -f .ChangeLog.tmp "$(top_distdir)/ChangeLog"; \ + else rm -f .ChangeLog.tmp; exit 1; fi diff --git a/build/doc-reference.am b/build/doc-reference.am new file mode 100644 index 0000000..45f0703 --- /dev/null +++ b/build/doc-reference.am @@ -0,0 +1,146 @@ +## Copyright (c) 2009 Daniel Elstner <daniel.kitta@gmail.com> +## +## This file is part of mm-common. +## +## mm-common is free software: you can redistribute it and/or modify +## it under the terms of the GNU General Public License as published +## by the Free Software Foundation, either version 2 of the License, +## or (at your option) any later version. +## +## mm-common 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 General Public License for more details. +## +## You should have received a copy of the GNU General Public License +## along with mm-common. If not, see <http://www.gnu.org/licenses/>. + +## Parameters: book_name +## Overrides: pubdocbase, htmlrefpub, book_title, htmlref_patterns, +## doc_postprocess, doc_install, tagfile_to_devhelp2 +## Files: doc_input +## Output: dist_noinst_DATA, DISTCLEANFILES, MAINTAINERCLEANFILES + +# The base URL where the online documentation for C++ binding modules +# is located, including the trailing slash. +pubdocbase ?= http://www.gtkmm.org/docs/ + +# The URL of the module's online HTML reference documentation, +# excluding the trailing slash. +htmlrefpub ?= $(pubdocbase)$(book_name)/reference/html + +# The title of the generated Devhelp book. +book_title ?= $(PACKAGE_NAME) Reference Manual + +# A list of wildcard patterns matching the files from the HTML directory +# generated by Doxygen which should be distributed and installed. +htmlref_patterns ?= \ + reference/html/*.html \ + reference/html/*.css \ + reference/html/*.png \ + reference/html/*.gif + +# Locations of utilities shipped with gmmproc. Made overridable +# in case the installed utilities cannot be used for some reason. +doc_postprocess ?= $(GMMPROC_DIR)/doc-postprocess.pl +doc_install ?= $(GMMPROC_DIR)/doc-install.pl +tagfile_to_devhelp2 ?= $(GMMPROC_DIR)/tagfile-to-devhelp2.xsl + +# Names of the main output files. +doxytagfile = reference/$(book_name).tag +devhelpfile = reference/$(book_name).devhelp2 + +# Function: $(call vpath_listall,PATTERN ...) +# Get all filenames which match a PATTERN from the list. Look for files +# relative to either the current directory or $(srcdir). Strip $(srcdir)/ +# again before returning and remove any duplicates. +vpath_srclist = $(patsubst $(srcdir)/%,%,$(wildcard $(addprefix $(srcdir)/,$(1)))) +vpath_listall = $(sort $(wildcard $(1)) $(if $(srcdir:.=),$(vpath_srclist))) + +# Function: $(call vpath_resolve,FILENAME ...) +# For each FILENAME, test whether the file exists relative to the current +# directory. If the file exists, return the filename unchanged, otherwise +# prepend $(srcdir)/ to the filename. +vpath_srctest = $(foreach file,$(1),$(or $(wildcard $(file)),$(srcdir)/$(file))) +vpath_resolve = $(if $(srcdir:.=),$(vpath_srctest),$(1)) + +# Installation directories. +libdocdir = $(datarootdir)/doc/$(book_name) +referencedir = $(libdocdir)/reference +htmlrefdir = $(referencedir)/html +devhelpdir = $(datadir)/devhelp/books/$(book_name) + +# List of files in the HTML reference documentation. +htmlreffiles = $(call vpath_listall,$(htmlref_patterns)) + +dist_reference_DATA = $(doxytagfile) +dist_devhelp_DATA = $(devhelpfile) +dist_noinst_DATA = $(htmlreffiles) + +DISTCLEANFILES = reference/doxygen.log +MAINTAINERCLEANFILES = $(doxytagfile) $(devhelpfile) reference/html/* + +# The generic bit of the doc-install.pl command line. +doc_install_cmd = $(PERL) -- $(doc_install) --verbose --mode=0644 + +# The command and options used to install the files from the HTML reference +# documentation. The $(subst) magic translates external tag references from +# absolute to relative paths if the destination is on the local file system +# and installed under the same prefix as the package being built. +htmlref_install = $(doc_install_cmd) $(subst @$(datarootdir)/doc/,@../../../,$(DOCINSTALL_FLAGS)) + +# Override the file installation program for dist_devhelp_DATA files. +# Note that this is not a documented feature as far as I'm aware, but +# Automake recognizes the override and does not try to assign its own +# default value. +dist_devhelpDATA_INSTALL = $(doc_install_cmd) --book-base='$(htmlrefdir)' -T -- + +# The parameters to the Doxygen-to-Devhelp XSLT script +dh_xsl_params = --stringparam book_title '$(book_title)' \ + --stringparam book_name '$(book_name)' \ + --stringparam book_base '$(htmlrefpub)' + +# Regenerate the documentation automatically only in maintainer mode. +if MAINTAINER_MODE +doc_dependencies = $(doc_input) $(srcdir)/reference/Doxyfile.in +else +doc_dependencies = +endif + +# Install the HTML reference documentation files with just one invocation +# of doc-install.pl to speed up the build process. +install-data-local: reference/html/index.html + @$(NORMAL_INSTALL) + $(MKDIR_P) '$(DESTDIR)$(htmlrefdir)' + $(htmlref_install) -t '$(DESTDIR)$(htmlrefdir)' -- $(call vpath_resolve,$(htmlreffiles)) + +# Delete all files in the html installation directory, but avoid recursion +# in order to limit the harm done if something goes horribly wrong. +uninstall-local: + @$(NORMAL_UNINSTALL) + (cd '$(DESTDIR)$(htmlrefdir)' 2>/dev/null || exit 0; rm -f $(notdir $(htmlref_patterns))) + -test ! -r '$(DESTDIR)$(htmlrefdir)' || rmdir '$(DESTDIR)$(htmlrefdir)' + +# Regenerate the Doxygen configuration file automatically. +reference/Doxyfile: $(srcdir)/reference/Doxyfile.in $(top_builddir)/config.status + cd $(top_builddir) && $(SHELL) ./config.status $(subdir)/$@ + +# Make sure that the documentation will always have been generated before +# executing the commands of a rule that depends on files in reference/html/. +reference/html/%: | $(doxytagfile) + +# Run Doxygen to build the reference documentation. The generated tag file +# also functions as time stamp target for the documentation as a whole. +$(doxytagfile): $(doc_dependencies) | reference/Doxyfile + -rm -f '$@' + -rm -f reference/html/* + (echo '@INCLUDE =' reference/Doxyfile && echo 'INPUT =' $(doc_input)) | $(DOXYGEN) - + $(PERL) -- "$(doc_postprocess)" reference/html/*.html + +# Run XSL transformation to generate a Devhelp book from a Doxygen tag file. +%.devhelp2: %.tag + $(XSLTPROC) $(dh_xsl_params) -o $@ "$(tagfile_to_devhelp2)" $< + +# Instruct GNU make to delete the targets of a rule after it failed, in +# order to avoid the complication of handling that situation manually. +.DELETE_ON_ERROR: diff --git a/build/generate-binding.am b/build/generate-binding.am new file mode 100644 index 0000000..dd4c474 --- /dev/null +++ b/build/generate-binding.am @@ -0,0 +1,76 @@ +## Copyright (c) 2009 Daniel Elstner <daniel.kitta@gmail.com> +## +## This file is part of mm-common. +## +## mm-common is free software: you can redistribute it and/or modify +## it under the terms of the GNU General Public License as published +## by the Free Software Foundation, either version 2 of the License, +## or (at your option) any later version. +## +## mm-common 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 General Public License for more details. +## +## You should have received a copy of the GNU General Public License +## along with mm-common. If not, see <http://www.gnu.org/licenses/>. + +## Parameters: binding_name, wrap_init_flags +## Overrides: codegen_srcdir, codegen_m4_srcdir, binding_outputdir +## Files: files_codegen_m4, files_defs, files_hg, files_ccg +## Output: dist_noinst_DATA, gmmproc_dependencies, other_built_sources, +## MAINTAINERCLEANFILES + +# Location of the module's gmmproc support files. +codegen_srcdir ?= $(top_srcdir)/codegen + +# Location of the module's gmmproc M4 files. +codegen_m4_srcdir ?= $(codegen_srcdir)/m4 + +# Destination directory of the generated source files. +binding_outputdir ?= $(top_srcdir)/$(dir $(subdir))$(binding_name) + +# Additional built sources not generated by gmmproc. +other_built_sources = $(binding_outputdir)/wrap_init.cc + +# Where to put the stamp files for the gmmproc output. +binding_stampdir = $(srcdir)/.stamps + +# Lists of qualified file names relative to the current directory. +binding_relfiles_m4 = $(addprefix $(codegen_m4_srcdir)/,$(files_codegen_m4)) +binding_relfiles_hg = $(addprefix $(srcdir)/,$(files_hg)) +binding_stampfiles = $(files_hg:%.hg=$(binding_stampdir)/%.stamp) + +# Distributed code generation source files. +dist_noinst_DATA = $(files_defs) $(files_hg) $(files_ccg) + +# Delete stamps on make maintainer-clean. The other generated source +# files are deleted by the make rules for the output directory. +MAINTAINERCLEANFILES = $(binding_stampdir)/*.stamp + +# Dependencies of the gmmproc code generator targets. +gmmproc_dependencies = $(binding_relfiles_m4) $(files_defs) + +# Command lines to invoke the code generator tools. +gmmproc_cmd = $(PERL) -- "$(GMMPROC_DIR)/gmmproc" -I $(codegen_m4_srcdir) --defs $(srcdir) +gen_wrap_init_cmd = $(PERL) -- "$(GMMPROC_DIR)/generate_wrap_init.pl" $(wrap_init_flags) + +# Declare the built sources main targets. +all-local: $(binding_stampfiles) $(other_built_sources) + +# Create the .stamps/ subdirectory if it does not exist already. +$(binding_stampdir): + $(MKDIR_P) $@ + +# Generate the wrap_init.cc file using generate_wrap_init.pl. +$(binding_outputdir)/wrap_init.cc: $(binding_relfiles_hg) + $(gen_wrap_init_cmd) $(binding_relfiles_hg) >$@ + +# Run the gmmproc code generator to produce the C++ binding code. +$(binding_stampdir)/%.stamp: %.hg %.ccg $(gmmproc_dependencies) | $(binding_stampdir) + @: >$@ + $(gmmproc_cmd) $(notdir $*) $(srcdir) $(binding_outputdir) + +# Instruct GNU make to delete the targets of a rule after it failed, in +# order to avoid the complication of handling that situation manually. +.DELETE_ON_ERROR: diff --git a/configure.ac b/configure.ac new file mode 100644 index 0000000..dc74086 --- /dev/null +++ b/configure.ac @@ -0,0 +1,28 @@ +## Copyright (c) 2009 Openismus GmbH <http://www.openismus.com/> +## +## This file is part of mm-common. +## +## mm-common is free software: you can redistribute it and/or modify +## it under the terms of the GNU General Public License as published +## by the Free Software Foundation, either version 2 of the License, +## or (at your option) any later version. +## +## mm-common 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 General Public License for more details. +## +## You should have received a copy of the GNU General Public License +## along with mm-common. If not, see <http://www.gnu.org/licenses/>. + +AC_INIT([mm-common], [0.1], [gtkmm-list@gnome.org], [mm-common]) +AC_PREREQ([2.62]) + +AC_CONFIG_SRCDIR([build/compile-binding.am]) + +AM_INIT_AUTOMAKE([1.9 no-define nostdinc tar-ustar]) +AM_MAINTAINER_MODE +AC_ARG_VAR([ACLOCAL_FLAGS], [aclocal flags, e.g. -I <macro dir>]) + +AC_CONFIG_FILES([Makefile util/mm-common-prepare]) +AC_OUTPUT diff --git a/macros/mm-doc.m4 b/macros/mm-doc.m4 new file mode 100644 index 0000000..6d7e1e7 --- /dev/null +++ b/macros/mm-doc.m4 @@ -0,0 +1,158 @@ +## Copyright (c) 2009 Daniel Elstner <daniel.kitta@gmail.com> +## +## This file is part of mm-common. +## +## mm-common is free software: you can redistribute it and/or modify +## it under the terms of the GNU General Public License as published +## by the Free Software Foundation, either version 2 of the License, +## or (at your option) any later version. +## +## mm-common 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 General Public License for more details. +## +## You should have received a copy of the GNU General Public License +## along with mm-common. If not, see <http://www.gnu.org/licenses/>. + +#serial 20090804 + +## MM_ARG_ENABLE_DOCUMENTATION +## +## Provide the --disable-documentation configure option. By default, +## the documentation will be included in the build. If not explicitly +## disabled, also check whether the necessary tools are installed, and +## abort if any are missing. +## +## The tools checked for are Perl, dot, Doxygen and xsltproc. The +## substitution variables PERL, DOT, DOXYGEN and XSLTPROC are set to +## the command paths, unless overridden in the user environment. +## +## If the package provides the --enable-maintainer-mode option, the +## tools dot, Doxygen and xsltproc are mandatory only when maintainer +## mode is enabled. Perl is required for the installdox utility even +## if not in maintainer mode. +## +AC_DEFUN([MM_ARG_ENABLE_DOCUMENTATION], +[dnl +AC_ARG_VAR([PERL], [path to Perl interpreter])[]dnl +AC_ARG_VAR([DOT], [path to dot utility])[]dnl +AC_ARG_VAR([DOXYGEN], [path to Doxygen utility])[]dnl +AC_ARG_VAR([XSLTPROC], [path to xsltproc utility])[]dnl +dnl +AC_PATH_PROG([PERL], [perl], [perl]) +AC_PATH_PROG([DOT], [dot], [dot]) +AC_PATH_PROG([DOXYGEN], [doxygen], [doxygen]) +AC_PATH_PROG([XSLTPROC], [xsltproc], [xsltproc]) +dnl +AC_ARG_ENABLE([documentation], + [AS_HELP_STRING([--disable-documentation], + [do not build or install the documentation])], + [ENABLE_DOCUMENTATION=$enableval], + [ENABLE_DOCUMENTATION=yes]) +AS_IF([test "x$ENABLE_DOCUMENTATION" != xno], +[ + AS_IF([test "x$PERL" = xperl], + [AC_MSG_FAILURE([[Perl is required for installing the documentation.]])]) + + AS_IF([test "x$USE_MAINTAINER_MODE" != xno], + [ + for mm_prog in "$DOT" "$DOXYGEN" "$XSLTPROC" + do + AS_CASE([$mm_prog], [[dot|doxygen|xsltproc]], + [AC_MSG_FAILURE([[The documentation will be built in this configuration, +but the required tool $mm_prog could not be found.]])]) + done + ])[]dnl +]) +AM_CONDITIONAL([ENABLE_DOCUMENTATION], [test "x$ENABLE_DOCUMENTATION" != xno]) +AC_SUBST([DOXYGEN_TAGFILES], [[]]) +AC_SUBST([DOCINSTALL_FLAGS], [[]])[]dnl +]) + +## _MM_ARG_WITH_TAGFILE_DOC(option-basename, tagfilename, [module]) +## +m4_define([_MM_ARG_WITH_TAGFILE_DOC], +[dnl + AC_MSG_CHECKING([for $1 documentation]) + AC_ARG_WITH([$1-doc], + [AS_HELP_STRING([[--with-$1-doc=[TAGFILE@]HTMLREFDIR]], + [Link to external $1 documentation]m4_ifval([$3], [[ [auto]]]))], + [ + mm_htmlrefdir=`[expr "@$withval" : '.*@\(.*\)' 2>&]AS_MESSAGE_LOG_FD` + mm_tagname=`[expr "/$withval" : '[^@]*[\\/]\([^\\/@]*\)@' 2>&]AS_MESSAGE_LOG_FD` + mm_tagpath=`[expr "X$withval" : 'X\([^@]*\)@' 2>&]AS_MESSAGE_LOG_FD` + test "x$mm_tagname" != x || mm_tagname="$2" + test "x$mm_tagpath" != x || mm_tagpath=$mm_tagname[]dnl + ], [ + mm_htmlrefdir= + mm_tagname="$2" + mm_tagpath=$mm_tagname[]dnl + ]) +m4_ifval([$3], [dnl + AS_IF([test "x$mm_htmlrefdir" = x], + [ + mm_htmlrefdir=`$PKG_CONFIG --variable=htmlrefdir "$3" 2>&AS_MESSAGE_LOG_FD`dnl + ]) + AS_CASE([$mm_htmlrefdir], [[http://*|https://*]], [mm_htmlrefpub=$mm_htmlrefdir], + [ + mm_htmlrefpub=`$PKG_CONFIG --variable=htmlrefpub "$3" 2>&AS_MESSAGE_LOG_FD` + test "x$mm_htmlrefpub" != x || mm_htmlrefpub=$mm_htmlrefdir + test "x$mm_htmlrefdir" != x || mm_htmlrefdir=$mm_htmlrefpub + ]) + AS_CASE([$mm_tagpath], [[*[\\/]*]],, + [ + mm_doxytagfile=`$PKG_CONFIG --variable=doxytagfile "$3" 2>&AS_MESSAGE_LOG_FD` + test "x$mm_doxytagfile" = x || mm_tagpath=$mm_doxytagfile + ]) +])[]dnl + AC_MSG_RESULT([$mm_tagpath@$mm_htmlrefdir]) + + AS_IF([test "x$USE_MAINTAINER_MODE" != xno && test ! -f "$mm_tagpath"], + [AC_MSG_WARN([Doxygen tag file $2 not found])]) + AS_IF([test "x$mm_htmlrefdir" = x], + [AC_MSG_WARN([Location of external $1 documentation not set])])[]dnl + + test "x$DOXYGEN_TAGFILES" = x || DOXYGEN_TAGFILES="$DOXYGEN_TAGFILES " + DOXYGEN_TAGFILES=$DOXYGEN_TAGFILES[\]"$mm_tagpath=$[mm_htmlref]m4_ifval([$3], [pub], [dir])[\]" + test "x$DOCINSTALL_FLAGS" = x || DOCINSTALL_FLAGS="$DOCINSTALL_FLAGS " + DOCINSTALL_FLAGS=[$]DOCINSTALL_FLAGS"-l '$mm_tagname@$mm_htmlrefdir'"dnl +]) + +## MM_ARG_WITH_TAGFILE_DOC(tagfilename, [module]) +## +## Provide a --with-<tagfilebase>-doc=[/path/tagfile@]htmlrefdir configure +## option, which may be used to specify the location of a tag file and the +## path to the corresponding HTML reference documentation. If the project +## provides the maintainer mode option and maintainer mode is not enabled, +## the user does not have to provide the full path to the tag file. The +## full path is only required for rebuilding the documentation. +## +## If the optional <module> argument has been specified, and either the tag +## file or the HTML location have not been overridden by the user already, +## try to retrieve the missing paths automatically via pkg-config. Also ask +## pkg-config for the URI to the online documentation, for use as the preset +## location when the documentation is generated. +## +## A warning message will be shown if the HTML path could not be determined. +## If maintainer mode is active, a warning is also displayed if the tag file +## could not be found. +## +## The results are appended to the substitution variables DOXYGEN_TAGFILES +## and DOCINSTALL_FLAGS, using the following format: +## +## DOXYGEN_TAGFILES = "/path/tagfile=htmlrefpub" [...] +## DOCINSTALL_FLAGS = -l 'tagfile@htmlrefdir' [...] +## +## The substitutions are intended to be used for the Doxygen configuration, +## and as argument list to the doc-install.pl or installdox utility. +## +AC_DEFUN([MM_ARG_WITH_TAGFILE_DOC], +[dnl +m4_assert([$# >= 1])[]dnl +m4_ifval([$2], [AC_REQUIRE([PKG_PROG_PKG_CONFIG])])[]dnl +AC_REQUIRE([MM_ARG_ENABLE_DOCUMENTATION])[]dnl +dnl +AS_IF([test "x$ENABLE_DOCUMENTATION" != xno], [_MM_ARG_WITH_TAGFILE_DOC( + m4_quote(m4_bpatsubst([$1], [\([-+][0123456789]\|[+]*[._]\).*$])), [$1], [$2])])[]dnl +]) diff --git a/macros/mm-module.m4 b/macros/mm-module.m4 new file mode 100644 index 0000000..5a63c33 --- /dev/null +++ b/macros/mm-module.m4 @@ -0,0 +1,67 @@ +## Copyright (c) 2009 Daniel Elstner <daniel.kitta@gmail.com> +## +## This file is part of mm-common. +## +## mm-common is free software: you can redistribute it and/or modify +## it under the terms of the GNU General Public License as published +## by the Free Software Foundation, either version 2 of the License, +## or (at your option) any later version. +## +## mm-common 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 General Public License for more details. +## +## You should have received a copy of the GNU General Public License +## along with mm-common. If not, see <http://www.gnu.org/licenses/>. + +#serial 20090804 + +## _MM_INIT_MODULE_VERSION(basename, BASENAME, [major], [minor], [micro]) +## +m4_define([_MM_INIT_MODULE_VERSION], +[dnl +m4_ifval([$3], [AC_DEFINE([$2][_MAJOR_VERSION], [$3], [Major version number of $1.])])[]dnl +m4_ifval([$4], [AC_DEFINE([$2][_MINOR_VERSION], [$4], [Minor version number of $1.])])[]dnl +m4_ifval([$5], [AC_DEFINE([$2][_MICRO_VERSION], [$5], [Micro version number of $1.])])[]dnl +]) + +## _MM_INIT_MODULE_SUBST(module-name, module-version, basename, api-version, BASENAME) +## +m4_define([_MM_INIT_MODULE_SUBST], +[dnl +AC_SUBST([$5][_MODULE_NAME], [$1])[]dnl +AC_SUBST([$5][_VERSION], [$2])[]dnl +m4_ifval([$4], [AC_SUBST([$5][_API_VERSION], [$4])])[]dnl +_MM_INIT_MODULE_VERSION([$3], [$5], m4_bpatsubst([$2], [[^0123456789]+], [,]))[]dnl +]) + +## _MM_INIT_MODULE_BASENAME(module-name, module-version, basename, api-version) +## +m4_define([_MM_INIT_MODULE_BASENAME], + [_MM_INIT_MODULE_SUBST([$1], [$2], [$3], [$4], m4_quote(AS_TR_CPP([$3])))]) + +## MM_INIT_MODULE(module-name, module-version) +## +## Set up substitution variables and macro definitions for a module with +## the specified pkg-config <module-name> and <module-version> triplet. +## +## Substitutions: <BASENAME>_MODULE_NAME <module-name> +## <BASENAME>_VERSION <module-version> +## <BASENAME>_API_VERSION <api-version> +## +## Defines: <BASENAME>_MAJOR_VERSION <major> +## <BASENAME>_MINOR_VERSION <minor> +## <BASENAME>_MICRO_VERSION <micro> +## +## Where: <BASENAME> AS_TR_CPP(<basename>) +## <basename>[-<api-version>] <module-name> +## <major>.<minor>.<micro>[.*] <module-version> +## +AC_DEFUN([MM_INIT_MODULE], +[dnl +m4_assert([$# >= 2])[]dnl +_MM_INIT_MODULE_BASENAME([$1], [$2], + m4_quote(m4_bpatsubst([$1], [-[.0123456789]+$])), + m4_quote(m4_bregexp([$1], [-\([.0123456789]+\)$], [\1])))[]dnl +]) diff --git a/macros/mm-pkg.m4 b/macros/mm-pkg.m4 new file mode 100644 index 0000000..4327fda --- /dev/null +++ b/macros/mm-pkg.m4 @@ -0,0 +1,40 @@ +## Copyright (c) 2009 Daniel Elstner <daniel.kitta@gmail.com> +## +## This file is part of mm-common. +## +## mm-common is free software: you can redistribute it and/or modify +## it under the terms of the GNU General Public License as published +## by the Free Software Foundation, either version 2 of the License, +## or (at your option) any later version. +## +## mm-common 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 General Public License for more details. +## +## You should have received a copy of the GNU General Public License +## along with mm-common. If not, see <http://www.gnu.org/licenses/>. + +#serial 20090804 + +## MM_PKG_CONFIG_SUBST(variable, arguments, [action-if-found], [action-if-not-found]) +## +## Run the pkg-config utility with the specified command-line <arguments> +## and capture its standard output in the named shell <variable>. If the +## command exited successfully, execute <action-if-found> in the shell if +## specified. If the command failed, run <action-if-not-found> if given, +## otherwise ignore the error. +## +AC_DEFUN([MM_PKG_CONFIG_SUBST], +[dnl +m4_assert([$# >= 2])[]dnl +AC_REQUIRE([PKG_PROG_PKG_CONFIG])[]dnl +AC_MSG_CHECKING([for $1]) + +AS_IF([test -z "${$1+set}"], + [$1=`$PKG_CONFIG $2 2>&AS_MESSAGE_LOG_FD` + AS_IF([test "[$]?" -eq 0], [$3], [$4])]) + +AC_MSG_RESULT([[$]$1]) +AC_SUBST([$1])[]dnl +]) diff --git a/macros/mm-warnings.m4 b/macros/mm-warnings.m4 new file mode 100644 index 0000000..10ea951 --- /dev/null +++ b/macros/mm-warnings.m4 @@ -0,0 +1,94 @@ +## Copyright (c) 2009 Daniel Elstner <daniel.kitta@gmail.com> +## +## This file is part of mm-common. +## +## mm-common is free software: you can redistribute it and/or modify +## it under the terms of the GNU General Public License as published +## by the Free Software Foundation, either version 2 of the License, +## or (at your option) any later version. +## +## mm-common 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 General Public License for more details. +## +## You should have received a copy of the GNU General Public License +## along with mm-common. If not, see <http://www.gnu.org/licenses/>. + +#serial 20090804 + +## MM_ARG_ENABLE_WARNINGS(variable, min-flags, max-flags, [deprecation-prefixes]) +## +## Provide the --enable-warnings configure argument, set to "min" by default. +## <min-flags> and <max-flags> should be space-separated lists of compiler +## warning flags to use with --enable-warnings=min or --enable-warnings=max, +## respectively. Warning level "fatal" is the same as "max" but in addition +## enables -Werror mode. +## +## If not empty, <deprecation-prefixes> should be a list of module prefixes +## which is expanded to -D<module>_DISABLE_DEPRECATED flags if fatal warnings +## are enabled, too. +## +AC_DEFUN([MM_ARG_ENABLE_WARNINGS], +[dnl +m4_assert([$# >= 3])[]dnl +dnl +AC_ARG_ENABLE([warnings], + [AS_HELP_STRING([[--enable-warnings[=min|max|fatal|no]]], + [set compiler pedantry level [default=min]])], + [mm_enable_warnings=$enableval], + [mm_enable_warnings=min])[]dnl + +AS_CASE([$ac_compile], + [*'$CXXFLAGS '*], [mm_lang='C++' mm_cc=$CXX mm_conftest=conftest.${ac_ext-cc}], + [*'$CFLAGS '*], [mm_lang=C mm_cc=$CC mm_conftest=conftest.${ac_ext-c}], + [mm_lang=])[]dnl + +AS_IF([test "x$mm_lang" != x], +[ + AC_MSG_CHECKING([which $mm_lang compiler warning flags to use]) + mm_deprecation_flags= + mm_tested_flags= + + AS_CASE([$mm_enable_warnings], + [no], [mm_warning_flags=], + [max], [mm_warning_flags="$3"], + [fatal], [mm_warning_flags="$3 -Werror"][m4_ifval([$4], [ + for mm_prefix in $4 + do + mm_deprecation_flags="${mm_deprecation_flags}-D${mm_prefix}_DISABLE_DEPRECATED " + done])], + [mm_warning_flags="$2"])[]dnl + + AS_IF([test "x$mm_warning_flags" != x], + [ + # Keep in mind that the dummy source must be devoid of any + # problems that might cause diagnostics. + AC_LANG_CONFTEST([AC_LANG_SOURCE([[ +int main(int argc, char** argv) { return (argv != 0) ? argc : 0; } +]])]) + for mm_flag in $mm_warning_flags + do + # Test whether the compiler accepts the flag. GCC doesn't bail + # out when given an unsupported flag but prints a warning, so + # check the compiler output instead. + mm_cc_out=`$mm_cc $mm_tested_flags $mm_flag -c "$mm_conftest" 2>&1 || echo failed` + rm -f "conftest.${OBJEXT-o}" + + AS_IF([test "x$mm_cc_out" = x], + [AS_IF([test "x$mm_tested_flags" = x], + [mm_tested_flags=$mm_flag], + [mm_tested_flags="$mm_tested_flags $mm_flag"])], + [cat <<_MMEOF >&AS_MESSAGE_LOG_FD +$mm_cc: $mm_cc_out +_MMEOF]) + done + rm -f "$mm_conftest" + ]) + mm_all_flags=$mm_deprecation_flags$mm_tested_flags + AC_SUBST([$1], [$mm_all_flags])[]dnl + + test "x$mm_all_flags" != x || mm_all_flags=none + AC_MSG_RESULT([$mm_all_flags])[]dnl +])[]dnl +]) diff --git a/mm-common.doap b/mm-common.doap new file mode 100644 index 0000000..1813954 --- /dev/null +++ b/mm-common.doap @@ -0,0 +1,25 @@ +<Project xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#" + xmlns:rdfs="http://www.w3.org/2000/01/rdf-schema#" + xmlns:foaf="http://xmlns.com/foaf/0.1/" + xmlns:gnome="http://api.gnome.org/doap-extensions#" + xmlns="http://usefulinc.com/ns/doap#"> + + <name xml:lang="en">mm-common</name> + <shortdesc xml:lang="en">Common build files of the C++ bindings</shortdesc> + <homepage rdf:resource="http://www.gtkmm.org/" /> + <mailing-list rdf:resource="mailto:gtkmm-list@gnome.org" /> + <category rdf:resource="http://api.gnome.org/doap-extensions#bindings" /> + + <maintainer> + <foaf:Person> + <foaf:name>Daniel Elstner</foaf:name> + <foaf:mbox rdf:resource="mailto:daniel.kitta@gmail.com" /> + <gnome:userid>daniel</gnome:userid> + </foaf:Person> + <foaf:Person> + <foaf:name>Murray Cumming</foaf:name> + <foaf:mbox rdf:resource="mailto:murrayc@murrayc.com" /> + <gnome:userid>murrayc</gnome:userid> + </foaf:Person> + </maintainer> +</Project> diff --git a/util/doc-install.pl b/util/doc-install.pl new file mode 100644 index 0000000..3bca5f7 --- /dev/null +++ b/util/doc-install.pl @@ -0,0 +1,207 @@ +package main; + +# Copyright (c) 2009 Daniel Elstner <daniel.kitta@gmail.com> +# +# This file is part of mm-common. +# +# mm-common is free software: you can redistribute it and/or modify +# it under the terms of the GNU General Public License as published +# by the Free Software Foundation, either version 2 of the License, +# or (at your option) any later version. +# +# mm-common 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 General Public License for more details. +# +# You should have received a copy of the GNU General Public License +# along with mm-common. If not, see <http://www.gnu.org/licenses/>. + +use strict; +use warnings; +use bytes; +use File::Spec; +use Getopt::Long qw(:config no_getopt_compat no_ignore_case require_order bundling); + +# Globals +my $message_prefix; +my %tags_hash; +my $book_base; +my $perm_mode; +my $target_dir; +my $target_nodir = ''; +my $verbose = ''; + +sub path_basename ($) +{ + my ($path) = @_; + my $basename = File::Spec->splitpath($path); + + return $basename; +} + +sub exit_help () +{ + my $script_name = path_basename($0) || 'doc-install.pl'; + + print <<"EOF"; +Usage: perl $script_name [OPTION]... [-T] SOURCE DEST + or: perl $script_name [OPTION]... SOURCE... DIRECTORY + or: perl $script_name [OPTION]... -t DIRECTORY SOURCE... + +Copy SOURCE to DEST or multiple SOURCE files to the existing DIRECTORY, +while setting permission modes. For HTML files, translate references to +external documentation. + +Mandatory arguments to long options are mandatory for short options, too. + -k, --book-base=BASEPATH use reference BASEPATH for Devhelp book + -l, --tag-base=TAGFILE\@BASEPATH use BASEPATH for references from TAGFILE + -m, --mode=MODE override file permission MODE (octal) + -t, --target-directory=DIRECTORY copy all SOURCE arguments into DIRECTORY + -T, --no-target-directory treat DEST as normal file + -v, --verbose enable informational messages + -?, --help display this help and exit +EOF + exit; +} + +sub notice (@) +{ + print($message_prefix, @_, "\n") if ($verbose); +} + +sub warning (@) +{ + print STDERR ($message_prefix, @_, "\n"); +} + +sub error (@) +{ + warning(@_); + exit 1; +} + +# Copy file to destination while translating references on the fly. +# Sniff the content for the file type, as it is always read in anyway. +sub install_file ($$$) +{ + my ($in_name, $out_name, $basename) = @_; + my ($in, $out, $buf); + { + local $/; # slurp mode: read entire file into buffer + + open($in, '<', $in_name) and binmode($in) and defined($buf = <$in>) and close($in) + or error('Failed to read ', $basename, ': ', $!); + } + + if (%tags_hash and $buf =~ m/\A(?> \s*)(?> (?> <[?!][^<]+ )* )<html[>\s]/sx) + { + my $count = 0; + my $total = $buf =~ + s!(?<= \s) doxygen="((?> [^:"]+)):((?> [^"]*))" # doxygen="(TAGFILE):(BASEPATH)" + (?> \s+) ((?> href|src) =") \2 ((?> [^"]*)") # (href|src=")BASEPATH(RELPATH") + ! $3 . ((exists $tags_hash{$1}) ? (++$count, $tags_hash{$1}) : $2) . $4 + !egsx; + my $change = $total ? "rewrote $count of $total" + : 'no'; + notice('Translating ', $basename, ' (', $change, ' references)'); + } + elsif (defined($book_base) and $buf =~ m/\A(?> \s*)(?> (?> <[?!][^<]+ )* )<book\s/sx) + { + # Substitute new value for attribute "base" of element <book> + my $change = $buf =~ s/(<book \s [^<>]*? \b base=") (?> [^"]*) (?= ")/$1$book_base/sx + ? 'rewrote base path' + : 'base path not set'; + notice('Translating ', $basename, ' (', $change, ')'); + } + else + { + notice('Copying ', $basename); + } + + # Avoid inheriting permissions of existing file + unlink($out_name); + + open($out, '>', $out_name) and binmode($out) and print $out ($buf) and close($out) + or error('Failed to write ', $basename, ': ', $!); + + chmod($perm_mode, $out_name) + or warning('Failed to set ', $basename, ' permissions: ', $!); +} + +# Split TAGFILE@BASEPATH argument into key/value pair +sub split_key_value ($) +{ + my ($mapping) = @_; + my ($name, $path) = split(m'@', $mapping, 2); + + error('Invalid base path mapping: ', $mapping) unless (defined($name) and $name ne ''); + + if (defined $path) + { + notice('Using base path ', $path, ' for tag file ', $name); + return ($name, $path); + } + notice('Not changing base path for tag file ', $name); + return (); +} + +# Define line leader of log messages +$message_prefix = path_basename($0); +$message_prefix =~ s/\.[^.]*$//s if (defined $message_prefix); +$message_prefix = ($message_prefix || 'doc-install') . ': '; + +# Process command-line options +{ + my @tags = (); + my $mode = '0644'; + + GetOptions('book-base|k=s' => \$book_base, + 'tag-base|l=s' => \@tags, + 'mode|m=s' => \$mode, + 'target-directory|t=s' => \$target_dir, + 'no-target-directory|T' => \$target_nodir, + 'verbose|v' => \$verbose, + 'help|?' => \&exit_help) + or exit 2; + + error('Invalid permission mode: ', $mode) unless ($mode =~ m/^[0-7]+$/s); + + $perm_mode = oct($mode); + %tags_hash = map(split_key_value($_), @tags); +} +notice('Using base path ', $book_base, ' for Devhelp book') if (defined $book_base); + +if ($target_nodir) +{ + error('Conflicting target directory options') if (defined $target_dir); + error('Source and destination filenames expected') unless ($#ARGV == 1); + + install_file($ARGV[0], $ARGV[1], path_basename($ARGV[1])); + exit; +} + +unless (defined $target_dir) +{ + if ($#ARGV == 1) + { + my $basename = path_basename($ARGV[1]); + + if (defined($basename) and $basename ne '') + { + install_file($ARGV[0], $ARGV[1], $basename); + exit; + } + } + $target_dir = pop(@ARGV); +} +error('No target directory specified') unless (defined($target_dir) and $target_dir ne ''); + +foreach my $in_name (@ARGV) +{ + my $basename = path_basename($in_name); + my $out_name = File::Spec->catfile($target_dir, $basename); + + install_file($in_name, $out_name, $basename); +} +exit; diff --git a/util/doc-postprocess.pl b/util/doc-postprocess.pl new file mode 100644 index 0000000..76a9f0a --- /dev/null +++ b/util/doc-postprocess.pl @@ -0,0 +1,81 @@ +package main; + +# Copyright (c) 2009 Daniel Elstner <daniel.kitta@gmail.com> +# +# This file is part of mm-common. +# +# mm-common is free software: you can redistribute it and/or modify +# it under the terms of the GNU General Public License as published +# by the Free Software Foundation, either version 2 of the License, +# or (at your option) any later version. +# +# mm-common 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 General Public License for more details. +# +# You should have received a copy of the GNU General Public License +# along with mm-common. If not, see <http://www.gnu.org/licenses/>. + +use strict; +use warnings; +use bytes; + +foreach my $filename (@ARGV) +{ + my @outbuf = (); + my $file; + + open($file, '<', $filename); + + while (<$file>) + { + if (/<a class="el"/) + { + # return value + s/ & /& /; + s/ \* /* /; + + # parameters + s/ &/&/g; + s/&\b/& /g; + s/ \*/*/g; + s/\*\b/* /g; + + # templates + s/\btemplate</template </; + } + elsif (/<td class="md(?:name)?"/) + { + # left parenthesis + s/\( /(/; + + # return value + s/ & /& /g; + s/ \* /* /g; + + # parameters + s/ & /& /g; + s/ \* /* /g; + + # templates + s/\btemplate</template </; + } + else + { + # template decls + s/^(<h\d>|)template</$1template </; + } + s/ / /g; + + push(@outbuf, $_); + } + close($file); + + # write the whole buffer back + open($file, '>', $filename); + print $file ($_) foreach (@outbuf); + close($file); +} + +exit; diff --git a/util/mm-common-prepare.in b/util/mm-common-prepare.in new file mode 100644 index 0000000..6a1a556 --- /dev/null +++ b/util/mm-common-prepare.in @@ -0,0 +1,89 @@ +#! /bin/sh -e + +# Copyright (c) 2009 Openismus GmbH <http://www.openismus.com/> +# +# This file is part of mm-common. +# +# mm-common is free software: you can redistribute it and/or modify +# it under the terms of the GNU General Public License as published +# by the Free Software Foundation, either version 2 of the License, +# or (at your option) any later version. +# +# mm-common 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 General Public License for more details. +# +# You should have received a copy of the GNU General Public License +# along with mm-common. If not, see <http://www.gnu.org/licenses/>. + +prefix="@prefix@" +datarootdir="@datarootdir@" +datadir="@datadir@" +pkgdatadir="${datadir}/@PACKAGE_TARNAME@" + +progname=${0##/*} +installcmd='ln -s' +forceflag= +srcdir=. + +for arg +do + case $arg in + --help) + cat <<EOF +Usage: $progname [OPTION]... [DIRECTORY] + +Prepare a C++ binding module to use mm-common. + + -c, --copy copy files rather than symlinking them + -f, --force replace existing files + --help display this help message + --version print version information +EOF + exit 0 + ;; + --version) + echo "$progname @PACKAGE_VERSION@" + exit 0 + ;; + -c|--copy) + installcmd=cp + ;; + -f|--force) + forceflag=' -f' + ;; + -cf|-fc) + installcmd=cp + forceflag=' -f' + ;; + -*) + echo "$progname: unrecognized option '$arg'" >&2 + exit 1 + ;; + ?*) + srcdir=$arg + ;; + esac +done + +if test -f "$srcdir/configure.ac"; then :; else + echo "$progname: $srcdir/configure.ac not found" >&2 + exit 1 +fi + +auxdir=`sed -n 's/^ *AC_CONFIG_AUX_DIR([[ ]*\([^]),$ ]*\).*/\1/p' "$srcdir/configure.ac"` +auxdir=$srcdir${auxdir:+"/$auxdir"} + +echo "Build support directory: $auxdir" + +for file in "$pkgdatadir"/build/*.am +do + basename=${file##*/} + if test " $forceflag" = ' -f' || test ! -f "$auxdir/$basename"; then + echo "$progname: Copying $basename to $auxdir" + $installcmd$forceflag "$file" "$auxdir/$basename" + fi +done + +exit 0 diff --git a/util/tagfile-to-devhelp2.xsl b/util/tagfile-to-devhelp2.xsl new file mode 100644 index 0000000..8dd55ec --- /dev/null +++ b/util/tagfile-to-devhelp2.xsl @@ -0,0 +1,79 @@ +<?xml version="1.0" encoding="UTF-8"?> +<xsl:stylesheet version="1.0" xmlns="http://www.devhelp.net/book" + xmlns:xsl="http://www.w3.org/1999/XSL/Transform"> + <!-- + Copyright (c) 2009 Daniel Elstner <daniel.kitta@gmail.com> + + XSL transformation from a Doxygen tag file to DevHelp 2 format. + + This script is free software: you can redistribute it and/or modify + it under the terms of the GNU General Public License as published + by the Free Software Foundation, either version 2 of the License, + or (at your option) any later version. + + This script 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 General Public License for more details. + + You should have received a copy of the GNU General Public License + along with this script. If not, see <http://www.gnu.org/licenses/>. + --> + <xsl:output method="xml" version="1.0" indent="yes" encoding="UTF-8"/> + + <xsl:param name="book_title"/> + <xsl:param name="book_name"/> + <xsl:param name="book_base"/> + + <xsl:template match="/"> + <book title="{$book_title}" name="{$book_name}" base="{$book_base}" + link="index.html" version="2" language="c++"> + <chapters> + <sub name="Classes" link="classes.html"> + <xsl:apply-templates select="tagfile/compound[@kind='class' or @kind='struct']" mode="sub"> + <xsl:sort lang="en" case-order="upper-first" select="name"/> + </xsl:apply-templates> + </sub> + <sub name="Namespaces" link="namespaces.html"> + <xsl:apply-templates select="tagfile/compound[@kind='namespace']" mode="sub"> + <xsl:sort lang="en" case-order="upper-first" select="name"/> + </xsl:apply-templates> + </sub> + </chapters> + <functions> + <xsl:apply-templates select="tagfile/compound|tagfile/compound/member" mode="keyword"> + <xsl:sort lang="en" select="concat(../name, '::', name)"/> + </xsl:apply-templates> + </functions> + </book> + </xsl:template> + + <xsl:template match="compound" mode="sub"> + <sub name="{name}" link="{filename}"/> + </xsl:template> + + <xsl:template match="compound[@kind='class' or @kind='struct']" mode="keyword"> + <keyword type="struct" name="{name}" link="{filename}"/> + </xsl:template> + <xsl:template match="member[@kind='function' or @kind='typedef']" mode="keyword"> + <keyword type="{@kind}" xsl:use-attribute-sets="keyword-member"/> + </xsl:template> + <xsl:template match="member[@kind='enumeration']" mode="keyword"> + <keyword type="enum" xsl:use-attribute-sets="keyword-member"/> + </xsl:template> + <xsl:template match="member[@kind='enumvalue' or @kind='define']" mode="keyword"> + <keyword type="macro" xsl:use-attribute-sets="keyword-member"/> + </xsl:template> + <!-- Ignore keywords of unknown type --> + <xsl:template match="*" mode="keyword"/> + + <xsl:attribute-set name="keyword-member"> + <xsl:attribute name="name"> + <xsl:value-of select="concat(../name, '::', name)"/> + </xsl:attribute> + <xsl:attribute name="link"> + <xsl:value-of select="concat(anchorfile, '#', anchor)"/> + </xsl:attribute> + </xsl:attribute-set> + +</xsl:stylesheet> |