switched to mono continued fork

This commit is contained in:
2025-04-22 00:15:28 +05:00
parent 51259e72fe
commit 366dd1214c
8 changed files with 105 additions and 109 deletions

View File

@@ -0,0 +1,73 @@
#!/usr/bin/env bash
package_version="$TASK_ARGS"
if [ -z "$package_version" ]; then
package_version="8.0.15"
myprint "${YELLOW}You can choose package version manually: cbuild get_mono_files_from=x.y.z"
fi
myprint "${BLUE}package_version: ${CYAN}$package_version"
if [ -z $ARCH ]; then
ARCH='x64'
fi
case "$OS" in
LINUX)
package_platform="linux-$ARCH"
;;
WINDOWS)
package_platform="win-$ARCH"
;;
esac
package_name="Microsoft.NETCore.App.Runtime.Mono.$package_platform"
package_dir="$package_name.$package_version"
package_file="$package_name.$package_version.nupkg"
package_url="https://www.nuget.org/api/v2/package/$package_name/$package_version"
mkdir -p "$OBJDIR/downloads"
myprint "${BLUE}downloading nuget package: ${WHITE}$package_name ${BLUE}to $OBJDIR/downloads"
cd "$OBJDIR/downloads"
wget -q $package_url -O $package_file
clean_dir $package_dir
cd $package_dir
myprint "${BLUE}extracting nuget package"
unzip -oq "../$package_file"
# copy headers
myprint "${BLUE}copying headers"
mkdir -p "../../../dependencies/include"
delete_dir "../../../dependencies/include/mono"
cp -r "runtimes/$package_platform/native/include/mono-2.0/mono" "../../../dependencies/include/"
precompiled_dir="../../../dependencies/precompiled/$OS-$ARCH"
mkdir -p "$precompiled_dir"
clean_dir "$precompiled_dir/mono-libs"
# copy mono native libraries
myprint "${BLUE}copying mono native libraries"
shared_libs=$(find "runtimes/$package_platform/native" -maxdepth 1 \( -not -name "System.Private.CoreLib.dll" -a \( -name '*.so*' -o -name '*.dll' \) \) -type f)
if [ -z "$shared_libs" ]; then
error "can't find mono shared libraries"
fi
for l in $shared_libs ; do
cp -v "$l" "$precompiled_dir"
done
# copy mono c# libraries
myprint "${BLUE}copying mono managed libraries"
managed_libraries="runtimes/$package_platform/native/System.Private.CoreLib.dll"
_subdirs=(runtimes/$package_platform/lib/*)
_managed_lib_dir="${_subdirs[0]}"
for l in $(find $_managed_lib_dir -type f); do
managed_libraries+=" $l"
done
for l in $managed_libraries; do
cp -v "$l" "$precompiled_dir/mono-libs"
done
myprint "${GREEN}mono files have been copied successfully!"
cd ../../..
clean_dir "$OBJDIR/downloads"

View File

@@ -1,59 +0,0 @@
#!/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"
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
# myprint "${BLUE}stripping debug symbols from mono shared libraries"
# for l in $(find "dependencies/precompiled/mono-libs" -name '*.so') ; do
# strip -g "$l"
# 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!"