From 07896ee61dba47bc57c4c3b3b819033dc0324a1b Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Karel=20Ko=C4=8D=C3=AD?= Date: Mon, 8 Aug 2022 08:27:06 +0200 Subject: Turris Omnia cross build now should work --- pkgs/0001-configure.ac-replace-AC_CHECK_FILE.patch | 31 ---------------------- pkgs/certgen/default.nix | 25 +++++++++++++++++ pkgs/crypto-wrapper/default.nix | 28 +++++++++++++++++++ pkgs/default.nix | 31 ---------------------- pkgs/libatsha204/default.nix | 3 +++ pkgs/libatsha204/multiple-definitions.patch | 13 +++++++++ .../0001-configure.ac-replace-AC_CHECK_FILE.patch | 31 ++++++++++++++++++++++ 7 files changed, 100 insertions(+), 62 deletions(-) delete mode 100644 pkgs/0001-configure.ac-replace-AC_CHECK_FILE.patch create mode 100644 pkgs/certgen/default.nix create mode 100644 pkgs/crypto-wrapper/default.nix create mode 100644 pkgs/libatsha204/multiple-definitions.patch create mode 100644 pkgs/patches/0001-configure.ac-replace-AC_CHECK_FILE.patch (limited to 'pkgs') diff --git a/pkgs/0001-configure.ac-replace-AC_CHECK_FILE.patch b/pkgs/0001-configure.ac-replace-AC_CHECK_FILE.patch deleted file mode 100644 index 8b377f3..0000000 --- a/pkgs/0001-configure.ac-replace-AC_CHECK_FILE.patch +++ /dev/null @@ -1,31 +0,0 @@ -From 4ddfdca8416a008819d08d14d6a6f4796aef7857 Mon Sep 17 00:00:00 2001 -From: Fabrice Fontaine -Date: Mon, 12 Oct 2020 22:40:13 +0200 -Subject: [PATCH] configure.ac: replace AC_CHECK_FILE - -AC_CHECK_FILE can't be used when cross-compiling so replace it by a -simple test -f - -Signed-off-by: Fabrice Fontaine ---- - configure.ac | 4 ++-- - 1 file changed, 2 insertions(+), 2 deletions(-) - -diff --git a/configure.ac b/configure.ac -index 0a19a2a..9773993 100644 ---- a/configure.ac -+++ b/configure.ac -@@ -16,8 +16,8 @@ AC_PROG_CC_STDC - # Check for a2x only if the man page is missing, i.e. we are building from git. The release tarballs - # are set up to include the man pages. This way, only people creating tarballs via `make dist` and - # people building from git need a2x as a dependency. --AC_CHECK_FILE( -- [src/pixz.1], -+AS_IF( -+ [test -f src/pixz.1], - [], - [ - AC_ARG_WITH( --- -2.35.1 - diff --git a/pkgs/certgen/default.nix b/pkgs/certgen/default.nix new file mode 100644 index 0000000..3818b9b --- /dev/null +++ b/pkgs/certgen/default.nix @@ -0,0 +1,25 @@ +{ buildPythonApplication, lib, fetchgit +, python3 +, crypto-wrapper +}: + +buildPythonApplication rec { + pname = "sentinel-certgen"; + version = "6.2"; + meta = with lib; { + homepage = "https://gitlab.nic.cz/turris/sentinel/certgen"; + description = "Sentinel automated passwords and certificates retrieval"; + license = licenses.gpl3; + }; + + src = fetchgit { + url = "https://gitlab.nic.cz/turris/sentinel/certgen.git"; + rev = "v" + version; + sha256 = "10ii3j3wqdib7m2fc0w599981mv9q3ahj96q4kyrn5sh18v2c7nb"; + }; + + propagatedBuildInputs = with python3.pkgs; [ + crypto-wrapper + six requests cryptography + ]; +} diff --git a/pkgs/crypto-wrapper/default.nix b/pkgs/crypto-wrapper/default.nix new file mode 100644 index 0000000..3f431b2 --- /dev/null +++ b/pkgs/crypto-wrapper/default.nix @@ -0,0 +1,28 @@ +{ stdenv, lib, fetchgit +, bash +, makeWrapper +}: + +stdenv.mkDerivation rec { + pname = "crypto-wrapper"; + version = "0.4"; + meta = with lib; { + homepage = "https://gitlab.nic.cz/turris/crypto-wrapper"; + description = "Simple script abstracting access to the Turris crypto backend."; + platforms = platforms.linux; + license = licenses.gpl3; + }; + + src = fetchgit { + url = "https://gitlab.nic.cz/turris/crypto-wrapper.git"; + rev = "v" + version; + sha256 = "1ly37cajkmgqmlj230h5az9m2m1rgvf4r0bf94yipp80wl0z215s"; + }; + + installPhase = '' + mkdir -p $out/bin + cp crypto-wrapper.sh $out/bin/crypto-wrapper + wrapProgram $out/bin/crypto-wrapper \ + --prefix PATH : ${lib.makeBinPath [ bash openssl coreutils ]} + ''; +} diff --git a/pkgs/default.nix b/pkgs/default.nix index 929d030..a64757f 100644 --- a/pkgs/default.nix +++ b/pkgs/default.nix @@ -19,37 +19,6 @@ let #crypto-wrapper = callPackage ./crypto-wrapper { }; #certgen = python3Packages.callPackage ./certgen { }; - # Overrides to get build to work - patchelf = armv7lDisableCheck nixpkgs.patchelf; - bison = armv7lDisableCheck nixpkgs.bison; - findutils = armv7lDisableCheck nixpkgs.findutils; - libuv = armv7lDisableCheck nixpkgs.libuv; - p11-kit = armv7lDisableCheck nixpkgs.p11-kit; - elfutils = armv7lDisableCheck nixpkgs.elfutils; - glib = armv7lDisableCheck nixpkgs.glib; - rustc = armv7lDisableCheck nixpkgs.rustc; - mdbook = armv7lDisableCheck nixpkgs.mdbook; - ell = armv7lDisableCheck nixpkgs.ell; - polkit = armv7lDisableCheck nixpkgs.polkit; - udisks2 = disableCheck nixpkgs.udisks2; - udisks = udisks2; - llvm = armv7lDisableCheck nixpkgs.llvm; - llvm_14 = armv7lDisableCheck nixpkgs.llvm_14; - jemalloc = armv7lDisableCheck nixpkgs.jemalloc; - openssh = armv7lDisableCheck nixpkgs.openssh; - nlohmann_json = armv7lDisableCheck nixpkgs.nlohmann_json; - libseccomp = armv7lDisableCheck nixpkgs.libseccomp; - openldap = armv7lDisableCheck nixpkgs.openldap; - # Crosscompilation worarounds - btrfs-progs = nixpkgs.btrfs-progs.overrideAttrs (oldAttrs: { - configureFlags = ["--disable-python"]; - installFlags = []; - }); - pixz = nixpkgs.pixz.overrideAttrs (oldAttrs: { - configureFlags = ["--without-manpage"]; - patches = [ ./0001-configure.ac-replace-AC_CHECK_FILE.patch ]; - }); - }; in turrispkgs diff --git a/pkgs/libatsha204/default.nix b/pkgs/libatsha204/default.nix index 96a621d..10cd859 100644 --- a/pkgs/libatsha204/default.nix +++ b/pkgs/libatsha204/default.nix @@ -19,6 +19,9 @@ stdenv.mkDerivation rec { fetchSubmodules = true; sha256 = "1lhvqdy2sfbvz9y9lwqhxggpr8rwfd66v73gv9s7b7811r6way20"; }; + patches = [ + ./multiple-definitions.patch + ]; buildInputs = [openssl unbound]; nativeBuildInputs = [pkg-config perl patchelf]; diff --git a/pkgs/libatsha204/multiple-definitions.patch b/pkgs/libatsha204/multiple-definitions.patch new file mode 100644 index 0000000..94dd5fc --- /dev/null +++ b/pkgs/libatsha204/multiple-definitions.patch @@ -0,0 +1,13 @@ +diff --git a/src/libatsha204/dnsmagic.c b/src/libatsha204/dnsmagic.c +index d5f82b4..dc0bb90 100644 +--- a/src/libatsha204/dnsmagic.c ++++ b/src/libatsha204/dnsmagic.c +@@ -42,7 +42,7 @@ + /* + * Global variable with configuration and some initial config values. + */ +-atsha_configuration g_config; ++extern atsha_configuration g_config; + + /* + * Get decimal number from its string representation diff --git a/pkgs/patches/0001-configure.ac-replace-AC_CHECK_FILE.patch b/pkgs/patches/0001-configure.ac-replace-AC_CHECK_FILE.patch new file mode 100644 index 0000000..8b377f3 --- /dev/null +++ b/pkgs/patches/0001-configure.ac-replace-AC_CHECK_FILE.patch @@ -0,0 +1,31 @@ +From 4ddfdca8416a008819d08d14d6a6f4796aef7857 Mon Sep 17 00:00:00 2001 +From: Fabrice Fontaine +Date: Mon, 12 Oct 2020 22:40:13 +0200 +Subject: [PATCH] configure.ac: replace AC_CHECK_FILE + +AC_CHECK_FILE can't be used when cross-compiling so replace it by a +simple test -f + +Signed-off-by: Fabrice Fontaine +--- + configure.ac | 4 ++-- + 1 file changed, 2 insertions(+), 2 deletions(-) + +diff --git a/configure.ac b/configure.ac +index 0a19a2a..9773993 100644 +--- a/configure.ac ++++ b/configure.ac +@@ -16,8 +16,8 @@ AC_PROG_CC_STDC + # Check for a2x only if the man page is missing, i.e. we are building from git. The release tarballs + # are set up to include the man pages. This way, only people creating tarballs via `make dist` and + # people building from git need a2x as a dependency. +-AC_CHECK_FILE( +- [src/pixz.1], ++AS_IF( ++ [test -f src/pixz.1], + [], + [ + AC_ARG_WITH( +-- +2.35.1 + -- cgit v1.2.3