-
Notifications
You must be signed in to change notification settings - Fork 568
/
Copy pathbuild_tarballs.jl
118 lines (102 loc) · 3.78 KB
/
build_tarballs.jl
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
using BinaryBuilder, Pkg
name = "MicrosoftMPI"
microsoftmpi_version = v"10.1.3"
version = v"10.1.4"
sources = [
FileSource("https://download.microsoft.com/download/7/2/7/72731ebb-b63c-4170-ade7-836966263a8f/msmpisetup.exe",
"47443829114d8d8670f77af98939fe876d33eceb35d0ce4e0e85efeec4d87213"),
FileSource("https://download.microsoft.com/download/7/2/7/72731ebb-b63c-4170-ade7-836966263a8f/msmpisdk.msi",
"8ccbc77a0cfe1e30f7495a759886b4d99b2c494b9b9ad414dcda1da84c00d3fa"),
GitSource("https://github.com/eschnett/MPIconstants", "d2763908c4d69c03f77f5f9ccc546fe635d068cb"),
]
script = raw"""
apk add p7zip
cd ${WORKSPACE}/srcdir/
7z x -t# msmpisetup.exe -otmp
if [[ ${target} == i686-w64-* ]]; then
# 32-bit files
7z x tmp/2.msi -o$prefix
else
# 64-bit files
7z x tmp/4.msi -o$prefix
mv -f $prefix/msmpi64.dll $prefix/msmpi.dll
mv -f $prefix/msmpires64.dll $prefix/msmpires.dll
fi
7z x msmpisdk.msi -o$prefix
cd ${prefix}
chmod +x *.exe
mkdir -p bin
mv *.exe *.dll bin
mkdir -p lib
mv *.lib lib
mkdir -p include
# Move to includedir only the mpifptr.h for current architecture
mv "mpifptr${nbits}.h" "include/mpifptr.h"
rm mpifptr*.h
mv *.h *.man include
mkdir -p src
mv *.f90 src
mkdir -p share/licenses/MicrosoftMPI
mv *.txt *.rtf share/licenses/MicrosoftMPI
# Generate "mpi.mod", "mpi_base.mod", "mpi_sizeofs.mod" and "mpi_constants.mod"
cd $includedir
gfortran -I. ../src/mpi.f90 -fsyntax-only -fno-range-check
# Replace an unknown character in mpif.h by a space
sed -i '/Copyright Notice/!b;n;c! + 2002 University of Chicago' mpif.h
################################################################################
# Install MPIconstants
################################################################################
cd ${WORKSPACE}/srcdir/MPIconstants*
mkdir build
cd build
if [[ "$target" == x86_64-w64-mingw32 ]]; then
cmake \
-DCMAKE_TOOLCHAIN_FILE=${CMAKE_TARGET_TOOLCHAIN} \
-DCMAKE_FIND_ROOT_PATH=${prefix} \
-DCMAKE_INSTALL_PREFIX=${prefix} \
-DBUILD_SHARED_LIBS=ON \
-DMPI_HOME=$prefix \
-DMPI_GUESS_LIBRARY_NAME=MSMPI \
-DMPI_C_LIBRARIES=msmpi64 \
-DMPI_CXX_LIBRARIES=msmpi64 \
..
elif [[ "$target" == *-mingw* ]]; then
cmake \
-DCMAKE_TOOLCHAIN_FILE=${CMAKE_TARGET_TOOLCHAIN} \
-DCMAKE_FIND_ROOT_PATH=${prefix} \
-DCMAKE_INSTALL_PREFIX=${prefix} \
-DBUILD_SHARED_LIBS=ON \
-DMPI_HOME=$prefix \
-DMPI_GUESS_LIBRARY_NAME=MSMPI \
..
else
exit 1
fi
cmake --build . --config RelWithDebInfo --parallel $nproc
cmake --build . --config RelWithDebInfo --parallel $nproc --target install
if [[ ${target} == i686-w64-* ]]; then
# Remove 64-bit import libraries
rm $prefix/lib/*64.lib
else
# Rename 64-bit import libraries
mv -f $prefix/lib/msmpifmc64.lib $prefix/lib/msmpifmc.lib
mv -f $prefix/lib/msmpifec64.lib $prefix/lib/msmpifec.lib
mv -f $prefix/lib/msmpi64.lib $prefix/lib/msmpi.lib
fi
install_license $WORKSPACE/destdir/share/licenses/MicrosoftMPI/* $WORKSPACE/srcdir/MPIconstants*/LICENSE.md
"""
platforms = filter!(Sys.iswindows, supported_platforms())
platforms = expand_gfortran_versions(platforms)
products = [
# MicrosoftMPI
LibraryProduct("msmpi", :libmpi),
ExecutableProduct("mpiexec", :mpiexec),
# MPIconstants
LibraryProduct("libload_time_mpi_constants", :libload_time_mpi_constants),
ExecutableProduct("generate_compile_time_mpi_constants", :generate_compile_time_mpi_constants),
]
dependencies = Dependency[
]
# Build the tarballs.
# We use GCC 5 to ensure Fortran module files are readable by all `libgfortran3` architectures. GCC 4 would use an older format.
build_tarballs(ARGS, name, version, sources, script, platforms, products, dependencies, preferred_gcc_version=v"5")