fix: Linux: bundle zlib

This commit is contained in:
Sebastian Ullrich 2021-11-07 23:07:44 +01:00
parent acf7903691
commit 42ee91bcda
3 changed files with 8 additions and 6 deletions

View file

@ -26,7 +26,7 @@ jobs:
- name: Linux release
os: ubuntu-latest
release: true
shell: nix-shell --arg glibc "(import (fetchTarball \"channel:nixos-19.03\") {{}}).glibc" --run "bash -euxo pipefail {0}"
shell: nix-shell --arg pkgsDist "import (fetchTarball \"channel:nixos-19.03\") {{}}" --run "bash -euxo pipefail {0}"
llvm-url: https://github.com/leanprover/lean-llvm/releases/download/13.0.0/lean-llvm-x86_64-linux-gnu.tar.zst
- name: Linux
os: ubuntu-latest

View file

@ -1,7 +1,7 @@
#!/usr/bin/env bash
set -uo pipefail
# run from root build directory (from inside nix-shell or otherwise defining GLIBC/GMP) as in
# run from root build directory (from inside nix-shell or otherwise defining GLIBC/ZLIB/GMP) as in
# ```
# eval cmake ../.. $(../../script/prepare-llvm-linux.sh ~/Downloads/clang+llvm-13.0.0-x86_64-linux-gnu-ubuntu-16.04.tar.xz)
# ```
@ -14,9 +14,10 @@ CP="cp -d" # preserve symlinks
# a C compiler!
$CP $(realpath llvm/bin/clang) stage1/bin/clang
# a linker!
$CP llvm/bin/{lld,ld.lld} stage1/bin/
$CP llvm/bin/{ld.lld,lld} stage1/bin/
# dependencies of the above
$CP llvm/lib/lib{clang-cpp,LLVM}*.so* stage1/lib/
$CP $ZLIB/lib/libz.so* stage1/lib/
# lean.h dependencies
$CP llvm/lib/clang/*/include/{std*,__std*,limits}.h stage1/include/clang
# ELF dependencies, must be put there for `--sysroot`

View file

@ -1,6 +1,6 @@
let
flakePkgs = (import ./default.nix).packages.${builtins.currentSystem};
in { pkgs ? flakePkgs.nixpkgs, llvmPackages ? null, glibc ? pkgs.glibc }:
in { pkgs ? flakePkgs.nixpkgs, pkgsDist ? pkgs, llvmPackages ? null }:
# use `shell` as default
(attribs: attribs.shell // attribs) rec {
shell = pkgs.mkShell.override {
@ -13,8 +13,9 @@ in { pkgs ? flakePkgs.nixpkgs, llvmPackages ? null, glibc ? pkgs.glibc }:
hardeningDisable = [ "all" ];
# more convenient `ctest` output
CTEST_OUTPUT_ON_FAILURE = 1;
GMP = pkgs.gmp.override { withStatic = true; };
GLIBC = glibc;
GMP = pkgsDist.gmp.override { withStatic = true; };
GLIBC = pkgsDist.glibc;
ZLIB = pkgsDist.zlib;
shellHook = ''
export LEAN_SRC_PATH="$PWD/src"
'';