lol
1{ stdenv
2, lib
3, fetchFromGitLab
4, fetchpatch
5, autoreconfHook
6, buildPackages
7, optimize ? false # impure hardware optimizations
8}:
9stdenv.mkDerivation rec {
10 pname = "gf2x";
11 version = "1.3.0";
12
13 src = fetchFromGitLab {
14 domain = "gitlab.inria.fr";
15 owner = "gf2x";
16 repo = pname;
17 rev = "${pname}-${version}";
18 sha256 = "04g5jg0i4vz46b4w2dvbmahwzi3k6b8g515mfw7im1inc78s14id";
19 };
20
21 patches = [
22 (fetchpatch {
23 name = "gf2x-1.3.0-configure-clang16.patch";
24 url = "https://gitlab.inria.fr/gf2x/gf2x/-/commit/a2f0fd388c12ca0b9f4525c6cfbc515418dcbaf8.diff";
25 hash = "sha256-Aj2KzWZMR24S04IbPOBPwacCU4rEiB+FFWxtRuF50LA=";
26 })
27 ];
28
29 depsBuildBuild = [ buildPackages.stdenv.cc ];
30
31 nativeBuildInputs = [
32 autoreconfHook
33 ];
34
35 # no actual checks present yet (as of 1.2), but can't hurt trying
36 # for an indirect test, run ntl's test suite
37 doCheck = true;
38
39 configureFlags = lib.optionals (!optimize) [
40 "--disable-hardware-specific-code"
41 ];
42
43 meta = with lib; {
44 description = "Routines for fast arithmetic in GF(2)[x]";
45 homepage = "https://gitlab.inria.fr/gf2x/gf2x/";
46 license = licenses.gpl2Plus;
47 maintainers = teams.sage.members;
48 platforms = platforms.unix;
49 };
50}