ffmpeg.mk 15 KB

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