forked from M-Labs/nix-scripts
conda-windows: build llvmlite with VS, again
This commit is contained in:
parent
80bf1d300e
commit
69d8e02853
@ -1,16 +1,28 @@
|
||||
{ pkgs, conda-windows-llvm-or1k, version, src }:
|
||||
|
||||
# See: https://github.com/valtron/llvm-stuff/wiki/Build-llvmlite-with-MSYS2
|
||||
|
||||
let
|
||||
wfvm = import ../wfvm { inherit pkgs; };
|
||||
conda-vs2015_runtime-filename = "vs2015_runtime-14.16.27012-hf0eaf9b_2.tar.bz2";
|
||||
conda-vs2015_runtime = pkgs.fetchurl {
|
||||
url = "https://anaconda.org/anaconda/vs2015_runtime/14.16.27012/download/win-64/${conda-vs2015_runtime-filename}";
|
||||
sha256 = "1gbm6i6nkp8linmak5mm42hj1nzqd5ppak8kv1n3wfn52p21ngvs";
|
||||
};
|
||||
conda-cmake-filename = "cmake-3.17.2-h33f27b4_0.tar.bz2";
|
||||
conda-cmake = pkgs.fetchurl {
|
||||
url = "https://anaconda.org/anaconda/cmake/3.17.2/download/win-64/${conda-cmake-filename}";
|
||||
sha256 = "0lg782pj2i9h20rwfkwwskis038r98b3z4c9j1a6ih95rc6m2acn";
|
||||
};
|
||||
build = wfvm.utils.wfvm-run {
|
||||
name = "build-llvmlite-artiq";
|
||||
image = wfvm.makeWindowsImage { installCommands = with wfvm.layers; [ anaconda3 msys2 msys2-packages ]; };
|
||||
image = wfvm.makeWindowsImage { installCommands = with wfvm.layers; [ anaconda3 msvc msvc-ide-unbreak ]; };
|
||||
script = ''
|
||||
ln -s ${conda-windows-llvm-or1k}/win-64/llvm-or1k-*.tar.bz2 llvm-or1k.tar.bz2
|
||||
${wfvm.utils.win-put}/bin/win-put llvm-or1k.tar.bz2 .
|
||||
${wfvm.utils.win-exec}/bin/win-exec ".\Anaconda3\scripts\activate && conda create -n build llvm-or1k.tar.bz2"
|
||||
ln -s ${conda-vs2015_runtime} ${conda-vs2015_runtime-filename}
|
||||
ln -s ${conda-cmake} ${conda-cmake-filename}
|
||||
${wfvm.utils.win-exec}/bin/win-exec "mkdir fake-channel && mkdir fake-channel\win-64"
|
||||
${wfvm.utils.win-put}/bin/win-put ${conda-vs2015_runtime-filename} ./fake-channel/win-64
|
||||
${wfvm.utils.win-put}/bin/win-put ${conda-cmake-filename} ./fake-channel/win-64
|
||||
${wfvm.utils.win-put}/bin/win-put ${conda-windows-llvm-or1k}/win-64/llvm-or1k-*.tar.bz2 ./fake-channel/win-64
|
||||
${wfvm.utils.win-exec}/bin/win-exec ".\Anaconda3\scripts\activate && conda index fake-channel"
|
||||
|
||||
cat > meta.yaml << EOF
|
||||
package:
|
||||
@ -19,28 +31,32 @@ let
|
||||
|
||||
source:
|
||||
url: ../src.tar
|
||||
|
||||
requirements:
|
||||
build:
|
||||
- cmake
|
||||
- llvm-or1k
|
||||
EOF
|
||||
|
||||
cat > bld.bat << EOF
|
||||
set MSYS=C:\MSYS64
|
||||
set PATH=%MSYS%\usr\bin;%MSYS%\mingw64\bin;%PATH%
|
||||
@rem Let CMake know about the LLVM install path, for find_package()
|
||||
set CMAKE_PREFIX_PATH=%LIBRARY_PREFIX%
|
||||
|
||||
python setup.py install \
|
||||
--prefix=\$PREFIX \
|
||||
--single-version-externally-managed \
|
||||
--record=record.txt \
|
||||
--no-compile
|
||||
@rem Ensure there are no build leftovers (CMake can complain)
|
||||
if exist ffi\build rmdir /S /Q ffi\build
|
||||
|
||||
python setup.py install
|
||||
if errorlevel 1 exit 1
|
||||
EOF
|
||||
|
||||
${wfvm.utils.win-exec}/bin/win-exec "mkdir llvmlite-artiq"
|
||||
${wfvm.utils.win-put}/bin/win-put meta.yaml llvmlite-artiq
|
||||
${wfvm.utils.win-put}/bin/win-put bld.bat llvmlite-artiq
|
||||
cp --no-preserve=mode,ownership -R ${src} src
|
||||
patch -d src -p1 < ${./llvmlite-msys.diff}
|
||||
ln -s ${src} src
|
||||
tar chf src.tar src
|
||||
${wfvm.utils.win-put}/bin/win-put src.tar .
|
||||
|
||||
${wfvm.utils.win-exec}/bin/win-exec ".\Anaconda3\scripts\activate build && conda build --no-anaconda-upload --no-test llvmlite-artiq"
|
||||
${wfvm.utils.win-exec}/bin/win-exec ".\Anaconda3\scripts\activate && conda build --no-anaconda-upload --no-test -c file:///C:/users/wfvm/fake-channel --override-channels llvmlite-artiq"
|
||||
|
||||
${wfvm.utils.win-get}/bin/win-get "Anaconda3/conda-bld/win-64/llvmlite-artiq-${version}-0.tar.bz2"
|
||||
'';
|
||||
|
@ -1,42 +0,0 @@
|
||||
diff --git a/ffi/CMakeLists.txt b/ffi/CMakeLists.txt
|
||||
index 15470d4..11d06a5 100755
|
||||
--- a/ffi/CMakeLists.txt
|
||||
+++ b/ffi/CMakeLists.txt
|
||||
@@ -29,6 +29,7 @@ list(REMOVE_ITEM LLVM_AVAILABLE_LIBS LTO LLVM)
|
||||
# that we wish to use
|
||||
# llvm_map_components_to_libnames(llvm_libs support core irreader)
|
||||
llvm_map_components_to_libnames(llvm_libs all)
|
||||
+list(REMOVE_ITEM llvm_libs "LTO")
|
||||
|
||||
# Link against LLVM libraries
|
||||
target_link_libraries(llvmlite ${llvm_libs})
|
||||
diff --git a/ffi/build.py b/ffi/build.py
|
||||
index 9169d35..41a9a40 100755
|
||||
--- a/ffi/build.py
|
||||
+++ b/ffi/build.py
|
||||
@@ -24,7 +24,7 @@ def try_cmake(cmake_dir, build_dir, generator):
|
||||
old_dir = os.getcwd()
|
||||
try:
|
||||
os.chdir(build_dir)
|
||||
- subprocess.check_call(['cmake', '-G', generator, cmake_dir])
|
||||
+ subprocess.check_call(['cmake', '-G', generator, '-D', 'LLVM_DIR=$LLVM/lib/cmake/llvm', cmake_dir])
|
||||
finally:
|
||||
os.chdir(old_dir)
|
||||
|
||||
@@ -57,6 +57,7 @@ def find_win32_generator():
|
||||
if is_64bit:
|
||||
generator += ' Win64'
|
||||
build_dir = tempfile.mkdtemp()
|
||||
+ generator = 'MinGW Makefiles'
|
||||
print("Trying generator %r" % (generator,))
|
||||
try:
|
||||
try_cmake(cmake_dir, build_dir, generator)
|
||||
@@ -78,7 +79,7 @@ def main_win32():
|
||||
# Run configuration step
|
||||
try_cmake(here_dir, build_dir, generator)
|
||||
subprocess.check_call(['cmake', '--build', build_dir, '--config', config])
|
||||
- shutil.copy(os.path.join(build_dir, config, 'llvmlite.dll'), target_dir)
|
||||
+ shutil.copy(os.path.join(build_dir, 'libllvmlite.dll'), os.path.join(target_dir, 'llvmlite.dll'))
|
||||
|
||||
|
||||
def main_posix(kind, library_ext):
|
@ -139,12 +139,11 @@ let
|
||||
inherit (mainPackages.llvm-or1k) version;
|
||||
src = mainPackages.llvm-or1k.llvm-src;
|
||||
};
|
||||
conda-windows-llvmlite-artiq = import ./conda-windows/redistribute.nix {
|
||||
conda-windows-llvmlite-artiq = import ./conda-windows/llvmlite-artiq.nix {
|
||||
inherit pkgs;
|
||||
name = "llvmlite-artiq";
|
||||
filename = "llvmlite-artiq-0.23.0.dev-py35_5.tar.bz2";
|
||||
baseurl = "https://anaconda.org/m-labs/llvmlite-artiq/0.23.0.dev/download/win-64/";
|
||||
sha256 = "10w24w5ljvan06pbvwqj4pzal072jnyynmwm42dn06pq88ryz9wj";
|
||||
# TODO: stop using the legacy package after https://github.com/m-labs/artiq/issues/1473 is fixed
|
||||
inherit (condaWindowsLegacy) conda-windows-llvm-or1k;
|
||||
inherit (mainPackages.llvmlite-artiq) version src;
|
||||
};
|
||||
};
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user