dov / paps

A text to postscript converter through pango
Other
52 stars 15 forks source link

build on cygwin? #50

Open mintty opened 1 year ago

mintty commented 1 year ago

I tried to build paps on cygwin. File INSTALL mentions a configure script but there is none. INSTALL.md advises to use meson and mentions a dependency to fmtlib (pango and cairo dependencies could also be mentioned) - however, fmtlib does not have any build instructions at all.

dov commented 1 year ago

There is a configure file in the release tar ball, and it archive passes the checkdist test. Please try the tar ball and see if it works.

Regarding meson, I'm still very much a beginner w.r.t. it and would happily receive patches to make it work. All I really know is that it works well on my fedora system.

mintty commented 1 year ago

OK, there is no configure script and autogen.sh stalled the first time but worked later. Now configure claims missing package fmt, which I don't know how to build.

dov commented 1 year ago

Ok. Good. fmt is the libfmt library available from:

https://github.com/fmtlib/fmt

I'll add its dependency to the paps installation instructions. I thought that this library was quite ubiquitous by now, but perhaps I should bundle it.

mintty commented 1 year ago

The lib is mentioned as a dependency already. It is however obscure how to build it.

eli-schwartz commented 1 year ago

For Meson, it's as simple as executing the following command:

mkdir -p subprojects
meson wrap install fmt

This will cause Meson to bundle a copy of fmt, but only if there isn't one on the system already. See https://mesonbuild.com/Wrap-dependency-system-manual.html

Note: this doesn't require editing any files checked into git, and you can do it as an end user. You can also do it as the developer, and check it into git, which may be convenient for other users too. The only thing that's used is a small ini-file describing where to get the actual sources, anyway. :)

dov commented 1 year ago

@eli-schwartz Thanks! I did that. The wrapping will be part of the next release.

dov commented 1 year ago

I commited a change that includes wrapping of the fmt dependency. It would be great if @eli-schwartz or @mintty can review it and see if meson building works with it.

mintty commented 1 year ago

meson build

... meson.build:10:2: ERROR: Unknown variable "libsimple_proj".

eli-schwartz commented 1 year ago

https://github.com/dov/paps/blob/58afdc8a7ea02e7621ec0b8f2881a424afc8b7c1/meson.build#L6-L11

This is wrong, you don';t need any of this.

Note: this doesn't require editing any files checked into git

The only thing that's used is a small ini-file describing where to get the actual sources, anyway. :)

I very much mean this, for the record. :) The previous code in src/meson.build was fmt_dep = dependency('fmt') and this works fine as-is. The dependency() itself will first look on the system, and then look at the wrap.

dov commented 1 year ago

meson build

... meson.build:10:2: ERROR: Unknown variable "libsimple_proj".

My typo. Please pull again.

dov commented 1 year ago

https://github.com/dov/paps/blob/58afdc8a7ea02e7621ec0b8f2881a424afc8b7c1/meson.build#L6-L11

This is wrong, you don';t need any of this.

Note: this doesn't require editing any files checked into git

The only thing that's used is a small ini-file describing where to get the actual sources, anyway. :)

I very much mean this, for the record. :) The previous code in src/meson.build was fmt_dep = dependency('fmt') and this works fine as-is. The dependency() itself will first look on the system, and then look at the wrap.

Ok... Thanks. I reverted the change. I told you I'm a newbee w.r.t. meson. I'll add your instructions from Jan 27 to the ReadMe file.

mintty commented 1 year ago

