Skip to content

Commit 5b78489

Browse files
committed
Added meson build files. Updated readme. Minor fixes.
1 parent 37e6ca1 commit 5b78489

File tree

9 files changed

+330
-174
lines changed

9 files changed

+330
-174
lines changed

.gitignore

Lines changed: 46 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -1,15 +1,50 @@
1-
Makefile
2-
Makefile.in
1+
/*.bak
2+
/*.lo
3+
/*.o
4+
/*.orig
5+
/*.rej
6+
/*.tab.c
7+
/*~
8+
/.*.sw[nop]
9+
/.deps
10+
/.dirstamp
11+
/.gitignore
12+
/.libs
13+
/GPATH
14+
/GRTAGS
15+
/GSYMS
16+
/GTAGS
17+
/ID
18+
/Makefile
19+
/Makefile.in
20+
/TAGS
21+
/_libs
322
/aclocal.m4
23+
/autom4te.cache
24+
/config
25+
/config.cache
26+
/config.h
427
/config.log
28+
/config.lt
529
/config.status
6-
src/.deps
7-
/src/.sconsign.dblite
8-
*.o
9-
/src/paps
30+
/config.status.lineno
1031
/configure
11-
config/
12-
autom4te.cache
13-
*.pdf
14-
*.ps
15-
*.svg
32+
/configure.lineno
33+
/intltool-extract.in
34+
/intltool-merge.in
35+
/intltool-update.in
36+
/libtool
37+
/po/*.gmo
38+
/po/*.mo
39+
/po/.intltool-merge-cache
40+
/po/Makefile
41+
/po/Makefile.in
42+
/po/Makefile.in.in
43+
/po/POTFILES
44+
/po/paps.pot
45+
/po/stamp-it
46+
/so_locations
47+
/stamp-h1
48+
/tags
49+
build/
50+
*.tar.gz

INSTALL

Lines changed: 159 additions & 161 deletions
Large diffs are not rendered by default.

NEWS

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,14 @@
1+
Overview of changes between 0.7.0 and 0.7.1
2+
=============================================
3+
4+
* Added initial meson compilation support.
5+
6+
* Minor accumulated bug fixes since 0.7.0
7+
8+
9+
Older news
10+
=============================================
11+
112
* 2015-08-16 Sun
213

314
Ported paps to cairo

README.md

Lines changed: 19 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -3,6 +3,25 @@
33
paps is a command line program for converting Unicode text encoded in UTF-8
44
to postscript and pdf by using pango.
55

6+
# Example
7+
8+
Here is the output from processing the file misc/small-hello.utf8:
9+
10+
![Example image](misc/small-hello.png)
11+
12+
## History
13+
14+
paps was written around 2005 to enable printing of plain text unicode UTF-8 files. It is named by the use of the excellent Pango library (from which it took its first two characters) and outputed postscript (ps, the last two characters). When the initial version was written, there was no simple way of translating the output of pango to postscript outlines, and therefore Ι wrote my own font encoding library, by making use of the fact that postscript is a full programming language. This worked well when sending the resulting postscript to the printer, but it had some serious disadvantages:
15+
16+
- When converting to pdf you got huge files (two orders of magnitude larger!) since in contrast to postscript, pdf is not a programming language, and thus it encoded a path for each glyph.
17+
- You couldn't select and copy and paste from the resulting postscript file, since there was no underlying text, only graphic paths.
18+
19+
In the early 2010's the library cairo and its accompanying pangocairo library finally created an easy way of converting pango output to postscript in an idiomatic way. But it took me several years until I finally rewrote paps to make use of them.
20+
21+
But I finally did so and released the resulting version on github in 2015 as version 0.7.0 .
22+
23+
But even so the new cairo based version was not picked up! E.g. Fedora still supplies the old 0.6.8 version without cairo. Perhaps because I did not update the old SourceForge page.
24+
625
# Usage
726

827
Run `paps --help` for getting help.

meson.build

Lines changed: 54 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,54 @@
1+
project('paps', 'c',
2+
version: '0.7.0',
3+
default_options : ['c_std=c99'],
4+
meson_version : '>= 0.44')
5+
6+
# C compiler. This is the cross compiler if we're cross-compiling
7+
cc = meson.get_compiler('c')
8+
9+
cdata = configuration_data()
10+
11+
# Checks for library functions
12+
foreach f : ['memmove', 'memset', 'strdup']
13+
cdata.set('HAVE_' + f.to_upper(), cc.has_function(f))
14+
endforeach
15+
16+
# Checks for header files
17+
# Some HAVE_FOO defines need to be defined to either 1 or 0, others need to
18+
# be defined or undefined. The code base is a bit inconsistent there.
19+
foreach h : ['stdlib.h', 'string.h', 'memory.h']
20+
cdata.set10('HAVE_' + h.underscorify().to_upper(), cc.has_header(h))
21+
endforeach
22+
foreach h : ['strings.h', 'sys/times.h']
23+
cdata.set('HAVE_' + h.underscorify().to_upper(), cc.has_header(h))
24+
endforeach
25+
26+
# Not entirely correct, but sufficient for us. Should move away from this
27+
# ancient define and just include individual headers based on individual defs
28+
if cc.has_header('strings.h')
29+
# define to 1 or leave undefined otherwise, don't simplify
30+
cdata.set('STDC_HEADERS', 1)
31+
endif
32+
33+
# This is available pretty much everywhere
34+
cdata.set('HAVE_STRINGIZE', 1)
35+
36+
# Assume we have nls, since paps doesn't compile without it
37+
cdata.set('ENABLE_NLS',1)
38+
39+
# Not really sure what this is used for, but paps doesn't compile without it.
40+
cdata.set_quoted('DATADIR','.')
41+
42+
buildtype = get_option('buildtype')
43+
if buildtype == 'debug' or buildtype == 'debugoptimized'
44+
cdata.set('DEBUG', 1)
45+
endif
46+
47+
cdata.set_quoted('GETTEXT_PACKAGE', meson.project_name())
48+
49+
# write config.h
50+
config_h = configure_file(output: 'config.h', configuration: cdata)
51+
52+
incs = include_directories('.', 'src')
53+
54+
subdir('src')

misc/small-hello.png

20.4 KB
Loading

src/SConstruct

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,9 @@
11
env = Environment()
22
env.ParseConfig('pkg-config --cflags --libs pangocairo pangoft2')
33
env.Append(CFLAGS=['-Wall','-g'],
4+
CPPDEFINES=['ENABLE_NLS',
5+
'GETTEXT_PACKAGE=\\"paps\\"',
6+
'DATADIR=\\".\\"'],
47
LINKFLAGS=[#'-fsanitize=address', # Use for fsanitize
58
]
69
)

src/meson.build

Lines changed: 35 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,35 @@
1+
pkg = import('pkgconfig')
2+
pango_dep = dependency('pangoft2')
3+
cairo_dep = dependency('pangocairo')
4+
5+
paps_config = configuration_data()
6+
7+
paps_config.set('configure_input', 'paps-config.h file generated by Meson')
8+
paps_config.set('PACKAGE', meson.project_name())
9+
paps_config.set('PACKAGE_NAME', 'paps')
10+
paps_config.set('PACKAGE_BUGREPORT', 'https://github.com/paps/paps/issues/new')
11+
paps_config.set('PAPS_VERSION', meson.project_version())
12+
version_arr = meson.project_version().split('.')
13+
paps_config.set('PAPS_MAJOR_VERSION', version_arr[0].to_int())
14+
paps_config.set('PAPS_MINOR_VERSION', version_arr[1].to_int())
15+
paps_config.set('PAPS_MICRO_VERSION', version_arr[2].to_int())
16+
17+
paps_config.set('SIZEOF_INT', cc.sizeof('int'))
18+
19+
if cc.get_id() == 'msvc'
20+
paps_config.set('PAPS_MSVC_BUILD_PLACEHOLDER', '#define PAPS_BUILT_WITH_MSVC')
21+
else
22+
paps_config.set('PAPS_MSVC_BUILD_PLACEHOLDER', '#undef PAPS_BUILT_WITH_MSVC')
23+
endif
24+
25+
#paps_config_h = configure_file(input: files('paps-config.h.in'),
26+
# output: 'paps-config.h',
27+
# configuration: paps_config,
28+
# install_dir: join_paths(get_option('includedir'), 'paps'))
29+
30+
paps = executable('paps',
31+
['paps.c'],
32+
c_args: ['-DHAVE_CONFIG_H'],
33+
include_directories: incs,
34+
dependencies : [pango_dep, cairo_dep],
35+
install: true)

src/paps.c

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -37,6 +37,7 @@
3737
#include <math.h>
3838
#include <wchar.h>
3939
#include <libgen.h>
40+
#include <config.h>
4041

4142
#if ENABLE_NLS
4243
#include <libintl.h>
@@ -420,7 +421,7 @@ _paps_arg_cpi_cb(const gchar *option_name,
420421

421422

422423
/*
423-
* Return codeset name of the environment's locale.
424+
* Return codeset name of the environment's locale. Use UTF8 by default
424425
*/
425426
static char*
426427
get_encoding()
@@ -500,7 +501,7 @@ int main(int argc, char *argv[])
500501
{"markup", 0, 0, G_OPTION_ARG_NONE, &do_use_markup,
501502
N_("Interpret input text as pango markup."), NULL},
502503
{"encoding", 0, 0, G_OPTION_ARG_STRING, &encoding,
503-
N_("Assume encoding of input text. (Default: encoding of current locale)"), "ENCODING"},
504+
N_("Assume encoding of input text. (Default: UTF-8)"), "ENCODING"},
504505
{"lpi", 0, 0, G_OPTION_ARG_CALLBACK, _paps_arg_lpi_cb,
505506
N_("Set the amount of lines per inch."), "REAL"},
506507
{"cpi", 0, 0, G_OPTION_ARG_CALLBACK, _paps_arg_cpi_cb,

0 commit comments

Comments
 (0)