]> git.sesse.net Git - vlc/blob - extras/contrib/src/Patches/x264-svn-win32.patch
x264.patch: Sync with upstream
[vlc] / extras / contrib / src / Patches / x264-svn-win32.patch
1 Index: configure
2 ===================================================================
3 --- configure   (revision 473)
4 +++ configure   (working copy)
5 @@ -7,6 +7,7 @@
6  echo "available options:"
7  echo ""
8  echo "  --help                   print this message"
9 +echo "  --crosscompile=ARCH      crosscompile for ARCH"
10  echo "  --enable-avis-input      enables avisynth input (win32 only)"
11  echo "  --enable-mp4-output      enables mp4 output (using gpac)"
12  echo "  --enable-vfw             compiles the VfW frontend"
13 @@ -64,43 +65,143 @@
14  
15  EXE=""
16  
17 -UNAMES="`uname -s`"
18 +AR="ar"
19 +AROPTS="rc"
20 +RANLIB="ranlib"
21 +
22 +UNAMES="`uname -s |tr A-Z a-z`"
23 +UNAMEM="`uname -m |tr A-Z a-z`"
24 +
25 +# parse options
26 +
27 +for opt do
28 +    optarg="${opt#*=}"
29 +    case "$opt" in
30 +       --crosscompile=*)
31 +           CROSS="$optarg"
32 +           CC="$CROSS-gcc"
33 +           AR="$CROSS-ar"
34 +           RANLIB="$CROSS-ranlib"
35 +           UNAMES="`echo $CROSS | cut -d- -f2`"
36 +           UNAMEM="`echo $CROSS | cut -d- -f1`"
37 +           ;;
38 +       --prefix=*)
39 +           prefix="$optarg"
40 +           ;;
41 +       --exec-prefix=*)
42 +           eprefix="$optarg"
43 +           ;;
44 +       --bindir=*)
45 +           bindir="$optarg"
46 +           ;;
47 +       --libdir=*)
48 +           libdir="$optarg"
49 +           ;;
50 +       --includedir=*)
51 +           includedir="$optarg"
52 +           ;;
53 +        --enable-avis-input)
54 +            if [ $SYS = CYGWIN -o $SYS = MINGW ]; then
55 +                CFLAGS="$CFLAGS -DAVIS_INPUT"
56 +                LDFLAGS="$LDFLAGS -lvfw32"
57 +                avis_input="yes"
58 +            fi
59 +            ;;
60 +        --enable-mp4-output)
61 +            CFLAGS="$CFLAGS -DMP4_OUTPUT"
62 +            LDFLAGS="$LDFLAGS -lgpac_static"
63 +            if [ $SYS = CYGWIN -o $SYS = MINGW ]; then
64 +                LDFLAGS="$LDFLAGS -lwinmm"
65 +            fi
66 +            mp4_output="yes"
67 +            ;;
68 +        --extra-asflags=*)
69 +            ASFLAGS="$ASFLAGS ${opt#--extra-asflags=}"
70 +            ;;
71 +        --extra-cflags=*)
72 +            CFLAGS="$CFLAGS ${opt#--extra-cflags=}"
73 +            VFW_CFLAGS="${opt#--extra-cflags=}"
74 +            ;;
75 +        --extra-ldflags=*)
76 +            LDFLAGS="$LDFLAGS ${opt#--extra-ldflags=}"
77 +            VFW_LDFLAGS="${opt#--extra-ldflags=}"
78 +            ;;
79 +        --enable-pthread)
80 +            CFLAGS="$CFLAGS -DHAVE_PTHREAD=1"
81 +            pthread="yes"
82 +            case $SYS in
83 +              MINGW|CYGWIN|BEOS)
84 +                ;;
85 +              *)
86 +                LDFLAGS="$LDFLAGS -lpthread"
87 +                ;;
88 +            esac
89 +            ;;
90 +        --enable-debug)
91 +            CFLAGS="$CFLAGS -g"
92 +            debug="yes"
93 +            ;;
94 +        --enable-gprof)
95 +            CFLAGS="$CFLAGS -pg"
96 +            LDFLAGS="$LDFLAGS -pg"
97 +            gprof="yes"
98 +            ;;
99 +        --enable-pic)
100 +            CFLAGS="$CFLAGS -fPIC"
101 +            ASFLAGS="$ASFLAGS -D__PIC__"
102 +            pic="yes"
103 +            ;;
104 +        --enable-vfw)
105 +            vfw="yes"
106 +            ;;
107 +        --enable-visualize)
108 +            LDFLAGS="$LDFLAGS -L/usr/X11R6/lib -lX11"
109 +            CFLAGS="$CFLAGS -DVISUALIZE=1"
110 +            vis="yes"
111 +            ;;
112 +        *)
113 +            echo "Unknown option $opt, ignored"
114 +            ;;
115 +    esac
116 +done
117 +
118 +
119  case "$UNAMES" in
120 -  BeOS)
121 +  beos)
122      SYS="BEOS"
123      CFLAGS="$CFLAGS -DHAVE_MALLOC_H"
124      ;;
125 -  Darwin)
126 +  darwin)
127      SYS="MACOSX"
128      CFLAGS="$CFLAGS -falign-loops=16"
129      LDFLAGS="$LDFLAGS -lm -lmx"
130      ;;
131 -  FreeBSD)
132 +  freebsd)
133      SYS="FREEBSD"
134      LDFLAGS="$LDFLAGS -lm"
135      ;;
136 -  NetBSD)
137 +  netbsd)
138      SYS="NETBSD"
139      LDFLAGS="$LDFLAGS -lm"
140      ;;
141 -  Linux)
142 +  linux)
143      SYS="LINUX"
144      CFLAGS="$CFLAGS -DHAVE_MALLOC_H"
145      LDFLAGS="$LDFLAGS -lm"
146      ;;
147 -  CYGWIN*)
148 +  cygwin*)
149      SYS="CYGWIN"
150      CFLAGS="$CFLAGS -mno-cygwin"
151      LDFLAGS="$LDFLAGS -mno-cygwin"
152      EXE=".exe"
153      DEVNULL="NUL"
154      ;;
155 -  MINGW*)
156 +  mingw*)
157      SYS="MINGW"
158      EXE=".exe"
159      DEVNULL="NUL"
160      ;;
161 -  SunOS)
162 +  sunos)
163      SYS="SunOS"
164      CFLAGS="$CFLAGS -DHAVE_MALLOC_H"
165      LDFLAGS="$LDFLAGS -lm"
166 @@ -112,9 +213,8 @@
167      ;;
168  esac
169  
170 -UNAMEM="`uname -m`"
171  case "$UNAMEM" in
172 -  i386|i486|i586|i686|BePC)
173 +  i386|i486|i586|i686|bepc)
174      ARCH="X86"
175      CFLAGS="$CFLAGS -DHAVE_MMXEXT -DHAVE_SSE2"
176      AS="nasm"
177 @@ -135,7 +235,7 @@
178      AS="yasm"
179      ASFLAGS="-f elf -m amd64"
180      ;;
181 -  "Power Macintosh"|ppc)
182 +  "power macintosh"|ppc)
183      ARCH="PPC"
184      if [ $SYS = MACOSX ]
185      then
186 @@ -183,90 +283,7 @@
187  
188  CFLAGS="$CFLAGS -DARCH_$ARCH -DSYS_$SYS"
189  
190 -# parse options
191  
192 -for opt do
193 -    optarg="${opt#*=}"
194 -    case "$opt" in
195 -        --prefix=*)
196 -            prefix="$optarg"
197 -            ;;
198 -        --exec-prefix=*)
199 -            exec_prefix="$optarg"
200 -            ;;
201 -        --bindir=*)
202 -            bindir="$optarg"
203 -            ;;
204 -        --libdir=*)
205 -            libdir="$optarg"
206 -            ;;
207 -        --includedir=*)
208 -            includedir="$optarg"
209 -            ;;
210 -        --enable-avis-input)
211 -            avis_input="yes"
212 -            ;;
213 -        --disable-avis-input)
214 -            avis_input="no"
215 -            ;;
216 -        --enable-mp4-output)
217 -            mp4_output="yes"
218 -            ;;
219 -        --disable-mp4-output)
220 -            mp4_output="no"
221 -            ;;
222 -        --extra-asflags=*)
223 -            ASFLAGS="$ASFLAGS ${opt#--extra-asflags=}"
224 -            ;;
225 -        --extra-cflags=*)
226 -            CFLAGS="$CFLAGS ${opt#--extra-cflags=}"
227 -            VFW_CFLAGS="${opt#--extra-cflags=}"
228 -            ;;
229 -        --extra-ldflags=*)
230 -            LDFLAGS="$LDFLAGS ${opt#--extra-ldflags=}"
231 -            VFW_LDFLAGS="${opt#--extra-ldflags=}"
232 -            ;;
233 -        --enable-pthread)
234 -            pthread="yes"
235 -            ;;
236 -        --disable-pthread)
237 -            pthread="no"
238 -            ;;
239 -        --enable-debug)
240 -            CFLAGS="$CFLAGS -g"
241 -            debug="yes"
242 -            ;;
243 -        --enable-gprof)
244 -            CFLAGS="$CFLAGS -pg"
245 -            LDFLAGS="$LDFLAGS -pg"
246 -            gprof="yes"
247 -            ;;
248 -        --enable-pic)
249 -            pic="yes"
250 -            ;;
251 -        --enable-vfw)
252 -            vfw="yes"
253 -            ;;
254 -        --disable-vfw)
255 -            vfw="no"
256 -            ;;
257 -        --enable-shared)
258 -            shared="yes"
259 -            if [ $ARCH = "X86_64" -o $ARCH = "PPC" -o $ARCH = "ALPHA" ] ; then
260 -                pic="yes"
261 -            fi
262 -            ;;
263 -        --enable-visualize)
264 -            LDFLAGS="$LDFLAGS -L/usr/X11R6/lib -lX11"
265 -            CFLAGS="$CFLAGS -DVISUALIZE=1"
266 -            vis="yes"
267 -            ;;
268 -        *)
269 -            echo "Unknown option $opt, ignored"
270 -            ;;
271 -    esac
272 -done
273 -
274  # autodetect options that weren't forced nor disabled
275  
276  if test "$pthread" = "auto" ; then
277 @@ -351,6 +368,9 @@
278  ASFLAGS=$ASFLAGS
279  VFW=$vfw
280  EXE=$EXE
281 +AR=$AR
282 +AROPTS=$AROPTS
283 +RANLIB=$RANLIB
284  VIS=$vis
285  HAVE_GETOPT_LONG=$HAVE_GETOPT_LONG
286  DEVNULL=$DEVNULL
287 Index: Makefile
288 ===================================================================
289 --- Makefile    (revision 473)
290 +++ Makefile    (working copy)
291 @@ -64,8 +64,8 @@
292  default: $(DEP) x264$(EXE)
293  
294  libx264.a: .depend $(OBJS) $(OBJASM)
295 -       ar rc libx264.a $(OBJS) $(OBJASM)
296 -       ranlib libx264.a
297 +       $(AR) rc libx264.a $(OBJS) $(OBJASM)
298 +       $(RANLIB) libx264.a
299  
300  $(SONAME): .depend $(OBJS) $(OBJASM)
301         $(CC) -shared -o $@ $(OBJS) $(OBJASM) -Wl,-soname,$(SONAME)
302 @@ -133,14 +133,14 @@
303  distclean: clean
304         rm -f config.mak config.h vfw/build/cygwin/config.mak x264.pc
305  
306 -install: x264 $(SONAME)
307 +install: x264$(EXE)
308         install -d $(DESTDIR)$(bindir) $(DESTDIR)$(includedir)
309         install -d $(DESTDIR)$(libdir) $(DESTDIR)$(libdir)/pkgconfig
310         install -m 644 x264.h $(DESTDIR)$(includedir)
311         install -m 644 libx264.a $(DESTDIR)$(libdir)
312         install -m 644 x264.pc $(DESTDIR)$(libdir)/pkgconfig
313 -       install x264 $(DESTDIR)$(bindir)
314 -       ranlib $(DESTDIR)$(libdir)/libx264.a
315 +       install x264$(EXE) $(DESTDIR)$(bindir)
316 +       $(RANLIB) $(DESTDIR)$(libdir)/libx264.a
317         $(if $(SONAME), ln -sf $(DESTDIR)$(libdir)/$(SONAME) $(DESTDIR)$(libdir)/libx264.so)
318         $(if $(SONAME), install -m 755 $(SONAME) $(DESTDIR)$(libdir))
319