rpm: install mono.attr and mono-find-[requires|provides] [release 6.12.0.122-2mamba;Wed Nov 24 2021]

This commit is contained in:
Silvan Calarco 2024-01-06 07:13:31 +01:00
parent 89bd9f2f5b
commit 1b7c4ee81c
4 changed files with 192 additions and 47 deletions

42
mono-find-provides Normal file
View File

@ -0,0 +1,42 @@
#!/usr/bin/bash
#
# mono-find-provides
#
# Authors:
# Ben Maurer (bmaurer@ximian.com)
#
# (C) 2005 Novell (http://www.novell.com)
#
# Args: builddir buildroot libdir
IFS=$'\n'
filelist=($(grep -Ev '/usr/doc/|/usr/share/doc/'))
monolist=($(printf "%s\n" "${filelist[@]}" | grep -E "\\.(exe|dll)\$"))
# If monodis is in the package being installed, use that one
# This is to support building mono
build_bindir="$2/usr/bin"
build_libdir="$2$3"
if [ -x $build_bindir/monodis ]; then
monodis="$build_bindir/monodis"
export LD_LIBRARY_PATH=$build_libdir${LD_LIBRARY_PATH:+:$LD_LIBRARY_PATH}
elif [ -x /usr/bin/monodis ]; then
monodis="/usr/bin/monodis"
else
exit 0;
fi
export MONO_SHARED_DIR=$1
for i in "${monolist[@]}"; do
($monodis --assembly $i | awk '
BEGIN { LIBNAME=""; VERSION=""; }
/^Version:/ { VERSION=$2 }
/^Name:/ { LIBNAME=$2 }
END {
if (VERSION && LIBNAME)
print "mono(" LIBNAME ") = " VERSION
}
') 2>/dev/null
done

86
mono-find-requires Normal file
View File

@ -0,0 +1,86 @@
#!/usr/bin/bash
#
# mono-find-requires
#
# Authors:
# Ben Maurer (bmaurer@ximian.com)
#
# (C) 2005 Novell (http://www.novell.com)
#
# Args: builddir buildroot libdir
IFS=$'\n'
filelist=($(grep -Ev '/usr/doc/|/usr/share/doc/'))
monolist=($(printf "%s\n" "${filelist[@]}" | grep -E "\\.(exe|dll)\$"))
# If monodis is in the package being installed, use that one
# This is to support building mono
build_bindir="$2/usr/bin"
build_libdir="$2$3"
if [ -x $build_bindir/monodis ]; then
monodis="$build_bindir/monodis"
export LD_LIBRARY_PATH=$build_libdir${LD_LIBRARY_PATH:+:$LD_LIBRARY_PATH}
elif [ -x /usr/bin/monodis ]; then
monodis="/usr/bin/monodis"
else
exit 0;
fi
export MONO_SHARED_DIR=$1
REQUIRES=$(
for i in "${monolist[@]}"; do
($monodis --assemblyref $i | awk '
BEGIN { START=0; LIBNAME=""; VERSION=""; }
(START==0) && /^[0-9]+: Version=/ {
START=1;
sub(/Version=/, "", $2);
VERSION=$2
}
(START==1) && /^\tName=/ {
sub(/Name=/, "", $1);
LIBNAME=$1
print "mono(" LIBNAME ") = " VERSION
START=0
}
') 2> /dev/null
done
)
PROVIDES=$(
for i in "${monolist[@]}"; do
($monodis --assembly $i | awk '
BEGIN { LIBNAME=""; VERSION=""; }
/^Version:/ { VERSION=$2 }
/^Name:/ { LIBNAME=$2 }
END {
if (VERSION && LIBNAME)
print "mono(" LIBNAME ") = " VERSION
}
') 2>/dev/null
done
)
#
# This is a little magic trick to get all REQUIRES that are not
# in PROVIDES. While RPM functions correctly when such deps exist,
# they make the metadata a bit bloated.
#
# Filter out dups from both lists
REQUIRES=$(echo "$REQUIRES" | sort | uniq)
PROVIDES=$(echo "$PROVIDES" | sort | uniq)
#
# Get a list of elements that exist in exactly one of PROVIDES or REQUIRES
#
UNIQ=$(echo "$PROVIDES
$REQUIRES" | sort | uniq -u)
#
# Of those, only chose the ones that are in REQUIRES
#
echo "$UNIQ
$REQUIRES" | sort | uniq -d

3
mono.attr Normal file
View File

@ -0,0 +1,3 @@
%__mono_provides %{_rpmconfigdir}/mono-find-provides %{_builddir}/%{?buildsubdir} %{buildroot} %{_libdir}
%__mono_requires %{_rpmconfigdir}/mono-find-requires %{_builddir}/%{?buildsubdir} %{buildroot} %{_libdir}
%__mono_magic Mono/.Net assembly

108
mono.spec
View File

@ -1,7 +1,7 @@
%define pkgver %(echo %version | cut -d. -f1-3)
Name: mono
Version: 6.12.0.122
Release: 1mamba
Release: 2mamba
Summary: A .NET runtime environment
Group: Applications/Development
Vendor: openmamba
@ -10,12 +10,14 @@ Packager: Silvan Calarco <silvan.calarco@mambasoft.it>
URL: https://www.mono-project.com
Source: http://download.mono-project.com/sources/mono/mono-%{version}.tar.xz
Source1: mono-binfmt
Source2: mono-find-provides
Source3: mono-find-requires
Source4: mono.attr
Patch0: %{name}-1.9.1-ppc-threading.patch
Patch1: %{name}-2.6.4-required.patch
License: GPL, LGPL, MIT, BSD
## AUTOBUILDREQ-BEGIN
BuildRequires: glibc-devel
BuildRequires: ldconfig
BuildRequires: libgcc
BuildRequires: libkrb5-devel
BuildRequires: libstdc++6-devel
@ -31,41 +33,41 @@ BuildRequires: cmake
Requires: ca-certificates
Requires: libgdiplus
Provides: mono-core
Obsoletes: mono-core
Obsoletes: mono-core < 6.12.0.122
Provides: mono-ikvm = %{?epoch:%epoch:}%{version}-%{release}
Obsoletes: mono-ikvm
Obsoletes: mono-ikvm < 6.12.0.122
Provides: monodoc
Obsoletes: monodoc
Obsoletes: monodoc < 6.12.0.122
Provides: mono-jay
Obsoletes: mono-jay
Obsoletes: mono-jay < 6.12.0.122
Provides: mono-web
Obsoletes: mono-web
Obsoletes: mono-web < 6.12.0.122
Provides: mono-winforms
Obsoletes: mono-winforms
Obsoletes: mono-winforms < 6.12.0.122
Provides: mono-nunit
Obsoletes: mono-nunit
Obsoletes: mono-nunit < 6.12.0.122
Provides: mono-data
Obsoletes: mono-data
Obsoletes: mono-data < 6.12.0.122
Provides: mono-locale-extras
Obsoletes: mono-locale-extras
Obsoletes: mono-locale-extras < 6.12.0.122
Provides: mono-extras
Obsoletes: mono-extras
Obsoletes: mono-extras < 6.12.0.122
Provides: mono-jscript
Obsoletes: mono-jscript
Obsoletes: mono-jscript < 6.12.0.122
Provides: mono-data-sqlite
Obsoletes: mono-data-sqlite
Obsoletes: mono-data-sqlite < 6.12.0.122
Provides: mono-data-sybase
Obsoletes: mono-data-sybase
Obsoletes: mono-data-sybase < 6.12.0.122
Provides: mono-data-oracle
Obsoletes: mono-data-oracle
Obsoletes: mono-data-oracle < 6.12.0.122
Provides: mono-data-postgresql
Obsoletes: mono-data-postgresql
Obsoletes: mono-data-postgresql < 6.12.0.122
Provides: mono-data-firebird
Obsoletes: mono-data-firebird
Obsoletes: mono-data-firebird < 6.12.0.122
Provides: mono-ibm-data-db2
Obsoletes: mono-ibm-data-db2
Obsoletes: mono-ibm-data-db2 < 6.12.0.122
Provides: mono-bytefx-data-mysql
Obsoletes: mono-bytefx-data-mysql
Obsoletes: mono-bytefx-data-mysql < 6.12.0.122
Provides: mono(System.Reactive.Linq)
Provides: mono(Microsoft.Build.Framework)
Provides: mono(Microsoft.Build.Tasks.Core)
@ -89,19 +91,18 @@ Its objective is to enable Unix developers to build and deploy cross-platform .N
%package devel
Summary: Development tools for Mono
Group: Development/Languages
Obsoletes: mono-cilc
Obsoletes: mono-cilc < 6.12.0.122
Provides: mono-cilc = %{?epoch:%epoch:}%{version}-%{release}
Requires: %{name} = %{?epoch:%epoch:}%{version}-%{release}
Provides: mono-nunit-devel
Obsoletes: mono-nunit-devel
Obsoletes: mono-nunit-devel < 6.12.0.122
Provides: monodoc-devel
Obsoletes: monodoc-devel
Obsoletes: monodoc-devel < 6.12.0.122
Requires: libglib-devel
%description devel
The Mono Project is an open development initiative that is working to develop an open source, Unix version of the .NET development platform.
Its objective is to enable Unix developers to build and deploy cross-platform .NET applications.
This package completes the Mono developer toolchain with the mono profiler, assembler and other various tools.
%debug_package
@ -113,27 +114,27 @@ This package completes the Mono developer toolchain with the mono profiler, asse
#%patch0 -p1 -b .ppc-threading
#%patch1 -p1
# NOTE: this is to pass %{_libdir} to __mono_requires to allow running of monodis
# using internal libraries to allow 2 -> 3 smooth update
%define __mono_requires %{_builddir}/mono-%{version}/mono_requires.sh
cat > mono_requires.sh << _EOF
%ifarch x86_64
# WORKAROUND: LD_LIBRARY_PATH seems to be ignored in x86_64
export LD_PRELOAD=%{buildroot}%{_libdir}/libmono-2.0.so.1.0.0
%endif
%{_prefix}/lib/rpm/mono-find-requires %{_builddir} %{buildroot} %{_libdir}
_EOF
%define __mono_provides %{_builddir}/mono-%{version}/mono_provides.sh
cat > mono_provides.sh << _EOF
%ifarch x86_64
# WORKAROUND: LD_LIBRARY_PATH seems to be ignored in x86_64
export LD_PRELOAD=%{buildroot}%{_libdir}/libmono-2.0.so.1.0.0
%endif
%{_prefix}/lib/rpm/mono-find-provides %{_builddir} %{buildroot} %{_libdir}
_EOF
chmod +x mono_requires.sh mono_provides.sh
## NOTE: this is to pass %{_libdir} to __mono_requires to allow running of monodis
## using internal libraries to allow 2 -> 3 smooth update
#% define __mono_requires %{_builddir}/mono-%{version}/mono_requires.sh
#cat > mono_requires.sh << _EOF
#%ifarch x86_64
## WORKAROUND: LD_LIBRARY_PATH seems to be ignored in x86_64
#export LD_PRELOAD=%{buildroot}%{_libdir}/libmono-2.0.so.1.0.0
#%endif
#%{_prefix}/lib/rpm/mono-find-requires %{_builddir} %{buildroot} %{_libdir}
#_EOF
#
#% define __mono_provides %{_builddir}/mono-%{version}/mono_provides.sh
#cat > mono_provides.sh << _EOF
#%ifarch x86_64
## WORKAROUND: LD_LIBRARY_PATH seems to be ignored in x86_64
#export LD_PRELOAD=%{buildroot}%{_libdir}/libmono-2.0.so.1.0.0
#%endif
#%{_prefix}/lib/rpm/mono-find-provides %{_builddir} %{buildroot} %{_libdir}
#_EOF
#
#chmod +x mono_requires.sh mono_provides.sh
%build
#:<< ___EOF
@ -193,6 +194,15 @@ ln -s mono-sgen %{buildroot}%{_bindir}/mono
ln -s mcs %{buildroot}%{_bindir}/gmcs
# rpm helper scripts
mkdir -p %{buildroot}%{_prefix}/lib/rpm/fileattrs/
install -p -m755 %{SOURCE2} %{SOURCE3} %{buildroot}%{_prefix}/lib/rpm/
install -p -m644 %{SOURCE4} %{buildroot}%{_prefix}/lib/rpm/fileattrs/
# remove these files, we are using the files installed in /usr/lib/rpm/
rm %{buildroot}%{_bindir}/mono-find-requires
rm %{buildroot}%{_bindir}/mono-find-provides
%clean
[ "%{buildroot}" != / ] && rm -rf "%{buildroot}"
@ -246,8 +256,6 @@ fi
%{_bindir}/ikdasm
%{_bindir}/illinkanalyzer
%{_bindir}/mono-package-runtime
%{_bindir}/%{name}-find-provides
%{_bindir}/%{name}-find-requires
%{_bindir}/mono-symbolicate
%{_bindir}/%{name}-service
%{_bindir}/%{name}-service2
@ -402,6 +410,9 @@ fi
%files devel
%defattr(-,root,root)
%{_includedir}/%{name}-*
%{_prefix}/lib/rpm/mono-find-provides
%{_prefix}/lib/rpm/mono-find-requires
%{_prefix}/lib/rpm/fileattrs/mono.attr
%{_libdir}/lib%{name}-2.0.so
%{_libdir}/lib%{name}-2.0.a
%{_libdir}/lib%{name}-2.0.la
@ -447,6 +458,9 @@ fi
#%doc ChangeLog NEWS
%changelog
* Wed Nov 24 2021 Silvan Calarco <silvan.calarco@mambasoft.it> 6.12.0.122-2mamba
- rpm: install mono.attr and mono-find-[requires|provides]
* Thu Feb 25 2021 Automatic Build System <autodist@mambasoft.it> 6.12.0.122-1mamba
- automatic version update by autodist