conda: build llvm-or1k

pull/30/head
Sebastien Bourdeauducq 2020-06-09 18:21:54 +08:00
parent 9e900d321e
commit 20c2871896
4 changed files with 66 additions and 2 deletions

View File

@ -16,6 +16,7 @@ let
targetPkgs = pkgs: ([ condaSrcChmod ] ++ condaDeps);
};
# for binutils
libiconv-filename = "libiconv-1.15-h516909a_1006.tar.bz2";
libiconv = pkgs.fetchurl {
url = "https://anaconda.org/conda-forge/libiconv/1.15/download/linux-64/${libiconv-filename}";
@ -38,5 +39,9 @@ let
in
buildFHSUserEnv {
name = "conda-builder-env";
targetPkgs = pkgs: [ condaInstalled ] ++ condaDeps;
targetPkgs = pkgs: ([ condaInstalled ] ++ condaDeps ++ [
# for llvm-or1k
cmake
]
);
}

View File

@ -0,0 +1,52 @@
{ pkgs, version, src }:
let
fake-src = pkgs.runCommand "conda-fake-source-llvm-or1k" { }
''
mkdir -p $out/fake-conda;
# work around yet more idiotic conda behavior - build breaks if write permissions aren't set on source files.
cp --no-preserve=mode,ownership -R ${src} workaround-conda
pushd workaround-conda
tar cf $out/src.tar .
popd
rm -rf workaround-conda
cat << EOF > $out/fake-conda/meta.yaml
package:
name: llvm-or1k
version: ${version}
# Use the nixpkgs cmake to build, so we are less bothered by conda idiocy.
source:
url: ../src.tar
EOF
cat << EOF > $out/fake-conda/build.sh
mkdir build
cd build
cmake .. \$COMPILER32 \
-DCMAKE_BUILD_TYPE=Release \
-DCMAKE_INSTALL_PREFIX=\$PREFIX \
-DLLVM_BUILD_LLVM_DYLIB=ON \
-DLLVM_LINK_LLVM_DYLIB=ON \
-DLLVM_TARGETS_TO_BUILD=X86 \
-DLLVM_EXPERIMENTAL_TARGETS_TO_BUILD=OR1K \
-DLLVM_ENABLE_ASSERTIONS=OFF \
-DLLVM_INSTALL_UTILS=ON \
-DLLVM_INCLUDE_TESTS=OFF \
-DLLVM_INCLUDE_DOCS=OFF \
-DLLVM_INCLUDE_EXAMPLES=OFF
make -j2
make install
EOF
chmod 755 $out/fake-conda/build.sh
'';
in
import ./build.nix { inherit pkgs; } {
name = "conda-llvm-or1k";
src = fake-src;
}

View File

@ -54,6 +54,11 @@ let
inherit (binutils-arm) version src;
target = "armv7-unknown-linux-gnueabihf";
};
conda-llvm-or1k = import ./conda/llvm-or1k.nix {
inherit pkgs;
inherit (llvm-or1k) version;
src = llvm-or1k.llvm-src;
};
conda-sipyco = import ./conda/build.nix { inherit pkgs; } {
name = "conda-sipyco";
src = import ./conda/fake-source.nix { inherit pkgs; } {

View File

@ -26,9 +26,11 @@ let
in
stdenv.mkDerivation rec {
name = "llvm-or1k";
passthru.llvm-src = llvm-src;
src = llvm-clang-src;
version = "6.0.0";
buildInputs = [ perl groff cmake libxml2 python libffi ] ++ stdenv.lib.optional stdenv.isLinux valgrind;
buildInputs = [ perl groff cmake libxml2 python libffi ] ++ stdenv.lib.optional stdenv.isLinux valgrind;
preBuild = ''
NIX_BUILD_CORES=4