diff options
Diffstat (limited to 'nixpkgs/pkgs/development/libraries/glib')
3 files changed, 210 insertions, 40 deletions
diff --git a/nixpkgs/pkgs/development/libraries/glib/default.nix b/nixpkgs/pkgs/development/libraries/glib/default.nix index de7505e6cde1..4a7d6cce90b0 100644 --- a/nixpkgs/pkgs/development/libraries/glib/default.nix +++ b/nixpkgs/pkgs/development/libraries/glib/default.nix @@ -1,4 +1,4 @@ -{ config, stdenv, fetchurl, gettext, meson, ninja, pkgconfig, perl, python3, glibcLocales +{ config, stdenv, fetchurl, gettext, meson, ninja, pkgconfig, perl, python3 , libiconv, zlib, libffi, pcre, libelf, gnome3, libselinux, bash, gnum4, gtk-doc, docbook_xsl, docbook_xml_dtd_45 # use utillinuxMinimal to avoid circular dependency (utillinux, systemd, glib) , utillinuxMinimal ? null @@ -8,7 +8,7 @@ , doCheck ? config.doCheckByDefault or false , coreutils, dbus, libxml2, tzdata , desktop-file-utils, shared-mime-info -, darwin +, darwin, fetchpatch }: with stdenv.lib; @@ -44,32 +44,53 @@ let done ln -sr -t "''${!outputInclude}/include/" "''${!outputInclude}"/lib/*/include/* 2>/dev/null || true ''; - - binPrograms = optional (!stdenv.isDarwin) "gapplication" ++ [ "gdbus" "gio" "gsettings" ]; in stdenv.mkDerivation rec { pname = "glib"; - version = "2.60.7"; + version = "2.62.4"; src = fetchurl { url = "mirror://gnome/sources/glib/${stdenv.lib.versions.majorMinor version}/${pname}-${version}.tar.xz"; - sha256 = "0433m0na8nc4cf0gidf4gfzz8k5d3dsssmh541qkpzcsaspw04lb"; + sha256 = "1g2vj9lyh032kcwij7avx5d6a99rcsnkd07sbl9i55zsfw6h712c"; }; - patches = optional stdenv.isDarwin ./darwin-compilation.patch - ++ optional doCheck ./skip-timer-test.patch - ++ optionals stdenv.hostPlatform.isMusl [ - ./quark_init_on_demand.patch - ./gobject_init_on_demand.patch - ] ++ [ - ./schema-override-variable.patch - # Require substituteInPlace in postPatch - ./fix-gio-launch-desktop-path.patch - ]; + patches = optionals stdenv.isDarwin [ + ./darwin-compilation.patch + ] ++ optionals stdenv.hostPlatform.isMusl [ + ./quark_init_on_demand.patch + ./gobject_init_on_demand.patch + ] ++ [ + ./schema-override-variable.patch + # Require substituteInPlace in postPatch + ./fix-gio-launch-desktop-path.patch + + # GLib contains many binaries used for different purposes; + # we will install them to different outputs: + # 1. Tools for desktop environment ($bin) + # * gapplication (non-darwin) + # * gdbus + # * gio + # * gio-launch-desktop (symlink to $out) + # * gsettings + # 2. Development/build tools ($dev) + # * gdbus-codegen + # * gio-querymodules + # * glib-compile-resources + # * glib-compile-schemas + # * glib-genmarshal + # * glib-gettextize + # * glib-mkenums + # * gobject-query + # * gresource + # * gtester + # * gtester-report + # 3. Tools for desktop environment that cannot go to $bin due to $out depending on them ($out) + # * gio-launch-desktop + ./split-dev-programs.patch + ] ++ optional doCheck ./skip-timer-test.patch; outputs = [ "bin" "out" "dev" "devdoc" ]; - outputBin = "dev"; setupHook = ./setup-hook.sh; @@ -84,7 +105,7 @@ stdenv.mkDerivation rec { ]); nativeBuildInputs = [ - meson ninja pkgconfig perl python3 gettext gtk-doc docbook_xsl docbook_xml_dtd_45 glibcLocales + meson ninja pkgconfig perl python3 gettext gtk-doc docbook_xsl docbook_xml_dtd_45 ]; propagatedBuildInputs = [ zlib libffi gettext libiconv ]; @@ -94,11 +115,10 @@ stdenv.mkDerivation rec { # Instead we just copy them over from the native output. "-Dgtk_doc=${if stdenv.hostPlatform == stdenv.buildPlatform then "true" else "false"}" "-Dnls=enabled" + "-Ddevbindir=${placeholder ''dev''}/bin" ]; - LC_ALL = "en_US.UTF-8"; - - NIX_CFLAGS_COMPILE = [ + NIX_CFLAGS_COMPILE = toString [ "-Wno-error=nonnull" # Default for release buildtype but passed manually because # we're using plain @@ -111,29 +131,16 @@ stdenv.mkDerivation rec { chmod +x gio/tests/gengiotypefuncs.py patchShebangs gio/tests/gengiotypefuncs.py + chmod +x docs/reference/gio/concat-files-helper.py + patchShebangs docs/reference/gio/concat-files-helper.py patchShebangs glib/gen-unicode-tables.pl patchShebangs tests/gen-casefold-txt.py patchShebangs tests/gen-casemap-txt.py ''; - LIBELF_CFLAGS = optional stdenv.isFreeBSD "-I${libelf}"; - LIBELF_LIBS = optional stdenv.isFreeBSD "-L${libelf} -lelf"; - DETERMINISTIC_BUILD = 1; postInstall = '' - mkdir -p $bin/bin - for app in ${concatStringsSep " " binPrograms}; do - mv "$dev/bin/$app" "$bin/bin" - done - - '' + optionalString (!stdenv.isDarwin) '' - # Add gio-launch-desktop to $out so we can refer to it from $dev - mkdir $out/bin - mv "$dev/bin/gio-launch-desktop" "$out/bin/" - ln -s "$out/bin/gio-launch-desktop" "$bin/bin/" - - '' + '' moveToOutput "share/glib-2.0" "$dev" substituteInPlace "$dev/bin/gdbus-codegen" --replace "$out" "$dev" sed -i "$dev/bin/glib-gettextize" -e "s|^gettext_dir=.*|gettext_dir=$dev/share/glib-2.0/gettext|" @@ -141,6 +148,11 @@ stdenv.mkDerivation rec { # This file is *included* in gtk3 and would introduce runtime reference via __FILE__. sed '1i#line 1 "${pname}-${version}/include/glib-2.0/gobject/gobjectnotifyqueue.c"' \ -i "$dev"/include/glib-2.0/gobject/gobjectnotifyqueue.c + '' + optionalString (!stdenv.isDarwin) '' + # Add gio-launch-desktop to $out so we can refer to it from $lib + mkdir $out/bin + mv "$bin/bin/gio-launch-desktop" "$out/bin/" + ln -s "$out/bin/gio-launch-desktop" "$bin/bin/" '' + optionalString (stdenv.hostPlatform != stdenv.buildPlatform) '' cp -r ${buildPackages.glib.devdoc} $devdoc ''; @@ -173,6 +185,8 @@ stdenv.mkDerivation rec { inherit doCheck; + separateDebugInfo = stdenv.isLinux; + passthru = rec { gioModuleDir = "lib/gio/modules"; makeSchemaPath = dir: name: "${dir}/share/gsettings-schemas/${name}/glib-2.0/schemas"; @@ -185,7 +199,7 @@ stdenv.mkDerivation rec { description = "C library of programming buildings blocks"; homepage = https://www.gtk.org/; license = licenses.lgpl21Plus; - maintainers = with maintainers; [ lovek323 raskin ]; + maintainers = with maintainers; [ lovek323 raskin worldofpeace ]; platforms = platforms.unix; longDescription = '' diff --git a/nixpkgs/pkgs/development/libraries/glib/setup-hook.sh b/nixpkgs/pkgs/development/libraries/glib/setup-hook.sh index a1cb1f40c58a..37c750b8db66 100644 --- a/nixpkgs/pkgs/development/libraries/glib/setup-hook.sh +++ b/nixpkgs/pkgs/development/libraries/glib/setup-hook.sh @@ -1,9 +1,11 @@ make_glib_find_gsettings_schemas() { # For packages that need gschemas of other packages (e.g. empathy) - if [ -d "$1"/share/gsettings-schemas/*/glib-2.0/schemas ]; then - addToSearchPath GSETTINGS_SCHEMAS_PATH "$1/share/gsettings-schemas/"* - fi + for maybe_dir in "$1"/share/gsettings-schemas/*; do + if [[ -d "$maybe_dir/glib-2.0/schemas" ]]; then + addToSearchPath GSETTINGS_SCHEMAS_PATH "$maybe_dir" + fi + done } addEnvHooks "$hostOffset" make_glib_find_gsettings_schemas diff --git a/nixpkgs/pkgs/development/libraries/glib/split-dev-programs.patch b/nixpkgs/pkgs/development/libraries/glib/split-dev-programs.patch new file mode 100644 index 000000000000..9d3989a30a54 --- /dev/null +++ b/nixpkgs/pkgs/development/libraries/glib/split-dev-programs.patch @@ -0,0 +1,154 @@ +diff --git a/gio/gdbus-2.0/codegen/meson.build b/gio/gdbus-2.0/codegen/meson.build +index 121e9e6bb..b76fa0188 100644 +--- a/gio/gdbus-2.0/codegen/meson.build ++++ b/gio/gdbus-2.0/codegen/meson.build +@@ -16,7 +16,7 @@ gdbus_codegen_conf.set('DATADIR', glib_datadir) + # Install gdbus-codegen executable + gdbus_codegen = configure_file(input : 'gdbus-codegen.in', + output : 'gdbus-codegen', +- install_dir : get_option('bindir'), ++ install_dir : get_option('devbindir'), + configuration : gdbus_codegen_conf + ) + # Provide tools for others when we're a subproject and they use the Meson GNOME module +diff --git a/gio/meson.build b/gio/meson.build +index 9a9e621b3..12e1d146a 100644 +--- a/gio/meson.build ++++ b/gio/meson.build +@@ -830,14 +830,15 @@ pkg.generate(libgio, + variables : ['datadir=' + join_paths('${prefix}', get_option('datadir')), + 'schemasdir=' + join_paths('${datadir}', schemas_subdir), + 'bindir=' + join_paths('${prefix}', get_option('bindir')), ++ 'devbindir=' + get_option('devbindir'), + 'giomoduledir=' + giomodulesdir, + 'gio=' + join_paths('${bindir}', 'gio'), +- 'gio_querymodules=' + join_paths('${bindir}', 'gio-querymodules'), +- 'glib_compile_schemas=' + join_paths('${bindir}', 'glib-compile-schemas'), +- 'glib_compile_resources=' + join_paths('${bindir}', 'glib-compile-resources'), ++ 'gio_querymodules=' + join_paths('${devbindir}', 'gio-querymodules'), ++ 'glib_compile_schemas=' + join_paths('${devbindir}', 'glib-compile-schemas'), ++ 'glib_compile_resources=' + join_paths('${devbindir}', 'glib-compile-resources'), + 'gdbus=' + join_paths('${bindir}', 'gdbus'), +- 'gdbus_codegen=' + join_paths('${bindir}', 'gdbus-codegen'), +- 'gresource=' + join_paths('${bindir}', 'gresource'), ++ 'gdbus_codegen=' + join_paths('${devbindir}', 'gdbus-codegen'), ++ 'gresource=' + join_paths('${devbindir}', 'gresource'), + 'gsettings=' + join_paths('${bindir}', 'gsettings')], + version : glib_version, + install_dir : glib_pkgconfigreldir, +@@ -938,12 +939,14 @@ executable('gio', gio_tool_sources, + + executable('gresource', 'gresource-tool.c', + install : true, ++ install_dir : get_option('devbindir'), + # intl.lib is not compatible with SAFESEH + link_args : noseh_link_args, + dependencies : [libelf, libgio_dep, libgobject_dep, libgmodule_dep, libglib_dep]) + + gio_querymodules = executable('gio-querymodules', 'gio-querymodules.c', 'giomodule-priv.c', + install : true, ++ install_dir : get_option('devbindir'), + c_args : gio_c_args, + # intl.lib is not compatible with SAFESEH + link_args : noseh_link_args, +@@ -952,6 +955,7 @@ gio_querymodules = executable('gio-querymodules', 'gio-querymodules.c', 'giomodu + glib_compile_schemas = executable('glib-compile-schemas', + [gconstructor_as_data_h, 'gvdb/gvdb-builder.c', 'glib-compile-schemas.c'], + install : true, ++ install_dir : get_option('devbindir'), + # intl.lib is not compatible with SAFESEH + link_args : noseh_link_args, + dependencies : [libgio_dep, libgobject_dep, libgmodule_dep, libglib_dep]) +@@ -959,6 +963,7 @@ glib_compile_schemas = executable('glib-compile-schemas', + glib_compile_resources = executable('glib-compile-resources', + [gconstructor_as_data_h, 'gvdb/gvdb-builder.c', 'glib-compile-resources.c'], + install : true, ++ install_dir : get_option('devbindir'), + c_args : gio_c_args, + # intl.lib is not compatible with SAFESEH + link_args : noseh_link_args, +diff --git a/glib/meson.build b/glib/meson.build +index 91a48f194..80472a06b 100644 +--- a/glib/meson.build ++++ b/glib/meson.build +@@ -375,9 +375,10 @@ pkg.generate(libglib, + subdirs : ['glib-2.0'], + extra_cflags : ['-I${libdir}/glib-2.0/include'] + win32_cflags, + variables : ['bindir=' + join_paths('${prefix}', get_option('bindir')), +- 'glib_genmarshal=' + join_paths('${bindir}', 'glib-genmarshal'), +- 'gobject_query=' + join_paths('${bindir}', 'gobject-query'), +- 'glib_mkenums=' + join_paths('${bindir}', 'glib-mkenums')], ++ 'devbindir=' + get_option('devbindir'), ++ 'glib_genmarshal=' + join_paths('${devbindir}', 'glib-genmarshal'), ++ 'gobject_query=' + join_paths('${devbindir}', 'gobject-query'), ++ 'glib_mkenums=' + join_paths('${devbindir}', 'glib-mkenums')], + version : glib_version, + install_dir : glib_pkgconfigreldir, + filebase : 'glib-2.0', +@@ -413,6 +414,7 @@ if host_system == 'windows' + else + gtester = executable('gtester', 'gtester.c', + install : true, ++ install_dir : get_option('devbindir'), + c_args : ['-UG_DISABLE_ASSERT'], + include_directories : configinc, + dependencies : [libglib_dep]) +@@ -424,7 +426,7 @@ report_conf.set('PYTHON', python_name) + configure_file( + input: 'gtester-report.in', + output: 'gtester-report', +- install_dir: get_option('bindir'), ++ install_dir: get_option('devbindir'), + configuration: report_conf, + install_mode: 'rwxr-xr-x' + ) +diff --git a/gobject/meson.build b/gobject/meson.build +index c7805c556..22ec629a4 100644 +--- a/gobject/meson.build ++++ b/gobject/meson.build +@@ -75,7 +75,7 @@ foreach tool: python_tools + input : tool + '.in', + output : tool, + configuration : python_tools_conf, +- install_dir : glib_bindir, ++ install_dir : get_option('devbindir'), + ) + + # Set variables for later use +@@ -145,6 +145,7 @@ libgobject_dep = declare_dependency(link_with : libgobject, + + executable('gobject-query', 'gobject-query.c', + install : true, ++ install_dir : get_option('devbindir'), + dependencies : [libglib_dep, libgobject_dep]) + + install_data('gobject_gdb.py', install_dir : join_paths(glib_pkgdatadir, 'gdb')) +diff --git a/meson.build b/meson.build +index 717d1bccb..fb0bee8a1 100644 +--- a/meson.build ++++ b/meson.build +@@ -2118,7 +2118,7 @@ if have_sh + gettextize_conf.set('datarootdir', glib_datadir) + gettextize_conf.set('datadir', glib_datadir) + configure_file(input : 'glib-gettextize.in', +- install_dir : glib_bindir, ++ install_dir : get_option('devbindir'), + output : 'glib-gettextize', + configuration : gettextize_conf) + endif +diff --git a/meson_options.txt b/meson_options.txt +index 2c831e37e..5d8928577 100644 +--- a/meson_options.txt ++++ b/meson_options.txt +@@ -3,6 +3,11 @@ option('runtime_libdir', + value : '', + description : 'install runtime libraries relative to libdir') + ++option('devbindir', ++ type : 'string', ++ value : '', ++ description : 'bindir for development tools') ++ + option('iconv', + type : 'combo', + choices : ['auto', 'libc', 'external'], |