After installing libpango-devel, meson build succeeds. But: ~/tmp/paps/build: ninja [1/7] Compiling C++ object subprojects/fmt-9.1.0/cygfmt.dll.p/src_os.cc.o FAILED: subprojects/fmt-9.1.0/cygfmt.dll.p/src_os.cc.o c++ -Isubprojects/fmt-9.1.0/cygfmt.dll.p -Isubprojects/fmt-9.1.0 -I../subprojects/fmt-9.1.0 -I../subprojects/fmt-9.1.0/include -I/home/towo/usr/include -I/home/towo/usr/include/ncursesw -I/usr/include/ncursesw -fdiagnostics-color=always -D_FILE_OFFSET_BITS=64 -Wall -Winvalid-pch -Wnon-virtual-dtor -std=c++14 -O0 -g -DFMT_EXPORT -MD -MQ subprojects/fmt-9.1.0/cygfmt.dll.p/src_os.cc.o -MF subprojects/fmt-9.1.0/cygfmt.dll.p/src_os.cc.o.d -o subprojects/fmt-9.1.0/cygfmt.dll.p/src_os.cc.o -c ../subprojects/fmt-9.1.0/src/os.cc In file included from ../subprojects/fmt-9.1.0/src/os.cc:13: ../subprojects/fmt-9.1.0/src/os.cc: In member function ‘int fmt::v9::bufferedfile::descriptor() const’: ../subprojects/fmt-9.1.0/src/os.cc:206:27: error: ‘::fileno’ has not been declared; did you mean ‘file’? 206 | int fd = FMT_POSIXCALL(fileno(file)); | ^~ ../subprojects/fmt-9.1.0/include/fmt/os.h:56:36: note: in definition of macro ‘FMT_POSIX_CALL’ 56 | # define FMT_POSIX_CALL(call) ::call | ^~~~ ../subprojects/fmt-9.1.0/src/os.cc: In member function ‘fmt::v9::buffered_file fmt::v9::file::fdopen(const char)’: ../subprojects/fmt-9.1.0/src/os.cc:335:28: error: ‘::fdopen’ has not been declared; did you mean ‘fopen’? 335 | FILE f = FMT_POSIXCALL(fdopen(fd, mode)); | ^~ ../subprojects/fmt-9.1.0/include/fmt/os.h:56:36: note: in definition of macro ‘FMT_POSIX_CALL’ 56 | # define FMT_POSIX_CALL(call) ::call | ^~~~ [2/7] Compiling C++ object src/paps.exe.p/paps.cc.o FAILED: src/paps.exe.p/paps.cc.o c++ -Isrc/paps.exe.p -Isrc -I../src -I. -I.. -I../subprojects/fmt-9.1.0/include -I/usr/include/pango-1.0 -I/usr/include/freetype2 -I/usr/include/glib-2.0 -I/usr/lib/glib-2.0/include -I/usr/include/harfbuzz -I/usr/include/uuid -I/usr/include/libpng16 -I/usr/include/cairo -I/usr/include/pixman-1 -I/home/towo/usr/include -I/home/towo/usr/include/ncursesw -I/usr/include/ncursesw -fdiagnostics-color=always -D_FILE_OFFSET_BITS=64 -Wall -Winvalid-pch -Wnon-virtual-dtor -std=c++17 -O0 -g -DFMT_SHARED -MD -MQ src/paps.exe.p/paps.cc.o -MF src/paps.exe.p/paps.cc.o.d -o src/paps.exe.p/paps.cc.o -c ../src/paps.cc ../src/paps.cc: In function ‘void layout_turn_off_hyphens(PangoLayout)’: ../src/paps.cc:1063:33: error: ‘pango_attr_insert_hyphens_new’ was not declared in this scope; did you mean ‘pango_attr_underline_new’? 1063 | pango_attr_list_insert(attrs, pango_attr_insert_hyphens_new(FALSE)); | ^~~~~~~~~ | pango_attr_underline_new ../src/paps.cc: In function ‘GList split_text_into_paragraphs(PangoContext, PageLayout, int, const char*)’: ../src/paps.cc:1173:38: error: ‘wcwidth’ was not declared in this scope; did you mean ‘wwidth’? 1173 | gssize w = wcwidth (wtext[i]); | ^~~ | wwidth [4/7] Compiling C++ object subprojects/fmt-9.1.0/cygfmt.dll.p/src_format.cc.o ninja: build stopped: subcommand failed.

mintty commented 1 year ago

Update after release 0.8: Dependency intltools needed to be installed. Ran autogen.sh then configure, cd build; ninja:

../src/paps.cc: In function ‘void layout_turn_off_hyphens(PangoLayout)’: ../src/paps.cc:1063:33: error: ‘pango_attr_insert_hyphens_new’ was not declared in this scope; did you mean ‘pango_attr_underline_new’? 1063 | pango_attr_list_insert(attrs, pango_attr_insert_hyphens_new(FALSE)); | ^~~~~~~~~ | pango_attr_underline_new ../src/paps.cc: In function ‘GList split_text_into_paragraphs(PangoContext, PageLayout, int, const char*)’: ../src/paps.cc:1173:38: error: ‘wcwidth’ was not declared in this scope; did you mean ‘wwidth’? 1173 | gssize w = wcwidth (wtext[i]);

dov commented 1 year ago

https://docs.gtk.org/Pango/func.attr_insert_hyphens_new.html

Available since pango 1.44 I assume that you are using an older version...

In any case you can remove this line. It will only affect the insertion of hyphens when doing line breaking.

mintty commented 1 year ago

OK, I've also uncommented line 50 (wcwidth); now:

../subprojects/fmt-9.1.0/src/os.cc: In member function ‘int fmt::v9::bufferedfile::descriptor() const’: ../subprojects/fmt-9.1.0/src/os.cc:206:27: error: ‘::fileno’ has not been declared; did you mean ‘file’? 206 | int fd = FMT_POSIXCALL(fileno(file)); | ^~ ../subprojects/fmt-9.1.0/include/fmt/os.h:56:36: note: in definition of macro ‘FMT_POSIX_CALL’ 56 | # define FMT_POSIX_CALL(call) ::call | ^~~~ ../subprojects/fmt-9.1.0/src/os.cc: In member function ‘fmt::v9::buffered_file fmt::v9::file::fdopen(const char)’: ../subprojects/fmt-9.1.0/src/os.cc:335:28: error: ‘::fdopen’ has not been declared; did you mean ‘fopen’? 335 | FILE f = FMT_POSIXCALL(fdopen(fd, mode)); | ^~ ../subprojects/fmt-9.1.0/include/fmt/os.h:56:36: note: in definition of macro ‘FMT_POSIX_CALL’ 56 | # define FMT_POSIX_CALL(call) ::call