Skip to content

Commit aa1766b

Browse files
rayegungiordano
andauthored
[PETSc] Attempt to rebuild with good include files (and don't rename libpetsc) (#3801)
* attempt to rebuild with good include files (and don't rename libpetsc) * fix symlink name * add target to directory * typo * Inject version * make check now passes * Remove symlinks, add LDFLAGS * so to dll on win * search bin for windows libs * use $libdir in products. * Update P/PETSc/build_tarballs.jl * Update P/PETSc/build_tarballs.jl * rename things * rm mingw specific mv cmd * match original better * version bump * Update build_tarballs.jl * fix windows Co-authored-by: Jeremiah Lewis <--get> Co-authored-by: Mosè Giordano <[email protected]>
1 parent b52235f commit aa1766b

File tree

1 file changed

+30
-38
lines changed

1 file changed

+30
-38
lines changed

P/PETSc/build_tarballs.jl

Lines changed: 30 additions & 38 deletions
Original file line numberDiff line numberDiff line change
@@ -1,13 +1,13 @@
11
using BinaryBuilder
22

33
name = "PETSc"
4-
version = v"3.15.2"
4+
version = v"3.16.5"
55

66
# Collection of sources required to build PETSc. Avoid using the git repository, it will
77
# require building SOWING which fails in all non-linux platforms.
88
sources = [
9-
ArchiveSource("https://www.mcs.anl.gov/petsc/mirror/release-snapshots/petsc-3.15.2.tar.gz",
10-
"3b10c19c69fc42e01a38132668724a01f1da56f5c353105cd28f1120cc9041d8"),
9+
ArchiveSource("https://www.mcs.anl.gov/petsc/mirror/release-snapshots/petsc-$(version).tar.gz",
10+
"7de8570eeb94062752d82a83208fc2bafc77b3f515023a4c14d8ff9440e66cac"),
1111
DirectorySource("./bundled"),
1212
]
1313

@@ -24,7 +24,7 @@ if [[ "${target}" == *-mingw* ]]; then
2424
else
2525
MPI_LIBS="[${libdir}/libmpifort.${dlext},${libdir}/libmpi.${dlext}]"
2626
fi
27-
27+
mkdir $libdir/petsc
2828
build_petsc()
2929
{
3030
@@ -33,19 +33,19 @@ build_petsc()
3333
else
3434
USE_INT64=0
3535
fi
36-
37-
./configure --prefix=${prefix} \
36+
mkdir $libdir/petsc/${1}_${2}_${3}
37+
./configure --prefix=${libdir}/petsc/${1}_${2}_${3} \
3838
CC=${CC} \
3939
FC=${FC} \
4040
CXX=${CXX} \
4141
COPTFLAGS='-O3' \
4242
CXXOPTFLAGS='-O3' \
4343
CFLAGS='-fno-stack-protector' \
44+
LDFLAGS="-L${libdir}" \
4445
FOPTFLAGS='-O3' \
4546
--with-64-bit-indices=${USE_INT64} \
4647
--with-debugging=0 \
4748
--with-batch \
48-
--PETSC_ARCH=${target}_${1}_${2}_${3} \
4949
--with-blaslapack-lib=$BLAS_LAPACK_LIB \
5050
--with-blaslapack-suffix="" \
5151
--known-64-bit-blas-indices=0 \
@@ -54,7 +54,8 @@ build_petsc()
5454
--with-mpi-include="${includedir}" \
5555
--with-sowing=0 \
5656
--with-precision=${1} \
57-
--with-scalar-type=${2}
57+
--with-scalar-type=${2} \
58+
--PETSC_ARCH=${target}_${1}_${2}_${3}
5859
5960
if [[ "${target}" == *-mingw* ]]; then
6061
export CPPFLAGS="-Dpetsc_EXPORTS"
@@ -64,29 +65,19 @@ build_petsc()
6465
fi
6566
6667
make -j${nproc} \
67-
PETSC_DIR="${PWD}" \
68-
PETSC_ARCH="${target}_${1}_${2}_${3}" \
6968
CPPFLAGS="${CPPFLAGS}" \
7069
CFLAGS="${CFLAGS}" \
71-
FFLAGS="${FFLAGS}" \
72-
DEST_DIR="${prefix}" \
73-
all
74-
75-
make PETSC_DIR=$PWD PETSC_ARCH=${target}_${1}_${2}_${3} DEST_DIR=$prefix install
70+
FFLAGS="${FFLAGS}"
71+
make install
7672
77-
# add suffix to library name
78-
if [[ "${target}" == *-mingw* ]]; then
79-
# changing the extension from so to dll.
80-
mv ${prefix}/lib/libpetsc.so.*.*.* "${libdir}/libpetsc_${1}_${2}_${3}.${dlext}"
81-
elif [[ "${target}" == *-apple* ]]; then
82-
mv ${prefix}/lib/libpetsc.*.*.*.${dlext} "${libdir}/libpetsc_${1}_${2}_${3}.${dlext}"
73+
if [[ "${target}" == *-apple* ]]; then
74+
mv ${libdir}/petsc/${1}_${2}_${3}/lib/libpetsc.*.*.*.${dlext} "${libdir}/petsc/${1}_${2}_${3}/lib/libpetsc_${1}_${2}_${3}.${dlext}"
8375
else
84-
mv ${prefix}/lib/libpetsc.${dlext}.*.*.* "${libdir}/libpetsc_${1}_${2}_${3}.${dlext}"
76+
mv ${libdir}/petsc/${1}_${2}_${3}/lib/libpetsc.${dlext}.*.*.* "${libdir}/petsc/${1}_${2}_${3}/lib/libpetsc_${1}_${2}_${3}.${dlext}"
8577
fi
86-
# Remove useless links
87-
rm ${prefix}/lib/libpetsc.*
88-
# Remove duplicated file
89-
rm ${prefix}/lib/pkgconfig/PETSc.pc
78+
79+
# Remove now broken(?) links
80+
rm ${libdir}/petsc/${1}_${2}_${3}/lib/libpetsc.*
9081
}
9182
9283
build_petsc double real Int32
@@ -103,23 +94,24 @@ build_petsc single complex Int64
10394
platforms = expand_gfortran_versions(supported_platforms(exclude=[Platform("i686", "windows")]))
10495

10596
products = [
106-
LibraryProduct("libpetsc_double_real_Int32", :libpetsc), # Current default build
107-
LibraryProduct("libpetsc_double_real_Int64", :libpetsc_Float64_Real_Int64),
108-
LibraryProduct("libpetsc_single_real_Int64", :libpetsc_Float32_Real_Int64),
109-
LibraryProduct("libpetsc_double_complex_Int64", :libpetsc_Float64_Complex_Int64),
110-
LibraryProduct("libpetsc_single_complex_Int64", :libpetsc_Float32_Complex_Int64),
111-
LibraryProduct("libpetsc_double_real_Int32", :libpetsc_Float64_Real_Int32),
112-
LibraryProduct("libpetsc_single_real_Int32", :libpetsc_Float32_Real_Int32),
113-
LibraryProduct("libpetsc_double_complex_Int32", :libpetsc_Float64_Complex_Int32),
114-
LibraryProduct("libpetsc_single_complex_Int32", :libpetsc_Float32_Complex_Int32),
97+
# Current default build, equivalent to Float64_Real_Int32
98+
LibraryProduct("libpetsc_double_real_Int32", :libpetsc, "\$libdir/petsc/double_real_Int32/lib")
99+
LibraryProduct("libpetsc_double_real_Int32", :libpetsc_Float64_Real_Int32, "\$libdir/petsc/double_real_Int32/lib")
100+
LibraryProduct("libpetsc_double_real_Int64", :libpetsc_Float64_Real_Int64, "\$libdir/petsc/double_real_Int64/lib")
101+
LibraryProduct("libpetsc_single_real_Int64", :libpetsc_Float32_Real_Int64, "\$libdir/petsc/single_real_Int64/lib")
102+
LibraryProduct("libpetsc_double_complex_Int64", :libpetsc_Float64_Complex_Int64, "\$libdir/petsc/double_complex_Int64/lib")
103+
LibraryProduct("libpetsc_single_complex_Int64", :libpetsc_Float32_Complex_Int64, "\$libdir/petsc/single_complex_Int64/lib")
104+
LibraryProduct("libpetsc_single_real_Int32", :libpetsc_Float32_Real_Int32, "\$libdir/petsc/single_real_Int32/lib")
105+
LibraryProduct("libpetsc_double_complex_Int32", :libpetsc_Float64_Complex_Int32, "\$libdir/petsc/double_complex_Int32/lib")
106+
LibraryProduct("libpetsc_single_complex_Int32", :libpetsc_Float32_Complex_Int32, "\$libdir/petsc/single_complex_Int32/lib")
115107
]
116108

117109
dependencies = [
118110
Dependency("OpenBLAS32_jll"),
119-
Dependency("MPICH_jll"),
120-
Dependency("MicrosoftMPI_jll"),
111+
Dependency("MPICH_jll"; platforms=filter(!Sys.iswindows, platforms)),
112+
Dependency("MicrosoftMPI_jll"; platforms=filter(Sys.iswindows, platforms)),
121113
Dependency("CompilerSupportLibraries_jll"),
122114
]
123115

124116
# Build the tarballs.
125-
build_tarballs(ARGS, name, version, sources, script, platforms, products, dependencies; preferred_gcc_version = v"9")
117+
build_tarballs(ARGS, name, version, sources, script, platforms, products, dependencies; julia_compat="1.6", preferred_gcc_version = v"9")

0 commit comments

Comments
 (0)