[PATCH][Ffmpeg-devel] Compilation Issue - Policy decision needed!

Alexander Strasser eclipse7
Mon Nov 7 14:34:27 CET 2005


Michel Bardiaux wrote:
> The question is now rather simple: which minimal version of the mingw 
> gcc will be mandated for ffmpeg? If we want to support gcc 3.2, then 
> some changes to the code will be necessary, as described under 
> --enable-auto-import in man ld.

  Here is a patch that does fix it another way.
It has one big problem: currently we build static
and dynamic libs when --enable-shared is activated
but the static libs would need another compile for
this to work with this patch.

  Deactivating the build of the static libs under
windows (or all platforms?) when --enable-shared
is specified would need some more (prior) changes
to the buildsystem AFAICT.

  Alex (beastd)
-------------- next part --------------
? rev.diff
Index: configure
===================================================================
RCS file: /cvsroot/ffmpeg/ffmpeg/configure,v
retrieving revision 1.215
diff -u -r1.215 configure
--- configure	22 Oct 2005 19:17:39 -0000	1.215
+++ configure	24 Oct 2005 23:10:49 -0000
@@ -1446,6 +1446,7 @@
   echo "#define HAVE_VHOOK 1" >> $TMPH
 fi
 if test "$lshared" = "yes" ; then
+  echo "#define BUILD_SHARED_AV 1" >> $TMPH
   echo "BUILD_SHARED=yes" >> config.mak
   echo "PIC=-fPIC -DPIC" >> config.mak
   echo "SPPMAJOR=0" >> config.mak
Index: libavcodec/Makefile
===================================================================
RCS file: /cvsroot/ffmpeg/ffmpeg/libavcodec/Makefile,v
retrieving revision 1.207
diff -u -r1.207 Makefile
--- libavcodec/Makefile	19 Oct 2005 18:42:37 -0000	1.207
+++ libavcodec/Makefile	24 Oct 2005 23:10:49 -0000
@@ -394,7 +394,7 @@
 	$(MAKE) -C libpostproc
 endif
 ifeq ($(CONFIG_WIN32),yes)
-	$(CC) $(SHFLAGS) -Wl,--output-def,$(@:.dll=.def) -o $@ $(OBJS) $(EXTRALIBS) $(AMREXTRALIBS)
+	$(CC) $(SHFLAGS) -Wl,--output-def,$(@:.dll=.def),--out-implib,$(LIB:.a=.dll.a) -o $@ $(OBJS) $(EXTRALIBS) $(AMREXTRALIBS)
 	-lib /machine:i386 /def:$(@:.dll=.def)
 else
 	$(CC) $(SHFLAGS) $(LDFLAGS) -o $@ $(OBJS) $(EXTRALIBS) $(AMREXTRALIBS)
@@ -417,7 +417,9 @@
 dep:	depend
 
 clean: $(CLEANAMR)
