diff --git a/.cvsignore b/.cvsignore index e69de29..119f521 100644 --- a/.cvsignore +++ b/.cvsignore @@ -0,0 +1 @@ +paps-0.6.6.tar.gz diff --git a/paps-0.6.6-encoding.patch b/paps-0.6.6-encoding.patch new file mode 100644 index 0000000..abcd42a --- /dev/null +++ b/paps-0.6.6-encoding.patch @@ -0,0 +1,103 @@ +diff -ruN paps-0.6.6.orig/src/paps.c paps-0.6.6/src/paps.c +--- paps-0.6.6.orig/src/paps.c 2006-05-25 13:23:07.000000000 +0900 ++++ paps-0.6.6/src/paps.c 2006-05-25 14:55:03.000000000 +0900 +@@ -105,7 +105,8 @@ + + /* Information passed in user data when drawing outlines */ + GList *split_paragraphs_into_lines (GList *paragraphs); +-static char *read_file (FILE *file); ++static char *read_file (FILE *file, ++ GIConv handle); + static GList *split_text_into_paragraphs (PangoContext *pango_context, + page_layout_t *page_layout, + int paint_width, +@@ -188,7 +189,7 @@ + gboolean do_landscape = FALSE, do_rtl = FALSE, do_justify = FALSE, do_draw_header = FALSE; + int num_columns = 1, font_scale = 12; + int top_margin = 36, bottom_margin = 36, right_margin = 36, left_margin = 36; +- char *font_family = "Monospace"; ++ char *font_family = "Monospace", *encoding = NULL; + GOptionContext *ctxt = g_option_context_new("[text file]"); + GOptionEntry entries[] = { + {"landscape", 0, 0, G_OPTION_ARG_NONE, &do_landscape, "Landscape output. (Default: portrait)", NULL}, +@@ -205,6 +206,7 @@ + {"right-margin", 0, 0, G_OPTION_ARG_INT, &right_margin, "Set right margin. (Default: 36)", "NUM"}, + {"left-margin", 0, 0, G_OPTION_ARG_INT, &left_margin, "Set left margin. (Default: 36)", "NUM"}, + {"header", 0, 0, G_OPTION_ARG_NONE, &do_draw_header, "Draw page header for each page.", NULL}, ++ {"encoding", 0, 0, G_OPTION_ARG_STRING, &encoding, "Assume the documentation encoding.", "ENCODING"}, + {NULL} + }; + GError *error = NULL; +@@ -228,6 +230,7 @@ + gchar *paps_header = NULL; + gchar *header_font_desc = "Monospace Bold 12"; + int header_sep = 20; ++ GIConv cvh = NULL; + + /* Prerequisite when using glib. */ + g_type_init(); +@@ -339,7 +342,21 @@ + page_layout.filename = filename_in; + page_layout.header_font_desc = header_font_desc; + +- text = read_file(IN); ++ if (encoding != NULL) ++ { ++ cvh = g_iconv_open ("UTF-8", encoding); ++ if (cvh == NULL) ++ { ++ fprintf(stderr, "%s: Invalid encoding: %s\n", g_get_prgname (), encoding); ++ exit(-1); ++ } ++ } ++ ++ text = read_file(IN, cvh); ++ ++ if (encoding != NULL && cvh != NULL) ++ g_iconv_close(cvh); ++ + paragraphs = split_text_into_paragraphs(pango_context, + &page_layout, + page_layout.column_width * page_layout.pt_to_pixel, +@@ -373,7 +390,8 @@ + /* Read an entire file into a string + */ + static char * +-read_file (FILE *file) ++read_file (FILE *file, ++ GIConv handle) + { + GString *inbuf; + char *text; +@@ -382,7 +400,9 @@ + inbuf = g_string_new (NULL); + while (1) + { +- char *bp = fgets (buffer, BUFSIZE-1, file); ++ char *ib, *ob, obuffer[BUFSIZE * 6], *bp = fgets (buffer, BUFSIZE-1, file); ++ gsize iblen, oblen; ++ + if (ferror (file)) + { + fprintf(stderr, "%s: Error reading file.\n", g_get_prgname ()); +@@ -392,7 +412,19 @@ + else if (bp == NULL) + break; + +- g_string_append (inbuf, buffer); ++ if (handle != NULL) ++ { ++ ib = bp; ++ iblen = strlen (ib); ++ ob = bp = obuffer; ++ oblen = BUFSIZE * 6 - 1; ++ if (g_iconv (handle, &ib, &iblen, &ob, &oblen) == -1) ++ { ++ fprintf (stderr, "%s: Error while converting strings.\n", g_get_prgname ()); ++ return NULL; ++ } ++ } ++ g_string_append (inbuf, bp); + } + + fclose (file); diff --git a/paps-0.6.6-font-option.patch b/paps-0.6.6-font-option.patch new file mode 100644 index 0000000..a8fb692 --- /dev/null +++ b/paps-0.6.6-font-option.patch @@ -0,0 +1,94 @@ +diff -ruN paps-0.6.6.orig/src/paps.1 paps-0.6.6/src/paps.1 +--- paps-0.6.6.orig/src/paps.1 2006-06-20 04:09:58.000000000 +0900 ++++ paps-0.6.6/src/paps.1 2006-06-20 04:12:23.000000000 +0900 +@@ -34,11 +34,8 @@ + .B \-\-columns=cl + Number of columns output. Default is 1. + .TP +-.B \-\-font\-scale=fs +-Font scaling. Default is 12. +-.TP +-.B \-\-family=f +-Pango ft2 font family. Default is Monospace. ++.B \-\-font=desc ++Set the font description. Default is Monospace 12. + .TP + .B \-\-rtl + Do rtl layout. +diff -ruN paps-0.6.6.orig/src/paps.c paps-0.6.6/src/paps.c +--- paps-0.6.6.orig/src/paps.c 2006-06-20 04:09:58.000000000 +0900 ++++ paps-0.6.6/src/paps.c 2006-06-20 04:01:57.000000000 +0900 +@@ -30,7 +30,11 @@ + #include + + #define BUFSIZE 1024 +-#define HEADER_FONT_SCALE 12 ++#define DEFAULT_FONT_FAMILY "Monospace" ++#define DEFAULT_FONT_SIZE 12 ++#define HEADER_FONT_FAMILY "Monospace Bold" ++#define HEADER_FONT_SCALE 12 ++#define MAKE_FONT_NAME(f,s) f " " #s + + typedef enum { + PAPER_TYPE_A4 = 0, +@@ -187,15 +191,14 @@ + int main(int argc, char *argv[]) + { + gboolean do_landscape = FALSE, do_rtl = FALSE, do_justify = FALSE, do_draw_header = FALSE; +- int num_columns = 1, font_scale = 12; ++ int num_columns = 1; + int top_margin = 36, bottom_margin = 36, right_margin = 36, left_margin = 36; +- char *font_family = "Monospace", *encoding = NULL; ++ gchar *font = MAKE_FONT_NAME (DEFAULT_FONT_FAMILY, DEFAULT_FONT_SIZE), *encoding = NULL; + GOptionContext *ctxt = g_option_context_new("[text file]"); + GOptionEntry entries[] = { + {"landscape", 0, 0, G_OPTION_ARG_NONE, &do_landscape, "Landscape output. (Default: portrait)", NULL}, + {"columns", 0, 0, G_OPTION_ARG_INT, &num_columns, "Number of columns output. (Default: 1)", "NUM"}, +- {"font-scale", 0, 0, G_OPTION_ARG_INT, &font_scale, "Font scaling. (Default: 12)", "NUM"}, +- {"family", 0, 0, G_OPTION_ARG_STRING, &font_family, "Pango FT2 font family. (Default: Monospace)", "FAMILY"}, ++ {"font", 0, 0, G_OPTION_ARG_STRING, &font, "Set the font description. (Default: Monospace 12)", "DESC"}, + {"rtl", 0, 0, G_OPTION_ARG_NONE, &do_rtl, "Do rtl layout.", NULL}, + {"justify", 0, 0, G_OPTION_ARG_NONE, &do_justify, "Do justify the lines.", NULL}, + {"paper", 0, 0, G_OPTION_ARG_CALLBACK, _paps_arg_paper_cb, +@@ -210,11 +213,8 @@ + {NULL} + }; + GError *error = NULL; +- char *filename_in; +- char *title; + FILE *IN, *OUT = NULL; + page_layout_t page_layout; +- char *text; + GList *paragraphs; + GList *pango_lines; + PangoContext *pango_context; +@@ -228,7 +228,8 @@ + int do_tumble = -1; /* -1 means not initialized */ + int do_duplex = -1; + gchar *paps_header = NULL; +- gchar *header_font_desc = "Monospace Bold 12"; ++ gchar *header_font_desc = MAKE_FONT_NAME (HEADER_FONT_FAMILY, HEADER_FONT_SIZE); ++ gchar *filename_in, *title, *text; + int header_sep = 20; + GIConv *cvh = NULL; + +@@ -271,13 +272,12 @@ + pango_context_set_language (pango_context, pango_language_from_string ("en_US")); + pango_context_set_base_dir (pango_context, pango_dir); + +- font_description = pango_font_description_new (); +- pango_font_description_set_family (font_description, g_strdup(font_family)); +- pango_font_description_set_style (font_description, PANGO_STYLE_NORMAL); +- pango_font_description_set_variant (font_description, PANGO_VARIANT_NORMAL); +- pango_font_description_set_weight (font_description, PANGO_WEIGHT_NORMAL); +- pango_font_description_set_stretch (font_description, PANGO_STRETCH_NORMAL); +- pango_font_description_set_size (font_description, font_scale * PANGO_SCALE); ++ /* create the font description */ ++ font_description = pango_font_description_from_string (font); ++ if ((pango_font_description_get_set_fields (font_description) & PANGO_FONT_MASK_FAMILY) == 0) ++ pango_font_description_set_family (font_description, DEFAULT_FONT_FAMILY); ++ if ((pango_font_description_get_set_fields (font_description) & PANGO_FONT_MASK_SIZE) == 0) ++ pango_font_description_set_size (font_description, DEFAULT_FONT_SIZE * PANGO_SCALE); + + pango_context_set_font_description (pango_context, font_description); + diff --git a/paps-0.6.6-lcctype.patch b/paps-0.6.6-lcctype.patch new file mode 100644 index 0000000..9e8afc2 --- /dev/null +++ b/paps-0.6.6-lcctype.patch @@ -0,0 +1,47 @@ +diff -ruN paps-0.6.6.orig/src/paps.c paps-0.6.6/src/paps.c +--- paps-0.6.6.orig/src/paps.c 2006-06-20 04:17:28.000000000 +0900 ++++ paps-0.6.6/src/paps.c 2006-06-20 04:24:27.000000000 +0900 +@@ -28,6 +28,7 @@ + #include + #include + #include ++#include + + #define BUFSIZE 1024 + #define DEFAULT_FONT_FAMILY "Monospace" +@@ -188,6 +188,26 @@ + return retval; + } + ++static PangoLanguage * ++get_language(void) ++{ ++ PangoLanguage *retval; ++ gchar *lang = g_strdup (setlocale (LC_CTYPE, NULL)); ++ gchar *p; ++ ++ p = strchr (lang, '.'); ++ if (p) ++ *p = 0; ++ p = strchr (lang, '@'); ++ if (p) ++ *p = 0; ++ ++ retval = pango_language_from_string (lang); ++ g_free (lang); ++ ++ return retval; ++} ++ + int main(int argc, char *argv[]) + { + gboolean do_landscape = FALSE, do_rtl = FALSE, do_justify = FALSE, do_draw_header = FALSE; +@@ -269,7 +289,7 @@ + pango_context = paps_get_pango_context (paps); + + /* Setup pango */ +- pango_context_set_language (pango_context, pango_language_from_string ("en_US")); ++ pango_context_set_language (pango_context, get_language ()); + pango_context_set_base_dir (pango_context, pango_dir); + + /* create the font description */ diff --git a/paps-0.6.6-segfault.patch b/paps-0.6.6-segfault.patch new file mode 100644 index 0000000..5f98522 --- /dev/null +++ b/paps-0.6.6-segfault.patch @@ -0,0 +1,12 @@ +diff -ruN paps-0.6.6.orig/src/paps.c paps-0.6.6/src/paps.c +--- paps-0.6.6.orig/src/paps.c 2006-05-25 15:12:02.000000000 +0900 ++++ paps-0.6.6/src/paps.c 2006-05-25 15:15:58.000000000 +0900 +@@ -453,7 +453,7 @@ + GList *result = NULL; + char *last_para = text; + +- while (*p) ++ while (p != NULL && *p) + { + wc = g_utf8_get_char (p); + next = g_utf8_next_char (p); diff --git a/paps-0.6.6-wordwrap.patch b/paps-0.6.6-wordwrap.patch new file mode 100644 index 0000000..a3d113d --- /dev/null +++ b/paps-0.6.6-wordwrap.patch @@ -0,0 +1,11 @@ +diff -ruN -x 'Makefile*' -x autom4te.cache -x 'config*' -x doc -x 'foo*' -x 'lib*' -x .deps -x .libs -x paps -x '*o' -x '*~' -x 'stamp*' -x 'test*' paps-0.6.6.orig/src/paps.c paps-0.6.6/src/paps.c +--- paps-0.6.6.orig/src/paps.c 2006-06-20 20:40:11.000000000 +0900 ++++ paps-0.6.6/src/paps.c 2006-06-21 01:36:54.000000000 +0900 +@@ -495,6 +495,7 @@ + page_layout->pango_dir == PANGO_DIRECTION_LTR + ? PANGO_ALIGN_LEFT : PANGO_ALIGN_RIGHT); + pango_layout_set_width (para->layout, paint_width * PANGO_SCALE); ++ pango_layout_set_wrap (para->layout, PANGO_WRAP_WORD_CHAR); + para->height = 0; + + if (wc == '\f') diff --git a/paps-makefile.patch b/paps-makefile.patch new file mode 100644 index 0000000..1f4f992 --- /dev/null +++ b/paps-makefile.patch @@ -0,0 +1,47 @@ +diff -ruN paps-0.6.5.orig/doc/Makefile.am paps-0.6.5/doc/Makefile.am +--- paps-0.6.5.orig/doc/Makefile.am 2005-12-21 04:35:35.000000000 +0900 ++++ paps-0.6.5/doc/Makefile.am 2006-04-17 17:28:52.000000000 +0900 +@@ -10,7 +10,7 @@ + + EXTRA_DIST = Doxyfile example-output.png mainpage.h + +-htmldir = share/doc/libpaps/html +-install-data-hook: +- mkdir -p $(prefix)/$(htmldir) +- cp -dpR doxygen-html/* $(prefix)/$(htmldir) ++htmldir = $(datadir)/doc/paps-$(VERSION)/html ++#install-data-hook: ++# mkdir -p $(prefix)/$(htmldir) ++# cp -dpR doxygen-html/* $(prefix)/$(htmldir) +diff -ruN paps-0.6.5.orig/src/Makefile.am paps-0.6.5/src/Makefile.am +--- paps-0.6.5.orig/src/Makefile.am 2006-04-17 15:04:13.000000000 +0900 ++++ paps-0.6.5/src/Makefile.am 2006-04-17 17:30:01.000000000 +0900 +@@ -1,5 +1,5 @@ + man_MANS = paps.1 +-lib_LIBRARIES = libpaps.a ++noinst_LIBRARIES = libpaps.a + libpaps_a_SOURCES = libpaps.c + libpaps_a_inc_HEADERS = libpaps.h + libpaps_a_incdir = $(includedir) +@@ -7,9 +7,9 @@ + bin_PROGRAMS = paps + paps_CFLAGS = -Wall + paps_SOURCES = paps.c +-paps_LDADD = $(lib_LIBRARIES) $(all_libraries) ++paps_LDADD = $(noinst_LIBRARIES) $(all_libraries) + paps_LDFLAGS = `pkg-config --libs pangoft2` +-paps_DEPENDENCIES = $(lib_LIBRARIES) ++paps_DEPENDENCIES = $(noinst_LIBRARIES) + + EXTRA_DIST = test_libpaps.c paps.1 + +@@ -21,7 +21,7 @@ + + + test_libpaps_SOURCES = test_libpaps.c +-test_libpaps_LDADD = $(lib_LIBRARIES) $(all_libraries) ++test_libpaps_LDADD = $(noinst_LIBRARIES) $(all_libraries) + test_libpaps_LDFLAGS = `pkg-config --libs pangoft2` +-test_libpaps_DEPENDENCIES = $(lib_LIBRARIES) ++test_libpaps_DEPENDENCIES = $(noinst_LIBRARIES) + diff --git a/paps-typo-font-scale.patch b/paps-typo-font-scale.patch new file mode 100644 index 0000000..f2fc83f --- /dev/null +++ b/paps-typo-font-scale.patch @@ -0,0 +1,34 @@ +Index: src/paps.c +=================================================================== +RCS file: /cvsroot/paps/paps/paps/src/paps.c,v +retrieving revision 1.4 +retrieving revision 1.5 +diff -u -r1.4 -r1.5 +--- src/paps.c 17 Apr 2006 07:42:08 -0000 1.4 ++++ src/paps.c 25 May 2006 07:26:55 -0000 1.5 +@@ -190,7 +190,7 @@ + GOptionEntry entries[] = { + {"landscape", 0, 0, G_OPTION_ARG_NONE, &do_landscape, "Landscape output. (Default: portrait)", NULL}, + {"columns", 0, 0, G_OPTION_ARG_INT, &num_columns, "Number of columns output. (Default: 1)", "NUM"}, +- {"font_scale", 0, 0, G_OPTION_ARG_INT, &font_scale, "Font scaling. (Default: 12)", "NUM"}, ++ {"font-scale", 0, 0, G_OPTION_ARG_INT, &font_scale, "Font scaling. (Default: 12)", "NUM"}, + {"family", 0, 0, G_OPTION_ARG_STRING, &font_family, "Pango FT2 font family. (Default: Monospace)", "FAMILY"}, + {"rtl", 0, 0, G_OPTION_ARG_NONE, &do_rtl, "Do rtl layout.", NULL}, + {"justify", 0, 0, G_OPTION_ARG_NONE, &do_justify, "Do justify the lines.", NULL}, +Index: src/paps.1 +=================================================================== +RCS file: /cvsroot/paps/paps/paps/src/paps.1,v +retrieving revision 1.1 +retrieving revision 1.2 +diff -u -r1.1 -r1.2 +--- src/paps.1 17 Apr 2006 19:21:43 -0000 1.1 ++++ src/paps.1 25 May 2006 07:26:55 -0000 1.2 +@@ -34,7 +34,7 @@ + .B \-\-columns=cl + Number of columns output. Default is 1. + .TP +-.B \-\-fontscale=fs ++.B \-\-font\-scale=fs + Font scaling. Default is 12. + .TP + .B \-\-family=f diff --git a/paps.spec b/paps.spec new file mode 100644 index 0000000..a2ee7e1 --- /dev/null +++ b/paps.spec @@ -0,0 +1,132 @@ +Name: paps +Version: 0.6.6 +Release: 6.fc6 + +License: LGPL +URL: http://paps.sourceforge.net/ +Source0: http://prdownloads.sourceforge.net/paps/paps-%{version}.tar.gz +BuildRoot: %{_tmppath}/%{name}-%{version}-%{release}-root-%(%{__id_u} -n) +BuildRequires: pango-devel automake autoconf libtool doxygen +Patch0: paps-makefile.patch +## http://sourceforge.net/mailarchive/forum.php?thread_id=9329194&forum_id=47278 +Patch2: paps-0.6.3-formfeed.patch +## http://sourceforge.net/tracker/index.php?func=detail&aid=1494769&group_id=153049&atid=786242 +Patch3: paps-0.6.6-encoding.patch +## fixed in CVS +Patch4: paps-typo-font-scale.patch +## fixed in CVS +Patch5: paps-0.6.6-segfault.patch +## http://sourceforge.net/tracker/index.php?func=detail&aid=1512382&group_id=153049&atid=786242 +Patch6: paps-0.6.6-font-option.patch +## http://sourceforge.net/tracker/index.php?func=detail&aid=1512384&group_id=153049&atid=786239 +Patch7: paps-0.6.6-lcctype.patch +## http://sourceforge.net/tracker/index.php?func=detail&aid=1512385&group_id=153049&atid=786239 +Patch8: paps-0.6.6-wordwrap.patch + +Summary: Plain Text to PostScript converter +Group: Applications/Publishing +%description +paps is a PostScript converter from plain text file using Pango. + + +%prep +%setup -q +%patch0 -p1 -b .makefile +%patch2 -p1 -b .formfeed +%patch3 -p1 -b .encoding +%patch4 -p0 -b .typo +%patch5 -p1 -b .segfault +%patch6 -p1 -b .fontopt +%patch7 -p1 -b .lcctype +%patch8 -p1 -b .wordwrap +aclocal +automake +autoconf + + +%build +%configure +make %{?_smp_mflags} + + +%install +rm -rf $RPM_BUILD_ROOT + +make install DESTDIR=$RPM_BUILD_ROOT +rm -rf $RPM_BUILD_ROOT%{_includedir} + +%clean +rm -rf $RPM_BUILD_ROOT + +%files +%defattr(-, root, root, -) +%doc AUTHORS COPYING.LIB README TODO +%{_bindir}/paps +%{_mandir}/man1/paps.1* + + +%changelog +* Wed Jun 21 2006 Akira TAGOH - 0.6.6-6 +- paps-0.6.6-wordwrap.patch: applied to do a wordwrap. + +* Tue Jun 20 2006 Akira TAGOH - 0.6.6-5 +- paps-typo-font-scale.patch: backported from CVS. +- paps-0.6.6-font-option.patch: integrated --font-family and --font-scale + options to --font. +- paps-0.6.6-lcctype.patch: follow LC_CTYPE to determine the default language. + +* Fri Jun 16 2006 Akira TAGOH - 0.6.6-4 +- added libtool and doxygen to BuildReq. +- removed NEWS file which is empty. + +* Mon Jun 12 2006 Akira TAGOH - 0.6.6-3 +- use make install DESTDIR=... instead of %%makeinstall +- add automake and autoconf to BuildReq. + +* Thu May 25 2006 Akira TAGOH - 0.6.6-2 +- paps-0.6.6-encoding.patch: support --encoding option to be able to convert + the input file to UTF-8. +- paps-0.6.6-segfault.patch: fixed a possible segfault issue when reading is + failed. + +* Fri May 19 2006 Akira TAGOH - 0.6.6-1 +- New upstream release. + +* Mon Apr 17 2006 Akira TAGOH - 0.6.5-1 +- New upstream release. + - paps-0.6.3-fix-pagesize.patch: removed. it has been merged in upstream. + - paps-0.6.3-goption.patch: removed. it has been merged in upstream. + - paps-0.6.3-header.patch: removed. it has been merged in upstream. +- paps-makefile.patch: rework to be applied. + +* Fri Mar 31 2006 Akira TAGOH - 0.6.3-4 +- paps-0.6.3-formfeed.patch: applied to deal with the formfeed mark properly. +- paps-0.6.3-goption.patch: rewritten option parser using GOption. and segfault + gone as well. (#187205) +- paps-0.6.3-header.patch: applied to support the output of the page header. + +* Fri Mar 24 2006 Akira TAGOH - 0.6.3-3 +- paps-0.6.3-fix-pagesize.patch: fixed displaying the beginning of line at out of page. (#176207) + +* Thu Mar 2 2006 Akira TAGOH - 0.6.3-2 +- rebuilt. + +* Wed Jan 11 2006 Akira TAGOH - 0.6.3-1 +- New upstream release. +- paps-0.6.2-fix-bufferoverflow.patch: removed. + +* Wed Dec 21 2005 Akira TAGOH - 0.6.2-1 +- New upstream release. + - the bitmap font is now ignored. (#176206) +- paps-0.6.2-fix-bufferoverflow.patch: applied to fix the buffer overflow. + +* Tue Dec 13 2005 Akira TAGOH - 0.6.1-1 +- New upstream release. +- paps-0.6.1-makefile.patch: applied to install docs on the proper dir. + +* Fri Nov 4 2005 Akira TAGOH - 0.5-1 +- New upstream release. + +* Tue Oct 18 2005 Akira TAGOH - 0.3-1 +- Initial package. + diff --git a/sources b/sources index e69de29..fbec873 100644 --- a/sources +++ b/sources @@ -0,0 +1 @@ +cc0975e70fe1e704e16f2fb08c71cee2 paps-0.6.6.tar.gz