justbuild: format

This commit is contained in:
Gaetan Lepage 2024-10-13 14:38:48 +02:00 committed by Gaétan Lepage
parent ed47a0bb77
commit ffd9d8f0f1

View File

@ -24,7 +24,8 @@
curl, curl,
libarchive, libarchive,
}: }:
let stdenv = gccStdenv; let
stdenv = gccStdenv;
in in
stdenv.mkDerivation rec { stdenv.mkDerivation rec {
pname = "justbuild"; pname = "justbuild";
@ -47,31 +48,30 @@ stdenv.mkDerivation rec {
hash = "sha256-W7awJTzPZLU9bHJJYlp+P2w7xkAqvVLTd4v6SCWHA6A="; hash = "sha256-W7awJTzPZLU9bHJJYlp+P2w7xkAqvVLTd4v6SCWHA6A=";
}; };
nativeBuildInputs = nativeBuildInputs = [
[ # Tools for the bootstrap process
# Tools for the bootstrap process jq
jq pkg-config
pkg-config python3
python3 unzip
unzip wget
wget coreutils
coreutils
# Dependencies of just # Dependencies of just
cli11 cli11
# Using fmt 10 because this is the same version upstream currently # Using fmt 10 because this is the same version upstream currently
# uses for bundled builds # uses for bundled builds
# For future updates: The currently used version can be found in the file # For future updates: The currently used version can be found in the file
# etc/repos.json: https://github.com/just-buildsystem/justbuild/blob/master/etc/repos.json # etc/repos.json: https://github.com/just-buildsystem/justbuild/blob/master/etc/repos.json
# under the key .repositories.fmt # under the key .repositories.fmt
fmt_10 fmt_10
microsoft-gsl microsoft-gsl
nlohmann_json nlohmann_json
# Dependencies of the compiled just-mr # Dependencies of the compiled just-mr
curl curl
libarchive libarchive
]; ];
buildInputs = [ buildInputs = [
grpc grpc
@ -81,34 +81,36 @@ stdenv.mkDerivation rec {
python3 python3
]; ];
postPatch = '' postPatch =
sed -ie 's|\./bin/just-mr.py|${python3}/bin/python3 ./bin/just-mr.py|' bin/bootstrap.py ''
sed -ie 's|#!/usr/bin/env python3|#!${python3}/bin/python3|' bin/parallel-bootstrap-traverser.py sed -ie 's|\./bin/just-mr.py|${python3}/bin/python3 ./bin/just-mr.py|' bin/bootstrap.py
jq '.repositories.protobuf.pkg_bootstrap.local_path = "${protobuf_25}"' etc/repos.json > etc/repos.json.patched sed -ie 's|#!/usr/bin/env python3|#!${python3}/bin/python3|' bin/parallel-bootstrap-traverser.py
mv etc/repos.json.patched etc/repos.json jq '.repositories.protobuf.pkg_bootstrap.local_path = "${protobuf_25}"' etc/repos.json > etc/repos.json.patched
jq '.repositories.com_github_grpc_grpc.pkg_bootstrap.local_path = "${grpc}"' etc/repos.json > etc/repos.json.patched mv etc/repos.json.patched etc/repos.json
mv etc/repos.json.patched etc/repos.json jq '.repositories.com_github_grpc_grpc.pkg_bootstrap.local_path = "${grpc}"' etc/repos.json > etc/repos.json.patched
jq '.unknown.PATH = []' etc/toolchain/CC/TARGETS > etc/toolchain/CC/TARGETS.patched mv etc/repos.json.patched etc/repos.json
mv etc/toolchain/CC/TARGETS.patched etc/toolchain/CC/TARGETS jq '.unknown.PATH = []' etc/toolchain/CC/TARGETS > etc/toolchain/CC/TARGETS.patched
'' + lib.optionalString stdenv.hostPlatform.isDarwin '' mv etc/toolchain/CC/TARGETS.patched etc/toolchain/CC/TARGETS
sed -ie 's|-Wl,-z,stack-size=8388608|-Wl,-stack_size,0x800000|' bin/bootstrap.py ''
''; + lib.optionalString stdenv.hostPlatform.isDarwin ''
sed -ie 's|-Wl,-z,stack-size=8388608|-Wl,-stack_size,0x800000|' bin/bootstrap.py
'';
/* The build phase follows the bootstrap procedure that is explained in /*
https://github.com/just-buildsystem/justbuild/blob/master/INSTALL.md The build phase follows the bootstrap procedure that is explained in
https://github.com/just-buildsystem/justbuild/blob/master/INSTALL.md
The bootstrap of the just binary depends on two proto libraries, which are The bootstrap of the just binary depends on two proto libraries, which are
supplied as external distfiles. supplied as external distfiles.
The microsoft-gsl library does not provide a pkg-config file, so one is The microsoft-gsl library does not provide a pkg-config file, so one is
created here. In case also the GNU Scientific Library would be used (which created here. In case also the GNU Scientific Library would be used (which
has also the pkg-config name gsl) this would cause a conflict. However, it has also the pkg-config name gsl) this would cause a conflict. However, it
is very unlikely that a build tool will ever depend on a GPL math library. is very unlikely that a build tool will ever depend on a GPL math library.
The extra build flags (ADD_CFLAGS and ADD_CXXFLAGS) are only needed in the
current version of just, the next release will contain a fix from upstream.
https://github.com/just-buildsystem/justbuild/commit/5abcd4140a91236c7bda1c21ce69e76a28da7c8a
The extra build flags (ADD_CFLAGS and ADD_CXXFLAGS) are only needed in the
current version of just, the next release will contain a fix from upstream.
https://github.com/just-buildsystem/justbuild/commit/5abcd4140a91236c7bda1c21ce69e76a28da7c8a
*/ */
buildPhase = '' buildPhase = ''
@ -170,6 +172,6 @@ stdenv.mkDerivation rec {
description = "Generic build tool"; description = "Generic build tool";
homepage = "https://github.com/just-buildsystem/justbuild"; homepage = "https://github.com/just-buildsystem/justbuild";
license = licenses.asl20; license = licenses.asl20;
maintainers = with maintainers; [clkamp]; maintainers = with maintainers; [ clkamp ];
}; };
} }