ffmpeg.mk 15 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628
  1. ################################################################################
  2. #
  3. # ffmpeg
  4. #
  5. ################################################################################
  6. # Update FFMPEG_CPE_ID_VERSION if needed
  7. FFMPEG_VERSION = n6.1.2-27-ge16ff06adb
  8. FFMPEG_SITE = https://git.ffmpeg.org/ffmpeg.git
  9. FFMPEG_SITE_METHOD = git
  10. FFMPEG_INSTALL_STAGING = YES
  11. FFMPEG_CPE_ID_VERSION = 6.1.2
  12. FFMPEG_LICENSE = LGPL-2.1+, libjpeg license
  13. FFMPEG_LICENSE_FILES = LICENSE.md COPYING.LGPLv2.1
  14. ifeq ($(BR2_PACKAGE_FFMPEG_GPL),y)
  15. FFMPEG_LICENSE += and GPL-2.0+
  16. FFMPEG_LICENSE_FILES += COPYING.GPLv2
  17. endif
  18. FFMPEG_CPE_ID_VENDOR = ffmpeg
  19. FFMPEG_CONF_OPTS = \
  20. --prefix=/usr \
  21. --enable-avfilter \
  22. --disable-version3 \
  23. --enable-logging \
  24. --enable-optimizations \
  25. --disable-extra-warnings \
  26. --enable-avdevice \
  27. --enable-avcodec \
  28. --enable-avformat \
  29. --enable-network \
  30. --disable-gray \
  31. --enable-swscale-alpha \
  32. --disable-small \
  33. --disable-crystalhd \
  34. --disable-dxva2 \
  35. --enable-runtime-cpudetect \
  36. --disable-hardcoded-tables \
  37. --disable-mipsdsp \
  38. --disable-mipsdspr2 \
  39. --disable-msa \
  40. --enable-hwaccels \
  41. --disable-cuda \
  42. --disable-cuvid \
  43. --disable-nvenc \
  44. --disable-avisynth \
  45. --disable-frei0r \
  46. --disable-libopencore-amrnb \
  47. --disable-libopencore-amrwb \
  48. --disable-libdc1394 \
  49. --disable-libgsm \
  50. --disable-libilbc \
  51. --disable-libvo-amrwbenc \
  52. --disable-symver \
  53. --disable-doc
  54. FFMPEG_DEPENDENCIES += host-pkgconf
  55. ifeq ($(BR2_PACKAGE_FFMPEG_GPL),y)
  56. FFMPEG_CONF_OPTS += --enable-gpl
  57. else
  58. FFMPEG_CONF_OPTS += --disable-gpl
  59. endif
  60. ifeq ($(BR2_PACKAGE_FFMPEG_NONFREE),y)
  61. FFMPEG_CONF_OPTS += --enable-nonfree
  62. else
  63. FFMPEG_CONF_OPTS += --disable-nonfree
  64. endif
  65. ifeq ($(BR2_PACKAGE_FFMPEG_FFMPEG),y)
  66. FFMPEG_CONF_OPTS += --enable-ffmpeg
  67. else
  68. FFMPEG_CONF_OPTS += --disable-ffmpeg
  69. endif
  70. ifeq ($(BR2_PACKAGE_FFMPEG_FFPLAY),y)
  71. FFMPEG_DEPENDENCIES += sdl2
  72. FFMPEG_CONF_OPTS += --enable-ffplay
  73. FFMPEG_CONF_ENV += SDL_CONFIG=$(STAGING_DIR)/usr/bin/sdl2-config
  74. else
  75. FFMPEG_CONF_OPTS += --disable-ffplay
  76. endif
  77. ifeq ($(BR2_PACKAGE_JACK1),y)
  78. FFMPEG_CONF_OPTS += --enable-libjack
  79. FFMPEG_DEPENDENCIES += jack1
  80. else ifeq ($(BR2_PACKAGE_JACK2),y)
  81. FFMPEG_CONF_OPTS += --enable-libjack
  82. FFMPEG_DEPENDENCIES += jack2
  83. else
  84. FFMPEG_CONF_OPTS += --disable-libjack
  85. endif
  86. ifeq ($(BR2_PACKAGE_LIBV4L),y)
  87. FFMPEG_DEPENDENCIES += libv4l
  88. FFMPEG_CONF_OPTS += --enable-libv4l2
  89. else
  90. FFMPEG_CONF_OPTS += --disable-libv4l2
  91. endif
  92. ifeq ($(BR2_PACKAGE_FFMPEG_FFPROBE),y)
  93. FFMPEG_CONF_OPTS += --enable-ffprobe
  94. else
  95. FFMPEG_CONF_OPTS += --disable-ffprobe
  96. endif
  97. ifeq ($(BR2_PACKAGE_FFMPEG_XCBGRAB),y)
  98. FFMPEG_CONF_OPTS += \
  99. --enable-libxcb \
  100. --enable-libxcb-shape \
  101. --enable-libxcb-shm \
  102. --enable-libxcb-xfixes
  103. FFMPEG_DEPENDENCIES += libxcb
  104. else
  105. FFMPEG_CONF_OPTS += --disable-libxcb
  106. endif
  107. ifeq ($(BR2_PACKAGE_FFMPEG_POSTPROC),y)
  108. FFMPEG_CONF_OPTS += --enable-postproc
  109. else
  110. FFMPEG_CONF_OPTS += --disable-postproc
  111. endif
  112. ifeq ($(BR2_PACKAGE_FFMPEG_SWSCALE),y)
  113. FFMPEG_CONF_OPTS += --enable-swscale
  114. else
  115. FFMPEG_CONF_OPTS += --disable-swscale
  116. endif
  117. ifneq ($(call qstrip,$(BR2_PACKAGE_FFMPEG_ENCODERS)),all)
  118. FFMPEG_CONF_OPTS += --disable-encoders \
  119. $(foreach x,$(call qstrip,$(BR2_PACKAGE_FFMPEG_ENCODERS)),--enable-encoder=$(x))
  120. endif
  121. ifneq ($(call qstrip,$(BR2_PACKAGE_FFMPEG_DECODERS)),all)
  122. FFMPEG_CONF_OPTS += --disable-decoders \
  123. $(foreach x,$(call qstrip,$(BR2_PACKAGE_FFMPEG_DECODERS)),--enable-decoder=$(x))
  124. endif
  125. ifneq ($(call qstrip,$(BR2_PACKAGE_FFMPEG_MUXERS)),all)
  126. FFMPEG_CONF_OPTS += --disable-muxers \
  127. $(foreach x,$(call qstrip,$(BR2_PACKAGE_FFMPEG_MUXERS)),--enable-muxer=$(x))
  128. endif
  129. ifneq ($(call qstrip,$(BR2_PACKAGE_FFMPEG_DEMUXERS)),all)
  130. FFMPEG_CONF_OPTS += --disable-demuxers \
  131. $(foreach x,$(call qstrip,$(BR2_PACKAGE_FFMPEG_DEMUXERS)),--enable-demuxer=$(x))
  132. endif
  133. ifneq ($(call qstrip,$(BR2_PACKAGE_FFMPEG_PARSERS)),all)
  134. FFMPEG_CONF_OPTS += --disable-parsers \
  135. $(foreach x,$(call qstrip,$(BR2_PACKAGE_FFMPEG_PARSERS)),--enable-parser=$(x))
  136. endif
  137. ifneq ($(call qstrip,$(BR2_PACKAGE_FFMPEG_BSFS)),all)
  138. FFMPEG_CONF_OPTS += --disable-bsfs \
  139. $(foreach x,$(call qstrip,$(BR2_PACKAGE_FFMPEG_BSFS)),--enable-bsf=$(x))
  140. endif
  141. ifneq ($(call qstrip,$(BR2_PACKAGE_FFMPEG_PROTOCOLS)),all)
  142. FFMPEG_CONF_OPTS += --disable-protocols \
  143. $(foreach x,$(call qstrip,$(BR2_PACKAGE_FFMPEG_PROTOCOLS)),--enable-protocol=$(x))
  144. endif
  145. ifneq ($(call qstrip,$(BR2_PACKAGE_FFMPEG_FILTERS)),all)
  146. FFMPEG_CONF_OPTS += --disable-filters \
  147. $(foreach x,$(call qstrip,$(BR2_PACKAGE_FFMPEG_FILTERS)),--enable-filter=$(x))
  148. endif
  149. ifeq ($(BR2_PACKAGE_FFMPEG_INDEVS),y)
  150. FFMPEG_CONF_OPTS += --enable-indevs
  151. ifeq ($(BR2_PACKAGE_ALSA_LIB),y)
  152. FFMPEG_CONF_OPTS += --enable-alsa
  153. FFMPEG_DEPENDENCIES += alsa-lib
  154. else
  155. FFMPEG_CONF_OPTS += --disable-alsa
  156. endif
  157. else
  158. FFMPEG_CONF_OPTS += --disable-indevs
  159. endif
  160. ifeq ($(BR2_PACKAGE_FFMPEG_OUTDEVS),y)
  161. FFMPEG_CONF_OPTS += --enable-outdevs
  162. ifeq ($(BR2_PACKAGE_ALSA_LIB),y)
  163. FFMPEG_DEPENDENCIES += alsa-lib
  164. endif
  165. else
  166. FFMPEG_CONF_OPTS += --disable-outdevs
  167. endif
  168. ifeq ($(BR2_TOOLCHAIN_HAS_THREADS),y)
  169. FFMPEG_CONF_OPTS += --enable-pthreads
  170. else
  171. FFMPEG_CONF_OPTS += --disable-pthreads
  172. endif
  173. ifeq ($(BR2_PACKAGE_ZLIB),y)
  174. FFMPEG_CONF_OPTS += --enable-zlib
  175. FFMPEG_DEPENDENCIES += zlib
  176. else
  177. FFMPEG_CONF_OPTS += --disable-zlib
  178. endif
  179. ifeq ($(BR2_PACKAGE_BZIP2),y)
  180. FFMPEG_CONF_OPTS += --enable-bzlib
  181. FFMPEG_DEPENDENCIES += bzip2
  182. else
  183. FFMPEG_CONF_OPTS += --disable-bzlib
  184. endif
  185. ifeq ($(BR2_PACKAGE_FDK_AAC)$(BR2_PACKAGE_FFMPEG_NONFREE),yy)
  186. FFMPEG_CONF_OPTS += --enable-libfdk-aac
  187. FFMPEG_DEPENDENCIES += fdk-aac
  188. else
  189. FFMPEG_CONF_OPTS += --disable-libfdk-aac
  190. endif
  191. ifeq ($(BR2_PACKAGE_FFMPEG_GPL)$(BR2_PACKAGE_LIBCDIO_PARANOIA),yy)
  192. FFMPEG_CONF_OPTS += --enable-libcdio
  193. FFMPEG_DEPENDENCIES += libcdio-paranoia
  194. else
  195. FFMPEG_CONF_OPTS += --disable-libcdio
  196. endif
  197. ifeq ($(BR2_PACKAGE_GNUTLS),y)
  198. FFMPEG_CONF_OPTS += --enable-gnutls --disable-openssl
  199. FFMPEG_DEPENDENCIES += gnutls
  200. else
  201. FFMPEG_CONF_OPTS += --disable-gnutls
  202. ifeq ($(BR2_PACKAGE_OPENSSL),y)
  203. # openssl isn't license compatible with GPL
  204. ifeq ($(BR2_PACKAGE_FFMPEG_GPL)x$(BR2_PACKAGE_FFMPEG_NONFREE),yx)
  205. FFMPEG_CONF_OPTS += --disable-openssl
  206. else
  207. FFMPEG_CONF_OPTS += --enable-openssl
  208. FFMPEG_DEPENDENCIES += openssl
  209. endif
  210. else
  211. FFMPEG_CONF_OPTS += --disable-openssl
  212. endif
  213. endif
  214. ifeq ($(BR2_PACKAGE_LIBDRM),y)
  215. FFMPEG_CONF_OPTS += --enable-libdrm
  216. FFMPEG_DEPENDENCIES += libdrm
  217. else
  218. FFMPEG_CONF_OPTS += --disable-libdrm
  219. endif
  220. ifeq ($(BR2_PACKAGE_LIBOPENH264),y)
  221. FFMPEG_CONF_OPTS += --enable-libopenh264
  222. FFMPEG_DEPENDENCIES += libopenh264
  223. else
  224. FFMPEG_CONF_OPTS += --disable-libopenh264
  225. endif
  226. ifeq ($(BR2_PACKAGE_LIBVORBIS),y)
  227. FFMPEG_DEPENDENCIES += libvorbis
  228. FFMPEG_CONF_OPTS += \
  229. --enable-libvorbis \
  230. --enable-muxer=ogg \
  231. --enable-encoder=libvorbis
  232. endif
  233. ifeq ($(BR2_PACKAGE_LIBVA),y)
  234. FFMPEG_CONF_OPTS += --enable-vaapi
  235. FFMPEG_DEPENDENCIES += libva
  236. else
  237. FFMPEG_CONF_OPTS += --disable-vaapi
  238. endif
  239. ifeq ($(BR2_PACKAGE_LIBVDPAU),y)
  240. FFMPEG_CONF_OPTS += --enable-vdpau
  241. FFMPEG_DEPENDENCIES += libvdpau
  242. else
  243. FFMPEG_CONF_OPTS += --disable-vdpau
  244. endif
  245. ifeq ($(BR2_PACKAGE_RPI_USERLAND),y)
  246. FFMPEG_CONF_OPTS += --enable-omx --enable-omx-rpi \
  247. --extra-cflags=-I$(STAGING_DIR)/usr/include/IL
  248. FFMPEG_DEPENDENCIES += rpi-userland
  249. ifeq ($(BR2_arm),y)
  250. FFMPEG_CONF_OPTS += --enable-mmal
  251. else
  252. FFMPEG_CONF_OPTS += --disable-mmal
  253. endif
  254. else
  255. FFMPEG_CONF_OPTS += --disable-mmal --disable-omx --disable-omx-rpi
  256. endif
  257. # To avoid a circular dependency only use opencv if opencv itself does
  258. # not depend on ffmpeg.
  259. ifeq ($(BR2_PACKAGE_OPENCV3_LIB_IMGPROC)x$(BR2_PACKAGE_OPENCV3_WITH_FFMPEG),yx)
  260. FFMPEG_CONF_OPTS += --enable-libopencv
  261. FFMPEG_DEPENDENCIES += opencv3
  262. else
  263. FFMPEG_CONF_OPTS += --disable-libopencv
  264. endif
  265. ifeq ($(BR2_PACKAGE_OPUS),y)
  266. FFMPEG_CONF_OPTS += --enable-libopus
  267. FFMPEG_DEPENDENCIES += opus
  268. else
  269. FFMPEG_CONF_OPTS += --disable-libopus
  270. endif
  271. ifeq ($(BR2_PACKAGE_LIBVPX),y)
  272. FFMPEG_CONF_OPTS += --enable-libvpx
  273. FFMPEG_DEPENDENCIES += libvpx
  274. else
  275. FFMPEG_CONF_OPTS += --disable-libvpx
  276. endif
  277. ifeq ($(BR2_PACKAGE_LIBASS),y)
  278. FFMPEG_CONF_OPTS += --enable-libass
  279. FFMPEG_DEPENDENCIES += libass
  280. else
  281. FFMPEG_CONF_OPTS += --disable-libass
  282. endif
  283. ifeq ($(BR2_PACKAGE_LIBBLURAY),y)
  284. FFMPEG_CONF_OPTS += --enable-libbluray
  285. FFMPEG_DEPENDENCIES += libbluray
  286. else
  287. FFMPEG_CONF_OPTS += --disable-libbluray
  288. endif
  289. ifeq ($(BR2_PACKAGE_LIBVPL),y)
  290. FFMPEG_CONF_OPTS += --enable-libvpl --disable-libmfx
  291. FFMPEG_DEPENDENCIES += libvpl
  292. else ifeq ($(BR2_PACKAGE_INTEL_MEDIASDK),y)
  293. FFMPEG_CONF_OPTS += --disable-libvpl --enable-libmfx
  294. FFMPEG_DEPENDENCIES += intel-mediasdk
  295. else
  296. FFMPEG_CONF_OPTS += --disable-libvpl --disable-libmfx
  297. endif
  298. ifeq ($(BR2_PACKAGE_RTMPDUMP),y)
  299. FFMPEG_CONF_OPTS += --enable-librtmp
  300. FFMPEG_DEPENDENCIES += rtmpdump
  301. else
  302. FFMPEG_CONF_OPTS += --disable-librtmp
  303. endif
  304. ifeq ($(BR2_PACKAGE_LAME),y)
  305. FFMPEG_CONF_OPTS += --enable-libmp3lame
  306. FFMPEG_DEPENDENCIES += lame
  307. else
  308. FFMPEG_CONF_OPTS += --disable-libmp3lame
  309. endif
  310. ifeq ($(BR2_PACKAGE_LIBMODPLUG),y)
  311. FFMPEG_CONF_OPTS += --enable-libmodplug
  312. FFMPEG_DEPENDENCIES += libmodplug
  313. else
  314. FFMPEG_CONF_OPTS += --disable-libmodplug
  315. endif
  316. ifeq ($(BR2_PACKAGE_LIBOPENMPT),y)
  317. FFMPEG_CONF_OPTS += --enable-libopenmpt
  318. FFMPEG_DEPENDENCIES += libopenmpt
  319. else
  320. FFMPEG_CONF_OPTS += --disable-libopenmpt
  321. endif
  322. ifeq ($(BR2_PACKAGE_SPEEX),y)
  323. FFMPEG_CONF_OPTS += --enable-libspeex
  324. FFMPEG_DEPENDENCIES += speex
  325. else
  326. FFMPEG_CONF_OPTS += --disable-libspeex
  327. endif
  328. ifeq ($(BR2_PACKAGE_LIBTHEORA),y)
  329. FFMPEG_CONF_OPTS += --enable-libtheora
  330. FFMPEG_DEPENDENCIES += libtheora
  331. else
  332. FFMPEG_CONF_OPTS += --disable-libtheora
  333. endif
  334. ifeq ($(BR2_PACKAGE_LIBICONV),y)
  335. FFMPEG_CONF_OPTS += --enable-iconv
  336. FFMPEG_DEPENDENCIES += libiconv
  337. else
  338. FFMPEG_CONF_OPTS += --disable-iconv
  339. endif
  340. ifeq ($(BR2_PACKAGE_LIBXML2),y)
  341. FFMPEG_CONF_OPTS += --enable-libxml2
  342. FFMPEG_DEPENDENCIES += libxml2
  343. else
  344. FFMPEG_CONF_OPTS += --disable-libxml2
  345. endif
  346. # ffmpeg freetype support require fenv.h which is only
  347. # available/working on glibc.
  348. # The microblaze variant doesn't provide the needed exceptions
  349. ifeq ($(BR2_PACKAGE_FREETYPE)$(BR2_TOOLCHAIN_USES_GLIBC)x$(BR2_microblaze),yyx)
  350. FFMPEG_CONF_OPTS += --enable-libfreetype
  351. FFMPEG_DEPENDENCIES += freetype
  352. else
  353. FFMPEG_CONF_OPTS += --disable-libfreetype
  354. endif
  355. ifeq ($(BR2_PACKAGE_FONTCONFIG),y)
  356. FFMPEG_CONF_OPTS += --enable-fontconfig
  357. FFMPEG_DEPENDENCIES += fontconfig
  358. else
  359. FFMPEG_CONF_OPTS += --disable-fontconfig
  360. endif
  361. ifeq ($(BR2_PACKAGE_HARFBUZZ),y)
  362. FFMPEG_CONF_OPTS += --enable-libharfbuzz
  363. FFMPEG_DEPENDENCIES += harfbuzz
  364. else
  365. FFMPEG_CONF_OPTS += --disable-libharfbuzz
  366. endif
  367. ifeq ($(BR2_PACKAGE_LIBFRIBIDI),y)
  368. FFMPEG_CONF_OPTS += --enable-libfribidi
  369. FFMPEG_DEPENDENCIES += libfribidi
  370. else
  371. FFMPEG_CONF_OPTS += --disable-libfribidi
  372. endif
  373. ifeq ($(BR2_PACKAGE_OPENJPEG),y)
  374. FFMPEG_CONF_OPTS += --enable-libopenjpeg
  375. FFMPEG_DEPENDENCIES += openjpeg
  376. else
  377. FFMPEG_CONF_OPTS += --disable-libopenjpeg
  378. endif
  379. ifeq ($(BR2_PACKAGE_X264)$(BR2_PACKAGE_FFMPEG_GPL),yy)
  380. FFMPEG_CONF_OPTS += --enable-libx264
  381. FFMPEG_DEPENDENCIES += x264
  382. else
  383. FFMPEG_CONF_OPTS += --disable-libx264
  384. endif
  385. ifeq ($(BR2_PACKAGE_X265)$(BR2_PACKAGE_FFMPEG_GPL),yy)
  386. FFMPEG_CONF_OPTS += --enable-libx265
  387. FFMPEG_DEPENDENCIES += x265
  388. else
  389. FFMPEG_CONF_OPTS += --disable-libx265
  390. endif
  391. ifeq ($(BR2_PACKAGE_DAV1D),y)
  392. FFMPEG_CONF_OPTS += --enable-libdav1d
  393. FFMPEG_DEPENDENCIES += dav1d
  394. else
  395. FFMPEG_CONF_OPTS += --disable-libdav1d
  396. endif
  397. ifeq ($(BR2_X86_CPU_HAS_MMX),y)
  398. FFMPEG_CONF_OPTS += --enable-x86asm
  399. FFMPEG_DEPENDENCIES += host-nasm
  400. else
  401. FFMPEG_CONF_OPTS += --disable-x86asm
  402. FFMPEG_CONF_OPTS += --disable-mmx
  403. endif
  404. ifeq ($(BR2_X86_CPU_HAS_SSE),y)
  405. FFMPEG_CONF_OPTS += --enable-sse
  406. else
  407. FFMPEG_CONF_OPTS += --disable-sse
  408. endif
  409. ifeq ($(BR2_X86_CPU_HAS_SSE2),y)
  410. FFMPEG_CONF_OPTS += --enable-sse2
  411. else
  412. FFMPEG_CONF_OPTS += --disable-sse2
  413. endif
  414. ifeq ($(BR2_X86_CPU_HAS_SSE3),y)
  415. FFMPEG_CONF_OPTS += --enable-sse3
  416. else
  417. FFMPEG_CONF_OPTS += --disable-sse3
  418. endif
  419. ifeq ($(BR2_X86_CPU_HAS_SSSE3),y)
  420. FFMPEG_CONF_OPTS += --enable-ssse3
  421. else
  422. FFMPEG_CONF_OPTS += --disable-ssse3
  423. endif
  424. ifeq ($(BR2_X86_CPU_HAS_SSE4),y)
  425. FFMPEG_CONF_OPTS += --enable-sse4
  426. else
  427. FFMPEG_CONF_OPTS += --disable-sse4
  428. endif
  429. ifeq ($(BR2_X86_CPU_HAS_SSE42),y)
  430. FFMPEG_CONF_OPTS += --enable-sse42
  431. else
  432. FFMPEG_CONF_OPTS += --disable-sse42
  433. endif
  434. ifeq ($(BR2_X86_CPU_HAS_AVX),y)
  435. FFMPEG_CONF_OPTS += --enable-avx
  436. else
  437. FFMPEG_CONF_OPTS += --disable-avx
  438. endif
  439. ifeq ($(BR2_X86_CPU_HAS_AVX2),y)
  440. FFMPEG_CONF_OPTS += --enable-avx2
  441. else
  442. FFMPEG_CONF_OPTS += --disable-avx2
  443. endif
  444. # Explicitly disable everything that doesn't match for ARM
  445. # FFMPEG "autodetects" by compiling an extended instruction via AS
  446. # This works on compilers that aren't built for generic by default
  447. ifeq ($(BR2_ARM_CPU_ARMV4),y)
  448. FFMPEG_CONF_OPTS += --disable-armv5te
  449. endif
  450. ifeq ($(BR2_ARM_CPU_ARMV6)$(BR2_ARM_CPU_ARMV7A),y)
  451. FFMPEG_CONF_OPTS += --enable-armv6
  452. else
  453. FFMPEG_CONF_OPTS += --disable-armv6 --disable-armv6t2
  454. endif
  455. ifeq ($(BR2_ARM_CPU_HAS_VFPV2),y)
  456. FFMPEG_CONF_OPTS += --enable-vfp
  457. else
  458. FFMPEG_CONF_OPTS += --disable-vfp
  459. endif
  460. ifeq ($(BR2_ARM_CPU_HAS_NEON),y)
  461. FFMPEG_CONF_OPTS += --enable-neon
  462. else ifeq ($(BR2_aarch64),y)
  463. FFMPEG_CONF_OPTS += --enable-neon
  464. else
  465. FFMPEG_CONF_OPTS += --disable-neon
  466. endif
  467. ifeq ($(BR2_mips)$(BR2_mipsel)$(BR2_mips64)$(BR2_mips64el),y)
  468. ifeq ($(BR2_MIPS_SOFT_FLOAT),y)
  469. FFMPEG_CONF_OPTS += --disable-mipsfpu
  470. else
  471. FFMPEG_CONF_OPTS += --enable-mipsfpu
  472. endif
  473. # Fix build failure on several missing assembly instructions
  474. FFMPEG_CONF_OPTS += --disable-asm
  475. endif # MIPS
  476. ifeq ($(BR2_POWERPC_CPU_HAS_ALTIVEC):$(BR2_powerpc64le),y:)
  477. FFMPEG_CONF_OPTS += --enable-altivec
  478. else ifeq ($(BR2_POWERPC_CPU_HAS_VSX):$(BR2_powerpc64le),y:y)
  479. # On LE, ffmpeg AltiVec support needs VSX intrinsics, and VSX
  480. # is an extension to AltiVec.
  481. FFMPEG_CONF_OPTS += --enable-altivec
  482. else
  483. FFMPEG_CONF_OPTS += --disable-altivec
  484. endif
  485. # Fix build failure on several missing assembly instructions
  486. ifeq ($(BR2_RISCV_32),y)
  487. FFMPEG_CONF_OPTS += --disable-rvv --disable-asm
  488. endif
  489. # Uses __atomic_fetch_add_4
  490. ifeq ($(BR2_TOOLCHAIN_HAS_LIBATOMIC),y)
  491. FFMPEG_CONF_OPTS += --extra-libs=-latomic
  492. endif
  493. ifeq ($(BR2_STATIC_LIBS),)
  494. FFMPEG_CONF_OPTS += --enable-pic
  495. else
  496. FFMPEG_CONF_OPTS += --disable-pic
  497. endif
  498. # Default to --cpu=generic for MIPS architecture, in order to avoid a
  499. # warning from ffmpeg's configure script.
  500. ifeq ($(BR2_mips)$(BR2_mipsel)$(BR2_mips64)$(BR2_mips64el),y)
  501. FFMPEG_CONF_OPTS += --cpu=generic
  502. else ifneq ($(GCC_TARGET_CPU),)
  503. FFMPEG_CONF_OPTS += --cpu="$(GCC_TARGET_CPU)"
  504. else ifneq ($(GCC_TARGET_ARCH),)
  505. FFMPEG_CONF_OPTS += --cpu="$(GCC_TARGET_ARCH)"
  506. endif
  507. FFMPEG_CFLAGS = $(TARGET_CFLAGS)
  508. ifeq ($(BR2_TOOLCHAIN_HAS_GCC_BUG_85180),y)
  509. FFMPEG_CONF_OPTS += --disable-optimizations
  510. FFMPEG_CFLAGS += -O0
  511. endif
  512. ifeq ($(BR2_TOOLCHAIN_HAS_GCC_BUG_68485),y)
  513. FFMPEG_CONF_OPTS += --disable-optimizations
  514. FFMPEG_CFLAGS += -O0
  515. endif
  516. ifeq ($(BR2_ARM_INSTRUCTIONS_THUMB),y)
  517. FFMPEG_CFLAGS += -marm
  518. endif
  519. FFMPEG_CONF_ENV += CFLAGS="$(FFMPEG_CFLAGS)"
  520. FFMPEG_CONF_OPTS += $(call qstrip,$(BR2_PACKAGE_FFMPEG_EXTRACONF))
  521. # Override FFMPEG_CONFIGURE_CMDS: FFmpeg does not support --target and others
  522. define FFMPEG_CONFIGURE_CMDS
  523. (cd $(FFMPEG_SRCDIR) && rm -rf config.cache && \
  524. $(TARGET_CONFIGURE_OPTS) \
  525. $(TARGET_CONFIGURE_ARGS) \
  526. $(FFMPEG_CONF_ENV) \
  527. ./configure \
  528. --enable-cross-compile \
  529. --cross-prefix=$(TARGET_CROSS) \
  530. --sysroot=$(STAGING_DIR) \
  531. --host-cc="$(HOSTCC)" \
  532. --arch=$(BR2_ARCH) \
  533. --target-os="linux" \
  534. --disable-stripping \
  535. --pkg-config="$(PKG_CONFIG_HOST_BINARY)" \
  536. $(SHARED_STATIC_LIBS_OPTS) \
  537. $(FFMPEG_CONF_OPTS) \
  538. )
  539. endef
  540. define FFMPEG_REMOVE_EXAMPLE_SRC_FILES
  541. rm -rf $(TARGET_DIR)/usr/share/ffmpeg/examples
  542. endef
  543. FFMPEG_POST_INSTALL_TARGET_HOOKS += FFMPEG_REMOVE_EXAMPLE_SRC_FILES
  544. $(eval $(autotools-package))