martes, 17 de marzo de 2009

x264-20090315

Toca compilar x264 para Cygwin.

Cogemos el x264 de hoy, y, como cuando detecta a Cygwin lo que hace es una compilación cruzada para MinGW, le aplicamos un parche:

patch < x264.cygwin.diff

El contenido de x264.cygwin.diff es:

diff --git a/configure b/configure
index eb51091..31da92e 100755
--- a/configure
+++ b/configure
@@ -212,11 +212,8 @@ case $host_os in
LDFLAGS="$LDFLAGS -lm"
;;
cygwin*)
- SYS="MINGW"
- CFLAGS="$CFLAGS -mno-cygwin"
- LDFLAGS="$LDFLAGS -mno-cygwin"
+ SYS="CYGWIN"
EXE=".exe"
- DEVNULL="NUL"
;;
mingw*)
SYS="MINGW"
@@ -241,6 +238,8 @@ case $host_cpu in
ASFLAGS="-O2"
if [ "$SYS" = MACOSX ]; then
ASFLAGS="$ASFLAGS -f macho -DPREFIX"
+ elif [ "$SYS" = CYGWIN ]; then
+ ASFLAGS="$ASFLAGS -f win32 -DPREFIX"
elif [ "$SYS" = MINGW ]; then
ASFLAGS="$ASFLAGS -f win32 -DPREFIX"
else
@@ -368,6 +367,8 @@ fi
if [ "$avis_input" = "auto" ] ; then
if [ $SYS = MINGW ]; then
avis_input="yes"
+ elif [ "$SYS" = CYGWIN ]; then
+ avis_input="yes"
else
avis_input="no";
fi
@@ -440,6 +441,10 @@ if [ "$shared" = "yes" ]; then
echo "SONAME=libx264-$API.dll" >> config.mak
echo 'IMPLIBNAME=libx264.dll.a' >> config.mak
echo 'SOFLAGS=-Wl,--out-implib,$(IMPLIBNAME) -Wl,--enable-auto-image-base' >> config.mak
+ elif [ "$SYS" = CYGWIN ]; then
+ echo "SONAME=libx264-$API.dll" >> config.mak
+ echo 'IMPLIBNAME=libx264.dll.a' >> config.mak
+ echo 'SOFLAGS=-Wl,--out-implib,$(IMPLIBNAME) -Wl,--enable-auto-image-base' >> config.mak
elif [ "$SYS" = "MACOSX" ]; then
echo "SOSUFFIX=dylib" >> config.mak
echo "SONAME=libx264.$API.dylib" >> config.mak


Esta es mi configuración:
CC=gcc-4 ./configure --disable-mp4-output --extra-cflags=-march=core2

Le damos caña y casca:

Found no assembler
Minimum version is yasm-0.6.1
If you really want to compile without asm, configure with --disable-asm.

Vaya, requiere yasm y no lo tengo instalado en mi Cygwin 1.7. Bueno pero lo tengo para Cygwin 1.5, bajado de Cygwin Ports, y se supone que hay compatibilidad hacia delante.

En mi Cygwin 1.5, cygcheck -l yasm me dice lo que tengo que copiar, y cygcheck /usr/bin/yasm.exe me dice las dependencias (las DLLs que también habrá que copiar si no existen ya).

Así que ejecuto en mi Cygwin 1.7:

cd /bin && cp -p /cygdrive/c/cygwin/bin/yasm.exe .
cd /usr/include && cp -pri /cygdrive/c/cygwin/usr/include/libyasm .


Y ahora ya funciona:

$ CC=gcc-4 ./configure --disable-mp4-output --extra-cflags=-march=core2
./version.sh: line 2: git: command not found
Platform: X86
System: CYGWIN
asm: yes
avis input: yes
mp4 output: no
pthread: yes
debug: no
gprof: no
PIC: no
shared: no
visualize: no
You can run 'make' or 'make fprofiled' now.


Bueno hay un errorcillo, pero git sólo se usa para poner la versión.

Así que make && make install y ya tenemos libx264 disponible.

No hay comentarios:

Publicar un comentario