Skip to content
This repository has been archived by the owner on Apr 18, 2024. It is now read-only.

Commit

Permalink
Staticly linked build
Browse files Browse the repository at this point in the history
  • Loading branch information
zmonteiro committed Jan 15, 2019
1 parent dbe9345 commit 50dd99b
Show file tree
Hide file tree
Showing 3 changed files with 87 additions and 6 deletions.
49 changes: 43 additions & 6 deletions build_tarballs.jl
100644 → 100755
Original file line number Diff line number Diff line change
Expand Up @@ -9,24 +9,58 @@ version = v"7.3.8"
sources = [
"https://sourceforge.net/projects/sdpa/files/sdpa/sdpa_7.3.8.tar.gz" =>
"c7541333da2f0bb2d18e90dbf758ac7cc099f3f7da3f256b284b0725f96d4117",

"./bundled"
]

# Bash recipe for building across all platforms
script = raw"""
cd $WORKSPACE/srcdir
cd sdpa-7.3.8/
./configure --prefix=$prefix --host=$target --with-blas="-L${prefix}/lib -lopenblas" --with-lapack="-L${prefix}/lib -lopenblas"
update_configure_scripts
for path in ${LD_LIBRARY_PATH//:/ }; do
for file in $(ls $path/*.la); do
echo "$file"
baddir=$(sed -n "s|libdir=||p" $file)
sed -i~ -e "s|$baddir|'$path'|g" $file
done
done
if [ $target = "x86_64-apple-darwin14" ]; then
# seems static linking requires apple's ar
export AR=/opt/x86_64-apple-darwin14/bin/x86_64-apple-darwin14-ar
fi
patch -p1 < $WORKSPACE/srcdir/patches/shared.diff
mv configure.in configure.ac
patch -p1 < $WORKSPACE/srcdir/patches/lt_init.diff
autoreconf -i
./configure --prefix=$prefix --host=${target} lt_cv_deplibs_check_method=pass_all \
--with-blas="-L${prefix}/lib -lcoinblas -lgfortran -lcoinmumps -lcoinmetis" \
--with-lapack="-L${prefix}/lib -lcoinlapack -lcoinmumps -lcoinmetis" \
--with-mumps-libs="-L${prefix}/lib -lcoinmumps -lcoinmetis" --with-mumps-include="-I$prefix/include/coin/ThirdParty"
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, :glibc)
Linux(:i686, libc=:glibc),
Linux(:x86_64, libc=:glibc),
Linux(:aarch64, libc=:glibc),
Linux(:armv7l, libc=:glibc, call_abi=:eabihf),
MacOS(:x86_64),
Windows(:i686),
Windows(:x86_64)
]
platforms = expand_gcc_versions(platforms)
# To fix gcc4 bug in Windows
# platforms = setdiff(platforms, [Windows(:x86_64, compiler_abi=CompilerABI(:gcc4)), Windows(:i686, compiler_abi=CompilerABI(:gcc4))])
push!(platforms, Windows(:i686,compiler_abi=CompilerABI(:gcc6)))
push!(platforms, Windows(:x86_64,compiler_abi=CompilerABI(:gcc6)))

# The products that we will ensure are always built
products(prefix) = [
Expand All @@ -35,9 +69,12 @@ products(prefix) = [

# Dependencies that must be installed before this package can be built
dependencies = [
"https://github.com/JuliaLinearAlgebra/OpenBLASBuilder/releases/download/v0.3.0-1/build_OpenBLAS.v0.3.0.jl"
"https://github.com/juan-pablo-vielma/COINBLASBuilder/releases/download/v1.4.6-1-static/build_COINBLASBuilder.v1.4.6.jl",
"https://github.com/juan-pablo-vielma/COINLapackBuilder/releases/download/v1.5.6-1-static/build_COINLapackBuilder.v1.5.6.jl",
"https://github.com/juan-pablo-vielma/COINMetisBuilder/releases/download/v1.3.5-1-static/build_COINMetisBuilder.v1.3.5.jl",
"https://github.com/juan-pablo-vielma/COINMumpsBuilder/releases/download/v1.6.0-1-static/build_COINMumpsBuilder.v1.6.0.jl"

]

# Build the tarballs, and possibly a `build.jl` as well.
build_tarballs(ARGS, name, version, sources, script, platforms, products, dependencies)

12 changes: 12 additions & 0 deletions bundled/patches/lt_init.diff
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
diff --git a/configure.ac b/configure.ac
index b9a3b19..19ef6d8 100644
--- a/configure.ac
+++ b/configure.ac
@@ -9,6 +9,7 @@ AC_PROG_RANLIB
AC_PROG_CC
AC_PROG_CXX
AC_PROG_FC
+LT_INIT
AC_FC_LIBRARY_LDFLAGS
AC_FC_WRAPPERS
AC_CANONICAL_HOST
32 changes: 32 additions & 0 deletions bundled/patches/shared.diff
Original file line number Diff line number Diff line change
@@ -0,0 +1,32 @@
diff --git a/Makefile.am b/Makefile.am
index afadcff..400b3cf 100644
--- a/Makefile.am
+++ b/Makefile.am
@@ -20,20 +20,22 @@ sdpa_call.h sdpa_chordal.h sdpa_dataset.h sdpa_dpotrf.h \
sdpa_include.h sdpa_io.h sdpa_jordan.h sdpa_linear.h sdpa_newton.h \
sdpa_parts.h sdpa_right.h sdpa_struct.h sdpa_tool.h

-lib_LIBRARIES = libsdpa.a
-libsdpa_a_SOURCES = sdpa_block.cpp sdpa_call.cpp sdpa_chordal.cpp \
+lib_LTLIBRARIES = libsdpa.la
+libsdpa_la_LDFLAGS = -shared -no-undefined -export-symbols-regex "(sdpa|SDPA)"
+libsdpa_la_LIBADD = $(MUMPS_LIBS) $(LAPACK_LIBS) $(BLAS_LIBS) $(PTHREAD_LIBS) $(FCLIBS)
+libsdpa_la_SOURCES = sdpa_block.cpp sdpa_call.cpp sdpa_chordal.cpp \
sdpa_dataset.cpp sdpa_dpotrf.cpp sdpa_io.cpp sdpa_jordan.cpp \
sdpa_linear.cpp sdpa_newton.cpp sdpa_parts.cpp sdpa_solve.cpp \
sdpa_struct.cpp sdpa_tool.cpp \
sdpa_algebra.h sdpa_block.h \
sdpa_call.h sdpa_chordal.h sdpa_dataset.h sdpa_dpotrf.h \
sdpa_include.h sdpa_io.h sdpa_jordan.h sdpa_linear.h sdpa_newton.h \
-sdpa_parts.h sdpa_right.h sdpa_struct.h sdpa_tool.h
-libsdpa_a_CXXFLAGS = $(pthread_cflags) $(MUMPS_INCLUDE) $(PTHREAD_INCLUDE)
+sdpa_parts.h sdpa_right.h sdpa_struct.h sdpa_tool.h
+libsdpa_la_CXXFLAGS = $(pthread_cflags) $(MUMPS_INCLUDE) $(PTHREAD_INCLUDE)

bin_PROGRAMS = sdpa
sdpa_SOURCES = sdpa_exe.cpp
-sdpa_LDADD = -L. -lsdpa $(MUMPS_LIBS) $(LAPACK_LIBS) $(BLAS_LIBS) $(PTHREAD_LIBS) $(FCLIBS)
+sdpa_LDADD = libsdpa.la $(MUMPS_LIBS) $(LAPACK_LIBS) $(BLAS_LIBS) $(PTHREAD_LIBS) $(FCLIBS)
sdpa_CXXFLAGS = $(pthread_cflags) $(MUMPS_INCLUDE) $(PTHREAD_INCLUDE)

# each file of mumps is copied by 'nobase' option

0 comments on commit 50dd99b

Please sign in to comment.