hi all,

I cross-compiled clamav for mips-uClinux (on i386-cygwin).

here are some changes I had to make in order to make it work:
1. apply the patch 'configure.in.patch-mips' to 'configure.in' before
runnning 'autoconf' to generate 'configure'
2. run the script 'mips-configure'
3. apply the patch 'blob.c.mips-patch' to 'libclamav\blob.c' before
building libclamav

some comments:
- these patches are not general and should not be applied for any
other target machine-os
- no garenty, but it seems to work
- if any of you can put these changes in the build without troubling
other target machines-os, please do

hope this helps,
Amir.
--- configure.in.old    2004-11-23 13:13:03.218750000 +0200
+++ configure.in        2004-11-23 14:17:55.375000000 +0200
@@ -66,6 +66,10 @@
                         AC_MSG_RESULT(no)
                         AC_DEFINE(BROKEN_SNPRINTF,1,[Define if your snprintf 
is busted])
                         AC_MSG_WARN([****** Your snprintf() function is 
broken, complain to your vendor])
+                ],
+                [
+                        AC_MSG_RESULT(yes)
+                        AC_MSG_WARN([cannot run test program while cross 
compiling - let's hope it works])
                 ]
         )
 fi
@@ -103,7 +107,8 @@
 [  --disable-clamuko     disable clamuko support (Linux and FreeBSD only)],
 want_clamuko="no",)
 
-AC_FUNC_SETPGRP
+dnl function does not work when cross compiling
+dnl AC_FUNC_SETPGRP
 
 AC_ARG_ENABLE(milter,
 [  --enable-milter       build clamav-milter],
@@ -250,14 +255,14 @@
 #include <sys/types.h>
 #include <netinet/in.h>
 int main(int argc, char **argv) { in_port_t pt; pt = 0; return pt; }
-], AC_DEFINE(HAVE_IN_PORT_T,1,[in_port_t is defined]), AC_MSG_RESULT(in_port_t 
is not defined))
+], AC_DEFINE(HAVE_IN_PORT_T,1,[in_port_t is defined]), AC_MSG_RESULT(in_port_t 
is not defined), AC_MSG_RESULT([Let's hope it works (cross-compiling)]))
 
 dnl check for in_addr_t definition
 AC_TRY_RUN([
 #include <sys/types.h>
 #include <netinet/in.h>
 int main(int argc, char **argv) { in_addr_t pt; pt = 0; return pt; }
-], AC_DEFINE(HAVE_IN_ADDR_T,1,[in_addr_t is defined]), AC_MSG_RESULT(in_addr_t 
is not defined))
+], AC_DEFINE(HAVE_IN_ADDR_T,1,[in_addr_t is defined]), AC_MSG_RESULT(in_addr_t 
is not defined), AC_DEFINE(HAVE_IN_ADDR_T,1,[in_addr_t is defined]))
 
 case "$target_os" in
 linux*)
@@ -726,6 +731,7 @@
                        struct { char c; long l; } s;
                        return sizeof(s)==sizeof(s.c)+sizeof(s.l) ? 0:1; } ],
                        [have_pragma_pack=yes],
+                       [have_pragma_pack=no],
                        [have_pragma_pack=no])
                ])
        AC_MSG_RESULT($have_pragma_pack)

./configure CC=mips-gcc CPP="mips-gcc -E" NM="mips-nm -B" RANLIB=mips-ranlib 
STRIP=mips-strip --host=mips-uC-linux --build=i386 --without-libcurl 
--disable-dns --disable-clamav --disable-dsig

--- blob.c.old  2004-11-23 15:19:34.375000000 +0200
+++ blob.c      2004-11-23 15:20:42.031250000 +0200
@@ -423,6 +423,13 @@
        free(fb);
 }
 
+// patch (!) around (override) non-functioning uClibc mktemp
+char *mktemp(char *template)
+{
+       sprintf(strstr(template, "XXXXXX"), "%d", cli_rndnum(1000000));
+       cli_dbgmsg("mktemp = %s\n", template);
+}
+
 void
 fileblobSetFilename(fileblob *fb, const char *dir, const char *filename)
 {
_______________________________________________
http://lists.clamav.net/cgi-bin/mailman/listinfo/clamav-devel

Reply via email to