2021-01-21 17:00:13 +00:00
|
|
|
{ lib, stdenv
|
2020-05-15 18:50:13 +01:00
|
|
|
, fetchurl
|
|
|
|
, glib
|
|
|
|
, flex
|
|
|
|
, bison
|
|
|
|
, meson
|
|
|
|
, ninja
|
2020-05-15 20:32:37 +01:00
|
|
|
, gtk-doc
|
|
|
|
, docbook-xsl-nons
|
|
|
|
, docbook_xml_dtd_43
|
|
|
|
, docbook_xml_dtd_45
|
2020-05-15 18:50:13 +01:00
|
|
|
, pkg-config
|
|
|
|
, libffi
|
|
|
|
, python3
|
|
|
|
, cctools
|
|
|
|
, cairo
|
|
|
|
, gnome3
|
|
|
|
, substituteAll
|
|
|
|
, nixStoreDir ? builtins.storeDir
|
2018-03-01 12:36:36 +00:00
|
|
|
, x11Support ? true
|
2016-01-22 17:49:33 +00:00
|
|
|
}:
|
2020-05-15 18:50:13 +01:00
|
|
|
|
2018-12-02 11:41:15 +00:00
|
|
|
# now that gobject-introspection creates large .gir files (eg gtk3 case)
|
2013-08-04 19:59:05 +01:00
|
|
|
# it may be worth thinking about using multiple derivation outputs
|
|
|
|
# In that case its about 6MB which could be separated
|
2010-05-13 16:56:04 +01:00
|
|
|
|
|
|
|
stdenv.mkDerivation rec {
|
2020-02-08 01:27:18 +00:00
|
|
|
pname = "gobject-introspection";
|
2020-10-24 02:45:18 +01:00
|
|
|
version = "1.66.1";
|
2010-05-13 16:56:04 +01:00
|
|
|
|
2020-05-15 18:50:13 +01:00
|
|
|
# outputs TODO: share/gobject-introspection-1.0/tests is needed during build
|
|
|
|
# by pygobject3 (and maybe others), but it's only searched in $out
|
2020-05-15 20:32:37 +01:00
|
|
|
outputs = [ "out" "dev" "devdoc" "man" ];
|
2020-05-15 18:50:13 +01:00
|
|
|
outputBin = "dev";
|
|
|
|
|
2013-08-04 19:59:05 +01:00
|
|
|
src = fetchurl {
|
2021-01-21 17:00:13 +00:00
|
|
|
url = "mirror://gnome/sources/${pname}/${lib.versions.majorMinor version}/${pname}-${version}.tar.xz";
|
2020-10-24 02:45:18 +01:00
|
|
|
sha256 = "078n0q7b6z682mf4irclrksm73cyixq295mqnqifl9plwmgaai6x";
|
2013-08-04 19:59:05 +01:00
|
|
|
};
|
|
|
|
|
2018-01-20 14:08:27 +00:00
|
|
|
patches = [
|
2020-05-15 20:03:52 +01:00
|
|
|
# Make g-ir-scanner put absolute path to GIR files it generates
|
|
|
|
# so that programs can just dlopen them without having to muck
|
|
|
|
# with LD_LIBRARY_PATH environment variable.
|
2018-01-20 14:08:27 +00:00
|
|
|
(substituteAll {
|
|
|
|
src = ./absolute_shlib_path.patch;
|
|
|
|
inherit nixStoreDir;
|
|
|
|
})
|
2021-01-21 17:00:13 +00:00
|
|
|
] ++ lib.optionals x11Support [
|
2020-05-15 20:03:52 +01:00
|
|
|
# Hardcode the cairo shared library path in the Cairo gir shipped with this package.
|
2020-05-15 18:50:13 +01:00
|
|
|
# https://github.com/NixOS/nixpkgs/issues/34080
|
2018-01-20 14:08:27 +00:00
|
|
|
(substituteAll {
|
|
|
|
src = ./absolute_gir_path.patch;
|
2021-01-21 17:00:13 +00:00
|
|
|
cairoLib = "${lib.getLib cairo}/lib";
|
2020-05-15 18:50:13 +01:00
|
|
|
})
|
|
|
|
];
|
|
|
|
|
|
|
|
nativeBuildInputs = [
|
|
|
|
meson
|
|
|
|
ninja
|
|
|
|
pkg-config
|
2020-05-17 21:28:06 +01:00
|
|
|
flex
|
|
|
|
bison
|
2020-05-15 20:32:37 +01:00
|
|
|
gtk-doc
|
|
|
|
docbook-xsl-nons
|
|
|
|
docbook_xml_dtd_45
|
2020-05-17 21:28:06 +01:00
|
|
|
python3
|
|
|
|
setupHook # move .gir files
|
2020-05-15 18:50:13 +01:00
|
|
|
];
|
|
|
|
|
|
|
|
buildInputs = [
|
|
|
|
python3
|
2020-05-17 21:28:06 +01:00
|
|
|
];
|
|
|
|
|
2021-01-21 17:00:13 +00:00
|
|
|
checkInputs = lib.optionals stdenv.isDarwin [
|
2020-05-17 21:28:06 +01:00
|
|
|
cctools # for otool
|
2020-05-15 18:50:13 +01:00
|
|
|
];
|
|
|
|
|
|
|
|
propagatedBuildInputs = [
|
|
|
|
libffi
|
|
|
|
glib
|
|
|
|
];
|
|
|
|
|
|
|
|
mesonFlags = [
|
|
|
|
"--datadir=${placeholder "dev"}/share"
|
|
|
|
"-Ddoctool=disabled"
|
|
|
|
"-Dcairo=disabled"
|
2020-05-15 20:32:37 +01:00
|
|
|
"-Dgtk_doc=true"
|
2020-05-15 18:50:13 +01:00
|
|
|
];
|
2014-08-14 21:59:24 +01:00
|
|
|
|
2019-03-15 15:04:16 +00:00
|
|
|
doCheck = !stdenv.isAarch64;
|
2018-04-25 04:20:18 +01:00
|
|
|
|
2020-09-20 12:15:34 +01:00
|
|
|
# During configurePhase, two python scripts are generated and need this. See
|
|
|
|
# https://github.com/NixOS/nixpkgs/pull/98316#issuecomment-695785692
|
|
|
|
postConfigure = ''
|
|
|
|
patchShebangs tools/*
|
|
|
|
'';
|
|
|
|
|
2020-05-15 18:55:13 +01:00
|
|
|
preCheck = ''
|
2020-02-08 01:27:18 +00:00
|
|
|
# Our gobject-introspection patches make the shared library paths absolute
|
|
|
|
# in the GIR files. When running tests, the library is not yet installed,
|
|
|
|
# though, so we need to replace the absolute path with a local one during build.
|
|
|
|
# We are using a symlink that we will delete before installation.
|
|
|
|
mkdir -p $out/lib
|
2020-04-04 03:07:29 +01:00
|
|
|
ln -s $PWD/tests/scanner/libregress-1.0${stdenv.targetPlatform.extensions.sharedLibrary} $out/lib/libregress-1.0${stdenv.targetPlatform.extensions.sharedLibrary}
|
2020-04-04 23:02:54 +01:00
|
|
|
'';
|
|
|
|
|
2020-05-15 18:55:13 +01:00
|
|
|
postCheck = ''
|
2020-04-04 23:02:54 +01:00
|
|
|
rm $out/lib/libregress-1.0${stdenv.targetPlatform.extensions.sharedLibrary}
|
2020-02-08 01:27:18 +00:00
|
|
|
'';
|
|
|
|
|
2020-05-15 18:50:13 +01:00
|
|
|
setupHook = ./setup-hook.sh;
|
|
|
|
|
2018-03-03 01:46:01 +00:00
|
|
|
passthru = {
|
|
|
|
updateScript = gnome3.updateScript {
|
|
|
|
packageName = pname;
|
|
|
|
};
|
|
|
|
};
|
|
|
|
|
2021-01-21 17:00:13 +00:00
|
|
|
meta = with lib; {
|
2013-07-03 13:02:40 +01:00
|
|
|
description = "A middleware layer between C libraries and language bindings";
|
2020-05-15 18:55:13 +01:00
|
|
|
homepage = "https://gi.readthedocs.io/";
|
|
|
|
maintainers = teams.gnome.members ++ (with maintainers; [ lovek323 ]);
|
2020-05-15 18:50:13 +01:00
|
|
|
platforms = platforms.unix;
|
2018-10-08 22:08:14 +01:00
|
|
|
license = with licenses; [ gpl2 lgpl2 ];
|
2013-07-03 13:02:40 +01:00
|
|
|
|
|
|
|
longDescription = ''
|
|
|
|
GObject introspection is a middleware layer between C libraries (using
|
|
|
|
GObject) and language bindings. The C library can be scanned at compile
|
|
|
|
time and generate a metadata file, in addition to the actual native C
|
|
|
|
library. Then at runtime, language bindings can read this metadata and
|
|
|
|
automatically provide bindings to call into the C library.
|
|
|
|
'';
|
2010-05-13 16:56:04 +01:00
|
|
|
};
|
|
|
|
}
|