[x264-devel] Re: [PATCH] crosscompilation support

Dimos Stamatiou stamati3 at otenet.gr
Thu Oct 27 17:30:03 CEST 2005


Bernhard Rosenkraenzer wrote:
> As discussed in the last couple of days -- here's a patch that combines the 
> various approaches discussed recently, applies cleanly to svn 342.
>
> LLaP
> bero
>   
> ------------------------------------------------------------------------
>
> --- x264/configure.crosscompile~	2005-10-23 14:48:21.000000000 +0200
> +++ x264/configure	2005-10-27 17:04:09.000000000 +0200
> @@ -7,6 +7,7 @@
>  echo "available options:"
>  echo ""
>  echo "  --help                   print this message"
> +echo "  --crosscompile=ARCH      crosscompile for ARCH"
>  echo "  --enable-avis-input      enables avisynth input (win32 only)"
>  echo "  --enable-mp4-output      enables mp4 output (using gpac)"
>  echo "  --enable-vfw             compiles the VfW frontend"
> @@ -45,43 +46,138 @@
>  
>  EXE=""
>  
> -UNAMES="`uname -s`"
> +AR="ar"
> +AROPTS="rc"
> +RANLIB="ranlib"
> +
> +UNAMES="`uname -s |tr A-Z a-z`"
> +UNAMEM="`uname -m |tr A-Z a-z`"
> +
> +# parse options
> +
> +for opt do
> +    optarg="${opt#*=}"
> +    case "$opt" in
> +	--crosscompile=*)
> +	    CROSS="$optarg"
> +	    CC="$CROSS-gcc"
> +	    AR="$CROSS-ar"
> +	    RANLIB="$CROSS-ranlib"
> +	    UNAMES="`echo $CROSS | cut -d- -f3`"
> +	    UNAMEM="`echo $CROSS | cut -d- -f1`"
> +	    ;;
> +	--prefix=*)
> +	    prefix="$optarg"
> +	    ;;
> +	--exec-prefix=*)
> +	    eprefix="$optarg"
> +	    ;;
> +	--bindir=*)
> +	    bindir="$optarg"
> +	    ;;
> +	--libdir=*)
> +	    libdir="$optarg"
> +	    ;;
> +	--includedir=*)
> +	    includedir="$optarg"
> +	    ;;
> +        --enable-avis-input)
> +            if [ $SYS = CYGWIN -o $SYS = MINGW ]; then
> +                CFLAGS="$CFLAGS -DAVIS_INPUT"
> +                LDFLAGS="$LDFLAGS -lvfw32"
> +                avis_input="yes"
> +            fi
> +            ;;
> +        --enable-mp4-output)
> +            CFLAGS="$CFLAGS -DMP4_OUTPUT"
> +            LDFLAGS="$LDFLAGS -lgpac_static"
> +            if [ $SYS = CYGWIN -o $SYS = MINGW ]; then
> +                LDFLAGS="$LDFLAGS -lwinmm"
> +            fi
> +            mp4_output="yes"
> +            ;;
> +        --extra-asflags=*)
> +            ASFLAGS="$ASFLAGS ${opt#--extra-asflags=}"
> +            ;;
> +        --extra-cflags=*)
> +            CFLAGS="$CFLAGS ${opt#--extra-cflags=}"
> +            VFW_CFLAGS="${opt#--extra-cflags=}"
> +            ;;
> +        --extra-ldflags=*)
> +            LDFLAGS="$LDFLAGS ${opt#--extra-ldflags=}"
> +            VFW_LDFLAGS="${opt#--extra-ldflags=}"
> +            ;;
> +        --enable-pthread)
> +            CFLAGS="$CFLAGS -DHAVE_PTHREAD=1"
> +            pthread="yes"
> +            case $SYS in
> +              MINGW|CYGWIN|BEOS)
> +                ;;
> +              *)
> +                LDFLAGS="$LDFLAGS -lpthread"
> +                ;;
> +            esac
> +            ;;
> +        --enable-debug)
> +            CFLAGS="$CFLAGS -g"
> +            debug="yes"
> +            ;;
> +        --enable-gprof)
> +            CFLAGS="$CFLAGS -pg"
> +            LDFLAGS="$LDFLAGS -pg"
> +            gprof="yes"
> +            ;;
> +        --enable-vfw)
> +            vfw="yes"
> +            ;;
> +        --enable-visualize)
> +            LDFLAGS="$LDFLAGS -L/usr/X11R6/lib -lX11"
> +            CFLAGS="$CFLAGS -DVISUALIZE=1"
> +            vis="yes"
> +            ;;
> +        *)
> +            echo "Unknown option $opt, ignored"
> +            ;;
> +    esac
> +done
> +
> +
>  case "$UNAMES" in
> -  BeOS)
> +  beos)
>      SYS="BEOS"
>      CFLAGS="$CFLAGS -DHAVE_MALLOC_H"
>      ;;
> -  Darwin)
> +  darwin)
>      SYS="MACOSX"
>      CFLAGS="$CFLAGS -falign-loops=16"
>      LDFLAGS="$LDFLAGS -lm -lmx"
>      ;;
> -  FreeBSD)
> +  freebsd)
>      SYS="FREEBSD"
>      LDFLAGS="$LDFLAGS -lm"
>      ;;
> -  NetBSD)
> +  netbsd)
>      SYS="NETBSD"
>      LDFLAGS="$LDFLAGS -lm"
>      ;;
> -  Linux)
> +  linux)
>      SYS="LINUX"
>      CFLAGS="$CFLAGS -DHAVE_MALLOC_H"
>      LDFLAGS="$LDFLAGS -lm"
>      ;;
> -  CYGWIN*)
> +  cygwin*)
>      SYS="CYGWIN"
>      CFLAGS="$CFLAGS -mno-cygwin"
>      LDFLAGS="$LDFLAGS -mno-cygwin"
>      ASFLAGS="-f win32 -DPREFIX"
>      EXE=".exe"
>      ;;
> -  MINGW*)
> +  mingw*)
>      SYS="MINGW"
>      ASFLAGS="-f win32 -DPREFIX"
>      EXE=".exe"
>      ;;
> -  SunOS)
> +  sunos)
>      SYS="SunOS"
>      CFLAGS="$CFLAGS -DHAVE_MALLOC_H"
>      LDFLAGS="$LDFLAGS -lm"
> @@ -93,9 +189,8 @@
>      ;;
>  esac
>  
> -UNAMEM="`uname -m`"
>  case "$UNAMEM" in
> -  i386|i486|i586|i686|BePC)
> +  i386|i486|i586|i686|bepc)
>      ARCH="X86"
>      CFLAGS="$CFLAGS -DHAVE_MMXEXT -DHAVE_SSE2"
>      ;;
> @@ -105,7 +200,7 @@
>      AS="yasm"
>      ASFLAGS="-f elf -m amd64"
>      ;;
> -  "Power Macintosh"|ppc)
> +  "power macintosh"|ppc)
>      ARCH="PPC"
>      if [ $SYS = MACOSX ]
>      then
> @@ -150,86 +245,6 @@
>  
>  CFLAGS="$CFLAGS -DARCH_$ARCH -DSYS_$SYS"
>  
> -# parse options
> -
> -for opt do
> -    optarg="${opt#*=}"
> -    case "$opt" in
> -        --prefix=*)
> -            prefix="$optarg"
> -            ;;
> -        --exec-prefix=*)
> -            eprefix="$optarg"
> -            ;;
> -        --bindir=*)
> -            bindir="$optarg"
> -            ;;
> -        --libdir=*)
> -            libdir="$optarg"
> -            ;;
> -        --includedir=*)
> -            includedir="$optarg"
> -            ;;
> -        --enable-avis-input)
> -            if [ $SYS = CYGWIN -o $SYS = MINGW ]; then
> -                CFLAGS="$CFLAGS -DAVIS_INPUT"
> -                LDFLAGS="$LDFLAGS -lvfw32"
> -                avis_input="yes"
> -            fi
> -            ;;
> -        --enable-mp4-output)
> -            CFLAGS="$CFLAGS -DMP4_OUTPUT"
> -            LDFLAGS="$LDFLAGS -lgpac_static"
> -            if [ $SYS = CYGWIN -o $SYS = MINGW ]; then
> -                LDFLAGS="$LDFLAGS -lwinmm"
> -            fi
> -            mp4_output="yes"
> -            ;;
> -        --extra-asflags=*)
> -            ASFLAGS="$ASFLAGS ${opt#--extra-asflags=}"
> -            ;;
> -        --extra-cflags=*)
> -            CFLAGS="$CFLAGS ${opt#--extra-cflags=}"
> -            VFW_CFLAGS="${opt#--extra-cflags=}"
> -            ;;
> -        --extra-ldflags=*)
> -            LDFLAGS="$LDFLAGS ${opt#--extra-ldflags=}"
> -            VFW_LDFLAGS="${opt#--extra-ldflags=}"
> -            ;;
> -        --enable-pthread)
> -            CFLAGS="$CFLAGS -DHAVE_PTHREAD=1"
> -            pthread="yes"
> -            case $SYS in
> -              MINGW|CYGWIN|BEOS)
> -                ;;
> -              *)
> -                LDFLAGS="$LDFLAGS -lpthread"
> -                ;;
> -            esac
> -            ;;
> -        --enable-debug)
> -            CFLAGS="$CFLAGS -g"
> -            debug="yes"
> -            ;;
> -        --enable-gprof)
> -            CFLAGS="$CFLAGS -pg"
> -            LDFLAGS="$LDFLAGS -pg"
> -            gprof="yes"
> -            ;;
> -        --enable-vfw)
> -            vfw="yes"
> -            ;;
> -        --enable-visualize)
> -            LDFLAGS="$LDFLAGS -L/usr/X11R6/lib -lX11"
> -            CFLAGS="$CFLAGS -DVISUALIZE=1"
> -            vis="yes"
> -            ;;
> -        *)
> -            echo "Unknown option $opt, ignored"
> -            ;;
> -    esac
> -done
> -
>  VFWFLAGS=
>  if [ "$debug" != "yes" -a "$gprof" != "yes" ]; then
>      CFLAGS="$CFLAGS -s -fomit-frame-pointer"
> @@ -253,6 +268,9 @@
>  ASFLAGS=$ASFLAGS
>  VFW=$vfw
>  EXE=$EXE
> +AR=$AR
> +AROPTS=$AROPTS
> +RANLIB=$RANLIB
>  VIS=$vis
>  HAVE_GETOPT_LONG=$HAVE_GETOPT_LONG
>  EOF
> --- x264/Makefile.crosscompile~	2005-10-27 17:01:35.000000000 +0200
> +++ x264/Makefile	2005-10-27 17:02:51.000000000 +0200
> @@ -62,8 +62,8 @@
>  default: $(DEP) x264$(EXE)
>  
>  libx264.a: .depend $(OBJS) $(OBJASM)
> -	ar rc libx264.a $(OBJS) $(OBJASM)
> -	ranlib libx264.a
> +	$(AR) $(AROPTS) libx264.a $(OBJS) $(OBJASM)
> +	$(RANLIB) libx264.a
>  
>  x264$(EXE): libx264.a x264.o matroska.o
>  	$(CC) -o $@ x264.o matroska.o libx264.a $(LDFLAGS)
> @@ -100,12 +100,12 @@
>  distclean: clean
>  	rm -f config.mak vfw/build/cygwin/config.mak
>  
> -install: x264
> +install: x264$(EXE)
>  	install -d $(DESTDIR)$(bindir) $(DESTDIR)$(libdir) $(DESTDIR)$(includedir)
>  	install -m 644 x264.h $(DESTDIR)$(includedir)
>  	install -m 644 libx264.a $(DESTDIR)$(libdir)
> -	install x264 $(DESTDIR)$(bindir)
> -	ranlib $(DESTDIR)$(libdir)/libx264.a
> +	install x264$(EXE) $(DESTDIR)$(bindir)
> +	$(RANLIB) $(DESTDIR)$(libdir)/libx264.a
>  
>  etags: TAGS
>  
>   
Question: Since you want to just add cross-compilation support to the 
main configure script, why do you have remove other switches such as 
--enable-pthread, --extra-cflags and others?

-- 
This is the x264-devel mailing-list
To unsubscribe, go to: http://developers.videolan.org/lists.html



More information about the x264-devel mailing list