diff mbox

libgit2, libgit2-glib: pkg-config file: dependencies on other libraries: how to represent them in Guix?

Message ID 20160617195657.38541268@scratchpost.org
State New
Headers show

Commit Message

Danny Milosavljevic June 17, 2016, 5:56 p.m. UTC
Hi,

I'm trying to package libgit2-glib and gnome-builder.

- libgit2 has openssl as input.
- libgit2-glib installs a pkg-config file.
- gnome-builder uses libgit2-glib .

Something always complains about missing openssl parts.

For example I can get
  Package 'openssl', required by 'libgit2', not found
when building libgit2-glib.

Almost whatever else I do instead, the error wanders around in the DAG.

In order to make it work I added openssl as a propagated input in libgit2-glib. This does work.

But is it the right fix?

Preliminary patch see below (don't commit it!):

Comments

Ricardo Wurmus June 18, 2016, 7:47 a.m. UTC | #1
Danny Milosavljevic <dannym@scratchpost.org> writes:

> I'm trying to package libgit2-glib and gnome-builder.
>
> - libgit2 has openssl as input.
> - libgit2-glib installs a pkg-config file.
> - gnome-builder uses libgit2-glib .
>
> Something always complains about missing openssl parts.
>
> For example I can get
>   Package 'openssl', required by 'libgit2', not found
> when building libgit2-glib.
>
> Almost whatever else I do instead, the error wanders around in the DAG.
>
> In order to make it work I added openssl as a propagated input in libgit2-glib. This does work.
>
> But is it the right fix?

This depends on the pkg-config file that the library installs.  If this
file contains a section that lists other libraries as private, then
propagation is probably the correct approach.

~~ Ricardo
Danny Milosavljevic June 18, 2016, 9:10 a.m. UTC | #2
On Sat, 18 Jun 2016 09:47:19 +0200
Ricardo Wurmus <rekado@elephly.net> wrote:

> This depends on the pkg-config file that the library installs.  If this
> file contains a section that lists other libraries as private, then
> propagation is probably the correct approach.

See <https://github.com/libgit2/libgit2/blob/master/libgit2.pc.in>

Name: libgit2
Description: The git library, take 2
Version: @LIBGIT2_VERSION_STRING@

Libs: -L"${libdir}" -lgit2
Libs.private: @LIBGIT2_PC_LIBS@
Requires.private: @LIBGIT2_PC_REQUIRES@

Cflags: -I${includedir}

And in the CMakeLists.txt :

	IF (CMAKE_SYSTEM_NAME MATCHES "FreeBSD")
		LIST(APPEND LIBGIT2_PC_LIBS "-lssl")
	ELSE()
		SET(LIBGIT2_PC_REQUIRES "${LIBGIT2_PC_REQUIRES} openssl")
	ENDIF ()

So I take it that it should have been a propagated-input in libgit2 itself already, right?
Danny Milosavljevic June 18, 2016, 9:16 a.m. UTC | #3
Also, it seems the only thing libgit2 uses openssl for is for the SHA1 hash. But there's also a builtin SHA1 hash in libgit2 under src/hash/hash_generic.c which we could use instead - should we?

It seems that Apple already deprecated OpenSSL so the support for libgit2 without OpenSSL should be fine.

There's a check in CMakeFiles.txt for SHA1_TYPE=builtin . I'm not well-versed in cmake, however, so no idea how to set that. 

Also, USE_OPENSSL defaults to ON. That's an externally-visible option. I would know how to set that to OFF.
Ludovic Courtès June 19, 2016, 1:53 p.m. UTC | #4
Danny Milosavljevic <dannym@scratchpost.org> skribis:

> On Sat, 18 Jun 2016 09:47:19 +0200
> Ricardo Wurmus <rekado@elephly.net> wrote:
>
>> This depends on the pkg-config file that the library installs.  If this
>> file contains a section that lists other libraries as private, then
>> propagation is probably the correct approach.
>
> See <https://github.com/libgit2/libgit2/blob/master/libgit2.pc.in>
>
> Name: libgit2
> Description: The git library, take 2
> Version: @LIBGIT2_VERSION_STRING@
>
> Libs: -L"${libdir}" -lgit2
> Libs.private: @LIBGIT2_PC_LIBS@
> Requires.private: @LIBGIT2_PC_REQUIRES@
>
> Cflags: -I${includedir}
>
> And in the CMakeLists.txt :
>
> 	IF (CMAKE_SYSTEM_NAME MATCHES "FreeBSD")
> 		LIST(APPEND LIBGIT2_PC_LIBS "-lssl")
> 	ELSE()
> 		SET(LIBGIT2_PC_REQUIRES "${LIBGIT2_PC_REQUIRES} openssl")
> 	ENDIF ()
>
> So I take it that it should have been a propagated-input in libgit2 itself already, right?

Yes.  OTOH, “Requires.private” is used only when static linking; are we
using static linking here?  If not, we could leave it as is.

Thanks,
Ludo’.
diff mbox

Patch

diff --git a/gnu/packages/gnome.scm b/gnu/packages/gnome.scm
index 74c4be6..fd3e75b 100644
--- a/gnu/packages/gnome.scm
+++ b/gnu/packages/gnome.scm
@@ -115,6 +115,7 @@ 
   #:use-module (gnu packages samba)
   #:use-module (gnu packages readline)
   #:use-module (gnu packages fonts)
+  #:use-module (gnu packages version-control)
   #:use-module (srfi srfi-1))
 
 (define-public brasero
@@ -1960,6 +1961,41 @@  various wrappers for the complex data types employed by JSON, such as arrays
 and objects.")
     (license license:lgpl2.1+)))
 
