debian/0000775000000000000000000000000012301726664007177 5ustar debian/rules0000775000000000000000000000356611752546333010273 0ustar #!/usr/bin/make -f # Sample debian/rules that uses debhelper. # GNU copyright 1997 by Joey Hess. # # This version is for a hypothetical package that builds an # architecture-dependant package, as well as an architecture-independent # package. # Uncomment this to turn on verbose mode. #export DH_VERBOSE=1 # This has to be exported to make some magic below work. export DH_OPTIONS ifeq ($(DEB_BUILD_ARCH),hppa) EXTRACFLAGS=-ffunction-sections else EXTRACFLAGS= endif build-arch: build build-indep: build build: build-stamp build-stamp: dh_testdir cp -vf /usr/share/misc/config.sub /usr/share/misc/config.guess . CFLAGS="${EXTRACFLAGS}" ./configure --prefix=/usr $(MAKE) touch build-stamp clean: dh_testdir dh_testroot rm -f build-stamp config.guess config.sub [ ! -f Makefile ] || $(MAKE) distclean dh_clean install: DH_OPTIONS= install: build dh_testdir dh_testroot dh_prep dh_installdirs $(MAKE) install prefix=$(CURDIR)/debian/drgeo/usr install -m 644 $(CURDIR)/debian/drgeo_32x32.xpm $(CURDIR)/debian/drgeo/usr/share/pixmaps mkdir -p $(CURDIR)/debian/drgeo/usr/share/doc/drgeo/ chrpath -d debian/drgeo/usr/bin/drgeo # Build architecture-independent files here. # Pass -i to all debhelper commands in this target to reduce clutter. # binary-indep: DH_OPTIONS=-i binary-indep: build install # We have nothing to do by default. # Build architecture-dependent files here. # Pass -a to all debhelper commands in this target to reduce clutter. binary-arch: DH_OPTIONS=-a binary-arch: build install dh_testdir dh_testroot dh_installdocs dh_installexamples dh_installmenu dh_installman debian/drgeo.1 debian/tm_drgeo.1 dh_installchangelogs ChangeLog dh_strip dh_link dh_compress dh_fixperms dh_makeshlibs dh_shlibdeps dh_installdeb dh_gencontrol dh_md5sums dh_builddeb binary: binary-indep binary-arch .PHONY: build clean binary-indep binary-arch binary install debian/watch0000664000000000000000000000006511752546333010233 0ustar version=3 http://sf.net/ofset/drgeo-(\d+.*)\.tar\.gz debian/changelog0000664000000000000000000002142212301726664011052 0ustar drgeo (1.1.0-10.1ubuntu1) trusty; urgency=medium * Remove obsolete libguile-ltdl-1 from Build-Depends. -- Logan Rosen Fri, 21 Feb 2014 14:48:56 -0500 drgeo (1.1.0-10.1) unstable; urgency=medium * Non-maintainer upload. * debian/control - Bump up "Build-Depends: guile-1.8-dev" from 1.6, not fully fixed issue since migrate to guile-2.0-dev is not satisfied but once closed it (Closes: #707903) -- Hideki Yamane Fri, 07 Feb 2014 22:55:50 +0900 drgeo (1.1.0-10) unstable; urgency=low [ Francisco Manuel Garcia Claramonte ] * Rebuilt debian patches with quilt. * Applied the patch sent by Jar Aalto. (Closes: #670725). * Fixed two minor sintax typos in debian/drgeo.1 [ Patch provided by Jari Aalto ] * Removed deprecated dpatch and upgrade to packaging format "3.0 quilt". * Updated to Standards-Version to 3.9.3 and debhelper to 9. * Added build-arch and build-indep targets; use dh_prep in rules file. * Patched 05 rm; move updating config.* files to rules file. * Fixed binary-or-shlib-defines-rpath (Lintian); add depends chrpath. * Fixed copyright-refers-to-symlink-license (Lintian). * Fixed description-synopsis-starts-with-article (Lintian). * Fixed desktop-entry-contains-encoding-key (Lintian). * Fixed description-synopsis-starts-with-article (Lintian). -- Francisco Manuel Garcia Claramonte Mon, 07 May 2012 21:24:45 +0200 drgeo (1.1.0-9) unstable; urgency=low * Fixed the ftbfs with gcc-4.5. Applied the Ubuntu patch (based on openSuse patch). Thanks to Fabrice Coutadeur (Closes: #564977). -- Francisco Manuel Garcia Claramonte Wed, 17 Nov 2010 20:32:20 +0100 drgeo (1.1.0-8) unstable; urgency=low * Added libltdl-dev build depends for hurd-i386 architecture. * Updated Debian policy to 3.9.1 -- Francisco Manuel Garcia Claramonte Wed, 04 Aug 2010 11:27:27 +0200 drgeo (1.1.0-7) unstable; urgency=low * Updated Debian policy to 3.9.0 * Added new dpatch file to make x-www-browser the default html viewer, instead dillo. * Added debian/source/format file. -- Francisco Manuel Garcia Claramonte Sat, 03 Jul 2010 17:02:09 +0200 drgeo (1.1.0-6) unstable; urgency=low * Added libltdl-dev build depends for kfreebsd-amd64 and kfreebsd-i386 architectures (Closes: #570874). -- Francisco Manuel Garcia Claramonte Sat, 13 Mar 2010 11:47:41 +0100 drgeo (1.1.0-5) unstable; urgency=low * Added debian/README.source file explaining how dpatch works, according to Debian Policy. * Updated Debian policy to 3.8.4. -- Francisco Manuel Garcia Claramonte Sat, 20 Feb 2010 10:48:01 +0100 drgeo (1.1.0-4) unstable; urgency=low * Updated Debian policy to 3.8.2 * Updated Maintainer control field to @debian.org. * Added new dpatch file to fix de problem with outdated config.{guess,sub} files. Updated with autotools-dev (Closes: #538884). * Removed the unsued /usr/X11R6/include/pixmaps in debian/dirs. Cleaned up in debian/rules too. * Updated GPL reference in debian/copyright to GPL-2. -- Francisco Manuel Garcia Claramonte Sat, 01 Aug 2009 13:34:40 +0200 drgeo (1.1.0-3) unstable; urgency=low * Fixed debian/rules file: - Changed pwd command to $(CURDIR) (Closes: #526728). - Changed dh_clean to dh_prep to avoid a lintian warning. - Cleaned up unneeded comments. * Updated to Debian policy 3.8.1. * Added Homepage control field with drgeo web page in gnu project web site. * Changed the long description control field with new web page reference, the old web page was removed. -- Francisco Garcia Sat, 09 May 2009 18:41:49 +0200 drgeo (1.1.0-2) unstable; urgency=low * New maintainer. * Upgraded depends control field from 5 to 7. * Upgraded debhelper compatibillity file to 7. -- Francisco Garcia Mon, 09 Feb 2009 23:45:39 +0100 drgeo (1.1.0-1.2) unstable; urgency=low * Non-maintainer upload. * Changed the debian/patches/*.dpatch license, from GPL3 to GPL2, or any later version. * Changed the debian/copyright license field according to the Drgeo license, GPL2 or any other later version. * Closed the bug #506617, It was fixed in the previous NMU. (Closes: #506617) * CLosed the bug #384744, it was fixed in and old previous release. (Closes: #384744) -- Francisco Garcia Wed, 26 Nov 2008 23:53:39 +0100 drgeo (1.1.0-1.1) unstable; urgency=low * Non-maintainer upload. * Fixed the drgo.desktop file, added the debian/drgeo_32x32.xpm file. Added a dpatch file. This icon has been generated from glade/drgeo.png. (Closes: #466996). * Fixed the problem with debian/watch file. Thanks to Raphael Geissert for the patch (Closes: #449758). * Fixed the problem rendering description with Aptitude. Thanks to Tomas Pospisek for the patch (Closes: #389137). * Updated to Debian policy 3.8.0.1 * Added a dpatch file to fix the problem with setting the x-www-browser as a renderer html viewer. (Closes: #284075). * Updated debian/rules Debianhelper compatibility version to 5. * Alter the dh_installdeb call after dh_makeshlibs and dh_shlibdeps calls in debian/rules to avoid a lintian warning. * Modified debian/menu file according to the Debian menu sub-policy, added the debian/drgeo_32x32.xpm icon. * Added the license to the debian/copyright file. * Updated Build-Depends control field to debhelper (>> 5.0.0) from 4.0.0. * Fixed the segfaults problem. This problem is fixed in Ubuntu launchpad (LP #257797). Thanks to Pietro Battiston for his report. (Closes: #505554). -- Francisco Garcia Sat, 01 Nov 2008 11:58:59 +0100 drgeo (1.1.0-1) unstable; urgency=low * New upstream release. Closes #313694 -- Hilaire Fernandes Sun, 18 Sep 2005 08:51:56 +0200 drgeo (1.0.0-1) unstable; urgency=high * New upstream release. Closes: #273411, #253356, #254230, #277786, #284075, #285644 -- Hilaire Fernandes Sat, 1 Jan 2005 16:39:07 +0100 drgeo (0.9.14-1.1) unstable; urgency=high * Non-maintainer upload, World-Wide BSP 2004/11/27. * Urgency is high as this fixes two release-critical bugs. * Rebuild as the previous upload was accidently built against some packages in experimental, closes: #271221. * debian/control: - Added extra ',' into Depends line between ${shlibs:Depends} and ${misc:Depends}. The lack of it was really upsetting linda. - Fixed typo 'Recommands' which should be 'Recommends'. - Added a Build-Conflicts on guile-1.6, that package provides a version of guile-config which breaks the building of this package. This ensures we get the version 1.4 guile-config, closes: #273411. -- Stephen Quinney Sat, 27 Nov 2004 13:15:15 +0000 drgeo (0.9.14-1) unstable; urgency=low * New upstream release -- Hilaire Fernandes Wed, 1 Sep 2004 00:21:59 +0200 drgeo (0.9.13-1) unstable; urgency=low * New upstream release -- Hilaire Fernandes Mon, 7 Jun 2004 22:17:44 +0200 drgeo (0.9.12-1) unstable; urgency=low * New upstream release -- Hilaire Fernandes Mon, 26 Jan 2004 22:21:21 +0100 drgeo (0.9.11-1) unstable; urgency=low * New upstream release. Closes:#221035 -- Hilaire Fernandes Fri, 21 Nov 2003 20:48:24 +0100 drgeo (0.9.10-1) unstable; urgency=low * New upstream release -- Hilaire Fernandes Wed, 22 Oct 2003 23:16:37 +0200 drgeo (0.9.9-2) unstable; urgency=low * Package depends on imagemagick not imagemagic. Closes: #213667 #213705 -- Hilaire Fernandes Thu, 2 Oct 2003 17:39:48 +0200 drgeo (0.9.9-1) unstable; urgency=low * New upstream release -- Hilaire Fernandes Mon, 22 Sep 2003 18:47:03 +0200 drgeo (0.9.8-1) unstable; urgency=low * New upstream release -- Hilaire Fernandes Sun, 24 Aug 2003 19:53:05 +0200 drgeo (0.9.7-1) unstable; urgency=low * New upstream release -- Hilaire Fernandes Tue, 12 Aug 2003 16:25:10 +0200 drgeo (0.9.6-1) unstable; urgency=low * New upstream release -- Hilaire Fernandes Sat, 26 Jul 2003 22:28:42 +0200 drgeo (0.9.5-1) unstable; urgency=low * New upstream release. Please read NEWS file. -- Hilaire Fernandes Fri, 18 Jul 2003 18:14:20 +0200 drgeo (0.9.4-1) unstable; urgency=low * Initial Release. -- Hilaire Fernandes Mon, 30 Jun 2003 23:30:59 +0200 debian/drgeo.10000664000000000000000000000601011753013217010347 0ustar .TH DRGEO 1 "September 18, 2005" GNU "Dr. Geo Manual" .SH NAME drgeo \- a GTK+ interactive geometry program .SH SYNOPSIS \fBdrgeo\fR [\fIOPTIONS\fR]... .SH DESCRIPTION \fBDr. Geo\fR is the OFSET's interactive geometry program. It is a sort of vector drawing software but with mathematical constraints - we also call this interactive geometry. It allows one to create geometric figure plus the interactive manipulation of such figure in respect with their geometric constraints. It is useable in teaching situation with students from primary or secondary level. To find more information concerning the use of \fBDr. Geo\fR, you can consult the online help. .SH OPTIONS This program follows the usual GNU command line syntax, with long options starting with two dashes (`--'). .SS "GTK options" .TP \fB\-\-gdk-debug=\fR\fIFLAGS\fR Gdk debugging flags to set .TP \fB\-\-gdk-no-debug=\fR\fIFLAGS\fR Gdk debugging flags to unset .TP \fB\-\-display=\fR\fIDISPLAY\fR X display to use .TP .B \-\-sync Make X calls synchronous .TP .B \-\-no-xshm Don't use X shared memory extension .TP \fB\-\-name=\fR\fINAME\fR Program name as used by the window manager .TP \fB\-\-class=\fR\fICLASS\fR Program class as used by the window manager .TP \fB\-\-gxid_host=\fR\fIHOST\fR .TP \fB\-\-gxid_port=\fR\fIPORT\fR .TP \fB\-\-xim-preedit=\fR\fISTYLE\fR .TP \fB\-\-xim-status=\fR\fISTYLE\fR .TP \fB\-\-gtk-debug=\fR\fIFLAGS\fR Gtk+ debugging flags to set .TP \fB\-\-gtk-no-debug=\fR\fIFLAGS\fR Gtk+ debugging flags to unset .TP \fB\-\-g-fatal-warnings\fR Make all warnings fatal .TP \fB\-\-gtk-module=\fR\fIMODULE\fR Load an additional Gtk module .SS "drgeo options" .TP \fb\-\-version\fR Display \fBDr. Geo\fR' version .TP \fb\-f, \-\-file=\fR\fIfilename\fR File to load .TP \fb\-e, \-\-evaluate=\fR\fIfilename\fR Evaluate and load a Dr. Geo figure defined in Scheme .TP \fb\-\-texmacs\fR Start Dr. Geo as a TeXmacs plugin, sending EPS figure to the standard output .TP \fb\-\-help\fR Display the command line help .SH VERSION 1.1.0 .SH "SEE ALSO" .TP .B Online manual The online manual available directly from the application. .TP .B The Dr. Geo homepage at OFSET .I http://www.ofset.org/drgeo .SH LICENSE \fBDr. Geo\fR is licensed under the terms of the General Public License version 2. For information on this license look at the source code that came with the software or see the GNU project page at http://www.gnu.org. .SH COPYRIGHT The copyright on the \fBDr. Geo \fR software and source code is held by the individual authors and the FSF. .SH AUTHORS .SS "Programming" Lead developer : Hilaire Fernandes http://www.ofset.org .SS "Graphic" Frederic Toussaint http://www.blender-cafe.org/ .SS "Documentation" Hilaire Fernandes .br This manual page was initialy written by Andreas Tille then by Hilaire Fernandes for the Debian GNU/Linux system (but may be used by others). .SS "Translations" Adrian Ulises Soto .br Jean-Philippe Georget .br Andrea Centomo .br Tobias Verbeke .SS "Packaging" Abel Cheung .br Dag Wieers .br Hilaire Fernandes debian/compat0000664000000000000000000000000211752546333010377 0ustar 9 debian/drgeo_32x32.xpm0000664000000000000000000002265311752546333011700 0ustar /* XPM */ static char * drgeo_32x32_xpm[] = { "32 32 463 2", " c None", ". c #7D7F7B", "+ c #6B6C6A", "@ c #565655", "# c #636461", "$ c #6D6E6C", "% c #A6A7A5", "& c #767871", "* c #787B70", "= c #777971", "- c #7B7C79", "; c #595A55", "> c #3D4037", ", c #4F504B", "' c #656B54", ") c #8B956A", "! c #7B875C", "~ c #5F6354", "{ c #5F605C", "] c #848A74", "^ c #ACB497", "/ c #879070", "( c #62645B", "_ c #565852", ": c #AEB891", "< c #CBD2B5", "[ c #BCC6A1", "} c #A7AF8F", "| c #B6BDA3", "1 c #D6DCC7", "2 c #E0E4D2", "3 c #BCC69E", "4 c #7F866C", "5 c #676B5B", "6 c #C3CBAC", "7 c #ABB09D", "8 c #A0A496", "9 c #DDE0D5", "0 c #E6E9DE", "a c #D8DACF", "b c #AEB3A0", "c c #C2CAAA", "d c #646A55", "e c #77805E", "f c #B9BEA8", "g c #7E8174", "h c #888A82", "i c #C3C7BA", "j c #E0E4D3", "k c #C2C6B6", "l c #767870", "m c #A9AE9A", "n c #555A47", "o c #4F524B", "p c #7D836C", "q c #939D76", "r c #D0D4C3", "s c #73756B", "t c #686967", "u c #595B54", "v c #D1D7BF", "w c #9C9F95", "x c #666862", "y c #616652", "z c #474A41", "A c #93958F", "B c #78815D", "C c #BBC3A2", "D c #66675F", "E c #9A9A9A", "F c #C7C7C6", "G c #5B5B5A", "H c #B5BAA5", "I c #696C61", "J c #D6D5D6", "K c #DBDBDB", "L c #71726D", "M c #6C725B", "N c #57594F", "O c #676D56", "P c #A2AE81", "Q c #9EA38E", "R c #6E6E6D", "S c #DCDCDC", "T c #E2E2E2", "U c #6A6A69", "V c #A5AB94", "W c #797A76", "X c #DDDDDD", "Y c #EBEBEB", "Z c #ABABAA", "` c #6C735B", " . c #76805A", ".. c #484A40", "+. c #454840", "@. c #737E55", "#. c #BCC4A7", "$. c #53554D", "%. c #DFDFDF", "&. c #F2F2F2", "*. c #555554", "=. c #9CA190", "-. c #888A85", ";. c #EAEAEA", ">. c #FAFAFA", ",. c #D6D7D6", "'. c #585B52", "). c #A2AE7D", "!. c #656D4F", "~. c #52544D", "{. c #606454", "]. c #2E3322", "^. c #959D7F", "/. c #B0B69F", "(. c #676863", "_. c #EFEFEF", ":. c #F3F3F3", "<. c #DBDBDA", "[. c #414241", "}. c #929882", "|. c #939491", "1. c #E4E4E4", "2. c #6E6F6C", "3. c #939E72", "4. c #828D65", "5. c #3A3C33", "6. c #65695A", "7. c #515A3A", "8. c #667048", "9. c #9EA589", "0. c #949788", "a. c #949593", "b. c #C8C8C7", "c. c #535450", "d. c #919782", "e. c #919190", "f. c #E9E9E9", "g. c #F9F9F9", "h. c #898988", "i. c #848E68", "j. c #AEBA8C", "k. c #A7B08B", "l. c #686F55", "m. c #656562", "n. c #63665C", "o. c #525C39", "p. c #8F9A70", "q. c #ACB78D", "r. c #B3BD98", "s. c #878880", "t. c #B4B5B0", "u. c #A7A7A6", "v. c #66695D", "w. c #99A086", "x. c #6C6D6A", "y. c #E3E3E3", "z. c #F5F5F5", "A. c #E6E8E2", "B. c #878883", "C. c #7E8A5F", "D. c #B2BD91", "E. c #C0C9A7", "F. c #909C72", "G. c #34362E", "H. c #61625F", "I. c #626951", "J. c #6F7B4D", "K. c #768059", "L. c #8C9573", "M. c #CCD3B8", "N. c #C9D0B3", "O. c #7C7F74", "P. c #B6B6B6", "Q. c #8C8C8B", "R. c #8F8F8C", "S. c #70716C", "T. c #889074", "U. c #AEB990", "V. c #525842", "W. c #B2B2B1", "X. c #888887", "Y. c #535352", "Z. c #5B5C59", "`. c #82905B", " + c #B0BC8F", ".+ c #C2CAAB", "++ c #727A5C", "@+ c #67704F", "#+ c #626C48", "$+ c #8B8B8A", "%+ c #555D41", "&+ c #76864A", "*+ c #A3B07E", "=+ c #A4AD8A", "-+ c #687053", ";+ c #C2C8B0", ">+ c #C6CEAF", ",+ c #737865", "'+ c #AFAFAE", ")+ c #A9A9A8", "!+ c #505348", "~+ c #9EA781", "{+ c #B6C198", "]+ c #859263", "^+ c #4E5048", "/+ c #848483", "(+ c #71716F", "_+ c #414538", ":+ c #93A268", "<+ c #BCC6A0", "[+ c #B7BEA1", "}+ c #828A6B", "|+ c #AEB795", "1+ c #A2AE7E", "2+ c #676C5A", "3+ c #525942", "4+ c #6C7E3F", "5+ c #97A66C", "6+ c #B0BB8E", "7+ c #B2BD92", "8+ c #9CA67D", "9+ c #C7CDB7", "0+ c #C9D1B3", "a+ c #757F5B", "b+ c #666762", "c+ c #8F8F8D", "d+ c #676965", "e+ c #707D4F", "f+ c #CFD6BC", "g+ c #B1BC90", "h+ c #7A8851", "i+ c #434B2B", "j+ c #414731", "k+ c #4D5734", "l+ c #A0AE78", "m+ c #C2CBA9", "n+ c #D6DCC6", "o+ c #D9DECB", "p+ c #C3CCAB", "q+ c #899469", "r+ c #6F7168", "s+ c #3F4827", "t+ c #7B8C4B", "u+ c #A4B07F", "v+ c #89936A", "w+ c #929F6A", "x+ c #C4CCAC", "y+ c #D2D9C0", "z+ c #A4AF84", "A+ c #767F5D", "B+ c #5D6646", "C+ c #636C48", "D+ c #A4B180", "E+ c #CAD1B5", "F+ c #D9DEC9", "G+ c #C3CCAC", "H+ c #9DAB72", "I+ c #8FA063", "J+ c #8C9B63", "K+ c #91A066", "L+ c #ABB68B", "M+ c #BFC7A6", "N+ c #D0D7BE", "O+ c #D2D8C0", "P+ c #C7CFB1", "Q+ c #CDD4B9", "R+ c #AAB68B", "S+ c #596047", "T+ c #696A68", "U+ c #48532C", "V+ c #8E9E61", "W+ c #808869", "X+ c #556135", "Y+ c #425020", "Z+ c #3C4723", "`+ c #828F5D", " @ c #B6C099", ".@ c #BFC9A5", "+@ c #BFC8A5", "@@ c #B8C19C", "#@ c #C0C9A6", "$@ c #CED5BB", "%@ c #D9DFCA", "&@ c #D5DBC4", "*@ c #D4DBC3", "=@ c #C6CEB0", "-@ c #BAC39F", ";@ c #B0BB92", ">@ c #BAC49D", ",@ c #B7C19C", "'@ c #B8C0A4", ")@ c #C9D0B6", "!@ c #C3CBAA", "~@ c #848583", "{@ c #737473", "]@ c #4B562E", "^@ c #8D9D61", "/@ c #96A17C", "(@ c #818E5C", "_@ c #607230", ":@ c #485B1C", "<@ c #3A4421", "[@ c #83915E", "}@ c #B5C099", "|@ c #D8DEC8", "1@ c #D8DEC9", "2@ c #DADFCB", "3@ c #D7DDC7", "4@ c #D4DAC3", "5@ c #CED5BA", "6@ c #CBD2B6", "7@ c #BBC5A1", "8@ c #BEC7A3", "9@ c #AEB98C", "0@ c #9BA778", "a@ c #626850", "b@ c #4E533F", "c@ c #5D6250", "d@ c #C0C7AE", "e@ c #8C9673", "f@ c #666864", "g@ c #535947", "h@ c #6A7844", "i@ c #909E66", "j@ c #A4B081", "k@ c #AAB687", "l@ c #99A771", "m@ c #5A6B2C", "n@ c #38421E", "o@ c #818F57", "p@ c #AAB686", "q@ c #DEE2D0", "r@ c #AEB49F", "s@ c #D0D6BD", "t@ c #CAD1B7", "u@ c #A3AA8E", "v@ c #C7CEB0", "w@ c #9EAC76", "x@ c #748250", "y@ c #252C11", "z@ c #4B5B22", "A@ c #728542", "B@ c #798659", "C@ c #98A081", "D@ c #808967", "E@ c #8E9086", "F@ c #90928D", "G@ c #747968", "H@ c #525A3B", "I@ c #788555", "J@ c #9CAA72", "K@ c #8A9A5D", "L@ c #59692C", "M@ c #3B4522", "N@ c #798850", "O@ c #BEC8A2", "P@ c #D3D9C1", "Q@ c #484D3C", "R@ c #BBC3A7", "S@ c #C1C7AD", "T@ c #7E846B", "U@ c #BCC3A7", "V@ c #AAB688", "W@ c #6B7B43", "X@ c #292F18", "Y@ c #526128", "Z@ c #87975A", "`@ c #8D986D", " # c #707958", ".# c #A9B38E", "+# c #757E5C", "@# c #70726B", "## c #565752", "$# c #54574C", "%# c #515A3C", "&# c #5B653F", "*# c #3E4A22", "=# c #30381D", "-# c #77864D", ";# c #A8B484", "># c #C0C7AB", ",# c #D6DCC5", "'# c #CCD2B8", ")# c #BEC8A5", "!# c #A1AE7A", "~# c #6F7D49", "{# c #252D10", "]# c #4D5B27", "^# c #87965E", "/# c #A4B080", "(# c #ACB88C", "_# c #A6B182", ":# c #808B62", "<# c #4F5345", "[# c #6E765A", "}# c #535B3C", "|# c #374419", "1# c #2E361A", "2# c #444D29", "3# c #808F54", "4# c #ABB787", "5# c #BBC59E", "6# c #C1CAA7", "7# c #B4BE94", "8# c #9CAA74", "9# c #7E8D55", "0# c #515A39", "a# c #4E5832", "b# c #545B40", "c# c #5E634F", "d# c #555A4A", "e# c #515543", "f# c #73766B", "g# c #848580", "h# c #737472", "i# c #596639", "j# c #60752E", "k# c #515E2F", "l# c #3C4425", "m# c #78884E", "n# c #8E9F62", "o# c #8C9C5F", "p# c #849656", "q# c #6E7E42", "r# c #596638", "s# c #58623C", "t# c #748348", "u# c #586A28", "v# c #4D533E", "w# c #646A56", "x# c #768549", "y# c #78894D", "z# c #647043", "A# c #384024", "B# c #56603B", "C# c #5B6839", "D# c #4A542D", "E# c #3A4225", "F# c #5F664A", "G# c #93A16C", "H# c #8D9E5F", "I# c #576041", "J# c #747670", "K# c #81837D", "L# c #6B764C", "M# c #8E9D5F", "N# c #95A469", "O# c #9BA777", "P# c #717A57", "Q# c #8A956D", "R# c #A5B084", "S# c #ABB78A", "T# c #95A46B", "U# c #848B71", "V# c #A0AE77", "W# c #A4B27C", "X# c #B3BE94", "Y# c #B7C29A", "Z# c #B9C49D", "`# c #BAC49E", " $ c #B6C09A", ".$ c #9BA876", "+$ c #727862", " ", " . + @ ", " # $ % ", " ", " & * = - ; > , ", " ' ) ! ~ { ] ^ / ( ", " _ : < [ } | 1 2 3 4 ", " 5 6 7 8 9 0 a b c d ", " e f g h i j k l m n o ", " p q r s t u v w t x y z ", " A B C D E F G H I J K L M N ", " O P Q R S T U V W X Y Z ` ... ", " +.@.#.$.%.&.T *.=.-.;.>.,.'.).!.~. ", " {.].^./.(._.:.<.[.}.|.;.>.1.2.3.4.5.x ", " 6.7.8.9.0.a._._.b.c.d.e.f.g.f.h.i.j.k.l.m. ", " n.o.p.q.r.s.t._.;.u.v.w.x.y.z.A.B.C.D.E.F.G.H. ", " I.J.K.L.M.N.O.P.Q.R.S.T.U.V.W.X.Y.Z.`. +.+++@+#+$+ ", " %+&+*+=+-+;+>+,+'+a.)+!+~+{+]+^+/+(+_+:+<+[+}+|+1+2+ ", " 3+4+5+6+7+8+9+0+a+b+c+d+e+{+f+g+h+i+j+k+l+m+n+o+M.p+q+r+ ", " s+t+u+v+ .w+x+y+z+A+B+C+D+E+F+G+H+I+J+K+L+M+N+O+P+Q+R+S+ ", " T+U+V+W+X+Y+Z+`+ @.@+@@@#@$@%@&@*@=@+@-@;@>@.@<+,@'@)@!@A+~@ ", " {@]@^@/@(@_@:@<@[@}@0+|@1@2@3@4@&@5@6@x+7@8@9@0@a@b@c@d@e@f@ ", " g@h@i@j@k@l@m@n@o@p@%@q@r@)@4@s@t@u@v@m+w@x@y@z@A@B@C@D@E@ ", " F@G@H@I@w@J@K@L@M@N@O@P@Q@R@3@P@S@T@U@V@W@X@Y@Z@`@ #.#+#@# ", " H.##$#%#&#*#=#-#;#>#Q+,#4@'#)#!#~#{#]#^#/#(#_#:#<# ", " [#}#|#1#2#3#4#5#6#6#7#8#9#0#a#b#b@c#d#e#f#g# ", " h#i#j#k#l#m#n#o#p#q#r#s#t#u#v# ", " w#x#y#z#A#B#C#D#E#F#G#H#I#J# ", " K#L#M#N#O#a+P#Q#R#S#T#8. ", " U#V#W#D.X#Y#Z#`# $.$+$ ", " ", " "}; debian/copyright0000664000000000000000000000253611752546333011142 0ustar This package was debianized by: Hilaire Fernandes on Mon, 30 Jun 2003 23:23:36 +0200 The original, pristine sources can be obtained from: http://www.ofset.org/drgeo Upstream authors: Hilaire Fernandes Copyright: Copyright (c) 2003 Hilaire Fernandes License: Drgeo is free software; you can redistribute it and/or modify it under the terms of the GNU General Public Licences as by published by the Free Software Foundation; either version 2; 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, see . On Debian GNU/Linux systems, the complete text of the GNU General Public License can be found in /usr/share/common-licenses/GPL-2 The Debian packaging is © 2003, Hilaire Fernandes and is licensed under the GNU General Public License, that, on a Debian system can be found in /usr/share/common-licenses/GPL-2. debian/source/0000775000000000000000000000000011752546333010501 5ustar debian/source/format0000664000000000000000000000001411752546333011707 0ustar 3.0 (quilt) debian/README.Debian0000664000000000000000000000022311752546333011237 0ustar drgeo for Debian ---------------- Dr. Geo 0.9.x supersedes Dr. Genius -- Hilaire Fernandes , Mon, 30 Jun 2003 23:30:59 +0200 debian/tm_drgeo.10000664000000000000000000000157411752546333011072 0ustar .TH tm_drgeo 1 "September 18, 2005" GNU "Dr. Geo Manual" .SH NAME tm_drgeo \- The Dr. Geo TeXmacs plug-in .SH SYNOPSIS \fBtm_drgeo. .SH DESCRIPTION \fBtm_drgeo\fR is the TeXmacs Dr. Geo plug-in. It is automatically used from TeXmacs to start the Dr. Geo plug-in. Outside of TeXmacs it will produce no meaningful results. .SH OPTIONS No option .SH VERSION 1.1.0 .SH LICENSE \fBtm_drgeo\fR is licensed under the terms of the General Public License version 2. For information on this license look at the source code that came with the software or see the GNU project page at http://www.gnu.org. .SH COPYRIGHT The copyright on the \fBtm_drgeo \fR software and source code is held by the individual authors and the FSF. .SH AUTHORS Adrian Ulises Soto .br This manual page was written by Hilaire Fernandes for the Debian GNU/Linux system (but may be used by others).debian/menu0000664000000000000000000000021011752546333010061 0ustar ?package(drgeo):needs="X11" section="Applications/Science/Mathematics"\ title="DrGeo" icon="drgeo_32x32.xpm" command="/usr/bin/drgeo" debian/control0000664000000000000000000000316212301726665010605 0ustar Source: drgeo Section: math Priority: extra Maintainer: Ubuntu Developers XSBC-Original-Maintainer: Francisco Manuel Garcia Claramonte Build-Depends: debhelper (>= 9), libglib2.0-dev, libgtk2.0-dev, libglade2-dev, libxml2-dev, guile-1.8-dev, intltool, libxml-parser-perl, autotools-dev, libltdl-dev [kfreebsd-amd64 kfreebsd-i386 hurd-i386], chrpath Standards-Version: 3.9.3 Homepage: http://www.gnu.org/software/dr_geo/dr_geo.html Package: drgeo Architecture: any Recommends: drgeo-doc Depends: ${shlibs:Depends}, ${misc:Depends}, imagemagick Replaces: drgenius Description: interactive geometry software This is the Gtk interactive geometry software. It allows one to create geometric figure plus the interactive manipulation of such figure in respect with their geometric constraints. It is usable in teaching situation with students from primary or secondary level. . Dr. Geo comes with a complete set of tools arranged in different categories: . * points * lines * geometric transformations * numeric function * macro-construction * DGS object - Dr. Geo Guile Script * DSF - Dr Geo Scheme Figure, it is interactive figure defined in a file and evaluated with the embedded Scheme interpretor, awesome! * Export facilities in the LaTeX and EPS formats . Several figures and macro-constructions examples are available in the /usr/share/drgeo/examples folder. . More information about Dr. Geo can be found at its web site http://www.gnu.org/software/dr_geo/dr_geo.html . Installing the drgeo-doc package is also encouraged to get more of Dr. Geo. debian/docs0000664000000000000000000000002111752546333010045 0ustar NEWS README TODO debian/dirs0000664000000000000000000000001011752546333010054 0ustar usr/bin debian/patches/0000775000000000000000000000000011752546333010630 5ustar debian/patches/01-html-viewer.patch0000664000000000000000000000135211752546333014333 0ustar # From: Francisco Manuel Garcia Claramonte # Subject: This patch fix the problem with the www browser configuration # Last-Update: 08-05-2012 --- a/glade/drgenius2.glade +++ b/glade/drgenius2.glade @@ -7225,6 +7225,15 @@ mozilla + + + + True + True + x-www-browser + + + debian/patches/05-default-html-viewer.patch0000664000000000000000000000063611752546333015765 0ustar # From: Francisco Manuel Garcia Claramonte # Subject: This patch change default html viewer from dillo to the # Last-Update: 08-05-2012 --- a/scm/preferences.scm +++ b/scm/preferences.scm @@ -10,7 +10,7 @@ (:angleStyle "Normal") (:scalarColor "Blue") (:sessionFile "session") - (:htmlViewer "dillo ") + (:htmlViewer "x-www-browser ") (:undoLevel "5") (:figureName "Figure %d") (:figureFile "figure_") debian/patches/series0000664000000000000000000000023011752546333012040 0ustar 01-html-viewer.patch 02-desktop-file-icon.patch 03-fix-segfault.patch 04-restore-pristine.patch 05-default-html-viewer.patch 06-fix-ftbfs-gcc-4.5.patch debian/patches/04-restore-pristine.patch0000664000000000000000000022203511752546333015414 0ustar # From: Francisco Manuel Garcia Claramonte # Subject: This patch restores the pristine source code # Last-Update: 08-05-2012 --- drgeo.desktop | 69 +++ intltool-extract | 473 ++++++++++++++++++++ intltool-merge | 1255 +++++++++++++++++++++++++++++++++++++++++++++++++++++++ intltool-update | 1034 +++++++++++++++++++++++++++++++++++++++++++++ 4 files changed, 2831 insertions(+) --- /dev/null +++ b/intltool-extract @@ -0,0 +1,473 @@ +#!/usr/bin/perl -w +# -*- Mode: perl; indent-tabs-mode: nil; c-basic-offset: 4 -*- + +# +# The Intltool Message Extractor +# +# Copyright (C) 2000-2001, 2003 Free Software Foundation. +# +# Intltool 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. +# +# Intltool 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., 675 Mass Ave, Cambridge, MA 02139, USA. +# +# As a special exception to the GNU General Public License, if you +# distribute this file as part of a program that contains a +# configuration script generated by Autoconf, you may include it under +# the same distribution terms that you use for the rest of that program. +# +# Authors: Kenneth Christiansen +# Darin Adler +# + +## Release information +my $PROGRAM = "intltool-extract"; +my $PACKAGE = "intltool"; +my $VERSION = "0.31.3"; + +## Loaded modules +use strict; +use File::Basename; +use Getopt::Long; + +## Scalars used by the option stuff +my $TYPE_ARG = "0"; +my $LOCAL_ARG = "0"; +my $HELP_ARG = "0"; +my $VERSION_ARG = "0"; +my $UPDATE_ARG = "0"; +my $QUIET_ARG = "0"; +my $SRCDIR_ARG = "."; + +my $FILE; +my $OUTFILE; + +my $gettext_type = ""; +my $input; +my %messages = (); +my %loc = (); +my %count = (); +my %comments = (); +my $strcount = 0; + +## Use this instead of \w for XML files to handle more possible characters. +my $w = "[-A-Za-z0-9._:]"; + +## Always print first +$| = 1; + +## Handle options +GetOptions ( + "type=s" => \$TYPE_ARG, + "local|l" => \$LOCAL_ARG, + "help|h" => \$HELP_ARG, + "version|v" => \$VERSION_ARG, + "update" => \$UPDATE_ARG, + "quiet|q" => \$QUIET_ARG, + "srcdir=s" => \$SRCDIR_ARG, + ) or &error; + +&split_on_argument; + + +## Check for options. +## This section will check for the different options. + +sub split_on_argument { + + if ($VERSION_ARG) { + &version; + + } elsif ($HELP_ARG) { + &help; + + } elsif ($LOCAL_ARG) { + &place_local; + &extract; + + } elsif ($UPDATE_ARG) { + &place_normal; + &extract; + + } elsif (@ARGV > 0) { + &place_normal; + &message; + &extract; + + } else { + &help; + + } +} + +sub place_normal { + $FILE = $ARGV[0]; + $OUTFILE = "$FILE.h"; +} + +sub place_local { + $OUTFILE = fileparse($FILE, ()); + if (!-e "tmp/") { + system("mkdir tmp/"); + } + $OUTFILE = "./tmp/$OUTFILE.h" +} + +sub determine_type { + if ($TYPE_ARG =~ /^gettext\/(.*)/) { + $gettext_type=$1 + } +} + +## Sub for printing release information +sub version{ + print <<_EOF_; +${PROGRAM} (${PACKAGE}) $VERSION +Copyright (C) 2000, 2003 Free Software Foundation, Inc. +Written by Kenneth Christiansen, 2000. + +This is free software; see the source for copying conditions. There is NO +warranty; not even for MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. +_EOF_ + exit; +} + +## Sub for printing usage information +sub help { + print <<_EOF_; +Usage: ${PROGRAM} [OPTION]... [FILENAME] +Generates a header file from an XML source file. + +It grabs all strings between <_translatable_node> and its end tag in +XML files. Read manpage (man ${PROGRAM}) for more info. + + --type=TYPE Specify the file type of FILENAME. Currently supports: + "gettext/glade", "gettext/ini", "gettext/keys" + "gettext/rfc822deb", "gettext/schemas", + "gettext/scheme", "gettext/xml" + -l, --local Writes output into current working directory + (conflicts with --update) + --update Writes output into the same directory the source file + reside (conflicts with --local) + --srcdir Root of the source tree + -v, --version Output version information and exit + -h, --help Display this help and exit + -q, --quiet Quiet mode + +Report bugs to http://bugzilla.gnome.org/ (product name "$PACKAGE") +or send email to . +_EOF_ + exit; +} + +## Sub for printing error messages +sub error{ + print STDERR "Try `${PROGRAM} --help' for more information.\n"; + exit; +} + +sub message { + print "Generating C format header file for translation.\n" unless $QUIET_ARG; +} + +sub extract { + &determine_type; + + &convert; + + open OUT, ">$OUTFILE"; + &msg_write; + close OUT; + + print "Wrote $OUTFILE\n" unless $QUIET_ARG; +} + +sub convert { + + ## Reading the file + { + local (*IN); + local $/; #slurp mode + open (IN, "<$SRCDIR_ARG/$FILE") || die "can't open $SRCDIR_ARG/$FILE: $!"; + $input = ; + } + + &type_ini if $gettext_type eq "ini"; + &type_keys if $gettext_type eq "keys"; + &type_xml if $gettext_type eq "xml"; + &type_glade if $gettext_type eq "glade"; + &type_scheme if $gettext_type eq "scheme"; + &type_schemas if $gettext_type eq "schemas"; + &type_rfc822deb if $gettext_type eq "rfc822deb"; +} + +sub entity_decode_minimal +{ + local ($_) = @_; + + s/'/'/g; # ' + s/"/"/g; # " + s/&/&/g; + + return $_; +} + +sub entity_decode +{ + local ($_) = @_; + + s/'/'/g; # ' + s/"/"/g; # " + s/&/&/g; + s/<//g; + + return $_; +} + +sub escape_char +{ + return '\"' if $_ eq '"'; + return '\n' if $_ eq "\n"; + return '\\' if $_ eq '\\'; + + return $_; +} + +sub escape +{ + my ($string) = @_; + return join "", map &escape_char, split //, $string; +} + +sub type_ini { + ### For generic translatable desktop files ### + while ($input =~ /^_.*=(.*)$/mg) { + $messages{$1} = []; + } +} + +sub type_keys { + ### For generic translatable mime/keys files ### + while ($input =~ /^\s*_\w+=(.*)$/mg) { + $messages{$1} = []; + } +} + +sub type_xml { + ### For generic translatable XML files ### + + while ($input =~ /(?:[^\n]*\n?[^\n]*)?\s_$w+\s*=\s*\"([^"]+)\"/sg) { # " + $messages{entity_decode_minimal($2)} = []; + $comments{entity_decode_minimal($2)} = $1 if (defined($1)); + } + + while ($input =~ /(?:\s*)?<_($w+)(?: xml:space="($w+)")?[^>]*>(.+?)<\/_\2>/sg) { + $_ = $4; + if (!defined($3) || $3 ne "preserve") { + s/\s+/ /g; + s/^ //; + s/ $//; + } + $messages{$_} = []; + $comments{$_} = $1 if (defined($1)); + } +} + +sub type_schemas { + ### For schemas XML files ### + + # FIXME: We should handle escaped < (less than) + while ($input =~ / + \s* + (\s*(?:\s*)?(.*?)\s*<\/default>\s*)? + (\s*(?:\s*)?(.*?)\s*<\/short>\s*)? + (\s*(?:\s*)?(.*?)\s*<\/long>\s*)? + <\/locale> + /sgx) { + my @totranslate = ($3,$6,$9); + my @eachcomment = ($2,$5,$8); + foreach (@totranslate) { + my $currentcomment = shift @eachcomment; + next if !$_; + s/\s+/ /g; + $messages{entity_decode_minimal($_)} = []; + $comments{entity_decode_minimal($_)} = $currentcomment if (defined($currentcomment)); + } + } +} + +sub type_rfc822deb { + ### For rfc822-style Debian configuration files ### + + my $lineno = 1; + my $type = ''; + while ($input =~ /\G(.*?)(^|\n)(_+)([^:]+):[ \t]*(.*?)(?=\n\S|$)/sg) + { + my ($pre, $newline, $underscore, $tag, $text) = ($1, $2, $3, $4, $5); + while ($pre =~ m/\n/g) + { + $lineno ++; + } + $lineno += length($newline); + my @str_list = rfc822deb_split(length($underscore), $text); + for my $str (@str_list) + { + $strcount++; + $messages{$str} = []; + $loc{$str} = $lineno; + $count{$str} = $strcount; + my $usercomment = ''; + while($pre =~ s/(^|\n)#([^\n]*)$//s) + { + $usercomment = "\n" . $2 . $usercomment; + } + $comments{$str} = $tag . $usercomment; + } + $lineno += ($text =~ s/\n//g); + } +} + +sub rfc822deb_split { + # Debian defines a special way to deal with rfc822-style files: + # when a value contain newlines, it consists of + # 1. a short form (first line) + # 2. a long description, all lines begin with a space, + # and paragraphs are separated by a single dot on a line + # This routine returns an array of all paragraphs, and reformat + # them. + # When first argument is 2, the string is a comma separated list of + # values. + my $type = shift; + my $text = shift; + $text =~ s/^[ \t]//mg; + return (split(/, */, $text, 0)) if $type ne 1; + return ($text) if $text !~ /\n/; + + $text =~ s/([^\n]*)\n//; + my @list = ($1); + my $str = ''; + for my $line (split (/\n/, $text)) + { + chomp $line; + if ($line =~ /^\.\s*$/) + { + # New paragraph + $str =~ s/\s*$//; + push(@list, $str); + $str = ''; + } + elsif ($line =~ /^\s/) + { + # Line which must not be reformatted + $str .= "\n" if length ($str) && $str !~ /\n$/; + $line =~ s/\s+$//; + $str .= $line."\n"; + } + else + { + # Continuation line, remove newline + $str .= " " if length ($str) && $str !~ /\n$/; + $str .= $line; + } + } + $str =~ s/\s*$//; + push(@list, $str) if length ($str); + return @list; +} + +sub type_glade { + ### For translatable Glade XML files ### + + my $tags = "label|title|text|format|copyright|comments|preview_text|tooltip|message"; + + while ($input =~ /<($tags)>([^<]+)<\/($tags)>/sg) { + # Glade sometimes uses tags that normally mark translatable things for + # little bits of non-translatable content. We work around this by not + # translating strings that only includes something like label4 or window1. + $messages{entity_decode($2)} = [] unless $2 =~ /^(window|label)[0-9]+$/; + } + + while ($input =~ /(..[^<]*)<\/items>/sg) { + for my $item (split (/\n/, $1)) { + $messages{entity_decode($item)} = []; + } + } + + ## handle new glade files + while ($input =~ /<(property|atkproperty)\s+[^>]*translatable\s*=\s*"yes"[^>]*>([^<]+)<\/\1>/sg) { + $messages{entity_decode($2)} = [] unless $2 =~ /^(window|label)[0-9]+$/; + } + while ($input =~ /]*)"\s+description="([^>]+)"\/>/sg) { + $messages{entity_decode_minimal($2)} = []; + } +} + +sub type_scheme { + while ($input =~ /_\w*\(?"((?:[^"\\]+|\\.)*)"\)?/sg) { + $messages{$1} = []; + } +} + +sub msg_write { + my @msgids; + if (%count) + { + @msgids = sort { $count{$a} <=> $count{$b} } keys %count; + } + else + { + @msgids = sort keys %messages; + } + for my $message (@msgids) + { + my $offsetlines = 1; + $offsetlines++ if $message =~ /%/; + if (defined ($comments{$message})) + { + while ($comments{$message} =~ m/\n/g) + { + $offsetlines++; + } + } + print OUT "# ".($loc{$message} - $offsetlines). " \"$FILE\"\n" + if defined $loc{$message}; + print OUT "/* ".$comments{$message}." */\n" + if defined $comments{$message}; + print OUT "/* xgettext:no-c-format */\n" if $message =~ /%/; + + my @lines = split (/\n/, $message, -1); + for (my $n = 0; $n < @lines; $n++) + { + if ($n == 0) + { + print OUT "char *s = N_(\""; + } + else + { + print OUT " \""; + } + + print OUT escape($lines[$n]); + + if ($n < @lines - 1) + { + print OUT "\\n\"\n"; + } + else + { + print OUT "\");\n"; + } + } + } +} + --- /dev/null +++ b/intltool-merge @@ -0,0 +1,1255 @@ +#!/usr/bin/perl -w +# -*- Mode: perl; indent-tabs-mode: nil; c-basic-offset: 4 -*- + +# +# The Intltool Message Merger +# +# Copyright (C) 2000, 2003 Free Software Foundation. +# Copyright (C) 2000, 2001 Eazel, Inc +# +# Intltool is free software; you can redistribute it and/or +# modify it under the terms of the GNU General Public License +# version 2 published by the Free Software Foundation. +# +# Intltool 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., 675 Mass Ave, Cambridge, MA 02139, USA. +# +# As a special exception to the GNU General Public License, if you +# distribute this file as part of a program that contains a +# configuration script generated by Autoconf, you may include it under +# the same distribution terms that you use for the rest of that program. +# +# Authors: Maciej Stachowiak +# Kenneth Christiansen +# Darin Adler +# +# Proper XML UTF-8'ification written by Cyrille Chepelov +# + +## Release information +my $PROGRAM = "intltool-merge"; +my $PACKAGE = "intltool"; +my $VERSION = "0.31.3"; + +## Loaded modules +use strict; +use Getopt::Long; +use Text::Wrap; +use File::Basename; + +my $must_end_tag = -1; +my $last_depth = -1; +my $translation_depth = -1; +my @tag_stack = (); +my @entered_tag = (); +my @translation_strings = (); +my $leading_space = ""; + +## Scalars used by the option stuff +my $HELP_ARG = 0; +my $VERSION_ARG = 0; +my $BA_STYLE_ARG = 0; +my $XML_STYLE_ARG = 0; +my $KEYS_STYLE_ARG = 0; +my $DESKTOP_STYLE_ARG = 0; +my $SCHEMAS_STYLE_ARG = 0; +my $RFC822DEB_STYLE_ARG = 0; +my $QUIET_ARG = 0; +my $PASS_THROUGH_ARG = 0; +my $UTF8_ARG = 0; +my $MULTIPLE_OUTPUT = 0; +my $cache_file; + +## Handle options +GetOptions +( + "help" => \$HELP_ARG, + "version" => \$VERSION_ARG, + "quiet|q" => \$QUIET_ARG, + "oaf-style|o" => \$BA_STYLE_ARG, ## for compatibility + "ba-style|b" => \$BA_STYLE_ARG, + "xml-style|x" => \$XML_STYLE_ARG, + "keys-style|k" => \$KEYS_STYLE_ARG, + "desktop-style|d" => \$DESKTOP_STYLE_ARG, + "schemas-style|s" => \$SCHEMAS_STYLE_ARG, + "rfc822deb-style|r" => \$RFC822DEB_STYLE_ARG, + "pass-through|p" => \$PASS_THROUGH_ARG, + "utf8|u" => \$UTF8_ARG, + "multiple-output|m" => \$MULTIPLE_OUTPUT, + "cache|c=s" => \$cache_file + ) or &error; + +my $PO_DIR; +my $FILE; +my $OUTFILE; + +my %po_files_by_lang = (); +my %translations = (); +my $iconv = $ENV{"ICONV"} || $ENV{"INTLTOOL_ICONV"} || "/usr/bin/iconv"; + +# Use this instead of \w for XML files to handle more possible characters. +my $w = "[-A-Za-z0-9._:]"; + +# XML quoted string contents +my $q = "[^\\\"]*"; + +## Check for options. + +if ($VERSION_ARG) +{ + &print_version; +} +elsif ($HELP_ARG) +{ + &print_help; +} +elsif ($BA_STYLE_ARG && @ARGV > 2) +{ + &preparation; + &print_message; + &ba_merge_translations; + &finalize; +} +elsif ($XML_STYLE_ARG && @ARGV > 2) +{ + &utf8_sanity_check; + &preparation; + &print_message; + + &xml_merge_output; + + &finalize; +} +elsif ($KEYS_STYLE_ARG && @ARGV > 2) +{ + &utf8_sanity_check; + &preparation; + &print_message; + &keys_merge_translations; + &finalize; +} +elsif ($DESKTOP_STYLE_ARG && @ARGV > 2) +{ + &preparation; + &print_message; + &desktop_merge_translations; + &finalize; +} +elsif ($SCHEMAS_STYLE_ARG && @ARGV > 2) +{ + &preparation; + &print_message; + &schemas_merge_translations; + &finalize; +} +elsif ($RFC822DEB_STYLE_ARG && @ARGV > 2) +{ + &preparation; + &print_message; + &rfc822deb_merge_translations; + &finalize; +} +else +{ + &print_help; +} + +exit; + +## Sub for printing release information +sub print_version +{ + print <<_EOF_; +${PROGRAM} (${PACKAGE}) ${VERSION} +Written by Maciej Stachowiak, Darin Adler and Kenneth Christiansen. + +Copyright (C) 2000-2003 Free Software Foundation, Inc. +Copyright (C) 2000-2001 Eazel, Inc. +This is free software; see the source for copying conditions. There is NO +warranty; not even for MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. +_EOF_ + exit; +} + +## Sub for printing usage information +sub print_help +{ + print <<_EOF_; +Usage: ${PROGRAM} [OPTION]... PO_DIRECTORY FILENAME OUTPUT_FILE +Generates an output file that includes some localized attributes from an +untranslated source file. + +Mandatory options: (exactly one must be specified) + -b, --ba-style includes translations in the bonobo-activation style + -d, --desktop-style includes translations in the desktop style + -k, --keys-style includes translations in the keys style + -s, --schemas-style includes translations in the schemas style + -r, --rfc822deb-style includes translations in the RFC822 style + -x, --xml-style includes translations in the standard xml style + +Other options: + -u, --utf8 convert all strings to UTF-8 before merging + -p, --pass-through use strings as found in .po files, without + conversion (STRONGLY unrecommended with -x) + -m, --multiple-output output one localized file per locale, instead of + a single file containing all localized elements + -c, --cache=FILE specify cache file name + (usually \$top_builddir/po/.intltool-merge-cache) + -q, --quiet suppress most messages + --help display this help and exit + --version output version information and exit + +Report bugs to http://bugzilla.gnome.org/ (product name "$PACKAGE") +or send email to . +_EOF_ + exit; +} + + +## Sub for printing error messages +sub print_error +{ + print STDERR "Try `${PROGRAM} --help' for more information.\n"; + exit; +} + + +sub print_message +{ + print "Merging translations into $OUTFILE.\n" unless $QUIET_ARG; +} + + +sub preparation +{ + $PO_DIR = $ARGV[0]; + $FILE = $ARGV[1]; + $OUTFILE = $ARGV[2]; + + &gather_po_files; + &get_translation_database; +} + +# General-purpose code for looking up translations in .po files + +sub po_file2lang +{ + my ($tmp) = @_; + $tmp =~ s/^.*\/(.*)\.po$/$1/; + return $tmp; +} + +sub gather_po_files +{ + for my $po_file (glob "$PO_DIR/*.po") { + $po_files_by_lang{po_file2lang($po_file)} = $po_file; + } +} + +sub get_local_charset +{ + my ($encoding) = @_; + my $alias_file = $ENV{"G_CHARSET_ALIAS"} || "/usr/lib/charset.alias"; + + # seek character encoding aliases in charset.alias (glib) + + if (open CHARSET_ALIAS, $alias_file) + { + while () + { + next if /^\#/; + return $1 if (/^\s*([-._a-zA-Z0-9]+)\s+$encoding\b/i) + } + + close CHARSET_ALIAS; + } + + # if not found, return input string + + return $encoding; +} + +sub get_po_encoding +{ + my ($in_po_file) = @_; + my $encoding = ""; + + open IN_PO_FILE, $in_po_file or die; + while () + { + ## example: "Content-Type: text/plain; charset=ISO-8859-1\n" + if (/Content-Type\:.*charset=([-a-zA-Z0-9]+)\\n/) + { + $encoding = $1; + last; + } + } + close IN_PO_FILE; + + if (!$encoding) + { + print STDERR "Warning: no encoding found in $in_po_file. Assuming ISO-8859-1\n" unless $QUIET_ARG; + $encoding = "ISO-8859-1"; + } + + system ("$iconv -f $encoding -t UTF-8 /dev/null"); + if ($?) { + $encoding = get_local_charset($encoding); + } + + return $encoding +} + +sub utf8_sanity_check +{ + if (!$UTF8_ARG) + { + if (!$PASS_THROUGH_ARG) + { + $PASS_THROUGH_ARG="1"; + } + } +} + +sub get_translation_database +{ + if ($cache_file) { + &get_cached_translation_database; + } else { + &create_translation_database; + } +} + +sub get_newest_po_age +{ + my $newest_age; + + foreach my $file (values %po_files_by_lang) + { + my $file_age = -M $file; + $newest_age = $file_age if !$newest_age || $file_age < $newest_age; + } + + $newest_age = 0 if !$newest_age; + + return $newest_age; +} + +sub create_cache +{ + print "Generating and caching the translation database\n" unless $QUIET_ARG; + + &create_translation_database; + + open CACHE, ">$cache_file" || die; + print CACHE join "\x01", %translations; + close CACHE; +} + +sub load_cache +{ + print "Found cached translation database\n" unless $QUIET_ARG; + + my $contents; + open CACHE, "<$cache_file" || die; + { + local $/; + $contents = ; + } + close CACHE; + %translations = split "\x01", $contents; +} + +sub get_cached_translation_database +{ + my $cache_file_age = -M $cache_file; + if (defined $cache_file_age) + { + if ($cache_file_age <= &get_newest_po_age) + { + &load_cache; + return; + } + print "Found too-old cached translation database\n" unless $QUIET_ARG; + } + + &create_cache; +} + +sub create_translation_database +{ + for my $lang (keys %po_files_by_lang) + { + my $po_file = $po_files_by_lang{$lang}; + + if ($UTF8_ARG) + { + my $encoding = get_po_encoding ($po_file); + + if (lc $encoding eq "utf-8") + { + open PO_FILE, "<$po_file"; + } + else + { + print STDERR "WARNING: $po_file is not in UTF-8 but $encoding, converting...\n" unless $QUIET_ARG;; + + open PO_FILE, "$iconv -f $encoding -t UTF-8 $po_file|"; + } + } + else + { + open PO_FILE, "<$po_file"; + } + + my $nextfuzzy = 0; + my $inmsgid = 0; + my $inmsgstr = 0; + my $msgid = ""; + my $msgstr = ""; + + while () + { + $nextfuzzy = 1 if /^#, fuzzy/; + + if (/^msgid "((\\.|[^\\])*)"/ ) + { + $translations{$lang, $msgid} = $msgstr if $inmsgstr && $msgid && $msgstr; + $msgid = ""; + $msgstr = ""; + + if ($nextfuzzy) { + $inmsgid = 0; + } else { + $msgid = unescape_po_string($1); + $inmsgid = 1; + } + $inmsgstr = 0; + $nextfuzzy = 0; + } + + if (/^msgstr "((\\.|[^\\])*)"/) + { + $msgstr = unescape_po_string($1); + $inmsgstr = 1; + $inmsgid = 0; + } + + if (/^"((\\.|[^\\])*)"/) + { + $msgid .= unescape_po_string($1) if $inmsgid; + $msgstr .= unescape_po_string($1) if $inmsgstr; + } + } + $translations{$lang, $msgid} = $msgstr if $inmsgstr && $msgid && $msgstr; + } +} + +sub finalize +{ +} + +sub unescape_one_sequence +{ + my ($sequence) = @_; + + return "\\" if $sequence eq "\\\\"; + return "\"" if $sequence eq "\\\""; + return "\n" if $sequence eq "\\n"; + + # gettext also handles \n, \t, \b, \r, \f, \v, \a, \xxx (octal), + # \xXX (hex) and has a comment saying they want to handle \u and \U. + + return $sequence; +} + +sub unescape_po_string +{ + my ($string) = @_; + + $string =~ s/(\\.)/unescape_one_sequence($1)/eg; + + return $string; +} + +## NOTE: deal with < - < but not > - > because it seems its ok to have +## > in the entity. For further info please look at #84738. +sub entity_decode +{ + local ($_) = @_; + + s/'/'/g; # ' + s/"/"/g; # " + s/&/&/g; + s/</ 127 || $_ == 34 || $_ == 38 || $_ == 39 || $_ == 60) + { + # the ($_ > 127) should probably be removed + return "&#" . $_ . ";"; + } + else + { + return chr $_; + } +} + +sub entity_encoded_translation +{ + my ($lang, $string) = @_; + + my $translation = $translations{$lang, $string}; + return $string if !$translation; + return entity_encode ($translation); +} + +## XML (bonobo-activation specific) merge code + +sub ba_merge_translations +{ + my $source; + + { + local $/; # slurp mode + open INPUT, "<$FILE" or die "can't open $FILE: $!"; + $source = ; + close INPUT; + } + + open OUTPUT, ">$OUTFILE" or die "can't open $OUTFILE: $!"; + + while ($source =~ s|^(.*?)([ \t]*<\s*$w+\s+($w+\s*=\s*"$q"\s*)+/?>)([ \t]*\n)?||s) + { + print OUTPUT $1; + + my $node = $2 . "\n"; + + my @strings = (); + $_ = $node; + while (s/(\s)_($w+\s*=\s*"($q)")/$1$2/s) { + push @strings, entity_decode($3); + } + print OUTPUT; + + my %langs; + for my $string (@strings) + { + for my $lang (keys %po_files_by_lang) + { + $langs{$lang} = 1 if $translations{$lang, $string}; + } + } + + for my $lang (sort keys %langs) + { + $_ = $node; + s/(\sname\s*=\s*)"($q)"/$1"$2-$lang"/s; + s/(\s)_($w+\s*=\s*")($q)"/$1 . $2 . entity_encoded_translation($lang, $3) . '"'/seg; + print OUTPUT; + } + } + + print OUTPUT $source; + + close OUTPUT; +} + + +## XML (non-bonobo-activation) merge code + + +# Process tag attributes +# Only parameter is a HASH containing attributes -> values mapping +sub getAttributeString +{ + my $sub = shift; + my $do_translate = shift || 0; + my $language = shift || ""; + my $result = ""; + foreach my $e (reverse(sort(keys %{ $sub }))) { + my $key = $e; + my $string = $sub->{$e}; + my $quote = '"'; + + $string =~ s/^[\s]+//; + $string =~ s/[\s]+$//; + + if ($string =~ /^'.*'$/) + { + $quote = "'"; + } + $string =~ s/^['"]//g; + $string =~ s/['"]$//g; + + if ($do_translate && $key =~ /^_/) { + $key =~ s|^_||g; + if ($language) { + + # Handle translation + # + my $decode_string = entity_decode($string); + my $translation = $translations{$language, $decode_string}; + if ($translation) { + $translation = entity_encode($translation); + $string = $translation; + } + } + } + + $result .= " $key=$quote$string$quote"; + } + return $result; +} + +# Returns a translatable string from XML node, it works on contents of every node in XML::Parser tree +# doesn't support nesting of translatable tags (i.e. <_blah>this <_doh>doesn't work -- besides +# can you define the correct semantics for this?) +# + +sub getXMLstring +{ + my $ref = shift; + my @list = @{ $ref }; + my $result = ""; + + my $count = scalar(@list); + my $attrs = $list[0]; + my $index = 1; + while ($index < $count) { + my $type = $list[$index]; + my $content = $list[$index+1]; + if (! $type ) { + # We've got CDATA + if ($content) { + # lets strip the whitespace here, and *ONLY* here + $content =~ s/\s+/ /gs; + $result .= ($content); + } else { + #print "no cdata content when expected it\n"; # is this possible, is this ok? + # what to do if this happens? + # Did I mention that I hate XML::Parser tree style? + } + } else { + # We've got another element + $result .= "<$type"; + $result .= getAttributeString($attrs, 0); # no nested translatable elements + if ($content) { + my $subresult = getXMLstring($content); + if ($subresult) { + $result .= ">".$subresult . ""; + } else { + $result .= "/>"; + } + } else { + $result .= "/>"; + } + } + $index += 2; + } + return $result; +} + +sub traverse +{ + my $fh = shift; + my $nodename = shift; + my $content = shift; + my $language = shift || ""; + + if (!$nodename) { + if ($content =~ /^[\s]*$/) { + $leading_space .= $content; + } + print $fh $content; + } else { + # element + my @all = @{ $content }; + my $attrs = shift @all; + my $outattr = getAttributeString($attrs, 1, $language); + my $translate = 0; + + if ($nodename =~ /^_/) { + $translate = 1; + $nodename =~ s/^_//; + } + my $lookup = ''; + print $fh "<$nodename$outattr"; + if ($translate) { + $lookup = getXMLstring($content); + $lookup =~ s/^\s+//s; + $lookup =~ s/\s+$//s; + + if ($lookup) { + my $translation = $translations{$language, $lookup}; + if ($MULTIPLE_OUTPUT && $translation) { + print $fh " xml:lang=\"", $language, "\""; + print $fh ">", $translation, ""; + return; # this means there will be no same translation with xml:lang="$language"... + # if we want them both, just remove this "return" + } else { + print $fh ">$lookup"; + } + } else { + print $fh "/>"; + } + + + for my $lang (sort keys %po_files_by_lang) { + if ($MULTIPLE_OUTPUT && $lang ne "$language") { + next; + } + if ($lang) { + + # Handle translation + # + my $localattrs = getAttributeString($attrs, 1, $lang); + my $decode_string = ($lookup); #entity_decode($lookup); + my $translation = $translations{$lang, $decode_string}; + if ($translation) { + $translation = ($translation); + print $fh "\n"; + $leading_space =~ s/.*\n//g; + print $fh $leading_space; + print $fh "<", $nodename, " xml:lang=\"", $lang, "\"", $localattrs; + print $fh ">", $translation , ""; + } + } + } + + } else { + my $count = scalar(@all); + if ($count > 0) { + print $fh ">"; + } else { + print $fh "/>"; + } + my $index = 0; + while ($index < $count) { + my $type = $all[$index]; + my $rest = $all[$index+1]; + traverse($fh, $type, $rest, $language); + $index += 2; + } + if ($count > 0) { + print $fh ""; + } + } + } +} + +sub intltool_tree_char +{ + my $expat = shift; + my $text = shift; + my $clist = $expat->{Curlist}; + my $pos = $#$clist; + + # Use original_string so that we retain escaped entities + # in CDATA sections. + # + if ($pos > 0 and $clist->[$pos - 1] eq '0') { + $clist->[$pos] .= $expat->original_string(); + } else { + push @$clist, 0 => $expat->original_string(); + } +} + +sub intltool_tree_start +{ + my $expat = shift; + my $tag = shift; + my @origlist = (); + + # Use original_string so that we retain escaped entities + # in attribute values. We must convert the string to an + # @origlist array to conform to the structure of the Tree + # Style. + # + my @original_array = split /\x/, $expat->original_string(); + my $source = $expat->original_string(); + + # Remove leading tag. + # + $source =~ s|^\s*<\s*(\S+)||s; + + # Grab attribute key/value pairs and push onto @origlist array. + # + while ($source) + { + if ($source =~ /^\s*([\w:-]+)\s*[=]\s*["]/) + { + $source =~ s|^\s*([\w:-]+)\s*[=]\s*["]([^"]*)["]||s; + push @origlist, $1; + push @origlist, '"' . $2 . '"'; + } + elsif ($source =~ /^\s*([\w:-]+)\s*[=]\s*[']/) + { + $source =~ s|^\s*([\w:-]+)\s*[=]\s*[']([^']*)[']||s; + push @origlist, $1; + push @origlist, "'" . $2 . "'"; + } + else + { + last; + } + } + + my $ol = [ { @origlist } ]; + + push @{ $expat->{Lists} }, $expat->{Curlist}; + push @{ $expat->{Curlist} }, $tag => $ol; + $expat->{Curlist} = $ol; +} + +sub readXml +{ + my $filename = shift || return; + if(!-f $filename) { + die "ERROR Cannot find filename: $filename\n"; + } + + my $ret = eval 'require XML::Parser'; + if(!$ret) { + die "You must have XML::Parser installed to run $0\n\n"; + } + my $xp = new XML::Parser(Style => 'Tree'); + $xp->setHandlers(Char => \&intltool_tree_char); + $xp->setHandlers(Start => \&intltool_tree_start); + my $tree = $xp->parsefile($filename); + +# Hello thereHowdydo +# would be: +# [foo, [{}, head, [{id => "a"}, 0, "Hello ", em, [{}, 0, "there"]], bar, [{}, +# 0, "Howdy", ref, [{}]], 0, "do" ] ] + + return $tree; +} + +sub print_header +{ + my $infile = shift; + my $fh = shift; + my $source; + + if(!-f $infile) { + die "ERROR Cannot find filename: $infile\n"; + } + + print $fh qq{\n}; + { + local $/; + open DOCINPUT, "<${FILE}" or die; + $source = ; + close DOCINPUT; + } + if ($source =~ /()/s) + { + print $fh "$1\n"; + } + elsif ($source =~ /(]*>)/s) + { + print $fh "$1\n"; + } +} + +sub parseTree +{ + my $fh = shift; + my $ref = shift; + my $language = shift || ""; + + my $name = shift @{ $ref }; + my $cont = shift @{ $ref }; + traverse($fh, $name, $cont, $language); +} + +sub xml_merge_output +{ + my $source; + + if ($MULTIPLE_OUTPUT) { + for my $lang (sort keys %po_files_by_lang) { + if ( ! -e $lang ) { + mkdir $lang or die "Cannot create subdirectory $lang: $!\n"; + } + open OUTPUT, ">$lang/$OUTFILE" or die "Cannot open $lang/$OUTFILE: $!\n"; + my $tree = readXml($FILE); + print_header($FILE, \*OUTPUT); + parseTree(\*OUTPUT, $tree, $lang); + close OUTPUT; + print "CREATED $lang/$OUTFILE\n" unless $QUIET_ARG; + } + } + open OUTPUT, ">$OUTFILE" or die "Cannot open $OUTFILE: $!\n"; + my $tree = readXml($FILE); + print_header($FILE, \*OUTPUT); + parseTree(\*OUTPUT, $tree); + close OUTPUT; + print "CREATED $OUTFILE\n" unless $QUIET_ARG; +} + +sub keys_merge_translations +{ + open INPUT, "<${FILE}" or die; + open OUTPUT, ">${OUTFILE}" or die; + + while () + { + if (s/^(\s*)_(\w+=(.*))/$1$2/) + { + my $string = $3; + + print OUTPUT; + + my $non_translated_line = $_; + + for my $lang (sort keys %po_files_by_lang) + { + my $translation = $translations{$lang, $string}; + next if !$translation; + + $_ = $non_translated_line; + s/(\w+)=.*/[$lang]$1=$translation/; + print OUTPUT; + } + } + else + { + print OUTPUT; + } + } + + close OUTPUT; + close INPUT; +} + +sub desktop_merge_translations +{ + open INPUT, "<${FILE}" or die; + open OUTPUT, ">${OUTFILE}" or die; + + while () + { + if (s/^(\s*)_(\w+=(.*))/$1$2/) + { + my $string = $3; + + print OUTPUT; + + my $non_translated_line = $_; + + for my $lang (sort keys %po_files_by_lang) + { + my $translation = $translations{$lang, $string}; + next if !$translation; + + $_ = $non_translated_line; + s/(\w+)=.*/${1}[$lang]=$translation/; + print OUTPUT; + } + } + else + { + print OUTPUT; + } + } + + close OUTPUT; + close INPUT; +} + +sub schemas_merge_translations +{ + my $source; + + { + local $/; # slurp mode + open INPUT, "<$FILE" or die "can't open $FILE: $!"; + $source = ; + close INPUT; + } + + open OUTPUT, ">$OUTFILE" or die; + + # FIXME: support attribute translations + + # Empty nodes never need translation, so unmark all of them. + # For example, <_foo/> is just replaced by . + $source =~ s|<\s*_($w+)\s*/>|<$1/>|g; + + while ($source =~ s/ + (.*?) + (\s+)((\s*) + (\s*(?:\s*)?(.*?)\s*<\/default>)?(\s*) + (\s*(?:\s*)?(.*?)\s*<\/short>)?(\s*) + (\s*(?:\s*)?(.*?)\s*<\/long>)?(\s*) + <\/locale>) + //sx) + { + print OUTPUT $1; + + my $locale_start_spaces = $2 ? $2 : ''; + my $default_spaces = $4 ? $4 : ''; + my $short_spaces = $7 ? $7 : ''; + my $long_spaces = $10 ? $10 : ''; + my $locale_end_spaces = $13 ? $13 : ''; + my $c_default_block = $3 ? $3 : ''; + my $default_string = $6 ? $6 : ''; + my $short_string = $9 ? $9 : ''; + my $long_string = $12 ? $12 : ''; + + print OUTPUT "$locale_start_spaces$c_default_block"; + + $default_string =~ s/\s+/ /g; + $default_string = entity_decode($default_string); + $short_string =~ s/\s+/ /g; + $short_string = entity_decode($short_string); + $long_string =~ s/\s+/ /g; + $long_string = entity_decode($long_string); + + for my $lang (sort keys %po_files_by_lang) + { + my $default_translation = $translations{$lang, $default_string}; + my $short_translation = $translations{$lang, $short_string}; + my $long_translation = $translations{$lang, $long_string}; + + next if (!$default_translation && !$short_translation && + !$long_translation); + + print OUTPUT "\n$locale_start_spaces"; + + print OUTPUT "$default_spaces"; + + if ($default_translation) + { + $default_translation = entity_encode($default_translation); + print OUTPUT "$default_translation"; + } + + print OUTPUT "$short_spaces"; + + if ($short_translation) + { + $short_translation = entity_encode($short_translation); + print OUTPUT "$short_translation"; + } + + print OUTPUT "$long_spaces"; + + if ($long_translation) + { + $long_translation = entity_encode($long_translation); + print OUTPUT "$long_translation"; + } + + print OUTPUT "$locale_end_spaces"; + } + } + + print OUTPUT $source; + + close OUTPUT; +} + +sub rfc822deb_merge_translations +{ + my %encodings = (); + for my $lang (keys %po_files_by_lang) { + $encodings{$lang} = ($UTF8_ARG ? 'UTF-8' : get_po_encoding($po_files_by_lang{$lang})); + } + + my $source; + + $Text::Wrap::huge = 'overflow'; + $Text::Wrap::break = qr/\n|\s(?=\S)/; + + { + local $/; # slurp mode + open INPUT, "<$FILE" or die "can't open $FILE: $!"; + $source = ; + close INPUT; + } + + open OUTPUT, ">${OUTFILE}" or die; + + while ($source =~ /(^|\n+)(_*)([^:\s]+)(:[ \t]*)(.*?)(?=\n[\S\n]|$)/sg) + { + my $sep = $1; + my $non_translated_line = $3.$4; + my $string = $5; + my $underscore = length($2); + next if $underscore eq 0 && $non_translated_line =~ /^#/; + # Remove [] dummy strings + my $stripped = $string; + $stripped =~ s/\[\s[^\[\]]*\],/,/g if $underscore eq 2; + $stripped =~ s/\[\s[^\[\]]*\]$//; + $non_translated_line .= $stripped; + + print OUTPUT $sep.$non_translated_line; + + if ($underscore) + { + my @str_list = rfc822deb_split($underscore, $string); + + for my $lang (sort keys %po_files_by_lang) + { + my $is_translated = 1; + my $str_translated = ''; + my $first = 1; + + for my $str (@str_list) + { + my $translation = $translations{$lang, $str}; + + if (!$translation) + { + $is_translated = 0; + last; + } + + # $translation may also contain [] dummy + # strings, mostly to indicate an empty string + $translation =~ s/\[\s[^\[\]]*\]$//; + + if ($first) + { + if ($underscore eq 2) + { + $str_translated .= $translation; + } + else + { + $str_translated .= + Text::Tabs::expand($translation) . + "\n"; + } + } + else + { + if ($underscore eq 2) + { + $str_translated .= ', ' . $translation; + } + else + { + $str_translated .= Text::Tabs::expand( + Text::Wrap::wrap(' ', ' ', $translation)) . + "\n .\n"; + } + } + $first = 0; + + # To fix some problems with Text::Wrap::wrap + $str_translated =~ s/(\n )+\n/\n .\n/g; + } + next unless $is_translated; + + $str_translated =~ s/\n \.\n$//; + $str_translated =~ s/\s+$//; + + $_ = $non_translated_line; + s/^(\w+):\s*.*/$sep${1}-$lang.$encodings{$lang}: $str_translated/s; + print OUTPUT; + } + } + } + print OUTPUT "\n"; + + close OUTPUT; + close INPUT; +} + +sub rfc822deb_split +{ + # Debian defines a special way to deal with rfc822-style files: + # when a value contain newlines, it consists of + # 1. a short form (first line) + # 2. a long description, all lines begin with a space, + # and paragraphs are separated by a single dot on a line + # This routine returns an array of all paragraphs, and reformat + # them. + # When first argument is 2, the string is a comma separated list of + # values. + my $type = shift; + my $text = shift; + $text =~ s/^[ \t]//mg; + return (split(/, */, $text, 0)) if $type ne 1; + return ($text) if $text !~ /\n/; + + $text =~ s/([^\n]*)\n//; + my @list = ($1); + my $str = ''; + + for my $line (split (/\n/, $text)) + { + chomp $line; + if ($line =~ /^\.\s*$/) + { + # New paragraph + $str =~ s/\s*$//; + push(@list, $str); + $str = ''; + } + elsif ($line =~ /^\s/) + { + # Line which must not be reformatted + $str .= "\n" if length ($str) && $str !~ /\n$/; + $line =~ s/\s+$//; + $str .= $line."\n"; + } + else + { + # Continuation line, remove newline + $str .= " " if length ($str) && $str !~ /\n$/; + $str .= $line; + } + } + + $str =~ s/\s*$//; + push(@list, $str) if length ($str); + + return @list; +} + --- /dev/null +++ b/intltool-update @@ -0,0 +1,1034 @@ +#!/usr/bin/perl -w +# -*- Mode: perl; indent-tabs-mode: nil; c-basic-offset: 4 -*- + +# +# The Intltool Message Updater +# +# Copyright (C) 2000-2003 Free Software Foundation. +# +# Intltool is free software; you can redistribute it and/or +# modify it under the terms of the GNU General Public License +# version 2 published by the Free Software Foundation. +# +# Intltool 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., 675 Mass Ave, Cambridge, MA 02139, USA. +# +# As a special exception to the GNU General Public License, if you +# distribute this file as part of a program that contains a +# configuration script generated by Autoconf, you may include it under +# the same distribution terms that you use for the rest of that program. +# +# Authors: Kenneth Christiansen +# Maciej Stachowiak +# Darin Adler + +## Release information +my $PROGRAM = "intltool-update"; +my $VERSION = "0.31.3"; +my $PACKAGE = "intltool"; + +## Loaded modules +use strict; +use Getopt::Long; +use Cwd; +use File::Copy; +use File::Find; + +## Scalars used by the option stuff +my $HELP_ARG = 0; +my $VERSION_ARG = 0; +my $DIST_ARG = 0; +my $POT_ARG = 0; +my $HEADERS_ARG = 0; +my $MAINTAIN_ARG = 0; +my $REPORT_ARG = 0; +my $VERBOSE = 0; +my $GETTEXT_PACKAGE = ""; +my $OUTPUT_FILE = ""; + +my @languages; +my %varhash = (); +my %po_files_by_lang = (); + +# Regular expressions to categorize file types. +# FIXME: Please check if the following is correct + +my $xml_support = +"xml(?:\\.in)*|". # http://www.w3.org/XML/ (Note: .in is not required) +"ui|". # Bonobo specific - User Interface desc. files +"lang|". # ? +"glade2?(?:\\.in)*|". # Glade specific - User Interface desc. files (Note: .in is not required) +"scm(?:\\.in)*|". # ? (Note: .in is not required) +"oaf(?:\\.in)+|". # DEPRECATED: Replaces by Bonobo .server files +"etspec|". # ? +"server(?:\\.in)+|". # Bonobo specific +"sheet(?:\\.in)+|". # ? +"schemas(?:\\.in)+|". # GConf specific +"pong(?:\\.in)+|". # DEPRECATED: PONG is not used [by GNOME] any longer. +"kbd(?:\\.in)+"; # GOK specific. + +my $ini_support = +"desktop(?:\\.in)+|". # http://www.freedesktop.org/Standards/menu-spec +"caves(?:\\.in)+|". # GNOME Games specific +"directory(?:\\.in)+|". # http://www.freedesktop.org/Standards/menu-spec +"soundlist(?:\\.in)+|". # GNOME specific +"keys(?:\\.in)+|". # GNOME Mime database specific +"theme(?:\\.in)+"; # http://www.freedesktop.org/Standards/icon-theme-spec + +my $buildin_gettext_support = +"c|y|cs|cc|cpp|c\\+\\+|h|hh|gob|py"; + +## Always flush buffer when printing +$| = 1; + +## Sometimes the source tree will be rooted somewhere else. +my $SRCDIR = "."; +my $POTFILES_in; + +$SRCDIR = $ENV{"srcdir"} if $ENV{"srcdir"}; +$POTFILES_in = "<$SRCDIR/POTFILES.in"; + +## Handle options +GetOptions +( + "help" => \$HELP_ARG, + "version" => \$VERSION_ARG, + "dist|d" => \$DIST_ARG, + "pot|p" => \$POT_ARG, + "headers|s" => \$HEADERS_ARG, + "maintain|m" => \$MAINTAIN_ARG, + "report|r" => \$REPORT_ARG, + "verbose|x" => \$VERBOSE, + "gettext-package|g=s" => \$GETTEXT_PACKAGE, + "output-file|o=s" => \$OUTPUT_FILE, + ) or &Console_WriteError_InvalidOption; + +&Console_Write_IntltoolHelp if $HELP_ARG; +&Console_Write_IntltoolVersion if $VERSION_ARG; + +my $arg_count = ($DIST_ARG > 0) + + ($POT_ARG > 0) + + ($HEADERS_ARG > 0) + + ($MAINTAIN_ARG > 0) + + ($REPORT_ARG > 0); + +&Console_Write_IntltoolHelp if $arg_count > 1; + +# --version and --help don't require a module name +my $MODULE = $GETTEXT_PACKAGE || &FindPackageName; + +if ($POT_ARG) +{ + &GenerateHeaders; + &GeneratePOTemplate; +} +elsif ($HEADERS_ARG) +{ + &GenerateHeaders; +} +elsif ($MAINTAIN_ARG) +{ + &FindLeftoutFiles; +} +elsif ($REPORT_ARG) +{ + &GenerateHeaders; + &GeneratePOTemplate; + &Console_Write_CoverageReport; +} +elsif ((defined $ARGV[0]) && $ARGV[0] =~ /^[a-z]/) +{ + my $lang = $ARGV[0]; + + ## Report error if the language file supplied + ## to the command line is non-existent + &Console_WriteError_NotExisting("$lang.po") if ! -s "$lang.po"; + + if (!$DIST_ARG) + { + print "Working, please wait..." if $VERBOSE; + &GenerateHeaders; + &GeneratePOTemplate; + } + &POFile_Update ($lang, $OUTPUT_FILE); + &Console_Write_TranslationStatus ($lang, $OUTPUT_FILE); +} +else +{ + &Console_Write_IntltoolHelp; +} + +exit; + +######### + +sub Console_Write_IntltoolVersion +{ + print <<_EOF_; +${PROGRAM} (${PACKAGE}) $VERSION +Written by Kenneth Christiansen, Maciej Stachowiak, and Darin Adler. + +Copyright (C) 2000-2003 Free Software Foundation, Inc. +This is free software; see the source for copying conditions. There is NO +warranty; not even for MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. +_EOF_ + exit; +} + +sub Console_Write_IntltoolHelp +{ + print <<_EOF_; +Usage: ${PROGRAM} [OPTION]... LANGCODE +Updates PO template files and merge them with the translations. + +Mode of operation (only one is allowed): + -p, --pot generate the PO template only + -s, --headers generate the header files in POTFILES.in + -m, --maintain search for left out files from POTFILES.in + -r, --report display a status report for the module + -d, --dist merge LANGCODE.po with existing PO template + +Extra options: + -g, --gettext-package=NAME override PO template name, useful with --pot + -o, --output-file=FILE write merged translation to FILE + -x, --verbose display lots of feedback + --help display this help and exit + --version output version information and exit + +Examples of use: +${PROGRAM} --pot just create a new PO template +${PROGRAM} xy create new PO template and merge xy.po with it + +Report bugs to http://bugzilla.gnome.org/ (product name "$PACKAGE") +or send email to . +_EOF_ + exit; +} + +sub POFile_DetermineType ($) +{ + my $type = $_; + my $gettext_type; + + my $xml_regex = "(?:" . $xml_support . ")"; + my $ini_regex = "(?:" . $ini_support . ")"; + my $buildin_regex = "(?:" . $buildin_gettext_support . ")"; + + if ($type =~ /\[type: gettext\/([^\]].*)]/) + { + $gettext_type=$1; + } + elsif ($type =~ /schemas(\.in)+$/) + { + $gettext_type="schemas"; + } + elsif ($type =~ /glade2?(\.in)*$/) + { + $gettext_type="glade"; + } + elsif ($type =~ /scm(\.in)*$/) + { + $gettext_type="scheme"; + } + elsif ($type =~ /keys(\.in)+$/) + { + $gettext_type="keys"; + } + + # bucket types + + elsif ($type =~ /$xml_regex$/) + { + $gettext_type="xml"; + } + elsif ($type =~ /$ini_regex$/) + { + $gettext_type="ini"; + } + elsif ($type =~ /$buildin_regex$/) + { + $gettext_type="buildin"; + } + else + { + $gettext_type="unknown"; + } + + return "gettext\/$gettext_type"; +} + +sub TextFile_DetermineEncoding ($) +{ + my $gettext_code="ASCII"; # All files are ASCII by default + my $filetype=`file $_ | cut -d ' ' -f 2`; + + if ($? eq "0") + { + if ($filetype =~ /^(ISO|UTF)/) + { + chomp ($gettext_code = $filetype); + } + elsif ($filetype =~ /^XML/) + { + $gettext_code="UTF-8"; # We asume that .glade and other .xml files are UTF-8 + } + } + + return $gettext_code; +} + + +sub FindLeftoutFiles +{ + my (@buf_i18n_plain, + @buf_i18n_xml, + @buf_i18n_xml_unmarked, + @buf_i18n_ini, + @buf_potfiles, + @buf_potfiles_ignore, + @buf_allfiles, + @buf_allfiles_sorted, + @buf_potfiles_sorted + ); + + ## Search and find all translatable files + find sub { + push @buf_i18n_plain, "$File::Find::name" if /\.($buildin_gettext_support)$/; + push @buf_i18n_xml, "$File::Find::name" if /\.($xml_support)$/; + push @buf_i18n_ini, "$File::Find::name" if /\.($ini_support)$/; + push @buf_i18n_xml_unmarked, "$File::Find::name" if /\.(schemas(\.in)+)$/; + }, ".."; + + + open POTFILES, $POTFILES_in or die "$PROGRAM: there's no POTFILES.in!\n"; + @buf_potfiles = grep !/^(#|\s*$)/, ; + close POTFILES; + + foreach (@buf_potfiles) { + s/^\[.*]\s*//; + } + + print "Searching for missing translatable files...\n" if $VERBOSE; + + ## Check if we should ignore some found files, when + ## comparing with POTFILES.in + foreach my $ignore ("POTFILES.skip", "POTFILES.ignore") + { + (-s $ignore) or next; + + if ("$ignore" eq "POTFILES.ignore") + { + print "The usage of POTFILES.ignore is deprecated. Please consider moving the\n". + "content of this file to POTFILES.skip.\n"; + } + + print "Found $ignore: Ignoring files...\n" if $VERBOSE; + open FILE, "<$ignore" or die "ERROR: Failed to open $ignore!\n"; + + while () + { + push @buf_potfiles_ignore, $_ unless /^(#|\s*$)/; + } + close FILE; + + @buf_potfiles = (@buf_potfiles_ignore, @buf_potfiles); + } + + foreach my $file (@buf_i18n_plain) + { + my $in_comment = 0; + my $in_macro = 0; + + open FILE, "<$file"; + while () + { + # Handle continued multi-line comment. + if ($in_comment) + { + next unless s-.*\*/--; + $in_comment = 0; + } + + # Handle continued macro. + if ($in_macro) + { + $in_macro = 0 unless /\\$/; + next; + } + + # Handle start of macro (or any preprocessor directive). + if (/^\s*\#/) + { + $in_macro = 1 if /^([^\\]|\\.)*\\$/; + next; + } + + # Handle comments and quoted text. + while (m-(/\*|//|\'|\")-) # \' and \" keep emacs perl mode happy + { + my $match = $1; + if ($match eq "/*") + { + if (!s-/\*.*?\*/--) + { + s-/\*.*--; + $in_comment = 1; + } + } + elsif ($match eq "//") + { + s-//.*--; + } + else # ' or " + { + if (!s-$match([^\\]|\\.)*?$match-QUOTEDTEXT-) + { + warn "mismatched quotes at line $. in $file\n"; + s-$match.*--; + } + } + } + + if (/\.GetString ?\(QUOTEDTEXT/) + { + ## Remove the first 3 chars and add newline + push @buf_allfiles, unpack("x3 A*", $file) . "\n"; + last; + } + + if (/_\(QUOTEDTEXT/) + { + ## Remove the first 3 chars and add newline + push @buf_allfiles, unpack("x3 A*", $file) . "\n"; + last; + } + } + close FILE; + } + + foreach my $file (@buf_i18n_xml) + { + open FILE, "<$file"; + + while () + { + # FIXME: share the pattern matching code with intltool-extract + if (/\s_(.*)=\"/ || /<_[^>]+>/ || /translatable=\"yes\"/) + { + push @buf_allfiles, unpack("x3 A*", $file) . "\n"; + last; + } + } + close FILE; + } + + foreach my $file (@buf_i18n_ini) + { + open FILE, "<$file"; + while () + { + if (/_(.*)=/) + { + push @buf_allfiles, unpack("x3 A*", $file) . "\n"; + last; + } + } + close FILE; + } + + foreach my $file (@buf_i18n_xml_unmarked) + { + push @buf_allfiles, unpack("x3 A*", $file) . "\n"; + } + + + @buf_allfiles_sorted = sort (@buf_allfiles); + @buf_potfiles_sorted = sort (@buf_potfiles); + + my %in2; + foreach (@buf_potfiles_sorted) + { + $in2{$_} = 1; + } + + my @result; + + foreach (@buf_allfiles_sorted) + { + if (!exists($in2{$_})) + { + push @result, $_ + } + } + + my @buf_potfiles_notexist; + + foreach (@buf_potfiles_sorted) + { + chomp (my $dummy = $_); + if ("$dummy" ne "" and ! -f "../$dummy") + { + push @buf_potfiles_notexist, $_; + } + } + + ## Save file with information about the files missing + ## if any, and give information about this procedure. + if (@result + @buf_potfiles_notexist > 0) + { + if (@result) + { + print "\n" if $VERBOSE; + unlink "missing"; + open OUT, ">missing"; + print OUT @result; + close OUT; + warn "\e[1mThe following files contain translations and are currently not in use. Please\e[0m\n". + "\e[1mconsider adding these to the POTFILES.in file, located in the po/ directory.\e[0m\n\n"; + print STDERR @result, "\n"; + warn "If some of these files are left out on purpose then please add them to\n". + "POTFILES.skip instead of POTFILES.in. A file \e[1m'missing'\e[0m containing this list\n". + "of left out files has been written in the current directory.\n"; + } + if (@buf_potfiles_notexist) + { + unlink "notexist"; + open OUT, ">notexist"; + print OUT @buf_potfiles_notexist; + close OUT; + warn "\n" if ($VERBOSE or @result); + warn "\e[1mThe following files do not exist anymore:\e[0m\n\n"; + warn @buf_potfiles_notexist, "\n"; + warn "Please remove them from POTFILES.in or POTFILES.skip. A file \e[1m'notexist'\e[0m\n". + "containing this list of absent files has been written in the current directory.\n"; + } + } + + ## If there is nothing to complain about, notify the user + else { + print "\nAll files containing translations are present in POTFILES.in.\n" if $VERBOSE; + } +} + +sub Console_WriteError_InvalidOption +{ + ## Handle invalid arguments + print STDERR "Try `${PROGRAM} --help' for more information.\n"; + exit 1; +} + +sub GenerateHeaders +{ + my $EXTRACT = "/intltool-extract"; + chomp $EXTRACT; + + $EXTRACT = $ENV{"INTLTOOL_EXTRACT"} if $ENV{"INTLTOOL_EXTRACT"}; + + ## Generate the .h header files, so we can allow glade and + ## xml translation support + if (! -x "$EXTRACT") + { + print STDERR "\n *** The intltool-extract script wasn't found!" + ."\n *** Without it, intltool-update can not generate files.\n"; + exit; + } + else + { + open (FILE, $POTFILES_in) or die "$PROGRAM: POTFILES.in not found.\n"; + + while () + { + chomp; + next if /^\[\s*encoding/; + + ## Find xml files in POTFILES.in and generate the + ## files with help from the extract script + + my $gettext_type= &POFile_DetermineType ($1); + + if (/\.($xml_support|$ini_support)$/ || /^\[/) + { + s/^\[[^\[].*]\s*//; + + my $filename = "../$_"; + + if ($VERBOSE) + { + system ($EXTRACT, "--update", "--srcdir=$SRCDIR", + "--type=$gettext_type", $filename); + } + else + { + system ($EXTRACT, "--update", "--type=$gettext_type", + "--srcdir=$SRCDIR", "--quiet", $filename); + } + } + } + close FILE; + } +} + +# +# Generate .pot file from POTFILES.in +# +sub GeneratePOTemplate +{ + my $XGETTEXT = $ENV{"XGETTEXT"} || "/usr/bin/xgettext"; + my $XGETTEXT_ARGS = $ENV{"XGETTEXT_ARGS"} || ''; + chomp $XGETTEXT; + + if (! -x $XGETTEXT) + { + print STDERR " *** xgettext is not found on this system!\n". + " *** Without it, intltool-update can not extract strings.\n"; + exit; + } + + print "Building $MODULE.pot...\n" if $VERBOSE; + + open INFILE, $POTFILES_in; + unlink "POTFILES.in.temp"; + open OUTFILE, ">POTFILES.in.temp" or die("Cannot open POTFILES.in.temp for writing"); + + my $gettext_support_nonascii = 0; + + # checks for GNU gettext >= 0.12 + my $dummy = `$XGETTEXT --version --from-code=UTF-8 >/dev/null 2>/dev/null`; + if ($? == 0) + { + $gettext_support_nonascii = 1; + } + else + { + # urge everybody to upgrade gettext + print STDERR "WARNING: This version of gettext does not support extracting non-ASCII\n". + " strings. That means you should install a version of gettext\n". + " that supports non-ASCII strings (such as GNU gettext >= 0.12),\n". + " or have to let non-ASCII strings untranslated. (If there is any)\n"; + } + + my $encoding = "ASCII"; + my $forced_gettext_code; + my @temp_headers; + my $encoding_problem_is_reported = 0; + + while () + { + next if (/^#/ or /^\s*$/); + + chomp; + + my $gettext_code; + + if (/^\[\s*encoding:\s*(.*)\s*\]/) + { + $forced_gettext_code=$1; + } + elsif (/\.($xml_support|$ini_support)$/ || /^\[/) + { + s/^\[.*]\s*//; + print OUTFILE "$_.h\n"; + push @temp_headers, "../$_.h"; + $gettext_code = &TextFile_DetermineEncoding ("../$_.h") if ($gettext_support_nonascii and not defined $forced_gettext_code); + } + else + { + if ($SRCDIR eq ".") { + print OUTFILE "$_\n"; + } else { + print OUTFILE "$SRCDIR/../$_\n"; + } + $gettext_code = &TextFile_DetermineEncoding ("../$_") if ($gettext_support_nonascii and not defined $forced_gettext_code); + } + + next if (! $gettext_support_nonascii); + + if (defined $forced_gettext_code) + { + $encoding=$forced_gettext_code; + } + elsif (defined $gettext_code and "$encoding" ne "$gettext_code") + { + if ($encoding eq "ASCII") + { + $encoding=$gettext_code; + } + elsif ($gettext_code ne "ASCII") + { + # Only report once because the message is quite long + if (! $encoding_problem_is_reported) + { + print STDERR "WARNING: You should use the same file encoding for all your project files,\n". + " but $PROGRAM thinks that most of the source files are in\n". + " $encoding encoding, while \"$_\" is (likely) in\n". + " $gettext_code encoding. If you are sure that all translatable strings\n". + " are in same encoding (say UTF-8), please \e[1m*prepend*\e[0m the following\n". + " line to POTFILES.in:\n\n". + " [encoding: UTF-8]\n\n". + " and make sure that configure.in/ac checks for $PACKAGE >= 0.27 .\n". + "(such warning message will only be reported once.)\n"; + $encoding_problem_is_reported = 1; + } + } + } + } + + close OUTFILE; + close INFILE; + + unlink "$MODULE.pot"; + my @xgettext_argument=("$XGETTEXT", + "--add-comments", + "--directory\=\.\.", + "--output\=$MODULE\.pot", + "--files-from\=\.\/POTFILES\.in\.temp"); + my $XGETTEXT_KEYWORDS = &FindPOTKeywords; + push @xgettext_argument, $XGETTEXT_KEYWORDS; + push @xgettext_argument, "--from-code\=$encoding" if ($gettext_support_nonascii); + push @xgettext_argument, $XGETTEXT_ARGS if $XGETTEXT_ARGS; + my $xgettext_command = join ' ', @xgettext_argument; + + # intercept xgettext error message + print "Running $xgettext_command\n" if $VERBOSE; + my $xgettext_error_msg = `$xgettext_command 2>\&1`; + my $command_failed = $?; + + unlink "POTFILES.in.temp"; + + print "Removing generated header (.h) files..." if $VERBOSE; + unlink foreach (@temp_headers); + print "done.\n" if $VERBOSE; + + if (! $command_failed) + { + if (! -e "$MODULE.pot") + { + print "None of the files in POTFILES.in contain strings marked for translation.\n" if $VERBOSE; + } + else + { + print "Wrote $MODULE.pot\n" if $VERBOSE; + } + } + else + { + if ($xgettext_error_msg =~ /--from-code/) + { + # replace non-ASCII error message with a more useful one. + print STDERR "ERROR: xgettext failed to generate PO template file because there is non-ASCII\n". + " string marked for translation. Please make sure that all strings marked\n". + " for translation are in uniform encoding (say UTF-8), then \e[1m*prepend*\e[0m the\n". + " following line to POTFILES.in and rerun $PROGRAM:\n\n". + " [encoding: UTF-8]\n\n"; + } + else + { + print STDERR "$xgettext_error_msg"; + if (-e "$MODULE.pot") + { + # is this possible? + print STDERR "ERROR: xgettext failed but still managed to generate PO template file.\n". + " Please consult error message above if there is any.\n"; + } + else + { + print STDERR "ERROR: xgettext failed to generate PO template file. Please consult\n". + " error message above if there is any.\n"; + } + } + exit (1); + } +} + +sub POFile_Update +{ + -f "$MODULE.pot" or die "$PROGRAM: $MODULE.pot does not exist.\n"; + + my $MSGMERGE = $ENV{"MSGMERGE"} || "/usr/bin/msgmerge"; + my ($lang, $outfile) = @_; + + print "Merging $lang.po with $MODULE.pot..." if $VERBOSE; + + my $infile = "$lang.po"; + $outfile = "$lang.po" if ($outfile eq ""); + + # I think msgmerge won't overwrite old file if merge is not successful + system ("$MSGMERGE", "-o", $outfile, $infile, "$MODULE.pot"); +} + +sub Console_WriteError_NotExisting +{ + my ($file) = @_; + + ## Report error if supplied language file is non-existing + print STDERR "$PROGRAM: $file does not exist!\n"; + print STDERR "Try '$PROGRAM --help' for more information.\n"; + exit; +} + +sub GatherPOFiles +{ + my @po_files = glob ("./*.po"); + + @languages = map (&POFile_GetLanguage, @po_files); + + foreach my $lang (@languages) + { + $po_files_by_lang{$lang} = shift (@po_files); + } +} + +sub POFile_GetLanguage ($) +{ + s/^(.*\/)?(.+)\.po$/$2/; + return $_; +} + +sub Console_Write_TranslationStatus +{ + my ($lang, $output_file) = @_; + my $MSGFMT = $ENV{"MSGFMT"} || "/usr/bin/msgfmt"; + + $output_file = "$lang.po" if ($output_file eq ""); + + system ("$MSGFMT", "-o", "/dev/null", "--statistics", $output_file); +} + +sub Console_Write_CoverageReport +{ + my $MSGFMT = $ENV{"MSGFMT"} || "/usr/bin/msgfmt"; + + &GatherPOFiles; + + foreach my $lang (@languages) + { + print "$lang: "; + &POFile_Update ($lang, ""); + } + + print "\n\n * Current translation support in $MODULE \n\n"; + + foreach my $lang (@languages) + { + print "$lang: "; + system ("$MSGFMT", "-o", "/dev/null", "--statistics", "$lang.po"); + } +} + +sub SubstituteVariable +{ + my ($str) = @_; + + # always need to rewind file whenever it has been accessed + seek (CONF, 0, 0); + + # cache each variable. varhash is global to we can add + # variables elsewhere. + while () + { + if (/^(\w+)=(.*)$/) + { + ($varhash{$1} = $2) =~ s/^["'](.*)["']$/$1/; + } + } + + if ($str =~ /^(.*)\${?([A-Z_]+)}?(.*)$/) + { + my $rest = $3; + my $untouched = $1; + my $sub = $varhash{$2}; + + return SubstituteVariable ("$untouched$sub$rest"); + } + + # We're using Perl backticks ` and "echo -n" here in order to + # expand any shell escapes (such as backticks themselves) in every variable + return `echo -n "$str"`; +} + +sub CONF_Handle_Open +{ + my $base_dirname = getcwd(); + $base_dirname =~ s@.*/@@; + + my ($conf_in, $src_dir); + + if ($base_dirname =~ /^po(-.+)?$/) + { + if (-f "Makevars") + { + my $makefile_source; + + local (*IN); + open (IN, ") + { + if (/^top_builddir[ \t]*=/) + { + $src_dir = $_; + $src_dir =~ s/^top_builddir[ \t]*=[ \t]*([^ \t\n\r]*)/$1/; + + chomp $src_dir; + if (-f "$src_dir" . "/configure.ac") { + $conf_in = "$src_dir" . "/configure.ac" . "\n"; + } else { + $conf_in = "$src_dir" . "/configure.in" . "\n"; + } + last; + } + } + close IN; + + $conf_in || die "Cannot find top_builddir in Makevars."; + } + elsif (-f "../configure.ac") + { + $conf_in = "../configure.ac"; + } + elsif (-f "../configure.in") + { + $conf_in = "../configure.in"; + } + else + { + my $makefile_source; + + local (*IN); + open (IN, ") + { + if (/^top_srcdir[ \t]*=/) + { + $src_dir = $_; + $src_dir =~ s/^top_srcdir[ \t]*=[ \t]*([^ \t\n\r]*)/$1/; + + chomp $src_dir; + $conf_in = "$src_dir" . "/configure.in" . "\n"; + + last; + } + } + close IN; + + $conf_in || die "Cannot find top_srcdir in Makefile."; + } + + open (CONF, "<$conf_in"); + } + else + { + print STDERR "$PROGRAM: Unable to proceed.\n" . + "Make sure to run this script inside the po directory.\n"; + exit; + } +} + +sub FindPackageName +{ + my $version; + my $domain = &FindMakevarsDomain; + my $name = $domain || "untitled"; + + &CONF_Handle_Open; + + my $conf_source; { + local (*IN); + open (IN, "<&CONF") || return $name; + seek (IN, 0, 0); + local $/; # slurp mode + $conf_source = ; + close IN; + } + + # priority for getting package name: + # 1. GETTEXT_PACKAGE + # 2. first argument of AC_INIT (with >= 2 arguments) + # 3. first argument of AM_INIT_AUTOMAKE (with >= 2 argument) + + # /^AM_INIT_AUTOMAKE\([\s\[]*([^,\)\s\]]+)/m + # the \s makes this not work, why? + if ($conf_source =~ /^AM_INIT_AUTOMAKE\(([^,\)]+),([^,\)]+)/m) + { + ($name, $version) = ($1, $2); + $name =~ s/[\[\]\s]//g; + $version =~ s/[\[\]\s]//g; + $varhash{"AC_PACKAGE_NAME"} = $name; + $varhash{"PACKAGE"} = $name; + $varhash{"AC_PACKAGE_VERSION"} = $version; + $varhash{"VERSION"} = $version; + } + + if ($conf_source =~ /^AC_INIT\(([^,\)]+),([^,\)]+)/m) + { + ($name, $version) = ($1, $2); + $name =~ s/[\[\]\s]//g; + $version =~ s/[\[\]\s]//g; + $varhash{"AC_PACKAGE_NAME"} = $name; + $varhash{"PACKAGE"} = $name; + $varhash{"AC_PACKAGE_VERSION"} = $version; + $varhash{"VERSION"} = $version; + } + + # \s makes this not work, why? + $name = $1 if $conf_source =~ /^GETTEXT_PACKAGE=\[?([^\n\]]+)/m; + + # prepend '$' to auto* internal variables, usually they are + # used in configure.in/ac without the '$' + $name =~ s/AC_/\$AC_/g; + $name =~ s/\$\$/\$/g; + + $name = $domain if $domain; + + $name = SubstituteVariable ($name); + $name =~ s/^["'](.*)["']$/$1/; + + return $name if $name; +} + + +sub FindPOTKeywords +{ + + my $keywords = "--keyword\=\_ --keyword\=N\_ --keyword\=U\_"; + my $varname = "XGETTEXT_OPTIONS"; + my $make_source; { + local (*IN); + open (IN, "; + close IN; + } + + $keywords = $1 if $make_source =~ /^$varname[ ]*=\[?([^\n\]]+)/m; + + return $keywords; +} + +sub FindMakevarsDomain +{ + + my $domain = ""; + my $makevars_source; { + local (*IN); + open (IN, "; + close IN; + } + + $domain = $1 if $makevars_source =~ /^DOMAIN[ ]*=\[?([^\n\]\$]+)/m; + $domain =~ s/^\s+//; + $domain =~ s/\s+$//; + + return $domain; +} --- /dev/null +++ b/drgeo.desktop @@ -0,0 +1,69 @@ +[Desktop Entry] +Name=Dr.Geo +Name[ca]=Dr.Geo +Name[cs]=Dr.Geo +Name[da]=Dr Geo +Name[de]=Dr. Geo +Name[en_CA]=Dr.Geo +Name[en_GB]=Dr.Geo +Name[es]=Dr.Geo +Name[eu]=Dr.Geo +Name[fr]=Dr Geo +Name[ga]=Dr. Geo +Name[gu]=ડો. જીઓ +Name[hi]=डॉ जिओ +Name[hr]=Dr.Geo +Name[hu]=Dr.Geo +Name[it]=Dr. Geo +Name[ja]=Dr.Geo +Name[mr]=डॉ.जिओ +Name[nb]=Dr Geo +Name[ne]=ड्र. गियो +Name[nl]=Dr. Geo +Name[no]=Dr Geo +Name[pl]=Dr Geo +Name[pt]=Dr.Geo +Name[pt_BR]=Dr.Geo +Name[sq]=Dr.Geo +Name[sr]=др Гео +Name[sr@Latn]=dr Geo +Name[sv]=Dr.Geo +Name[zh_CN]=Dr.Geo +Name[zh_TW]=Dr.Geo +Comment=Dr.Geo Math Tool +Comment[ca]=Eina matemàtica del Dr. Geo +Comment[cs]=Nástroj pro matematiku Dr.Geo +Comment[da]=Matematikværktøjet Dr.Geo +Comment[de]=Interaktives Geometrieprogramm +Comment[en_CA]=Dr.Geo Math Tool +Comment[en_GB]=Dr.Geo Math Tool +Comment[es]=Herramienta Matemática de Dr. Geo +Comment[eu]=Dr.Geo-ren matematika-tresna +Comment[fr]=Outil mathématique Dr. Geo +Comment[ga]=Uirlís Math. Dr. Geo +Comment[gu]=ડો. જીઓ ગણિતશાસ્ત્ર નુ સાધન +Comment[hi]=डॉ जिओ गणित यन्त्र +Comment[hr]=Dr.Geo Math Tool +Comment[hu]=Dr.Geo interaktív geometria +Comment[it]=Strumenti matematici di Dr. Geo +Comment[ja]=Dr.Geo 数学ツール +Comment[mr]=डॉ जिओचे गणिताचे साधन +Comment[nb]=Dr.Geo matematikkverktøy +Comment[ne]=ड्र.गियो हिसाब उपकरण +Comment[nl]=Dr.Geo Math Tool +Comment[no]=Dr.Geo matematikkverktøy +Comment[pl]=Narzędzie matematyczne Dr Geo +Comment[pt]=Ferramenta Matemática Dr.Geo +Comment[pt_BR]=Ferramenta Matemática do Dr.Geo +Comment[sq]=Dr.Geo - Instrument për Matematikën +Comment[sr]=Математички алат др Гео +Comment[sr@Latn]=Matematički alat dr Geo +Comment[sv]=Matteverktyget Dr.Geo +Comment[zh_CN]=Dr.Geo 数学软件 +Comment[zh_TW]=Dr.Geo 數學工具 +Exec=drgeo +Icon=drgeo_32x32.xpm +Terminal=false +StartupNotify=true +Type=Application +Categories=GNOME;Application;Education;Math; debian/patches/03-fix-segfault.patch0000664000000000000000000000055311752546333014472 0ustar # From: Francisco Manuel Garcia Claramonte # Subject: This patch fix the problem with the segfault problem when doing # Last-Update: 08-05-2012 --- a/geo/drgeo_figure.cc +++ b/geo/drgeo_figure.cc @@ -1309,7 +1309,7 @@ gint drgeoFigure::preferedUndoLevel () { - atoi (drgeoConfigGet (":undoLevel")); + return atoi (drgeoConfigGet (":undoLevel")); } void debian/patches/06-fix-ftbfs-gcc-4.5.patch0000664000000000000000000000171011752546333015021 0ustar # From: Fabrice Coutadeur #Subject: fix FTBFS with gcc 4.5 with undefined reference to # --- a/geo/drgeo_dialog.cc +++ b/geo/drgeo_dialog.cc @@ -38,13 +38,7 @@ // Used in the style dialod callback, I know it's ugly, but so easy static drgeoFigure *selected_figure; -struct -{ - drgeoPoint mouse; - drgeoFigure *figure; -} -drgeoDialogData; - +DialogData drgeoDialogData; static void drgeo_edit_dialog_cb (GtkWidget * dialog, gint button, gpointer entry); --- a/geo/drgeo_dialog.h +++ b/geo/drgeo_dialog.h @@ -34,4 +34,11 @@ } #endif /* __cplusplus */ + +typedef struct +{ + drgeoPoint mouse; + drgeoFigure *figure; +} DialogData; + #endif --- a/geo/drgeo_figure.cc +++ b/geo/drgeo_figure.cc @@ -48,12 +48,7 @@ #include "drgeo_dialog.h" #include "traite.h" -extern struct -{ - drgeoPoint mouse; - drgeoFigure *figure; -} -drgeoDialogData; +extern DialogData drgeoDialogData; typedef struct drgeoSearchValue { debian/patches/02-desktop-file-icon.patch0000664000000000000000000000054511752546333015410 0ustar # From: Francisco Manuel Garcia Claramonte # Subject: This patch fix the problem with the missing icon in desktop # Last-Update: 08-05-2012 --- a/drgeo.desktop.in +++ b/drgeo.desktop.in @@ -3,7 +3,7 @@ _Name=Dr.Geo _Comment=Dr.Geo Math Tool Exec=drgeo -Icon=gnome-drgenius.png +Icon=drgeo_32x32.xpm Terminal=false StartupNotify=true Type=Application