rpm and mono

Jakub Bogusz qboosh at pld-linux.org
Sun Jul 15 20:58:09 CEST 2007


On Sun, Jul 15, 2007 at 01:08:51PM -0400, Jeff Johnson wrote:
[...]
> >>> Actually:
> >>> 1. We can safely generate (arch-dependent) soname dependencies for
> >>> arch-dependent dotnet* packages (those with glue ELF libraries, like
> >>> gtk-sharp, or gnome-sharp, which started this discussion).
> >>> mono-find-requires script can detect mono version basing on monodis
> >>> (or libmono.so) ELF type.
> >>>
> >>> 2. if we decide to generate soname dependencies for some noarch
> >>> dotnet* package, it won't by noarch any longer.
> >>>
> >>
> >> If there are soname dependencies, the package is not "noarch", is it?
> >
> > In case of mono/dotnet assemblies (*.dll) without native glue code
> > library sonames are specified in text/xml file (*.dll.config), and
> > libraries themselves are dlopened by mono - so assembly packages don't
> > contain anything arch-dependent.

Or even sonames can be hardcoded directly in *.dll, still dlopened by
mono.

Here is some ugly update to mono-find-requires script (from mono
package), which tries to generate soname deps.
But:
1. not all entries from `monodis --moduleref` are always required, see:

$ monodis --moduleref /usr/lib/mono/gac/System.Windows.Forms/2.0.0.0__b77a5c561934e089/System.Windows.Forms.dll
ModuleRef Table (1..21)
1: librsvg-2.so.2
2: libgdk_pixbuf-2.0.so.0
3: libglib-2.0.so.0
4: libgdk-x11-2.0.so.0
5: libgobject-2.0.so.0
6: libgnomeui-2.so.0
7: libgtk-x11-2.0.so.0
8: user32
9: gdi32
10: libgdk-x11-2.0.so
11: libgtk-x11-2.0.so
12: ole32.dll
13: shell32.dll
14: libX11
15: /System/Library/Frameworks/Carbon.framework/Versions/Current/Carbon
16: kernel32.dll
17: user32.dll
18: gdi32.dll
19: winmm.dll
20: uxtheme
21: X11

I suppose libgnomeui is only optional, Carbon.framework used on OSX only
etc.

2. sometimes .dll refers to soname directly, sometimes without ".so"
suffix... (when module doesn't refer to dll entry in config file)

3. not all dll .config entries end with ".dll", so this is messy;
and I don't know what "i:" prefix means.

Global file (/etc/mono/config) looks like this:
<configuration>
        <dllmap dll="i:cygwin1.dll" target="libc.so.6" os="!windows" />
        <dllmap dll="libc" target="libc.so.6" os="!windows"/>
        <dllmap dll="intl" target="libc.so.6" os="!windows"/>
        <dllmap dll="libintl" target="libc.so.6" os="!windows"/>
        <dllmap dll="i:libxslt.dll" target="libxslt.so.1" os="!windows"/>
        <dllmap dll="i:odbc32.dll" target="libodbc.so.1" os="!windows"/>
        <dllmap dll="i:odbc32.dll" target="libiodbc.dylib" os="osx"/>
        <dllmap dll="oci" target="libclntsh.so" os="!windows"/>
        <dllmap dll="db2cli" target="libdb2_36.so" os="!windows"/>
        <dllmap dll="MonoPosixHelper" target="libMonoPosixHelper.so" os="!windows" />
        <dllmap dll="i:msvcrt" target="libc.so.6" os="!windows"/>
        <dllmap dll="i:msvcrt.dll" target="libc.so.6" os="!windows"/>
        <dllmap dll="sqlite" target="libsqlite.so.0" os="!windows"/>
        <dllmap dll="sqlite3" target="libsqlite3.so.0" os="!windows"/>
        <dllmap dll="libX11" target="libX11.so.6" os="!windows" />
        <dllmap dll="libcairo-2.dll" target="libcairo.so.2" os="!windows"/>
</configuration>

And per-dll config files:
$ cat /usr/lib/mono/gac/gtk-sharp/2.10.0.0__35e10195dab3c99f/gtk-sharp.dll.config
<configuration>
  <dllmap dll="libglib-2.0-0.dll" target="libglib-2.0.so.0"/>
  <dllmap dll="libgobject-2.0-0.dll" target="libgobject-2.0.so.0"/>
  <dllmap dll="libatk-1.0-0.dll" target="libatk-1.0.so.0"/>
  <dllmap dll="libgtk-win32-2.0-0.dll" target="libgtk-x11-2.0.so.0"/>
</configuration>


-- 
Jakub Bogusz    http://qboosh.pl/
-------------- next part --------------
--- /usr/lib/rpm/mono-find-requires	2007-05-16 19:17:33.000000000 +0200
+++ /home/qboosh/mono-find-requires	2007-07-15 20:46:36.387271119 +0200
@@ -57,6 +57,35 @@
 	done
 )
 
+if file $bindir/monodis 2>/dev/null | grep 64-bit ; then 
+	ELFTYPE="()(64bit)"
+else
+	ELFTYPE=
+fi
+SOREQUIRES=$(
+	for i in "${monolist[@]}"; do
+		DLLCONF=
+		if [ -f ${i}.config ]; then
+			DLLCONF="${i}.config"
+		fi
+		for r in `($bindir/monodis --moduleref $i | awk '
+			/^[0-9]+: / { print $2 }' ) 2>/dev/null` ; do
+			if echo "$r" | grep 'lib.*\.so\.' ; then
+				echo "$r"
+			else
+				r=$(echo "$r" | sed -e 's,[./],\\&,g')
+				awk "
+					/<dllmap .* os=\"(windows|osx)\"/ { next }
+					/<dllmap dll=\"(i:)?$r\"/ {
+						sub(/.*target=\"/,\"\")
+						sub(/\".*/,\"\")
+						print \$0 \"$ELFTYPE\"
+					}" /etc/mono/config $DLLCONF
+			fi
+		done
+	done
+)
+
 PROVIDES=$(
 	for i in "${monolist[@]}"; do
 		($bindir/monodis --assembly $i | awk '
@@ -91,3 +120,7 @@
 #
 echo "$UNIQ
 $REQUIRES" | sort | uniq -d
+# and add SONAME requires
+if [ -n "$SOREQUIRES" ]; then
+	echo "$SOREQUIRES" | sort -u
+fi


More information about the pld-devel-en mailing list