|
3 | 3 |
|
4 | 4 | inputs.nixpkgs.url = "github:NixOS/nixpkgs/nixpkgs-unstable"; |
5 | 5 |
|
6 | | - outputs = { self, nixpkgs }: |
| 6 | + outputs = |
| 7 | + { self, nixpkgs }: |
7 | 8 |
|
8 | 9 | let |
9 | | - supportedSystems = [ "x86_64-linux" "i686-linux" "aarch64-linux" ]; |
| 10 | + supportedSystems = [ |
| 11 | + "x86_64-linux" |
| 12 | + "i686-linux" |
| 13 | + "aarch64-linux" |
| 14 | + ]; |
10 | 15 | forAllSystems = nixpkgs.lib.genAttrs supportedSystems; |
11 | 16 |
|
12 | 17 | version = nixpkgs.lib.removeSuffix "\n" (builtins.readFile ./version); |
13 | 18 | pkgs = nixpkgs.legacyPackages.x86_64-linux; |
14 | 19 |
|
15 | | - |
16 | | - patchelfFor = pkgs: let |
17 | | - # this is only |
18 | | - in pkgs.callPackage ./patchelf.nix { |
19 | | - inherit version; |
20 | | - src = self; |
21 | | - }; |
| 20 | + patchelfFor = |
| 21 | + pkgs: |
| 22 | + let |
| 23 | + # this is only |
| 24 | + in |
| 25 | + pkgs.callPackage ./patchelf.nix { |
| 26 | + inherit version; |
| 27 | + src = self; |
| 28 | + }; |
22 | 29 |
|
23 | 30 | in |
24 | 31 |
|
|
29 | 36 | }; |
30 | 37 |
|
31 | 38 | hydraJobs = { |
32 | | - tarball = |
33 | | - pkgs.releaseTools.sourceTarball rec { |
34 | | - name = "patchelf-tarball"; |
35 | | - inherit version; |
36 | | - versionSuffix = ""; # obsolete |
37 | | - src = self; |
38 | | - preAutoconf = "echo ${version} > version"; |
39 | | - |
40 | | - # portable configure shouldn't have a shebang pointing to the nix store |
41 | | - postConfigure = '' |
42 | | - sed -i '1s|^.*$|#!/bin/sh|' ./configure |
43 | | - ''; |
44 | | - postDist = '' |
45 | | - cp README.md $out/ |
46 | | - echo "doc readme $out/README.md" >> $out/nix-support/hydra-build-products |
47 | | - ''; |
48 | | - }; |
| 39 | + tarball = pkgs.releaseTools.sourceTarball rec { |
| 40 | + name = "patchelf-tarball"; |
| 41 | + inherit version; |
| 42 | + versionSuffix = ""; # obsolete |
| 43 | + src = self; |
| 44 | + preAutoconf = "echo ${version} > version"; |
| 45 | + |
| 46 | + # portable configure shouldn't have a shebang pointing to the nix store |
| 47 | + postConfigure = '' |
| 48 | + sed -i '1s|^.*$|#!/bin/sh|' ./configure |
| 49 | + ''; |
| 50 | + postDist = '' |
| 51 | + cp README.md $out/ |
| 52 | + echo "doc readme $out/README.md" >> $out/nix-support/hydra-build-products |
| 53 | + ''; |
| 54 | + }; |
49 | 55 |
|
50 | 56 | coverage = |
51 | 57 | (pkgs.releaseTools.coverageAnalysis { |
52 | 58 | name = "patchelf-coverage"; |
53 | 59 | src = self.hydraJobs.tarball; |
54 | | - lcovFilter = ["*/tests/*"]; |
55 | | - }).overrideAttrs (old: { |
56 | | - preCheck = '' |
57 | | - # coverage cflag breaks this target |
58 | | - NIX_CFLAGS_COMPILE=''${NIX_CFLAGS_COMPILE//--coverage} make -C tests phdr-corruption.so |
59 | | - ''; |
60 | | - }); |
| 60 | + lcovFilter = [ "*/tests/*" ]; |
| 61 | + }).overrideAttrs |
| 62 | + (old: { |
| 63 | + preCheck = '' |
| 64 | + # coverage cflag breaks this target |
| 65 | + NIX_CFLAGS_COMPILE=''${NIX_CFLAGS_COMPILE//--coverage} make -C tests phdr-corruption.so |
| 66 | + ''; |
| 67 | + }); |
61 | 68 |
|
62 | 69 | build = forAllSystems (system: self.packages.${system}.patchelf); |
63 | | - build-sanitized = forAllSystems (system: self.packages.${system}.patchelf.overrideAttrs (old: { |
64 | | - configureFlags = [ "--with-asan " "--with-ubsan" ]; |
65 | | - # -Wno-unused-command-line-argument is for clang, which does not like |
66 | | - # our cc wrapper arguments |
67 | | - CFLAGS = "-Werror -Wno-unused-command-line-argument"; |
68 | | - })); |
| 70 | + build-sanitized = forAllSystems ( |
| 71 | + system: |
| 72 | + self.packages.${system}.patchelf.overrideAttrs (old: { |
| 73 | + configureFlags = [ |
| 74 | + "--with-asan " |
| 75 | + "--with-ubsan" |
| 76 | + ]; |
| 77 | + # -Wno-unused-command-line-argument is for clang, which does not like |
| 78 | + # our cc wrapper arguments |
| 79 | + CFLAGS = "-Werror -Wno-unused-command-line-argument"; |
| 80 | + }) |
| 81 | + ); |
69 | 82 |
|
70 | 83 | # x86_64-linux seems to be only working clangStdenv at the moment |
71 | | - build-sanitized-clang = nixpkgs.lib.genAttrs [ "x86_64-linux" ] (system: self.hydraJobs.build-sanitized.${system}.override { |
72 | | - stdenv = nixpkgs.legacyPackages.${system}.llvmPackages_latest.libcxxStdenv; |
73 | | - }); |
| 84 | + build-sanitized-clang = nixpkgs.lib.genAttrs [ "x86_64-linux" ] ( |
| 85 | + system: |
| 86 | + self.hydraJobs.build-sanitized.${system}.override { |
| 87 | + stdenv = nixpkgs.legacyPackages.${system}.llvmPackages_latest.libcxxStdenv; |
| 88 | + } |
| 89 | + ); |
74 | 90 |
|
75 | 91 | # To get mingw compiler from hydra cache |
76 | 92 | inherit (self.packages.x86_64-linux) patchelf-win32 patchelf-win64; |
77 | 93 |
|
78 | | - release = pkgs.releaseTools.aggregate |
79 | | - { name = "patchelf-${self.hydraJobs.tarball.version}"; |
80 | | - constituents = |
81 | | - [ self.hydraJobs.tarball |
82 | | - self.hydraJobs.build.x86_64-linux |
83 | | - self.hydraJobs.build.i686-linux |
84 | | - # FIXME: add aarch64 emulation to our github action... |
85 | | - #self.hydraJobs.build.aarch64-linux |
86 | | - self.hydraJobs.build-sanitized.x86_64-linux |
87 | | - #self.hydraJobs.build-sanitized.aarch64-linux |
88 | | - self.hydraJobs.build-sanitized.i686-linux |
89 | | - self.hydraJobs.build-sanitized-clang.x86_64-linux |
90 | | - ]; |
91 | | - meta.description = "Release-critical builds"; |
92 | | - }; |
| 94 | + release = pkgs.releaseTools.aggregate { |
| 95 | + name = "patchelf-${self.hydraJobs.tarball.version}"; |
| 96 | + constituents = [ |
| 97 | + self.hydraJobs.tarball |
| 98 | + self.hydraJobs.build.x86_64-linux |
| 99 | + self.hydraJobs.build.i686-linux |
| 100 | + # FIXME: add aarch64 emulation to our github action... |
| 101 | + #self.hydraJobs.build.aarch64-linux |
| 102 | + self.hydraJobs.build-sanitized.x86_64-linux |
| 103 | + #self.hydraJobs.build-sanitized.aarch64-linux |
| 104 | + self.hydraJobs.build-sanitized.i686-linux |
| 105 | + self.hydraJobs.build-sanitized-clang.x86_64-linux |
| 106 | + ]; |
| 107 | + meta.description = "Release-critical builds"; |
| 108 | + }; |
93 | 109 |
|
94 | 110 | }; |
95 | 111 |
|
96 | 112 | checks = forAllSystems (system: { |
97 | 113 | build = self.hydraJobs.build.${system}; |
98 | 114 | }); |
99 | 115 |
|
100 | | - devShells = forAllSystems (system: { |
101 | | - glibc = self.packages.${system}.patchelf; |
102 | | - default = self.devShells.${system}.glibc; |
103 | | - } // nixpkgs.lib.optionalAttrs (system != "i686-linux") { |
104 | | - musl = self.packages.${system}.patchelf-musl; |
105 | | - }); |
106 | | - |
107 | | - packages = forAllSystems (system: let |
108 | | - pkgs = nixpkgs.legacyPackages.${system}; |
109 | | - in { |
110 | | - patchelf = patchelfFor pkgs; |
111 | | - default = self.packages.${system}.patchelf; |
112 | | - |
113 | | - # This is a good test to see if packages can be cross-compiled. It also |
114 | | - # tests if our testsuite uses target-prefixed executable names. |
115 | | - patchelf-musl-cross = patchelfFor pkgs.pkgsCross.musl64; |
116 | | - patchelf-netbsd-cross = patchelfFor pkgs.pkgsCross.x86_64-netbsd; |
117 | | - |
118 | | - patchelf-win32 = (patchelfFor pkgs.pkgsCross.mingw32).overrideAttrs (old: { |
119 | | - NIX_CFLAGS_COMPILE = "-static"; |
120 | | - }); |
121 | | - patchelf-win64 = (patchelfFor pkgs.pkgsCross.mingwW64).overrideAttrs (old: { |
122 | | - NIX_CFLAGS_COMPILE = "-static"; |
123 | | - }); |
124 | | - } // nixpkgs.lib.optionalAttrs (system != "i686-linux") { |
125 | | - patchelf-musl = patchelfFor nixpkgs.legacyPackages.${system}.pkgsMusl; |
126 | | - }); |
| 116 | + devShells = forAllSystems ( |
| 117 | + system: |
| 118 | + { |
| 119 | + glibc = self.packages.${system}.patchelf; |
| 120 | + default = self.devShells.${system}.glibc; |
| 121 | + } |
| 122 | + // nixpkgs.lib.optionalAttrs (system != "i686-linux") { |
| 123 | + musl = self.packages.${system}.patchelf-musl; |
| 124 | + } |
| 125 | + ); |
| 126 | + |
| 127 | + packages = forAllSystems ( |
| 128 | + system: |
| 129 | + let |
| 130 | + pkgs = nixpkgs.legacyPackages.${system}; |
| 131 | + in |
| 132 | + { |
| 133 | + patchelf = patchelfFor pkgs; |
| 134 | + default = self.packages.${system}.patchelf; |
| 135 | + |
| 136 | + # This is a good test to see if packages can be cross-compiled. It also |
| 137 | + # tests if our testsuite uses target-prefixed executable names. |
| 138 | + patchelf-musl-cross = patchelfFor pkgs.pkgsCross.musl64; |
| 139 | + patchelf-netbsd-cross = patchelfFor pkgs.pkgsCross.x86_64-netbsd; |
| 140 | + |
| 141 | + patchelf-win32 = (patchelfFor pkgs.pkgsCross.mingw32).overrideAttrs (old: { |
| 142 | + NIX_CFLAGS_COMPILE = "-static"; |
| 143 | + }); |
| 144 | + patchelf-win64 = (patchelfFor pkgs.pkgsCross.mingwW64).overrideAttrs (old: { |
| 145 | + NIX_CFLAGS_COMPILE = "-static"; |
| 146 | + }); |
| 147 | + } |
| 148 | + // nixpkgs.lib.optionalAttrs (system != "i686-linux") { |
| 149 | + patchelf-musl = patchelfFor nixpkgs.legacyPackages.${system}.pkgsMusl; |
| 150 | + } |
| 151 | + ); |
127 | 152 |
|
128 | 153 | }; |
129 | 154 | } |
0 commit comments