+(define-public libgit2-glib
+  (package
+    (name "libgit2-glib")
+    (version "0.24.0")
+    (source (origin
+              (method url-fetch)
+              (uri (string-append "mirror://gnome/sources/" name "/"
+                                  (version-major+minor version) "/"
+                                  name "-" version ".tar.xz"))
+              (sha256
+               (base32
+                "0ia81xlyf6qmyl89ql663piliyjmhnzrshd6q66zya0wh9lc45nn"))
+              (modules '((guix build utils)))))
+    (build-system gnu-build-system)
+    (native-inputs
+     `(("glib" ,glib "bin")              ;for glib-mkenums and glib-genmarshal
+       ("gobject-introspection" ,gobject-introspection)
+       ("pkg-config" ,pkg-config)))
+    (propagated-inputs
+     `(("glib" ,glib)
+       ("libgit2" ,libgit2)
+       ("openssl" ,openssl) ; actually, this is already needed by libgit2 itself.
+))
+    (inputs
+     `(
+       ("zlib" ,zlib)
+       ("libssh2" ,libssh2)
+       ; Note: make dist would need gtk-doc
+))
+    (home-page "https://wiki.gnome.org/Projects/Libgit2-glib")
+    (synopsis "Git-GLib wrapper")
+    (description
+     "GIT-GLib is a C library based on GLib providing Git support.")
+    (license license:lgpl2.1+)))
+
 (define-public libxklavier
   (package
     (name "libxklavier")
@@ -5386,3 +5422,35 @@  compiled.")
 GLib/GObject code.")
     (home-page "https://wiki.gnome.org/Projects/GFBGraph")
     (license license:lgpl2.1+)))
+
+(define-public gnome-builder
+ (package
+    (name "gnome-builder")
+    (version "3.18.1")
+    (source (origin
+              (method url-fetch)
+              (uri (string-append
+                    "mirror://gnome/sources/" name "/"
+                    (version-major+minor version) "/"
+                    name "-" version ".tar.xz"))
+              (sha256
+               (base32
+                "0z20wlv1i6w1srrmkabqxqx2rzkp4d4n7s28ax5a936g1li9a72h"))))
+    (build-system glib-or-gtk-build-system)
+    (native-inputs
+     `(("intltool" ,intltool)
+       ("glib:bin" ,glib "bin") ; glib-compile-schemas, etc.
+       ("pkg-config" ,pkg-config)
+       ("gobject-introspection" ,gobject-introspection)))
+    (inputs
+     `(("glib" ,glib)
+       ("gtk+" ,gtk+)
+       ("gtksourceview" ,gtksourceview)
+       ("libgit2-glib" ,libgit2-glib)
+       ("libpeas" ,libpeas)))
+    (synopsis "General-Purpose Integrated Development Environment")
+    (description "GNOME Builder ...")
+    (home-page "https://wiki.gnome.org/Apps/Builder")
+    (license license:gpl3)
+))