added aarch64 (raspberry pi) support
This commit is contained in:
parent
26fe53dfd8
commit
f60e2a4537
2 changed files with 190 additions and 168 deletions
16
flake.lock
16
flake.lock
|
@ -16,6 +16,21 @@
|
||||||
"url": "https://gist.github.com/f0fd86b6c73063283afe550bc5d77594.git"
|
"url": "https://gist.github.com/f0fd86b6c73063283afe550bc5d77594.git"
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
|
"flake-utils": {
|
||||||
|
"locked": {
|
||||||
|
"lastModified": 1659877975,
|
||||||
|
"narHash": "sha256-zllb8aq3YO3h8B/U0/J1WBgAL8EX5yWf5pMj3G0NAmc=",
|
||||||
|
"owner": "numtide",
|
||||||
|
"repo": "flake-utils",
|
||||||
|
"rev": "c0e246b9b83f637f4681389ecabcb2681b4f3af0",
|
||||||
|
"type": "github"
|
||||||
|
},
|
||||||
|
"original": {
|
||||||
|
"owner": "numtide",
|
||||||
|
"repo": "flake-utils",
|
||||||
|
"type": "github"
|
||||||
|
}
|
||||||
|
},
|
||||||
"gourou-src": {
|
"gourou-src": {
|
||||||
"flake": false,
|
"flake": false,
|
||||||
"locked": {
|
"locked": {
|
||||||
|
@ -68,6 +83,7 @@
|
||||||
"root": {
|
"root": {
|
||||||
"inputs": {
|
"inputs": {
|
||||||
"base64-src": "base64-src",
|
"base64-src": "base64-src",
|
||||||
|
"flake-utils": "flake-utils",
|
||||||
"gourou-src": "gourou-src",
|
"gourou-src": "gourou-src",
|
||||||
"nixpkgs": "nixpkgs",
|
"nixpkgs": "nixpkgs",
|
||||||
"pugixml-src": "pugixml-src",
|
"pugixml-src": "pugixml-src",
|
||||||
|
|
342
flake.nix
342
flake.nix
|
@ -1,6 +1,7 @@
|
||||||
{
|
{
|
||||||
inputs = {
|
inputs = {
|
||||||
nixpkgs.url = "github:NixOS/nixpkgs/nixos-unstable";
|
nixpkgs.url = "github:NixOS/nixpkgs/nixos-unstable";
|
||||||
|
flake-utils.url = "github:numtide/flake-utils";
|
||||||
gourou-src = {
|
gourou-src = {
|
||||||
url = "git://soutade.fr/libgourou.git";
|
url = "git://soutade.fr/libgourou.git";
|
||||||
flake = false;
|
flake = false;
|
||||||
|
@ -20,172 +21,177 @@
|
||||||
};
|
};
|
||||||
|
|
||||||
outputs = flakes:
|
outputs = flakes:
|
||||||
let
|
flakes.flake-utils.lib.eachSystem [ "x86_64-linux" "aarch64-linux" ]
|
||||||
version = "1.3.0";
|
(system:
|
||||||
self = flakes.self.packages.x86_64-linux;
|
let
|
||||||
nixpkgs = flakes.nixpkgs.legacyPackages.x86_64-linux.pkgsStatic;
|
version = "1.3.1";
|
||||||
nixpkgs-dyn = flakes.nixpkgs.legacyPackages.x86_64-linux;
|
self = flakes.self.packages.${system};
|
||||||
nixpkgs-fmt = flakes.nixpkgs-fmt.defaultPackage.x86_64-linux;
|
nixpkgs = flakes.nixpkgs.legacyPackages.${system}.pkgsStatic;
|
||||||
gourou-src = flakes.gourou-src;
|
nixpkgs-dyn = flakes.nixpkgs.legacyPackages.${system};
|
||||||
updfparser-src = flakes.updfparser-src;
|
nixpkgs-fmt = flakes.nixpkgs-fmt.defaultPackage.${system};
|
||||||
base64-src = flakes.base64-src;
|
gourou-src = flakes.gourou-src;
|
||||||
pugixml-src = flakes.pugixml-src;
|
updfparser-src = flakes.updfparser-src;
|
||||||
cxx = "${nixpkgs.stdenv.cc}/bin/x86_64-unknown-linux-musl-g++";
|
base64-src = flakes.base64-src;
|
||||||
ar = "${nixpkgs.stdenv.cc.bintools.bintools_bin}/bin/x86_64-unknown-linux-musl-ar";
|
pugixml-src = flakes.pugixml-src;
|
||||||
obj-flags = "-O2 -static";
|
cxx = "${nixpkgs.stdenv.cc}/bin/${nixpkgs.stdenv.cc.targetPrefix}c++";
|
||||||
in
|
ar = "${nixpkgs.stdenv.cc.bintools.bintools_bin}/bin/${nixpkgs.stdenv.cc.targetPrefix}ar";
|
||||||
rec {
|
obj-flags = "-O2 -static";
|
||||||
packages.x86_64-linux.libzip-static = nixpkgs.libzip.overrideAttrs (prev: {
|
in
|
||||||
cmakeFlags = (prev.cmakeFlags or [ ]) ++ [
|
rec {
|
||||||
"-DBUILD_SHARED_LIBS=OFF"
|
packages.libzip-static = nixpkgs.libzip.overrideAttrs (prev: {
|
||||||
"-DBUILD_EXAMPLES=OFF"
|
cmakeFlags = (prev.cmakeFlags or [ ]) ++ [
|
||||||
"-DBUILD_DOC=OFF"
|
"-DBUILD_SHARED_LIBS=OFF"
|
||||||
"-DBUILD_TOOLS=OFF"
|
"-DBUILD_EXAMPLES=OFF"
|
||||||
"-DBUILD_REGRESS=OFF"
|
"-DBUILD_DOC=OFF"
|
||||||
];
|
"-DBUILD_TOOLS=OFF"
|
||||||
outputs = [ "out" ];
|
"-DBUILD_REGRESS=OFF"
|
||||||
});
|
];
|
||||||
packages.x86_64-linux.base64 = derivation {
|
outputs = [ "out" ];
|
||||||
name = "updfparser";
|
});
|
||||||
system = "x86_64-linux";
|
packages.base64 = derivation {
|
||||||
builder = "${nixpkgs.bash}/bin/bash";
|
name = "updfparser";
|
||||||
PATH = "${nixpkgs.coreutils}/bin";
|
inherit system;
|
||||||
args = [
|
builder = "${nixpkgs.bash}/bin/bash";
|
||||||
"-c"
|
PATH = "${nixpkgs.coreutils}/bin";
|
||||||
''
|
args = [
|
||||||
mkdir -p $out/include/base64
|
"-c"
|
||||||
cp ${base64-src}/Base64.h $out/include/base64/Base64.h
|
''
|
||||||
''
|
mkdir -p $out/include/base64
|
||||||
];
|
cp ${base64-src}/Base64.h $out/include/base64/Base64.h
|
||||||
};
|
''
|
||||||
packages.x86_64-linux.updfparser = derivation {
|
];
|
||||||
name = "updfparser";
|
};
|
||||||
system = "x86_64-linux";
|
packages.updfparser = derivation {
|
||||||
builder = "${nixpkgs.bash}/bin/bash";
|
name = "updfparser";
|
||||||
PATH = "${nixpkgs.coreutils}/bin";
|
inherit system;
|
||||||
args = [
|
builder = "${nixpkgs.bash}/bin/bash";
|
||||||
"-c"
|
PATH = "${nixpkgs.coreutils}/bin";
|
||||||
''
|
args = [
|
||||||
${cxx} \
|
"-c"
|
||||||
-c ${updfparser-src}/src/*.cpp \
|
''
|
||||||
-I ${updfparser-src}/include \
|
${cxx} \
|
||||||
${obj-flags}
|
-c ${updfparser-src}/src/*.cpp \
|
||||||
mkdir -p $out/lib
|
-I ${updfparser-src}/include \
|
||||||
${ar} crs $out/lib/libupdfparser.a *.o
|
${obj-flags}
|
||||||
''
|
mkdir -p $out/lib
|
||||||
];
|
${ar} crs $out/lib/libupdfparser.a *.o
|
||||||
};
|
''
|
||||||
packages.x86_64-linux.gourou = derivation {
|
];
|
||||||
name = "gourou";
|
};
|
||||||
system = "x86_64-linux";
|
packages.gourou = derivation {
|
||||||
builder = "${nixpkgs.bash}/bin/bash";
|
name = "gourou";
|
||||||
PATH = "${nixpkgs.coreutils}/bin";
|
inherit system;
|
||||||
args = [
|
builder = "${nixpkgs.bash}/bin/bash";
|
||||||
"-c"
|
PATH = "${nixpkgs.coreutils}/bin";
|
||||||
''
|
args = [
|
||||||
${cxx} \
|
"-c"
|
||||||
-c \
|
''
|
||||||
${gourou-src}/src/*.cpp \
|
shopt -s extglob
|
||||||
${pugixml-src}/src/pugixml.cpp \
|
${cxx} \
|
||||||
-I ${self.base64}/include \
|
-c \
|
||||||
-I ${gourou-src}/include \
|
${gourou-src}/src/!(pugixml).cpp \
|
||||||
-I ${pugixml-src}/src \
|
${pugixml-src}/src/pugixml.cpp \
|
||||||
-I ${updfparser-src}/include \
|
-I ${self.base64}/include \
|
||||||
${obj-flags}
|
-I ${gourou-src}/include \
|
||||||
mkdir -p $out/lib $out/debug
|
-I ${pugixml-src}/src \
|
||||||
${ar} crs $out/lib/libgourou.a *.o
|
-I ${updfparser-src}/include \
|
||||||
cp *.o $out/debug
|
${obj-flags}
|
||||||
''
|
mkdir -p $out/lib $out/debug
|
||||||
];
|
${ar} crs $out/lib/libgourou.a *.o
|
||||||
};
|
cp *.o $out/debug
|
||||||
packages.x86_64-linux.utils-common = derivation {
|
''
|
||||||
name = "utils-common";
|
];
|
||||||
system = "x86_64-linux";
|
};
|
||||||
builder = "${nixpkgs.bash}/bin/bash";
|
packages.utils-common = derivation {
|
||||||
PATH = "${nixpkgs.coreutils}/bin";
|
name = "utils-common";
|
||||||
args = [
|
inherit system;
|
||||||
"-c"
|
builder = "${nixpkgs.bash}/bin/bash";
|
||||||
''
|
PATH = "${nixpkgs.coreutils}/bin";
|
||||||
${cxx} \
|
args = [
|
||||||
-c ${gourou-src}/utils/drmprocessorclientimpl.cpp \
|
"-c"
|
||||||
${gourou-src}/utils/utils_common.cpp \
|
''
|
||||||
-I ${gourou-src}/utils \
|
${cxx} \
|
||||||
-I ${gourou-src}/include \
|
-c ${gourou-src}/utils/drmprocessorclientimpl.cpp \
|
||||||
-I ${pugixml-src}/src \
|
${gourou-src}/utils/utils_common.cpp \
|
||||||
-I ${nixpkgs.openssl.dev}/include \
|
-I ${gourou-src}/utils \
|
||||||
-I ${nixpkgs.curl.dev}/include \
|
-I ${gourou-src}/include \
|
||||||
-I ${nixpkgs.zlib.dev}/include \
|
-I ${pugixml-src}/src \
|
||||||
-I ${self.libzip-static}/include \
|
-I ${nixpkgs.openssl.dev}/include \
|
||||||
${obj-flags}
|
-I ${nixpkgs.curl.dev}/include \
|
||||||
mkdir -p $out/lib
|
-I ${nixpkgs.zlib.dev}/include \
|
||||||
${ar} crs $out/lib/libutils-common.a *.o
|
-I ${self.libzip-static}/include \
|
||||||
''
|
${obj-flags}
|
||||||
];
|
mkdir -p $out/lib
|
||||||
};
|
${ar} crs $out/lib/libutils-common.a *.o
|
||||||
packages.x86_64-linux.knock = derivation {
|
''
|
||||||
name = "knock";
|
];
|
||||||
system = "x86_64-linux";
|
};
|
||||||
builder = "${nixpkgs.bash}/bin/bash";
|
packages.knock = derivation {
|
||||||
PATH = "${nixpkgs.coreutils}/bin";
|
name = "knock";
|
||||||
args = [
|
inherit system;
|
||||||
"-c"
|
builder = "${nixpkgs.bash}/bin/bash";
|
||||||
''
|
PATH = "${nixpkgs.coreutils}/bin";
|
||||||
mkdir -p $out/bin
|
args = [
|
||||||
${cxx} \
|
"-c"
|
||||||
-o $out/bin/knock \
|
''
|
||||||
${./src/knock.cpp} \
|
mkdir -p $out/bin
|
||||||
-D KNOCK_VERSION='"${version}"' \
|
${cxx} \
|
||||||
-Wl,--as-needed -static \
|
-o $out/bin/knock \
|
||||||
${self.utils-common}/lib/libutils-common.a \
|
${./src/knock.cpp} \
|
||||||
${self.gourou}/lib/libgourou.a \
|
-D KNOCK_VERSION='"${version}"' \
|
||||||
${self.updfparser}/lib/libupdfparser.a \
|
--std=c++17 \
|
||||||
-Wl,--start-group \
|
-Wl,--as-needed -static \
|
||||||
${self.libzip-static}/lib/libzip.a \
|
${self.utils-common}/lib/libutils-common.a \
|
||||||
${nixpkgs.libnghttp2}/lib/libnghttp2.a \
|
${self.gourou}/lib/libgourou.a \
|
||||||
${nixpkgs.libidn2.out}/lib/libidn2.a \
|
${self.updfparser}/lib/libupdfparser.a \
|
||||||
${nixpkgs.libunistring}/lib/libunistring.a \
|
-Wl,--start-group \
|
||||||
${nixpkgs.libssh2}/lib/libssh2.a \
|
${self.libzip-static}/lib/libzip.a \
|
||||||
${nixpkgs.zstd.out}/lib/libzstd.a \
|
${nixpkgs.libnghttp2}/lib/libnghttp2.a \
|
||||||
${nixpkgs.zlib}/lib/libz.a \
|
${nixpkgs.libidn2.out}/lib/libidn2.a \
|
||||||
${nixpkgs.openssl.out}/lib/libcrypto.a \
|
${nixpkgs.libunistring}/lib/libunistring.a \
|
||||||
${nixpkgs.curl.out}/lib/libcurl.a \
|
${nixpkgs.libssh2}/lib/libssh2.a \
|
||||||
${nixpkgs.openssl.out}/lib/libssl.a \
|
${nixpkgs.zstd.out}/lib/libzstd.a \
|
||||||
-static-libgcc -static-libstdc++ \
|
${nixpkgs.zlib}/lib/libz.a \
|
||||||
-Wl,--end-group \
|
${nixpkgs.openssl.out}/lib/libcrypto.a \
|
||||||
-I ${gourou-src}/utils \
|
${nixpkgs.curl.out}/lib/libcurl.a \
|
||||||
-I ${gourou-src}/include \
|
${nixpkgs.openssl.out}/lib/libssl.a \
|
||||||
-I ${pugixml-src}/src \
|
-static-libgcc -static-libstdc++ \
|
||||||
-I ${nixpkgs.openssl.dev}/include \
|
-Wl,--end-group \
|
||||||
-I ${nixpkgs.curl.dev}/include \
|
-I ${gourou-src}/utils \
|
||||||
-I ${nixpkgs.zlib.dev}/include \
|
-I ${gourou-src}/include \
|
||||||
-I ${self.libzip-static}/include
|
-I ${pugixml-src}/src \
|
||||||
''
|
-I ${nixpkgs.openssl.dev}/include \
|
||||||
];
|
-I ${nixpkgs.curl.dev}/include \
|
||||||
};
|
-I ${nixpkgs.zlib.dev}/include \
|
||||||
packages.x86_64-linux.default = self.knock;
|
-I ${self.libzip-static}/include
|
||||||
packages.x86_64-linux.tests = nixpkgs-dyn.stdenv.mkDerivation {
|
''
|
||||||
name = "tests";
|
];
|
||||||
src = ./tests;
|
};
|
||||||
buildInputs = [
|
packages.default = self.knock;
|
||||||
(nixpkgs-dyn.python3.withPackages (p: [
|
packages.tests = nixpkgs-dyn.stdenv.mkDerivation {
|
||||||
p.beautifulsoup4
|
name = "tests";
|
||||||
p.requests
|
src = ./tests;
|
||||||
]))
|
buildInputs = [
|
||||||
];
|
(nixpkgs-dyn.python3.withPackages (p: [
|
||||||
patchPhase = ''
|
p.beautifulsoup4
|
||||||
substituteInPlace tests.py --replace "./result/bin/knock" "${self.knock}/bin/knock"
|
p.requests
|
||||||
'';
|
]))
|
||||||
installPhase = ''
|
];
|
||||||
mkdir -p $out/bin
|
patchPhase = ''
|
||||||
cp tests.py $out/bin/tests
|
substituteInPlace tests.py --replace "./result/bin/knock" "${self.knock}/bin/knock"
|
||||||
chmod +x $out/bin/tests
|
'';
|
||||||
'';
|
installPhase = ''
|
||||||
};
|
mkdir -p $out/bin
|
||||||
packages.x86_64-linux.formatter = nixpkgs.writeShellScriptBin "formatter" ''
|
cp tests.py $out/bin/tests
|
||||||
set -x
|
chmod +x $out/bin/tests
|
||||||
${nixpkgs-dyn.clang-tools}/bin/clang-format -i --verbose ./src/*.cpp
|
'';
|
||||||
${nixpkgs-dyn.nixpkgs-fmt}/bin/nixpkgs-fmt .
|
};
|
||||||
${nixpkgs-dyn.black}/bin/black ./tests
|
packages.formatter = nixpkgs.writeShellScriptBin "formatter" ''
|
||||||
'';
|
set -x
|
||||||
};
|
${nixpkgs-dyn.clang-tools}/bin/clang-format -i --verbose ./src/*.cpp
|
||||||
|
${nixpkgs-dyn.nixpkgs-fmt}/bin/nixpkgs-fmt .
|
||||||
|
${nixpkgs-dyn.black}/bin/black ./tests
|
||||||
|
'';
|
||||||
|
}
|
||||||
|
);
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in a new issue