[Mono-list] build Mono statically linked?

Paolo Molaro lupus@ximian.com
Tue, 15 Jul 2003 15:34:09 +0200


--C7zPtVaVf+AK4Oqc
Content-Type: text/plain; charset=us-ascii
Content-Disposition: inline

On 07/09/03 Carl Potter wrote:
> I've got Mono-0.25 and am trying to build it statically.
> 
> So far I've tried both putting CFLAGS=-static in my environment as well as
> doing this with configure:
> 
> ./configure --enable-static --prefix=/my/special/place

It's not easy to build a static mono, especially since Martin added
the included libgc in the build process. If you take the included libgc
out of the picture, you can use the attached patch to create a monos
static binary. I don't know a better way to do it using libtool (if it
exists at all). The other solution is to do a little cut&paste
of the command used to build the final executable and change the
references to the .la files with references to the .a static libraries
created by configure --enable-static.

lupus

-- 
-----------------------------------------------------------------
lupus@debian.org                                     debian/rules
lupus@ximian.com                             Monkeys do it better

--C7zPtVaVf+AK4Oqc
Content-Type: text/plain; charset=us-ascii
Content-Disposition: attachment; filename="makefile-monos.diff"

Index: Makefile.am
===================================================================
RCS file: /cvs/public/mono/mono/mini/Makefile.am,v
retrieving revision 1.22
diff -u -p -r1.22 Makefile.am
--- Makefile.am	28 May 2003 09:33:15 -0000	1.22
+++ Makefile.am	9 Jun 2003 17:05:51 -0000
@@ -25,13 +25,14 @@ endif
 
 # hack for automake to have the same source file in a library and a bin
 genmdesc_CFLAGS = $(AM_CFLAGS)
+monos_CFLAGS = $(AM_CFLAGS)
 
 regtests=basic.exe arrays.exe basic-float.exe basic-long.exe objects.exe basic-calls.exe iltests.exe exceptions.exe bench.exe
 
 libmono_la_LDFLAGS=-Wl,-version-script=$(srcdir)/ldscript
 
 if JIT_SUPPORTED
-bin_PROGRAMS = mono
+bin_PROGRAMS = mono monos
 
 noinst_PROGRAMS = genmdesc
 
@@ -46,6 +47,11 @@ mono_LDADD = \
 	$(GLIB_LIBS)		\
 	$(GMODULE_LIBS) -lm
 
+monos_LDADD = \
+	$(libs)	\
+	$(GLIB_LIBS)		\
+	$(GMODULE_LIBS) -lm
+
 mono_LDFLAGS = \
 	-export-dynamic
 
@@ -96,12 +102,16 @@ if X86
 libmono_la_SOURCES = \
 	$(common_sources) $(x86_sources)
 
+monos_SOURCES = main.c $(common_sources) $(x86_sources)
+
 BURGSRC= $(common_BURGSRC) $(srcdir)/inssel-x86.brg
 endif
 
 if POWERPC
 libmono_la_SOURCES = \
 	$(common_sources) $(ppc_sources)
+
+monos_SOURCES = main.c $(common_sources) $(ppc_sources)
 
 BURGSRC= $(common_BURGSRC) $(srcdir)/inssel-ppc.brg
 endif

--C7zPtVaVf+AK4Oqc--