Browse code

build: Prefer NASM assembler over YASM

NASM is more actively maintained and permits generating dependency information
as a sideeffect of assembling, thus cutting build times in half.

(Cherry-picked from libav commit 57b753b445e23363c997a8ec1c556e0b0f6e9da3)

Signed-off-by: James Almer <jamrial@gmail.com>

Diego Biurrun authored on 2016/10/14 03:33:15
Showing 5 changed files
... ...
@@ -6,7 +6,7 @@ os:
6 6
 addons:
7 7
   apt:
8 8
     packages:
9
-      - yasm
9
+      - nasm
10 10
       - diffutils
11 11
 compiler:
12 12
   - clang
... ...
@@ -17,7 +17,7 @@ cache:
17 17
 before_install:
18 18
   - if [ "$TRAVIS_OS_NAME" == "osx" ]; then brew update --all; fi
19 19
 install:
20
-  - if [ "$TRAVIS_OS_NAME" == "osx" ]; then brew install yasm; fi
20
+  - if [ "$TRAVIS_OS_NAME" == "osx" ]; then brew install nasm; fi
21 21
 script:
22 22
   - mkdir -p ffmpeg-samples
23 23
   - ./configure --samples=ffmpeg-samples --cc=$CC
... ...
@@ -22,6 +22,8 @@ version <next>:
22 22
 - headphone audio filter
23 23
 - superequalizer audio filter
24 24
 - roberts video filter
25
+- The x86 assembler default switched from yasm to nasm, pass
26
+  --x86asmexe=yasm to configure to restore the old behavior.
25 27
 
26 28
 version 3.3:
27 29
 - CrystalHD decoder moved to new decode API
... ...
@@ -3258,7 +3258,7 @@ pkg_config_default=pkg-config
3258 3258
 ranlib_default="ranlib"
3259 3259
 strip_default="strip"
3260 3260
 version_script='--version-script'
3261
-x86asmexe_default="yasm"
3261
+x86asmexe_default="nasm"
3262 3262
 windres_default="windres"
3263 3263
 nvcc_default="nvcc"
3264 3264
 nvccflags_default="-gencode arch=compute_30,code=sm_30 -O2"
... ...
@@ -5506,7 +5506,7 @@ EOF
5506 5506
     }
5507 5507
 
5508 5508
     if ! disabled_any asm mmx x86asm; then
5509
-        for program in $x86asmexe yasm nasm; do
5509
+        for program in $x86asmexe nasm yasm; do
5510 5510
             probe_x86asm $program
5511 5511
             test -n "$x86asm_type" && break
5512 5512
         done
... ...
@@ -5518,7 +5518,7 @@ EOF
5518 5518
         esac
5519 5519
 
5520 5520
         check_x86asm "movbe ecx, [5]" && enable x86asm ||
5521
-            die "yasm/nasm not found or too old. Use --disable-x86asm for a crippled build."
5521
+            die "nasm/yasm not found or too old. Use --disable-x86asm for a crippled build."
5522 5522
         check_x86asm "vextracti128 xmm0, ymm0, 0"      || disable avx2_external
5523 5523
         check_x86asm "vpmacsdd xmm0, xmm1, xmm2, xmm3" || disable xop_external
5524 5524
         check_x86asm "vfmaddps ymm0, ymm1, ymm2, ymm3" || disable fma4_external
... ...
@@ -161,8 +161,8 @@ do{
161 161
 For x86, mark registers that are clobbered in your asm. This means both
162 162
 general x86 registers (e.g. eax) as well as XMM registers. This last one is
163 163
 particularly important on Win64, where xmm6-15 are callee-save, and not
164
-restoring their contents leads to undefined results. In external asm (e.g.
165
-yasm), you do this by using:
164
+restoring their contents leads to undefined results. In external asm,
165
+you do this by using:
166 166
 cglobal function_name, num_args, num_regs, num_xmm_regs
167 167
 In inline asm, you specify clobbered registers at the end of your asm:
168 168
 __asm__(".." ::: "%eax").
... ...
@@ -199,12 +199,12 @@ actual lines causing issues.
199 199
 Inline asm vs. external asm
200 200
 ---------------------------
201 201
 Both inline asm (__asm__("..") in a .c file, handled by a compiler such as gcc)
202
-and external asm (.s or .asm files, handled by an assembler such as yasm/nasm)
202
+and external asm (.s or .asm files, handled by an assembler such as nasm/yasm)
203 203
 are accepted in FFmpeg. Which one to use differs per specific case.
204 204
 
205 205
 - if your code is intended to be inlined in a C function, inline asm is always
206 206
    better, because external asm cannot be inlined
207
-- if your code calls external functions, yasm is always better
207
+- if your code calls external functions, external asm is always better
208 208
 - if your code takes huge and complex structs as function arguments (e.g.
209 209
    MpegEncContext; note that this is not ideal and is discouraged if there
210 210
    are alternatives), then inline asm is always better, because predicting
... ...
@@ -71,9 +71,9 @@ Mac OS X on PowerPC or ARM (iPhone) requires a preprocessor from
71 71
 assembly functions. Put the Perl script somewhere
72 72
 in your PATH, FFmpeg's configure will pick it up automatically.
73 73
 
74
-Mac OS X on amd64 and x86 requires @command{yasm} to build most of the
74
+Mac OS X on amd64 and x86 requires @command{nasm} to build most of the
75 75
 optimized assembly functions. @uref{http://www.finkproject.org/, Fink},
76
-@uref{http://www.gentoo.org/proj/en/gentoo-alt/prefix/bootstrap-macos.xml, Gentoo Prefix},
76
+@uref{https://wiki.gentoo.org/wiki/Project:Prefix, Gentoo Prefix},
77 77
 @uref{https://mxcl.github.com/homebrew/, Homebrew}
78 78
 or @uref{http://www.macports.org, MacPorts} can easily provide it.
79 79
 
... ...
@@ -141,7 +141,7 @@ them under @command{MinGW-w64 Win64 Shell} and @command{MinGW-w64 Win32 Shell}.
141 141
 pacman -S make pkgconf diffutils
142 142
 
143 143
 # mingw-w64 packages and toolchains
144
-pacman -S mingw-w64-x86_64-yasm mingw-w64-x86_64-gcc mingw-w64-x86_64-SDL
144
+pacman -S mingw-w64-x86_64-nasm mingw-w64-x86_64-gcc mingw-w64-x86_64-SDL2
145 145
 @end example
146 146
 
147 147
 To target 32 bits replace @code{x86_64} with @code{i686} in the command above.
... ...
@@ -159,7 +159,7 @@ You will need the following prerequisites:
159 159
 @item @uref{http://code.google.com/p/msinttypes/, msinttypes}
160 160
 (if using MSVC 2012 or earlier)
161 161
 @item @uref{http://msys2.github.io/, MSYS2}
162
-@item @uref{http://yasm.tortall.net/, YASM}
162
+@item @uref{http://www.nasm.us/, NASM}
163 163
 (Also available via MSYS2's package manager.)
164 164
 @end itemize
165 165