phasicFlow/thirdParty/Zoltan/buildlib

34 lines
1.1 KiB
Plaintext
Raw Normal View History

2025-05-15 18:28:43 +00:00
#!/bin/bash
2025-05-19 10:23:34 +00:00
cd ${0%/*} || exit 1 # Run from this directory
2025-05-15 18:28:43 +00:00
2025-05-19 10:23:34 +00:00
# Source the configurations - if there's a ./configurations file
[ -f ./configurations ] && source ./configurations
2025-05-15 18:28:43 +00:00
2025-05-19 10:23:34 +00:00
# Set environment variables to ensure shared library creation
export CFLAGS="-fPIC"
export CXXFLAGS="-fPIC"
export FCFLAGS="-fPIC"
# Create build directory
mkdir -p build
2025-05-15 18:28:43 +00:00
cd build
2025-05-19 10:23:34 +00:00
# Run configure with shared library options
echo "Running configure with options to build shared library..."
../configure --prefix=$PWD/.. --enable-shared --disable-static
2025-05-15 18:28:43 +00:00
2025-05-19 10:23:34 +00:00
# Run make and install
echo "Building and installing Zoltan..."
2025-05-15 18:28:43 +00:00
make install
2025-05-19 10:23:34 +00:00
# Convert static to shared library if static library exists and shared doesn't
echo "Checking for static library and converting to shared if needed..."
if [ -f "$PWD/../lib/libzoltan.a" ] && [ ! -f "$PWD/../lib/libzoltan.so" ]; then
echo "Converting static library to shared library..."
cd $PWD/../lib
gcc -shared -o libzoltan.so -Wl,--whole-archive libzoltan.a -Wl,--no-whole-archive
echo "Shared library created as libzoltan.so"
fi
echo "Build completed"