|
| 1 | +{ |
| 2 | + fetchFromGitLab, |
| 3 | + fetchpatch, |
| 4 | + gitUpdater, |
| 5 | + lib, |
| 6 | + stdenv, |
| 7 | + testers, |
| 8 | + autoreconfHook, |
| 9 | + dbus, |
| 10 | + dbus-test-runner, |
| 11 | + dpkg, |
| 12 | + getopt, |
| 13 | + glib, |
| 14 | + gobject-introspection, |
| 15 | + json-glib, |
| 16 | + libgee, |
| 17 | + perl, |
| 18 | + pkg-config, |
| 19 | + properties-cpp, |
| 20 | + python3Packages, |
| 21 | + vala, |
| 22 | + wrapGAppsHook3, |
| 23 | +}: |
| 24 | + |
| 25 | +let |
| 26 | + self = python3Packages.buildPythonApplication rec { |
| 27 | + pname = "click"; |
| 28 | + version = "0.5.2"; |
| 29 | + format = "other"; |
| 30 | + |
| 31 | + src = fetchFromGitLab { |
| 32 | + owner = "ubports"; |
| 33 | + repo = "development/core/click"; |
| 34 | + rev = version; |
| 35 | + hash = "sha256-AV3n6tghvpV/6Ew6Lokf8QAGBIMbHFAnp6G4pefVn+8="; |
| 36 | + }; |
| 37 | + |
| 38 | + patches = [ |
| 39 | + # Remove when version > 0.5.2 |
| 40 | + (fetchpatch { |
| 41 | + name = "0001-click-fix-Wimplicit-function-declaration.patch"; |
| 42 | + url = "https://gitlab.com/ubports/development/core/click/-/commit/8f654978a12e6f9a0b6ff64296ec5565e3ff5cd0.patch"; |
| 43 | + hash = "sha256-kio+DdtuagUNYEosyQY3q3H+dJM3cLQRW9wUKUcpUTY="; |
| 44 | + }) |
| 45 | + |
| 46 | + # Remove when version > 0.5.2 |
| 47 | + (fetchpatch { |
| 48 | + name = "0002-click-Add-uid_t-and-gid_t-to-the-ctypes-_typemap.patch"; |
| 49 | + url = "https://gitlab.com/ubports/development/core/click/-/commit/cbcd23b08b02fa122434e1edd69c2b3dcb6a8793.patch"; |
| 50 | + hash = "sha256-QaWRhxO61wAzULVqPLdJrLuBCr3+NhKmQlEPuYq843I="; |
| 51 | + }) |
| 52 | + ]; |
| 53 | + |
| 54 | + postPatch = '' |
| 55 | + # These should be proper Requires, using the header needs their headers |
| 56 | + substituteInPlace lib/click/click-*.pc.in \ |
| 57 | + --replace-fail 'Requires.private' 'Requires' |
| 58 | +
|
| 59 | + # Don't completely override PKG_CONFIG_PATH |
| 60 | + substituteInPlace click_package/tests/Makefile.am \ |
| 61 | + --replace-fail 'PKG_CONFIG_PATH=$(top_builddir)/lib/click' 'PKG_CONFIG_PATH=$(top_builddir)/lib/click:$(PKG_CONFIG_PATH)' |
| 62 | +
|
| 63 | + patchShebangs bin/click |
| 64 | + ''; |
| 65 | + |
| 66 | + strictDeps = true; |
| 67 | + |
| 68 | + pkgsBuildBuild = [ |
| 69 | + pkg-config |
| 70 | + ]; |
| 71 | + |
| 72 | + nativeBuildInputs = [ |
| 73 | + autoreconfHook |
| 74 | + dbus-test-runner # Always checking for this |
| 75 | + getopt |
| 76 | + gobject-introspection |
| 77 | + perl |
| 78 | + pkg-config |
| 79 | + vala |
| 80 | + wrapGAppsHook3 |
| 81 | + ]; |
| 82 | + |
| 83 | + buildInputs = [ |
| 84 | + glib |
| 85 | + json-glib |
| 86 | + libgee |
| 87 | + properties-cpp |
| 88 | + ]; |
| 89 | + |
| 90 | + propagatedBuildInputs = with python3Packages; [ |
| 91 | + python-debian |
| 92 | + pygobject3 |
| 93 | + setuptools |
| 94 | + ]; |
| 95 | + |
| 96 | + nativeCheckInputs = [ |
| 97 | + dbus |
| 98 | + dpkg |
| 99 | + python3Packages.unittestCheckHook |
| 100 | + ]; |
| 101 | + |
| 102 | + checkInputs = with python3Packages; [ |
| 103 | + python-apt |
| 104 | + six |
| 105 | + ]; |
| 106 | + |
| 107 | + preConfigure = '' |
| 108 | + export click_cv_perl_vendorlib=$out/${perl.libPrefix} |
| 109 | + export PYTHON_INSTALL_FLAGS="--prefix=$out" |
| 110 | + ''; |
| 111 | + |
| 112 | + configureFlags = [ |
| 113 | + "--with-systemdsystemunitdir=${placeholder "out"}/lib/systemd/system" |
| 114 | + "--with-systemduserunitdir=${placeholder "out"}/lib/systemd/user" |
| 115 | + ]; |
| 116 | + |
| 117 | + enableParallelBuilding = true; |
| 118 | + |
| 119 | + doCheck = stdenv.buildPlatform.canExecute stdenv.hostPlatform; |
| 120 | + |
| 121 | + disabledTestPaths = [ |
| 122 | + # From apt: Unable to determine a suitable packaging system type |
| 123 | + "click_package/tests/integration/test_signatures.py" |
| 124 | + "click_package/tests/test_build.py" |
| 125 | + "click_package/tests/test_install.py" |
| 126 | + "click_package/tests/test_scripts.py" |
| 127 | + ]; |
| 128 | + |
| 129 | + preCheck = '' |
| 130 | + export HOME=$TMP |
| 131 | +
|
| 132 | + # tests recompile some files for loaded predefines, doesn't use any optimisation level for it |
| 133 | + # makes test output harder to read, so make the warning go away |
| 134 | + export NIX_CFLAGS_COMPILE+=" -U_FORTIFY_SOURCE" |
| 135 | +
|
| 136 | + # Haven'tbeen able to get them excluded via disabledTest{s,Paths}, just deleting them |
| 137 | + for path in $disabledTestPaths; do |
| 138 | + rm -v $path |
| 139 | + done |
| 140 | + ''; |
| 141 | + |
| 142 | + preFixup = '' |
| 143 | + makeWrapperArgs+=( |
| 144 | + --prefix LD_LIBRARY_PATH : "$out/lib" |
| 145 | + ) |
| 146 | + ''; |
| 147 | + |
| 148 | + passthru = { |
| 149 | + updateScript = gitUpdater { }; |
| 150 | + }; |
| 151 | + |
| 152 | + meta = { |
| 153 | + description = "Tool to build click packages, mainly used for Ubuntu Touch"; |
| 154 | + homepage = "https://gitlab.com/ubports/development/core/click"; |
| 155 | + changelog = "https://gitlab.com/ubports/development/core/click/-/blob/${version}/ChangeLog"; |
| 156 | + license = lib.licenses.gpl3Only; |
| 157 | + mainProgram = "click"; |
| 158 | + maintainers = |
| 159 | + with lib.maintainers; |
| 160 | + [ |
| 161 | + ilyakooo0 |
| 162 | + ] |
| 163 | + ++ lib.teams.lomiri.members; |
| 164 | + platforms = lib.platforms.linux; |
| 165 | + pkgConfigModules = [ |
| 166 | + "click-0.4" |
| 167 | + ]; |
| 168 | + }; |
| 169 | + }; |
| 170 | +in |
| 171 | +self |
| 172 | +// { |
| 173 | + passthru = self.passthru // { |
| 174 | + tests.pkg-config = testers.hasPkgConfigModules { |
| 175 | + package = self; |
| 176 | + }; |
| 177 | + }; |
| 178 | +} |
0 commit comments