]> git.armaanb.net Git - asd-repo.git/blob - extra/x264/patches/x264-no-bash.patch
gmake: new package at 4.3
[asd-repo.git] / extra / x264 / patches / x264-no-bash.patch
1 diff --git a/configure b/configure-posix
2 index 3cf63e0..1e1fce5 100755
3 --- a/configure-posix
4 +++ b/configure
5 @@ -1,4 +1,4 @@
6 -#!/bin/bash
7 +#!/bin/sh
8
9  if test x"$1" = x"-h" -o x"$1" = x"--help" ; then
10  cat <<EOF
11 @@ -59,7 +59,7 @@ exit 1
12  fi
13
14  log_check() {
15 -    echo -n "checking $1... " >> config.log
16 +    echo "checking $1... " >> config.log
17  }
18
19  log_ok() {
20 @@ -78,13 +78,12 @@ cc_cflags() {
21      # several non gcc compilers issue an incredibly large number of warnings on high warning levels,
22      # suppress them by reducing the warning level rather than having to use #pragmas
23      for arg in $*; do
24 -        [[ "$arg" = -falign-loops* ]] && arg=
25 +        case $arg in
26 +            -falign-loops*|-mpreferred-stack-boundary*|-l*|-L*) arg=
27 +        esac
28          [ "$arg" = -fno-tree-vectorize ] && arg=
29          [ "$arg" = -Wshadow ] && arg=
30          [ "$arg" = -Wno-maybe-uninitialized ] && arg=
31 -        [[ "$arg" = -mpreferred-stack-boundary* ]] && arg=
32 -        [[ "$arg" = -l* ]] && arg=
33 -        [[ "$arg" = -L* ]] && arg=
34          if [ $compiler_style = MS ]; then
35              [ "$arg" = -ffast-math ] && arg="-fp:fast"
36              [ "$arg" = -Wall ] && arg=
37 @@ -100,14 +99,14 @@ cc_cflags() {
38          fi
39          [ $compiler = CL -a "$arg" = -O3 ] && arg=-O2
40
41 -        [ -n "$arg" ] && echo -n "$arg "
42 +        [ -n "$arg" ] && printf %s "$arg "
43      done
44  }
45
46  cl_ldflags() {
47      for arg in $*; do
48 -        arg=${arg/LIBPATH/libpath}
49 -        [ "${arg#-libpath:}" == "$arg" -a "${arg#-l}" != "$arg" ] && arg=${arg#-l}.lib
50 +        arg=$(echo "$arg" | sed -e 's/LIBPATH/libpath/')
51 +        [ "${arg#-libpath:}" = "$arg" -a "${arg#-l}" != "$arg" ] && arg=${arg#-l}.lib
52          [ "${arg#-L}" != "$arg" ] && arg=-libpath:${arg#-L}
53          [ "$arg" = -Wl,--large-address-aware ] && arg=-largeaddressaware
54          [ "$arg" = -s ] && arg=
55 @@ -116,14 +115,17 @@ cl_ldflags() {
56          [ "$arg" = -Werror ] && arg=
57          [ "$arg" = -Wshadow ] && arg=
58          [ "$arg" = -Wmaybe-uninitialized ] && arg=
59 -        [[ "$arg" = -Qdiag-error* ]] && arg=
60
61 -        arg=${arg/pthreadGC/pthreadVC}
62 +        case $arg in
63 +            -Qdiag-error*) arg=
64 +        esac
65 +
66 +        arg=$(echo "$arg" | sed -e 's/pthreadGC/pthreadVC/')
67          [ "$arg" = avifil32.lib ] && arg=vfw32.lib
68          [ "$arg" = gpac_static.lib ] && arg=libgpac_static.lib
69          [ "$arg" = x264.lib ] && arg=libx264.lib
70
71 -        [ -n "$arg" ] && echo -n "$arg "
72 +        [ -n "$arg" ] && printf %s "$arg "
73      done
74  }
75
76 @@ -180,7 +182,7 @@ cpp_check() {
77      for arg in $1; do
78          echo "#include <$arg>" >> conftest.c
79      done
80 -    echo -e "#if !($3) \n#error $4 \n#endif " >> conftest.c
81 +    printf '%b\n' "#if !($3) \n#error $4 \n#endif " >> conftest.c
82      if [ $compiler_style = MS ]; then
83          cpp_cmd="$CC conftest.c $(cc_cflags $CFLAGS $2) -P"
84      else
85 @@ -329,11 +331,15 @@ rm -rf conftest*
86
87  # Construct a path to the specified directory relative to the working directory
88  relative_path() {
89 -    local base="${PWD%/}"
90 -    local path="$(cd "$1" >/dev/null; printf '%s/.' "${PWD%/}")"
91 -    local up=''
92 +    base="${PWD%/}"
93 +    path="$(cd "$1" >/dev/null; printf '%s/.' "${PWD%/}")"
94 +    up=''
95 +
96 +    while :; do
97 +        case $path in
98 +            "$base/"*) break ;;
99 +        esac
100
101 -    while [[ $path != "$base/"* ]]; do
102          base="${base%/*}"
103          up="../$up"
104      done
105 @@ -564,48 +570,6 @@ trap 'rm -rf conftest*' EXIT
106  # test for use of compilers that require specific handling
107  cc_base="$(basename "$CC")"
108  QPRE="-"
109 -if [[ $host_os = mingw* || $host_os = cygwin* ]]; then
110 -    if [[ "$cc_base" = icl || "$cc_base" = icl[\ .]* ]]; then
111 -        # Windows Intel Compiler creates dependency generation with absolute Windows paths, Cygwin's make does not support Windows paths.
112 -        [[ $host_os = cygwin* ]] && die "Windows Intel Compiler support requires MSYS"
113 -        compiler=ICL
114 -        compiler_style=MS
115 -        CFLAGS="$CFLAGS -Qstd=c99 -nologo -Qms0 -DHAVE_STRING_H -I\$(SRCPATH)/extras"
116 -        QPRE="-Q"
117 -        cpp_check '' '' '_MSC_VER >= 1400' || die "Windows Intel Compiler support requires Visual Studio 2005 or newer"
118 -        if cpp_check '' '' 'defined(_M_AMD64) || defined(_M_X64)' ; then
119 -            host_cpu=x86_64
120 -        elif cpp_check '' '' 'defined(_M_IX86)' ; then
121 -            host_cpu=i486
122 -        fi
123 -        if cc_check '' -Qdiag-error:10006,10157 ; then
124 -            CHECK_CFLAGS="$CHECK_CFLAGS -Qdiag-error:10006,10157"
125 -        fi
126 -    elif [[ "$cc_base" = cl || "$cc_base" = cl[\ .]* ]]; then
127 -        # Standard Microsoft Visual Studio
128 -        compiler=CL
129 -        compiler_style=MS
130 -        CFLAGS="$CFLAGS -nologo -GS- -DHAVE_STRING_H -I\$(SRCPATH)/extras"
131 -        cpp_check '' '' '_MSC_VER > 1800 || (_MSC_VER == 1800 && _MSC_FULL_VER >= 180030324)' || die "Microsoft Visual Studio support requires Visual Studio 2013 Update 2 or newer"
132 -        if cpp_check '' '' 'defined(_M_AMD64) || defined(_M_X64)' ; then
133 -            host_cpu=x86_64
134 -        elif cpp_check '' '' 'defined(_M_IX86)' ; then
135 -            host_cpu=i486
136 -        elif cpp_check '' '' 'defined(_M_ARM64)' ; then
137 -            host_cpu=aarch64
138 -        elif cpp_check '' '' 'defined(_M_ARM)' ; then
139 -            host_cpu=arm
140 -        fi
141 -    else
142 -        # MinGW uses broken pre-VS2015 Microsoft printf functions unless it's told to use the POSIX ones.
143 -        CFLAGS="$CFLAGS -D_POSIX_C_SOURCE=200112L"
144 -    fi
145 -else
146 -    if [[ "$cc_base" = icc || "$cc_base" = icc[\ .]* ]]; then
147 -        AR="xiar"
148 -        compiler=ICC
149 -    fi
150 -fi
151
152  if [ $compiler = GNU ]; then
153      if cc_check '' -Werror=unknown-warning-option ; then
154 @@ -653,18 +617,6 @@ case $host_os in
155          define HAVE_MALLOC_H
156          libm="-lm"
157          ;;
158 -    cygwin*|mingw*|msys*)
159 -        EXE=".exe"
160 -        if [[ $host_os = cygwin* ]] && cpp_check "" "" "defined(__CYGWIN__)" ; then
161 -            SYS="CYGWIN"
162 -            define HAVE_MALLOC_H
163 -        else
164 -            SYS="WINDOWS"
165 -            DEVNULL="NUL"
166 -            cc_check '' -lshell32 && LDFLAGSCLI="$LDFLAGSCLI -lshell32"
167 -            [ $compiler = GNU ] && RC="${RC-${cross_prefix}windres}" || RC="${RC-rc.exe}"
168 -        fi
169 -        ;;
170      sunos*|solaris*)
171          SYS="SunOS"
172          define HAVE_MALLOC_H
173 @@ -705,30 +657,6 @@ LDFLAGS="$LDFLAGS $libm"
174  stack_alignment=4
175  case $host_cpu in
176      i*86)
177 -        ARCH="X86"
178 -        AS="${AS-nasm}"
179 -        AS_EXT=".asm"
180 -        ASFLAGS="$ASFLAGS -DARCH_X86_64=0 -I\$(SRCPATH)/common/x86/"
181 -        if [ $compiler = GNU ]; then
182 -            if [[ "$asm" == auto && "$CFLAGS" != *-march* ]]; then
183 -                CFLAGS="$CFLAGS -march=i686"
184 -            fi
185 -            if [[ "$asm" == auto && "$CFLAGS" != *-mfpmath* ]]; then
186 -                CFLAGS="$CFLAGS -mfpmath=sse -msse -msse2"
187 -            fi
188 -            CFLAGS="-m32 $CFLAGS"
189 -            LDFLAGS="-m32 $LDFLAGS"
190 -        fi
191 -        if [ "$SYS" = MACOSX ]; then
192 -            ASFLAGS="$ASFLAGS -f macho32 -DPREFIX"
193 -        elif [ "$SYS" = WINDOWS -o "$SYS" = CYGWIN ]; then
194 -            ASFLAGS="$ASFLAGS -f win32 -DPREFIX"
195 -            LDFLAGS="$LDFLAGS -Wl,--large-address-aware"
196 -            [ $compiler = GNU ] && LDFLAGS="$LDFLAGS -Wl,--dynamicbase,--nxcompat,--tsaware"
197 -            [ $compiler = GNU ] && RCFLAGS="--target=pe-i386 $RCFLAGS"
198 -        else
199 -            ASFLAGS="$ASFLAGS -f elf32"
200 -        fi
201          ;;
202      x86_64)
203          ARCH="X86_64"
204 @@ -931,7 +859,7 @@ fi
205
206  if [ $asm = auto -a $ARCH = ARM ] ; then
207      # set flags so neon is built by default
208 -    [ $compiler == CL ] || echo $CFLAGS | grep -Eq '(-mcpu|-march|-mfpu)' || CFLAGS="$CFLAGS -mcpu=cortex-a8 -mfpu=neon"
209 +    [ $compiler = CL ] || echo $CFLAGS | grep -Eq '(-mcpu|-march|-mfpu)' || CFLAGS="$CFLAGS -mcpu=cortex-a8 -mfpu=neon"
210
211      cc_check '' '' '__asm__("add r0, r1, r2");' && define HAVE_ARM_INLINE_ASM
212      if [ $compiler = CL ] && cpp_check '' '' 'defined(_M_ARM) && _M_ARM >= 7' ; then
213 @@ -1576,7 +1504,8 @@ cat conftest.log >> config.log
214  cat conftest.log
215
216  [ "$SRCPATH" != "." ] && ln -sf ${SRCPATH}/Makefile ./Makefile
217 -mkdir -p common/{aarch64,arm,mips,ppc,x86} encoder extras filters/video input output tools
218 +mkdir -p common/aarch64 common/arm common/mips common/ppc common/x86
219 +mkdir -p encoder extras filters/video input output tools
220
221  echo
222  echo "You can run 'make' or 'make fprofiled' now."