[Icecast-dev] 2.4-beta fixes for MinGW

LRN lrn1986 at gmail.com
Wed Oct 3 02:10:40 PDT 2012


-----BEGIN PGP SIGNED MESSAGE-----
Hash: SHA1

With these one can build 2.4-beta (AKA 2.3.99.0) with mingw32 (gcc-4.7.0).

Note, however, that win32 subdirectory is:
1) Lacking a complete Makefile.am, so it can't be built with autotools.
2) Depends on MFC, and MFC is not provided by any MinGW toolset (and
MS' MFC is, most likely, highly incompatible with MinGW).

So you only get a console binary.

If someone has some free, maybe w32 GUI part of icecast could be
ported to GTK+? If that is too difficult, just allowing icecast to be
run as a service and be able to dump its statistics into a socket or
pipe should be enough - separate GUI can be hooked up to that.
-----BEGIN PGP SIGNATURE-----
Version: GnuPG v1.4.11 (MingW32)
Comment: Using GnuPG with Mozilla - http://www.enigmail.net/

iQEcBAEBAgAGBQJQbAEPAAoJEOs4Jb6SI2CweDQIAMbsylyScn4sVUWXJGCjrxv1
zQF3S5U+dWKHts7Q1q3SBOys+fIA2IWviuq0PRTh8smFb/GGdpmPJs5ti0DRhFiQ
Ylef5Zk5Hbx2BmKdJRcVtwl5xEU28nYkxZ1mdzr6q9hfJZl8JZRiwIfTjNyGcMD1
3r6qjKfBfP/s3NhwyzFwTRDR5IRiCmVHraI+R1HypzC8TEjWTakQszwWUN8HhR1j
lFyaEMl/jQ+Ff4JN5W3PfYZjeHLDjSeuxeyA4sGDuJsin0QAU1qgAoV/QazybNnh
is5K4Tz9cbyQhGR/6Ug56WwwcaK26xF6DnYFqR+K0XeiUeNxtcRSCnMRcU1GBKY=
=2djo
-----END PGP SIGNATURE-----
-------------- next part --------------
--- icecast-2.3.99.0.orig/configure.in	2012-07-18 01:25:56 +0400
+++ icecast-2.3.99.0/configure.in	2012-10-02 15:02:32 +0400
@@ -34,8 +34,9 @@
 AC_HEADER_TIME
 
 AC_CHECK_HEADERS([alloca.h sys/timeb.h])
-AC_CHECK_HEADERS(pwd.h, AC_DEFINE(CHUID, 1, [Define if you have pwd.h]),,)
-AC_CHECK_HEADERS(unistd.h, AC_DEFINE(CHROOT, 1, [Define if you have unistd.h]),,)
+AC_CHECK_HEADERS([pwd.h, unistd.h, grp.h, sys/types.h])
+AC_CHECK_FUNC ([chuid])
+AC_CHECK_FUNC ([chown])
 
 dnl Checks for typedefs, structures, and compiler characteristics.
 XIPH_C__FUNC__
--- icecast-2.3.99.0/src/main.c.orig	2012-10-02 14:52:40 +0400
+++ icecast-2.3.99.0/src/main.c	2012-10-02 15:02:04 +0400
@@ -41,9 +41,13 @@
 #include "net/resolver.h"
 #include "httpp/httpp.h"
 
-#ifdef CHUID
+#if HAVE_SYS_TYPES_H
 #include <sys/types.h>
+#endif
+#if HAVE_GRP_H
 #include <grp.h>
+#endif
+#if HAVE_PWD_H
 #include <pwd.h>
 #endif
 
@@ -362,7 +366,7 @@
    }
 #endif
 
-#ifdef CHROOT
+#if HAVE_CHROOT
    if (conf->chroot)
    {
        if(getuid()) /* root check */
@@ -380,7 +384,7 @@
 
    }   
 #endif
-#ifdef CHUID
+#if HAVE_CHUID
 
    if(conf->chuid)
    {
-------------- next part --------------
--- icecast-2.3.99.0/src/fserve.c.orig	2012-10-02 14:52:41 +0400
+++ icecast-2.3.99.0/src/fserve.c	2012-10-02 15:31:11 +0400
@@ -560,6 +560,7 @@
                 time_t now;
                 int strflen;
                 struct tm result;
+		struct tm *gmtime_result;
                 off_t endpos = rangenumber+new_content_len-1;
                 char *type;
 
@@ -567,8 +568,18 @@
                     endpos = 0;
                 }
                 time(&now);
+#if !defined(_WIN32)
+		gmtime_result = gmtime_r(&now, &result)
+#else
+		/* gmtime() on W32 breaks POSIX and IS thread-safe (uses TLS) */
+		gmtime_result = gmtime (&now);
+		if (gmtime_result)
+		  memcpy (&result, gmtime_result, sizeof (result));
+#endif
+		if (gmtime_result == NULL)
+                  goto fail;
                 strflen = strftime(currenttime, 50, "%a, %d-%b-%Y %X GMT",
-                                   gmtime_r(&now, &result));
+                                   &result);
                 httpclient->respcode = 206;
                 type = fserve_content_type (path);
                 bytes = snprintf (httpclient->refbuf->data, BUFSIZE,
--- icecast-2.3.99.0/src/logging.c.orig	2012-10-02 14:52:41 +0400
+++ icecast-2.3.99.0/src/logging.c	2012-10-02 15:30:57 +0400
@@ -54,7 +54,15 @@
     struct tm *thetime;
     time_t now;
 
-    gmtime_r(&time1, &gmt);
+#if !defined(_WIN32)
+    thetime = gmtime_r(&time1, &gmt)
+#else
+    /* gmtime() on W32 breaks POSIX and IS thread-safe (uses TLS) */
+    thetime = gmtime (&time1);
+    if (thetime)
+      memcpy (&gmt, thetime, sizeof (gmt));
+#endif
+    /* FIXME: bail out if gmtime* returns NULL */
 
     time_days = t->tm_yday - gmt.tm_yday;
 


More information about the Icecast-dev mailing list