mirror of
https://github.com/containers/skopeo.git
synced 2025-08-22 00:13:21 +00:00
This PR introduce 3 changes: - Upgrade Nix stable channel from 20.03 to 20.09. NixOS 20.09 released at 2020-10-27, see <https://nixos.org/manual/nixos/stable/release-notes.html#sec-release-20.09> for more information. - Replace `git` with `gitMinimal`. All 6 projects (i.e. crun/conmon/skopeo/buildah/podman/cri-o) are having `git` as dependency for failsafe during bootstrap. BTW <https://github.com/NixOS/nixpkgs/pull/104896> replace `asciidoc` with `asciidoctor` so trigger the dependency chain to `glib` and so failed (see below). Switching to `gitMinimal` skip this dependency chain to `glib`, which also speed up overall build process. - Adding `-pthread` for `glib` `conmon` couldn't skip the error by replacing `git` with `gitMinimal` since it do depend on `glib`. Since `glib` trigger error message "undefined reference to 'pthread\_create'", therefore adding `pthread` to `CFLAGS` could solve the problem. Also see: - <https://github.com/containers/crun/pull/550> - <https://github.com/containers/conmon/pull/218> - <https://github.com/containers/skopeo/pull/1120> - <https://github.com/containers/buildah/pull/2831> - <https://github.com/containers/podman/pull/8526> - <https://github.com/cri-o/cri-o/pull/4395> Signed-off-by: Wong Hoi Sing Edison <hswong3i@pantarei-design.com>
58 lines
1.7 KiB
Nix
58 lines
1.7 KiB
Nix
{ system ? builtins.currentSystem }:
|
|
let
|
|
pkgs = (import ./nixpkgs.nix {
|
|
config = {
|
|
packageOverrides = pkg: {
|
|
gpgme = (static pkg.gpgme);
|
|
libassuan = (static pkg.libassuan);
|
|
libgpgerror = (static pkg.libgpgerror);
|
|
libseccomp = (static pkg.libseccomp);
|
|
glib = (static pkg.glib).overrideAttrs(x: {
|
|
outputs = [ "bin" "out" "dev" ];
|
|
mesonFlags = [
|
|
"-Ddefault_library=static"
|
|
"-Ddevbindir=${placeholder ''dev''}/bin"
|
|
"-Dgtk_doc=false"
|
|
"-Dnls=disabled"
|
|
];
|
|
});
|
|
};
|
|
};
|
|
});
|
|
|
|
static = pkg: pkg.overrideAttrs(x: {
|
|
doCheck = false;
|
|
configureFlags = (x.configureFlags or []) ++ [
|
|
"--without-shared"
|
|
"--disable-shared"
|
|
];
|
|
dontDisableStatic = true;
|
|
enableSharedExecutables = false;
|
|
enableStatic = true;
|
|
});
|
|
|
|
self = with pkgs; buildGoModule rec {
|
|
name = "skopeo";
|
|
src = ./..;
|
|
vendorSha256 = null;
|
|
doCheck = false;
|
|
enableParallelBuilding = true;
|
|
outputs = [ "out" ];
|
|
nativeBuildInputs = [ bash gitMinimal go-md2man installShellFiles makeWrapper pkg-config which ];
|
|
buildInputs = [ glibc glibc.static gpgme libassuan libgpgerror libseccomp ];
|
|
prePatch = ''
|
|
export CFLAGS='-static -pthread'
|
|
export LDFLAGS='-s -w -static-libgcc -static'
|
|
export EXTRA_LDFLAGS='-s -w -linkmode external -extldflags "-static -lm"'
|
|
export BUILDTAGS='static netgo osusergo exclude_graphdriver_btrfs exclude_graphdriver_devicemapper'
|
|
'';
|
|
buildPhase = ''
|
|
patchShebangs .
|
|
make bin/skopeo
|
|
'';
|
|
installPhase = ''
|
|
install -Dm755 bin/skopeo $out/bin/skopeo
|
|
'';
|
|
};
|
|
in self
|