From 9efa069a65ec128ade802613d10d80a42a178390 Mon Sep 17 00:00:00 2001 From: Eelco Dolstra Date: Thu, 3 Mar 2005 17:19:58 +0000 Subject: [PATCH] * Added a tool `mono-dll-fixer' to absolutise the DLL maps in the `*.dll.config' files corresponding to CLR assemblies. I.e., the full path to native libraries is included in the maps. In effect this allows us to set the equivalent of an RPATH for assemblies. * gtk-sharp: use the DLL fixer. It's not perfect yet: I still have to set the LD_LIBRARY_PATH for monodoc to include the gtk-sharp lib directory itself, so that it can find the `*sharpglue.so' files. This seems to be gtk-sharp's fault; it doesn't have an entry for those libraries in its DLL maps. svn path=/nixpkgs/trunk/; revision=2330 --- pkgs/applications/editors/monodoc/default.nix | 2 +- pkgs/build-support/mono-dll-fixer/builder.sh | 5 +++ pkgs/build-support/mono-dll-fixer/default.nix | 9 ++++++ .../build-support/mono-dll-fixer/dll-fixer.pl | 32 +++++++++++++++++++ .../libraries/gtk-sharp/builder.sh | 11 +++++++ .../libraries/gtk-sharp/default.nix | 11 ++++--- pkgs/system/all-packages-generic.nix | 6 +++- 7 files changed, 69 insertions(+), 7 deletions(-) create mode 100644 pkgs/build-support/mono-dll-fixer/builder.sh create mode 100644 pkgs/build-support/mono-dll-fixer/default.nix create mode 100644 pkgs/build-support/mono-dll-fixer/dll-fixer.pl create mode 100644 pkgs/development/libraries/gtk-sharp/builder.sh diff --git a/pkgs/applications/editors/monodoc/default.nix b/pkgs/applications/editors/monodoc/default.nix index e4b4a5a22b3..e37b08af67d 100644 --- a/pkgs/applications/editors/monodoc/default.nix +++ b/pkgs/applications/editors/monodoc/default.nix @@ -1,7 +1,7 @@ {stdenv, fetchurl, mono, gtksharp, pkgconfig}: stdenv.mkDerivation { - name = "MonoDoc-1.0.6"; + name = "monodoc-1.0.6"; src = fetchurl { url = http://www.go-mono.com/archive/1.0.6/monodoc-1.0.6.tar.gz; diff --git a/pkgs/build-support/mono-dll-fixer/builder.sh b/pkgs/build-support/mono-dll-fixer/builder.sh new file mode 100644 index 00000000000..277a108ee7d --- /dev/null +++ b/pkgs/build-support/mono-dll-fixer/builder.sh @@ -0,0 +1,5 @@ +. $stdenv/setup +. $substituter + +substitute $dllFixer $out --subst-var-by perl $perl/bin/perl +chmod +x $out diff --git a/pkgs/build-support/mono-dll-fixer/default.nix b/pkgs/build-support/mono-dll-fixer/default.nix new file mode 100644 index 00000000000..d1d856235da --- /dev/null +++ b/pkgs/build-support/mono-dll-fixer/default.nix @@ -0,0 +1,9 @@ +{stdenv, perl}: + +stdenv.mkDerivation { + name = "mono-dll-fixer"; + builder = ./builder.sh; + substituter = ../substitute/substitute.sh; + dllFixer = ./dll-fixer.pl; + inherit perl; +} \ No newline at end of file diff --git a/pkgs/build-support/mono-dll-fixer/dll-fixer.pl b/pkgs/build-support/mono-dll-fixer/dll-fixer.pl new file mode 100644 index 00000000000..4a8b468692f --- /dev/null +++ b/pkgs/build-support/mono-dll-fixer/dll-fixer.pl @@ -0,0 +1,32 @@ +#! @perl@ -w + +use strict; + +my @paths = split ' ', $ENV{"ALL_INPUTS"}; + +open IN, "<$ARGV[0]" or die; +open OUT, ">$ARGV[0].tmp" or die; + +while () { + # !!! should use a real XML library here. + if (!//) { + print OUT; + next; + } + my $dll = $1; + my $target = $2; + + foreach my $path (@paths) { + my $fullPath = "$path/lib/$target"; + if (-e "$fullPath") { + $target = $fullPath; + last; + } + } + + print OUT " \n"; +} + +close IN; + +rename "$ARGV[0].tmp", "$ARGV[0]" or die "cannot rename $ARGV[0]"; diff --git a/pkgs/development/libraries/gtk-sharp/builder.sh b/pkgs/development/libraries/gtk-sharp/builder.sh new file mode 100644 index 00000000000..225cc3f3aae --- /dev/null +++ b/pkgs/development/libraries/gtk-sharp/builder.sh @@ -0,0 +1,11 @@ +. $stdenv/setup + +genericBuild + +# !!! hack +export ALL_INPUTS=$pkgs + +find $out -name "*.dll.config" | while read configFile; do + echo "modifying config file $configFile" + $monoDLLFixer "$configFile" +done diff --git a/pkgs/development/libraries/gtk-sharp/default.nix b/pkgs/development/libraries/gtk-sharp/default.nix index 8d8f27ee8ba..3b31d338119 100644 --- a/pkgs/development/libraries/gtk-sharp/default.nix +++ b/pkgs/development/libraries/gtk-sharp/default.nix @@ -10,22 +10,23 @@ , libgnomeui ? null , libgnomeprint ? null , libgnomeprintui ? null -, libxml2 } : +, libxml2 +, monoDLLFixer +}: stdenv.mkDerivation { name = "gtk-sharp-1.0.6"; + builder = ./builder.sh; src = fetchurl { url = http://www.go-mono.com/archive/1.0.6/gtk-sharp-1.0.6.tar.gz; md5 = "2651d14fe77174ab20b8af53d150ee11"; }; buildInputs = [ - pkgconfig mono glib pango gtk gconf libglade libgnomecanvas libgtkhtml libgnomeui libgnomeprint libgnomeprintui gtkhtml libxml2 - ]; + + inherit monoDLLFixer; } - - diff --git a/pkgs/system/all-packages-generic.nix b/pkgs/system/all-packages-generic.nix index 340f86b4d0f..ef269bba56b 100644 --- a/pkgs/system/all-packages-generic.nix +++ b/pkgs/system/all-packages-generic.nix @@ -390,6 +390,10 @@ rec { inherit (gtkLibs) glib; }; + monoDLLFixer = import ../build-support/mono-dll-fixer { + inherit stdenv perl; + }; + strategoxt = (import ../development/compilers/strategoxt) { inherit fetchurl stdenv aterm; sdf = sdf_23; @@ -633,7 +637,7 @@ rec { }; gtksharp = (import ../development/libraries/gtk-sharp) { - inherit fetchurl stdenv mono pkgconfig libxml2; + inherit fetchurl stdenv mono pkgconfig libxml2 monoDLLFixer; inherit (gnome) gtk glib pango libglade libgtkhtml gtkhtml libgnomecanvas libgnomeui libgnomeprint libgnomeprintui gconf;