Index: Makefile
===================================================================
--- Makefile	(revision 356)
+++ Makefile	(revision 360)
@@ -79,6 +79,12 @@
 VO_LIBS += $(EXTERNAL_VIDIX_LIB)
 endif
 
+ASS_LIB =
+
+ifeq ($(CONFIG_ASS),yes)
+ASS_LIB += libsub/libsub.a
+endif
+
 AO_LIBS = $(ARTS_LIB) \
           $(ESD_LIB) \
           $(JACK_LIB) \
@@ -107,6 +113,7 @@
              $(SPEEX_LIB) \
 
 COMMON_LIBS = libmpcodecs/libmpcodecs.a \
+              $(ASS_LIB) \
               $(W32_LIB) \
               $(DS_LIB) \
               libaf/libaf.a \
@@ -254,7 +261,6 @@
 endif
 ifeq ($(CONFIG_ASS),yes)
 COMMON_DEPS += libsub/libsub.a
-COMMON_LIBS += libsub/libsub.a
 PARTS += libsub
 endif
 
Index: libsub/ass_render.c
===================================================================
--- libsub/ass_render.c	(revision 356)
+++ libsub/ass_render.c	(revision 360)
@@ -1,6 +1,5 @@
 #include "config.h"
 
-#include <pthread.h>
 #include <assert.h>
 #include <math.h>
 
Index: libsub/ass.c
===================================================================
--- libsub/ass.c	(revision 356)
+++ libsub/ass.c	(revision 360)
@@ -4,7 +4,6 @@
 #include <stdlib.h>
 #include <string.h>
 #include <assert.h>
-#include <pthread.h>
 #include <errno.h>
 #include <sys/types.h>
 #include <sys/stat.h>
@@ -694,7 +693,7 @@
 	char* p;
 	int events_reached;
 	
-	FILE* fp = fopen(fname, "r");
+	FILE* fp = fopen(fname, "rb");
 	if (!fp) {
 		mp_msg(MSGT_GLOBAL, MSGL_WARN, "ass_read_file(%s): fopen failed\n", fname);
 		return -1;
@@ -852,7 +851,11 @@
 	rc = stat(fonts_dir, &st);
 	if (rc) {
 		int res;
+#ifndef __MINGW32__
 		res = mkdir(fonts_dir, 0700);
+#else
+		res = mkdir(fonts_dir);
+#endif
 		if (res) {
 			mp_msg(MSGT_GLOBAL, MSGL_WARN, "Failed to create: %s\n", fonts_dir);
 		}
@@ -866,7 +869,7 @@
 	free(fname);
 	free(fonts_dir);
 
-	fp = fopen(buf, "w");
+	fp = fopen(buf, "wb");
 	if (!fp) return;
 
 	fwrite(data, data_size, 1, fp);
