need some cmake help for poppler and ld.bfd

classic Classic list List threaded Threaded
4 messages Options
Reply | Threaded
Open this post in threaded view
|

need some cmake help for poppler and ld.bfd

Matthias Kilian
Hi,

this patch fixes the build with ld.bfd for me:

Index: patches/patch-cmake_modules_GObjectIntrospectionMacros_cmake
===================================================================
RCS file: patches/patch-cmake_modules_GObjectIntrospectionMacros_cmake
diff -N patches/patch-cmake_modules_GObjectIntrospectionMacros_cmake
--- /dev/null 1 Jan 1970 00:00:00 -0000
+++ patches/patch-cmake_modules_GObjectIntrospectionMacros_cmake 9 Jan 2019 20:51:05 -0000
@@ -0,0 +1,13 @@
+$OpenBSD$
+
+Index: cmake/modules/GObjectIntrospectionMacros.cmake
+--- cmake/modules/GObjectIntrospectionMacros.cmake.orig
++++ cmake/modules/GObjectIntrospectionMacros.cmake
+@@ -53,6 +53,7 @@ macro(gir_add_introspections introspections_girs)
+     add_custom_command(
+       COMMAND ${INTROSPECTION_SCANNER}
+               ${INTROSPECTION_SCANNER_ARGS}
++      -L /usr/X11R6/lib
+               --namespace=${_gir_namespace}
+               --nsversion=${_gir_version}
+               ${_gir_libtool}

But it's obviously ugly and wrong (hard coded /usr/X11R6). I'm not
very familiar with cmake, so if anyone could help a little bit
(passing -L ${X11BASE}lib via CONFIGURE_ARGS to the invocation of
g-ir-scanner), I'd be really happy.

Ciao,
        Kili

Reply | Threaded
Open this post in threaded view
|

Re: need some cmake help for poppler and ld.bfd

George Koehler-2
On Wed, 9 Jan 2019 22:01:28 +0100
Matthias Kilian <[hidden email]> wrote:

> But it's obviously ugly and wrong (hard coded /usr/X11R6). I'm not
> very familiar with cmake, so if anyone could help a little bit
> (passing -L ${X11BASE}lib via CONFIGURE_ARGS to the invocation of
> g-ir-scanner), I'd be really happy.

Thank you for looking at this problem!  I had added a similar patch
to my powerpc machine, but it also hardcoded /usr/X11R6, and it was
for an older version of poppler.

I can't find a way to pass -L /usr/X11R6/lib to g-ir-scanner without
patching a cmake script.  I can't do
  cmake -D Poppler_0_18_gir_CFLAGS=-L${X11BASE}/lib
because the set(Poppler_0_18_gir_CFLAGS ...) in the cmake script
would override the value from the command line.

The next diff (on top of your 0.73.0 update, and with
qt5/poppler-version.h moved to PLIST-qt5) builds a package on amd64
using `make package USE_LLD=No`.  This wraps ld.bfd in
/usr/ports/pobj/poppler-0.73.0-no_qt5-bootstrap/bin/ld

--- Makefile.orig Thu Jan 10 11:05:42 2019
+++ Makefile Thu Jan 10 11:06:15 2019
@@ -105,6 +105,7 @@
  -DBUILD_GTK_TESTS=False \
  -DENABLE_LIBCURL=False \
  -DCMAKE_DISABLE_FIND_PACKAGE_NSS3=True \
- -DOpenJPEG_DIR=${LOCALBASE}/lib/openjp2
+ -DOpenJPEG_DIR=${LOCALBASE}/lib/openjp2 \
+ -DX11BASE=${X11BASE}
 
 .include <bsd.port.mk>
--- /dev/null Thu Jan 10 11:17:48 2019
+++ patches/patch-glib_CMakeLists_txt Thu Jan 10 11:11:17 2019
@@ -0,0 +1,16 @@
+$OpenBSD$
+
+Index: glib/CMakeLists.txt
+--- glib/CMakeLists.txt.orig
++++ glib/CMakeLists.txt
+@@ -130,7 +130,9 @@ if (HAVE_INTROSPECTION AND BUILD_SHARED_LIBS)
+   set(Poppler_0_18_gir_INCLUDES GObject-2.0 Gio-2.0 cairo-1.0)
+   get_directory_property(_tmp_includes INCLUDE_DIRECTORIES)
+   _list_prefix(_includes _tmp_includes "-I")
+-  set(Poppler_0_18_gir_CFLAGS ${_includes} -L${CMAKE_BINARY_DIR} -L${CMAKE_CURRENT_BINARY_DIR})
++  set(Poppler_0_18_gir_CFLAGS ${_includes} -L${CMAKE_BINARY_DIR} -L${CMAKE_CURRENT_BINARY_DIR}
++    -L${X11BASE}/lib
++  )
+   set(Poppler_0_18_gir_LIBS poppler-glib)
+   _list_prefix(_abs_introspection_files introspection_files "${CMAKE_CURRENT_SOURCE_DIR}/")
+   list(APPEND _abs_introspection_files

There are a few different ways to get the value of X11BASE into
cmake.  I did cmake -DX11BASE=${X11BASE} which sets X11BASE in
CMake's cache, but no existing port does this.

Another way is to use SUBST_CMD to expand ${X11BASE}.  This
happens in 3 ports: cad/kicad emulators/ppsspp games/lostpixels

Another way is to use ${OPENBSD_X11BASE}, which is set by CMake but
not documented in cmake-variables(7) nor port-modules(5).  This
happens in 2 ports: games/openrct2 math/freemat

/usr/local/share/cmake/Modules/Platform/OpenBSD.cmake sets
OPENBSD_X11BASE to $ENV{X11BASE} or /usr/X11R6, but I don't see
X11BASE in make show=CONFIGURE_ENV.  I believe that OPENBSD_X11BASE
would ignore X11BASE from ports and hardcode /usr/X11R6.

--
George Koehler <[hidden email]>

Reply | Threaded
Open this post in threaded view
|

Re: need some cmake help for poppler and ld.bfd

Matthias Kilian
Hi,

On Thu, Jan 10, 2019 at 12:15:50PM -0500, George Koehler wrote:
> > But it's obviously ugly and wrong (hard coded /usr/X11R6). I'm not
> > very familiar with cmake, so if anyone could help a little bit
> > (passing -L ${X11BASE}lib via CONFIGURE_ARGS to the invocation of
> > g-ir-scanner), I'd be really happy.

[...]

> The next diff (on top of your 0.73.0 update, and with
> qt5/poppler-version.h moved to PLIST-qt5) builds a package on amd64
> using `make package USE_LLD=No`.  This wraps ld.bfd in
> /usr/ports/pobj/poppler-0.73.0-no_qt5-bootstrap/bin/ld
>
> --- Makefile.orig Thu Jan 10 11:05:42 2019
> +++ Makefile Thu Jan 10 11:06:15 2019
> @@ -105,6 +105,7 @@
>   -DBUILD_GTK_TESTS=False \
>   -DENABLE_LIBCURL=False \
>   -DCMAKE_DISABLE_FIND_PACKAGE_NSS3=True \
> - -DOpenJPEG_DIR=${LOCALBASE}/lib/openjp2
> + -DOpenJPEG_DIR=${LOCALBASE}/lib/openjp2 \
> + -DX11BASE=${X11BASE}
>  
>  .include <bsd.port.mk>
> --- /dev/null Thu Jan 10 11:17:48 2019
> +++ patches/patch-glib_CMakeLists_txt Thu Jan 10 11:11:17 2019
> @@ -0,0 +1,16 @@
> +$OpenBSD$
> +
> +Index: glib/CMakeLists.txt
> +--- glib/CMakeLists.txt.orig
> ++++ glib/CMakeLists.txt
> +@@ -130,7 +130,9 @@ if (HAVE_INTROSPECTION AND BUILD_SHARED_LIBS)
> +   set(Poppler_0_18_gir_INCLUDES GObject-2.0 Gio-2.0 cairo-1.0)
> +   get_directory_property(_tmp_includes INCLUDE_DIRECTORIES)
> +   _list_prefix(_includes _tmp_includes "-I")
> +-  set(Poppler_0_18_gir_CFLAGS ${_includes} -L${CMAKE_BINARY_DIR} -L${CMAKE_CURRENT_BINARY_DIR})
> ++  set(Poppler_0_18_gir_CFLAGS ${_includes} -L${CMAKE_BINARY_DIR} -L${CMAKE_CURRENT_BINARY_DIR}
> ++    -L${X11BASE}/lib
> ++  )
> +   set(Poppler_0_18_gir_LIBS poppler-glib)
> +   _list_prefix(_abs_introspection_files introspection_files "${CMAKE_CURRENT_SOURCE_DIR}/")
> +   list(APPEND _abs_introspection_files

Thanks! I'll try this after fixing some fallout caused (again!) by
the poppler update (libreoffice, gimp, pdf2djvu, apvlv).

> There are a few different ways to get the value of X11BASE into
> cmake.  I did cmake -DX11BASE=${X11BASE} which sets X11BASE in
> CMake's cache, but no existing port does this.

If it works, it's ok for now. When I find some time to learn more
about cmake (which I'll have to do anyways), I can try to find some
better way that could also accepted upstream.

Ciao,
        Kili

Reply | Threaded
Open this post in threaded view
|

Re: need some cmake help for poppler and ld.bfd

Stuart Henderson
In reply to this post by George Koehler-2
On 2019/01/10 12:15, George Koehler wrote:
>
> /usr/local/share/cmake/Modules/Platform/OpenBSD.cmake sets
> OPENBSD_X11BASE to $ENV{X11BASE} or /usr/X11R6, but I don't see
> X11BASE in make show=CONFIGURE_ENV.  I believe that OPENBSD_X11BASE
> would ignore X11BASE from ports and hardcode /usr/X11R6.

Maybe cmake.port.mk should set OPENBSD_X11BASE where it sets
MODJAVA_VER/MODPY_BIN/etc..