54 lines
2.1 KiB
Bash
54 lines
2.1 KiB
Bash
#!/usr/bin/env bash
|
|
mono_prefix_path="$TASK_ARGS"
|
|
if [ -z "$mono_prefix_path" ]; then
|
|
error "required argument 'mono_prefix_path'
|
|
Usage: cbuild get_mono_files_from=mono_prefix_path"
|
|
fi
|
|
myprint "${BLUE}mono prefix: ${WHITE}$mono_prefix_path"
|
|
|
|
# copy headers
|
|
rm -rf 'dependencies/include/mono'
|
|
mkdir -p 'dependencies/include'
|
|
cp -r "$mono_prefix_path/include/mono-2.0/mono" 'dependencies/include/'
|
|
rm -rf "dependencies/precompiled/mono-libs"
|
|
mkdir -p "dependencies/precompiled/mono-libs"
|
|
|
|
case "$OS" in
|
|
LINUX)
|
|
# copy mono dynamic libraries
|
|
shared_libs=$(find "$mono_prefix_path/lib" -maxdepth 1 \( -name '*.so*' -a -not -name '*-profiler*' \) -type f)
|
|
if [ -z "$shared_libs" ]; then
|
|
error "can't find mono shared libraries"
|
|
fi
|
|
for l in $shared_libs ; do
|
|
cp -v "$l" "dependencies/precompiled/mono-libs/"
|
|
done
|
|
so_v_libs=$(find "dependencies/precompiled/mono-libs" -name '*.so.*')
|
|
for l in $so_v_libs ; do
|
|
l_basename=$(basename "$l")
|
|
soname_without_version=$(safeprint "$l_basename" | sed 's,.so.*,.so,')
|
|
myprint "${BLUE}patching ${WHITE}$l_basename${BLUE}: replacing soname with ${CYAN}$soname_without_version"
|
|
patchelf --set-soname "$soname_without_version" "$l"
|
|
mv -v "$l" "dependencies/precompiled/mono-libs/$soname_without_version"
|
|
done
|
|
|
|
# copy mono c# libraries
|
|
managed_libraries="mscorlib.dll"
|
|
myprint "${BLUE}copying mono managed libraries"
|
|
for l in $managed_libraries ; do
|
|
cp -v "$mono_prefix_path/lib/mono/4.5/$l" "dependencies/precompiled/mono-libs/"
|
|
done
|
|
|
|
# copy config
|
|
myprint "${BLUE}copying mono config"
|
|
cp "$mono_prefix_path/etc/mono/config" "dependencies/precompiled/mono-libs/config.xml"
|
|
myprint "${BLUE}removing '$mono_libdir/' from mono config"
|
|
sed 's,$mono_libdir/,,g' -i "dependencies/precompiled/mono-libs/config.xml"
|
|
;;
|
|
*)
|
|
error "operating system $OS has no configuration variants"
|
|
;;
|
|
esac
|
|
|
|
myprint "${GREEN}mono files were copied successfully!"
|