-	rm -f *.o *.d *~ .depend $(LIB) $(SLIBNAME) *$(SLIBSUF) i386/*.o i386/*~ \
+	rm -f *.o *.d *~ .depend $(LIB) $(SLIBNAME) *$(SLIBSUF) \
+	   *.lib *.def *.dll.a *.exp \
+	   i386/*.o i386/*~ \
 	   armv4l/*.o armv4l/*~ \
 	   mlib/*.o mlib/*~ \
 	   alpha/*.o alpha/*~ \
Index: libavformat/Makefile
===================================================================
RCS file: /cvsroot/ffmpeg/ffmpeg/libavformat/Makefile,v
retrieving revision 1.101
diff -u -r1.101 Makefile
--- libavformat/Makefile	4 Oct 2005 11:19:08 -0000	1.101
+++ libavformat/Makefile	24 Oct 2005 23:10:49 -0000
@@ -98,7 +98,7 @@
 
 $(SLIBNAME): $(OBJS)
 ifeq ($(CONFIG_WIN32),yes)
-	$(CC) $(SHFLAGS) -Wl,--output-def,$(@:.dll=.def) -o $@ $(OBJS) $(PPOBJS) $(AVCLIBS) $(EXTRALIBS)
+	$(CC) $(SHFLAGS) -Wl,--output-def,$(@:.dll=.def),--out-implib,$(LIB:.a=.dll.a) -o $@ $(OBJS) $(PPOBJS) $(AVCLIBS) $(EXTRALIBS)
 	-lib /machine:i386 /def:$(@:.dll=.def)
 else
 	$(CC) $(SHFLAGS) $(LDFLAGS) -o $@ $(OBJS) $(PPOBJS) $(AVCLIBS) $(EXTRALIBS)
@@ -141,7 +141,8 @@
 	g++ $(subst -Wall,,$(CFLAGS)) -c -o $@ $< 
 
 distclean clean: 
-	rm -f *.o *.d .depend *~ *.a *$(SLIBSUF) $(LIB)
+	rm -f *.o *.d .depend *~ *.a *$(SLIBSUF) $(LIB) \
+	      *.lib *.def *.dll.a *.exp
 
 #
 # include dependency files if they exist
Index: libavutil/Makefile
===================================================================
RCS file: /cvsroot/ffmpeg/ffmpeg/libavutil/Makefile,v
retrieving revision 1.3
diff -u -r1.3 Makefile
--- libavutil/Makefile	26 Sep 2005 10:05:13 -0000	1.3
+++ libavutil/Makefile	24 Oct 2005 23:10:50 -0000
@@ -6,7 +6,7 @@
 VPATH=$(SRC_PATH)/libavutil
 
 # NOTE: -I.. is needed to include config.h
-CFLAGS=$(OPTFLAGS) -DHAVE_AV_CONFIG_H -I.. -D_FILE_OFFSET_BITS=64 -D_LARGEFILE_SOURCE -D_GNU_SOURCE
+CFLAGS=$(OPTFLAGS) -DHAVE_AV_CONFIG_H -DBUILD_AVUTIL -I.. -D_FILE_OFFSET_BITS=64 -D_LARGEFILE_SOURCE -D_GNU_SOURCE
 
 OBJS= mathematics.o \
       integer.o \
@@ -37,7 +37,7 @@
 
 $(SLIBNAME): $(OBJS)
 ifeq ($(CONFIG_WIN32),yes)
-	$(CC) $(SHFLAGS) -Wl,--output-def,$(@:.dll=.def) -o $@ $(OBJS) $(EXTRALIBS) $(AMREXTRALIBS)
+	$(CC) $(SHFLAGS) -Wl,--output-def,$(@:.dll=.def),--out-implib,$(LIB:.a=.dll.a) -o $@ $(OBJS) $(EXTRALIBS) $(AMREXTRALIBS)
 	-lib /machine:i386 /def:$(@:.dll=.def)
 else
 	$(CC) $(SHFLAGS) $(LDFLAGS) -o $@ $(OBJS) $(EXTRALIBS) $(AMREXTRALIBS)
@@ -52,7 +52,8 @@
 dep:	depend
 
 clean:
-	rm -f *.o *.d *~ .depend $(LIB) $(SLIBNAME) *$(SLIBSUF)
+	rm -f *.o *.d *~ .depend $(LIB) $(SLIBNAME) *$(SLIBSUF) \
+	      *.lib *.def *.dll.a *.exp
 
 distclean: clean
 	rm -f Makefile.bak .depend
Index: libavutil/common.h
===================================================================
RCS file: /cvsroot/ffmpeg/ffmpeg/libavutil/common.h,v
retrieving revision 1.153
diff -u -r1.153 common.h
--- libavutil/common.h	19 Sep 2005 23:26:47 -0000	1.153
+++ libavutil/common.h	24 Oct 2005 23:10:50 -0000
@@ -214,6 +214,13 @@
 
 #ifdef HAVE_AV_CONFIG_H
 
+#if defined(__MINGW32__) && !defined(BUILD_AVUTIL) && defined(BUILD_SHARED_AV)
+#  define FF_IMPORT_ATTR __declspec(dllimport)
+#else
+#  define FF_IMPORT_ATTR
+#endif
+
+
 #    include "bswap.h"
 
 // Use rip-relative addressing if compiling PIC code on x86-64.
@@ -309,7 +316,7 @@
 #endif
 
 /* misc math functions */
-extern const uint8_t ff_log2_tab[256];
+extern FF_IMPORT_ATTR const uint8_t ff_log2_tab[256];
 
 static inline int av_log2(unsigned int v)
 {
@@ -387,7 +394,7 @@
 }
 
 /* math */
-extern const uint8_t ff_sqrt_tab[128];
+extern FF_IMPORT_ATTR const uint8_t ff_sqrt_tab[128];
 
 int64_t ff_gcd(int64_t a, int64_t b);
 



More information about the ffmpeg-devel mailing list