-
Notifications
You must be signed in to change notification settings - Fork 0
/
build_tarballs.jl
139 lines (113 loc) · 5.31 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
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
# Note that this script can accept some limited command-line arguments, run
# `julia build_tarballs.jl --help` to see a usage message.
using BinaryBuilder
name = "umat_binaries"
version = v"0.5.1"
# Collection of sources required to build umat_binaries
sources = [
"https://raw.githubusercontent.com/KratosMultiphysics/Kratos/80d68b9a7e89d97438fd04726e5198084b7be43e/applications/constitutive_laws_application/custom_external_libraries/umat/mises_umat.f" =>
"bfb0f46ae0c9cef0cc91c1dbf78943dd7afd24a5a757dd3224ed66cdd71e7ec6",
"https://raw.githubusercontent.com/KratosMultiphysics/Kratos/80d68b9a7e89d97438fd04726e5198084b7be43e/applications/constitutive_laws_application/custom_external_libraries/umat/ABA_PARAM.INC" =>
"b7d74a332dda559e06720db8b7f907aedb72f58b8ed957c7c67ba7007a8e93a8",
"https://raw.githubusercontent.com/KratosMultiphysics/Kratos/80d68b9a7e89d97438fd04726e5198084b7be43e/applications/constitutive_laws_application/custom_external_libraries/umat/xit.f" =>
"14f74acd4a20ad680b0c354416f302e5f2e078f3a5750df60888b9b41cb887a5",
#"https://sourceforge.net/code-snapshots/svn/p/pa/parafem/code/parafem-code-r2281-trunk-parafem-src-umats-dp.zip" =>
#"114d5773e806de0070eee7379131ceae25c3516fb49b8e3fb8f0f9e1926717bf"
# The above is the original but for some reason sourceforge blogged the trafic
"https://github.com/TeroFrondelius/umat_binaries_builder/releases/download/v0.3.1/parafem-code-r2281-trunk-parafem-src-umats-dp.zip" =>
"114d5773e806de0070eee7379131ceae25c3516fb49b8e3fb8f0f9e1926717bf",
# Gurson model from UMAT.jl/umat_models
"https://github.com/JuliaFEM/UMAT.jl.git" =>
"db0046a44b2c8dfd5ca5b3212cbd6fee37f6baa3"
]
# Bash recipe for building across all platforms
prefix_script = """
export name=$name
export version=$version
"""
script = prefix_script * raw"""
cd $WORKSPACE/srcdir
cat >CMakeLists.txt <<EOL
cmake_minimum_required(VERSION 3.5)
project($name)
set(VERSION $version)
enable_language(Fortran)
set(SOURCE_FILES mises_umat.f xit.f)
set(LIBRARY_NAME mises_umat)
add_library(\${LIBRARY_NAME} SHARED \${SOURCE_FILES})
add_library(elastic SHARED elastic.f)
add_library(isotropic_plast_exp SHARED isotropic_plast_exp.f)
add_library(isotropic_plast_imp SHARED isotropic_plast_imp.f)
install(TARGETS mises_umat DESTINATION lib)
install(TARGETS elastic DESTINATION lib)
install(TARGETS isotropic_plast_exp DESTINATION lib)
install(TARGETS isotropic_plast_imp DESTINATION lib)
EOL
export dp=parafem-code-r2281-trunk-parafem-src-umats-dp
cp $dp/elasticity/elastic.f .
cp $dp/plasticity_exp/code_exp.f isotropic_plast_exp.f
cp $dp/plasticity_imp/code_imp.f isotropic_plast_imp.f
sed -i -e '1i\ IMPLICIT REAL*8(A-H,O-Z)' ABA_PARAM.INC
cmake -DCMAKE_INSTALL_PREFIX=$prefix -DCMAKE_TOOLCHAIN_FILE=/opt/$target/$target.toolchain
make
make install
################################################################################
# From this forward is UMAT.jl/umat_models building
################################################################################
cd UMAT.jl/umat_models
sed -i 's/CALL ROTSIG(/!CALL ROTSIG(/g' gurson_porous_plasticity.f90
if [[ ${nbits} == 64 ]]; then
export OB=openblas64_
sed -i 's/call dgesv(/call dgesv_64(/g' gurson_porous_plasticity.f90
else
export OB=openblas
fi
cat >CMakeLists.txt <<EOL
cmake_minimum_required(VERSION 3.5)
project($name)
set(VERSION $version)
enable_language(Fortran)
set(CMAKE_Fortran_FLAGS "-fdefault-real-8 -fdefault-integer-8")
add_library(gurson_porous_plasticity SHARED gurson_porous_plasticity.f90)
target_link_libraries(gurson_porous_plasticity $OB)
install(TARGETS gurson_porous_plasticity DESTINATION lib)
add_library(drucker_prager_plasticity SHARED drucker_prager_plasticity.f90 drucker_prager_plasticity_deriv.f90 ../../xit.f)
install(TARGETS drucker_prager_plasticity DESTINATION lib)
EOL
cmake -DCMAKE_INSTALL_PREFIX=$prefix -DCMAKE_TOOLCHAIN_FILE=/opt/$target/$target.toolchain
make
make install
"""
# These are the platforms we will build for by default, unless further
# platforms are passed in on the command line
platforms = [
Linux(:i686, libc=:glibc),
Windows(:x86_64),
MacOS(:x86_64),
Windows(:i686),
Linux(:x86_64, libc=:glibc),
Linux(:aarch64, libc=:glibc),
Linux(:armv7l, libc=:glibc, call_abi=:eabihf),
Linux(:powerpc64le, libc=:glibc),
Linux(:i686, libc=:musl),
Linux(:x86_64, libc=:musl),
Linux(:aarch64, libc=:musl),
Linux(:armv7l, libc=:musl, call_abi=:eabihf),
FreeBSD(:x86_64)
]
platforms = expand_gcc_versions(platforms)
# The products that we will ensure are always built
products(prefix) = [
LibraryProduct(prefix, "libmises_umat", :mises_umat),
LibraryProduct(prefix, "libelastic", :elastic),
LibraryProduct(prefix, "libisotropic_plast_exp", :isotropic_plast_exp),
LibraryProduct(prefix, "libisotropic_plast_imp", :isotropic_plast_imp),
LibraryProduct(prefix, "libgurson_porous_plasticity", :gurson_porous_plasticity),
LibraryProduct(prefix, "libdrucker_prager_plasticity", :drucker_prager_plasticity)
]
# Dependencies that must be installed before this package can be built
dependencies = [
"https://github.com/JuliaLinearAlgebra/OpenBLASBuilder/releases/download/v0.3.0-3/build_OpenBLAS.v0.3.0.jl"
]
# Build the tarballs, and possibly a `build.jl` as well.
build_tarballs(ARGS, name, version, sources, script, platforms, products, dependencies)