You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

744 lines
17 KiB

  1. #
  2. # Copyright (C) 2017-2018 Ian Leonard <antonlacon@gmail.com>
  3. # Copyright (C) 2018 Ted Hess <thess@kitschensync.net>
  4. #
  5. # This is free software, licensed under the GNU General Public License v2.
  6. # See /LICENSE for more information.
  7. #
  8. include $(TOPDIR)/rules.mk
  9. PKG_NAME:=ffmpeg
  10. PKG_VERSION:=3.2.12
  11. PKG_RELEASE:=3
  12. PKG_SOURCE:=$(PKG_NAME)-$(PKG_VERSION).tar.xz
  13. PKG_SOURCE_URL:=https://ffmpeg.org/releases/
  14. PKG_HASH:=8985cea7b1b3b2e0e2b2a8ac6187a7fb022fe8aa9d35101760a000205c59c412
  15. PKG_MAINTAINER:=Ted Hess <thess@kitschensync.net>, \
  16. Ian Leonard <antonlacon@gmail.com>
  17. PKG_LICENSE:=LGPL-2.1+ GPL-2+ LGPL-3
  18. PKG_LICENSE_FILES:=COPYING.GPLv2 COPYING.GPLv3 COPYING.LGPLv2.1 COPYING.LGPLv3
  19. PKG_CPE_ID:=cpe:/a:ffmpeg:ffmpeg
  20. FFMPEG_CUSTOM_ENCODERS:= \
  21. ac3 \
  22. jpegls \
  23. mpeg1video \
  24. mpeg2video \
  25. mpeg4 \
  26. pcm_s16be \
  27. pcm_s16le \
  28. png \
  29. vorbis \
  30. zlib \
  31. FFMPEG_CUSTOM_DECODERS:= \
  32. aac \
  33. ac3 \
  34. alac \
  35. amrnb \
  36. amrwb \
  37. ape \
  38. atrac3 \
  39. flac \
  40. gif \
  41. h264 \
  42. hevc \
  43. jpegls \
  44. mp2 \
  45. mp3 \
  46. mpeg1video \
  47. mpeg2video \
  48. mpeg4 \
  49. mpegvideo \
  50. mpc7 \
  51. mpc8 \
  52. pcm_s16be \
  53. pcm_s16le \
  54. png \
  55. vc1 \
  56. vorbis \
  57. wavpack \
  58. wmav1 \
  59. wmav2 \
  60. zlib \
  61. FFMPEG_CUSTOM_MUXERS:= \
  62. ac3 \
  63. ffm \
  64. h264 \
  65. hevc \
  66. mp3 \
  67. mp4 \
  68. mpeg1video \
  69. mpeg2video \
  70. mpegts \
  71. ogg \
  72. rtp \
  73. FFMPEG_CUSTOM_DEMUXERS:= \
  74. aac \
  75. ac3 \
  76. amr \
  77. ape \
  78. avi \
  79. flac \
  80. ffm \
  81. h264 \
  82. hevc \
  83. matroska \
  84. mov \
  85. mp3 \
  86. mpegps \
  87. mpegts \
  88. mpegvideo \
  89. mpc \
  90. mpc8 \
  91. ogg \
  92. rm \
  93. rtsp \
  94. rtp \
  95. sdp \
  96. v4l2 \
  97. vc1 \
  98. wav \
  99. wv \
  100. FFMPEG_CUSTOM_PARSERS:= \
  101. aac \
  102. flac \
  103. ac3 \
  104. h264 \
  105. hevc \
  106. mpegaudio \
  107. mpeg4video \
  108. mpegvideo \
  109. vc1 \
  110. FFMPEG_CUSTOM_PROTOCOLS:= \
  111. file http icecast pipe rtp tcp udp
  112. FFMPEG_MINI_DECODERS:= \
  113. ac3 \
  114. flac \
  115. jpegls \
  116. mp2 \
  117. mp3 \
  118. mpeg1video \
  119. mpeg2video \
  120. mpeg4 \
  121. mpegvideo \
  122. opus \
  123. png \
  124. vorbis \
  125. FFMPEG_PATENTED_MINI_DECODERS:= \
  126. h264 \
  127. hevc \
  128. vc1 \
  129. FFMPEG_MINI_DEMUXERS:= \
  130. avi \
  131. flac \
  132. matroska \
  133. mov \
  134. mp3 \
  135. mpegps \
  136. mpegts \
  137. mpegvideo \
  138. ogg \
  139. FFMPEG_MINI_PROTOCOLS:= \
  140. file
  141. FFMPEG_AUDIO_DECODERS:= \
  142. ac3 \
  143. adpcm_* \
  144. alac \
  145. amrnb \
  146. amrwb \
  147. ape \
  148. atrac3 \
  149. flac \
  150. mp2 \
  151. mp3* \
  152. mpc7 \
  153. mpc8 \
  154. opus \
  155. pcm_* \
  156. vorbis \
  157. wavpack \
  158. zlib \
  159. FFMPEG_AUDIO_DEMUXERS:= \
  160. ac3 \
  161. aiff \
  162. amr \
  163. ape \
  164. avi \
  165. flac \
  166. ffm \
  167. matroska \
  168. mp3 \
  169. mov \
  170. mpc \
  171. mpc8 \
  172. mpegts \
  173. ogg \
  174. rm \
  175. rtsp \
  176. rtp \
  177. sdp \
  178. wav \
  179. wv \
  180. FFMPEG_AUDIO_PROTOCOLS:= \
  181. file http icecast rtp tcp udp
  182. FFMPEG_PATENTED_DECODERS:= \
  183. atrac3 \
  184. h264 \
  185. hevc \
  186. vc1 \
  187. FFMPEG_PATENTED_ENCODERS:=$(FFMPEG_PATENDED_DECODERS)
  188. FFMPEG_PATENTED_MUXERS:= \
  189. h264 \
  190. hevc \
  191. vc1 \
  192. FFMPEG_PATENTED_DEMUXERS:=$(FFMPEG_PATENTED_MUXERS)
  193. FFMPEG_PATENTED_PARSERS:= \
  194. h264 \
  195. hevc \
  196. vc1 \
  197. PKG_BUILD_DIR:=$(BUILD_DIR)/$(PKG_NAME)-$(BUILD_VARIANT)/$(PKG_NAME)-$(PKG_VERSION)
  198. PKG_CONFIG_DEPENDS:= \
  199. $(patsubst %,CONFIG_FFMPEG_CUSTOM_ENCODER_%,$(FFMPEG_CUSTOM_ENCODERS)) \
  200. $(patsubst %,CONFIG_FFMPEG_CUSTOM_DECODER_%,$(FFMPEG_CUSTOM_DECODERS)) \
  201. $(patsubst %,CONFIG_FFMPEG_CUSTOM_MUXER_%,$(FFMPEG_CUSTOM_MUXERS)) \
  202. $(patsubst %,CONFIG_FFMPEG_CUSTOM_DEMUXER_%,$(FFMPEG_CUSTOM_DEMUXERS)) \
  203. $(patsubst %,CONFIG_FFMPEG_CUSTOM_PARSER_%,$(FFMPEG_CUSTOM_PARSERS)) \
  204. $(patsubst %,CONFIG_FFMPEG_CUSTOM_PROTOCOL_%,$(FFMPEG_CUSTOM_PROTOCOLS))
  205. include $(INCLUDE_DIR)/package.mk
  206. define Package/ffmpeg/Default
  207. TITLE:=FFmpeg
  208. URL:=https://ffmpeg.org/
  209. DEPENDS+= +libpthread
  210. endef
  211. define Package/ffmpeg/Default/description
  212. FFmpeg is a a software package that can record, convert and stream digital
  213. audio and video in numerous formats.
  214. FFmpeg licensing / patent issues are complex. It is the reponsibility of the
  215. user to understand any requirements in this regard with its usage. See:
  216. https://ffmpeg.org/legal.html for further information.
  217. endef
  218. define Package/ffmpeg
  219. $(call Package/ffmpeg/Default)
  220. SECTION:=multimedia
  221. CATEGORY:=Multimedia
  222. TITLE+= program
  223. DEPENDS+= +libffmpeg-full
  224. VARIANT:=full
  225. endef
  226. define Package/ffmpeg/description
  227. $(call Package/ffmpeg/Default/description)
  228. .
  229. This package contains the FFmpeg command line tool.
  230. endef
  231. define Package/ffprobe
  232. $(call Package/ffmpeg/Default)
  233. SECTION:=multimedia
  234. CATEGORY:=Multimedia
  235. TITLE+= CLI media identifier
  236. DEPENDS+= +libffmpeg-full
  237. VARIANT:=full
  238. endef
  239. define Package/ffprobe/description
  240. $(call Package/ffmpeg/Default/description)
  241. .
  242. This package contains the FFprobe command line tool.
  243. endef
  244. define Package/ffserver
  245. $(call Package/ffmpeg/Default)
  246. SECTION:=multimedia
  247. CATEGORY:=Multimedia
  248. TITLE+= streaming server
  249. DEPENDS+= +libffmpeg-full
  250. VARIANT:=full
  251. endef
  252. define Package/ffserver/description
  253. $(call Package/ffmpeg/Default/description)
  254. .
  255. This package contains the FFmpeg streaming server.
  256. endef
  257. define Package/libffmpeg/Default
  258. $(call Package/ffmpeg/Default)
  259. SECTION:=libs
  260. CATEGORY:=Libraries
  261. TITLE+= libraries
  262. DEPENDS+= +libpthread +zlib +libbz2
  263. PROVIDES:= libffmpeg
  264. endef
  265. # Package build suppressed when CONFIG_ALL=y
  266. define Package/libffmpeg-custom
  267. $(call Package/libffmpeg/Default)
  268. TITLE+= (custom)
  269. DEPENDS+= @!ALL \
  270. +FFMPEG_CUSTOM_SELECT_libopus:libopus \
  271. +PACKAGE_libx264:libx264 +PACKAGE_lame-lib:lame-lib \
  272. +FFMPEG_CUSTOM_SELECT_libshine:shine \
  273. +PACKAGE_fdk-aac:fdk-aac
  274. VARIANT:=custom
  275. MENU:=1
  276. endef
  277. define Package/libffmpeg-custom/config
  278. source "$(SOURCE)/Config.in"
  279. endef
  280. define Package/libffmpeg-custom/description
  281. $(call Package/ffmpeg/Default/description)
  282. .
  283. This package contains customized FFmpeg shared libraries.
  284. endef
  285. define Package/libffmpeg-audio-dec
  286. $(call Package/libffmpeg/Default)
  287. TITLE+= (audio)
  288. VARIANT:=audio-dec
  289. endef
  290. define Package/libffmpeg-audio-dec/description
  291. $(call Package/ffmpeg/Default/description)
  292. .
  293. This package contains FFmpeg shared libraries for audio decoding
  294. endef
  295. define Package/libffmpeg-full
  296. $(call Package/libffmpeg/Default)
  297. TITLE+= (full)
  298. DEPENDS+= +alsa-lib +PACKAGE_libopus:libopus \
  299. +SOFT_FLOAT:shine \
  300. +!SOFT_FLOAT:lame-lib \
  301. +!SOFT_FLOAT:libx264
  302. VARIANT:=full
  303. endef
  304. define Package/libffmpeg-full/description
  305. $(call Package/ffmpeg/Default/description)
  306. .
  307. This package contains full-featured FFmpeg shared libraries.
  308. endef
  309. define Package/libffmpeg-mini
  310. $(call Package/libffmpeg/Default)
  311. TITLE+= (mini)
  312. VARIANT:=mini
  313. endef
  314. define Package/libffmpeg-mini/description
  315. $(call Package/ffmpeg/Default/description)
  316. .
  317. This package contains minimal-featured FFmpeg shared libraries.
  318. endef
  319. # Strip off FPU notation
  320. REAL_CPU_TYPE:=$(firstword $(subst +, ,$(CONFIG_CPU_TYPE)))
  321. # Fixup cpu types recogized by ffmpeg configure
  322. REAL_CPU_TYPE:=$(subst octeonplus,octeon+,$(REAL_CPU_TYPE))
  323. FFMPEG_CONFIGURE:= \
  324. CFLAGS="$(TARGET_CFLAGS) $(TARGET_CPPFLAGS) $(FPIC)" \
  325. LDFLAGS="$(TARGET_LDFLAGS)" \
  326. ./configure \
  327. --enable-cross-compile \
  328. --cross-prefix="$(TARGET_CROSS)" \
  329. --arch="$(ARCH)" \
  330. $(if $(REAL_CPU_TYPE),--cpu=$(call qstrip,$(REAL_CPU_TYPE)),) \
  331. --target-os=linux \
  332. --prefix="/usr" \
  333. --pkg-config="pkg-config" \
  334. --enable-shared \
  335. --enable-static \
  336. --enable-pthreads \
  337. --enable-zlib \
  338. --disable-doc \
  339. --disable-debug \
  340. \
  341. --disable-lzma \
  342. --disable-vaapi \
  343. --disable-vdpau \
  344. --disable-outdevs
  345. ifeq ($(CONFIG_SOFT_FLOAT),y)
  346. FFMPEG_CONFIGURE+= \
  347. --disable-altivec \
  348. --disable-vsx \
  349. --disable-power8 \
  350. --disable-armv5te \
  351. --disable-armv6 \
  352. --disable-armv6t2 \
  353. --disable-inline-asm \
  354. --disable-mipsdsp \
  355. --disable-mipsdspr2 \
  356. --disable-mipsfpu \
  357. --disable-msa \
  358. --disable-mmi \
  359. --disable-fast-unaligned \
  360. --disable-runtime-cpudetect
  361. else ifneq ($(findstring arm,$(CONFIG_ARCH)),)
  362. FFMPEG_CONFIGURE+= \
  363. --disable-runtime-cpudetect
  364. # XXX: GitHub issue 3320 ppc cpu with fpu but no altivec (WNDR4700)
  365. else ifneq ($(findstring powerpc,$(CONFIG_ARCH)),)
  366. FFMPEG_CONFIGURE+= \
  367. --disable-altivec
  368. # libavcode/mips/aacdec_mips.c build problem
  369. else ifneq ($(findstring 24kf,$(CONFIG_CPU_TYPE)),)
  370. FFMPEG_CONFIGURE+= \
  371. --disable-inline-asm
  372. endif
  373. # selectively disable optimizations according to arch/cpu type
  374. ifneq ($(findstring arm,$(CONFIG_ARCH)),)
  375. FFMPEG_CONFIGURE+= --enable-lto
  376. ifneq ($(findstring vfp,$(CONFIG_TARGET_OPTIMIZATION)),)
  377. FFMPEG_CONFIGURE+= --enable-vfp
  378. else
  379. FFMPEG_CONFIGURE+= --disable-vfp
  380. endif
  381. ifneq ($(findstring neon,$(CONFIG_TARGET_OPTIMIZATION)),)
  382. FFMPEG_CONFIGURE+= \
  383. --enable-neon \
  384. --enable-vfp
  385. else
  386. FFMPEG_CONFIGURE+= --disable-neon
  387. endif
  388. endif
  389. ifeq ($(ARCH),x86_64)
  390. FFMPEG_CONFIGURE+= --enable-lto
  391. endif
  392. ifneq ($(CONFIG_TARGET_x86),)
  393. ifeq ($(CONFIG_NASM),y)
  394. # Set yasmexe to anything but YASM/NASM (ffmpeg configure will then find NASM correctly)
  395. # Newer ffmpeg packages will use --enable-x86asm (with NASM default)
  396. FFMPEG_CONFIGURE += --yasmexe=xyzzy
  397. else
  398. FFMPEG_CONFIGURE += --disable-yasm
  399. endif
  400. endif
  401. ifeq ($(BUILD_VARIANT),full)
  402. FFMPEG_DISABLE= \
  403. $(foreach c, $(2), \
  404. --disable-$(1)="$(c)" \
  405. )
  406. FFMPEG_CONFIGURE+= \
  407. --enable-avresample \
  408. $(if $(CONFIG_BUILD_PATENTED),, \
  409. $(call FFMPEG_DISABLE,decoder,$(FFMPEG_PATENTED_DECODERS)) \
  410. $(call FFMPEG_DISABLE,encoder,$(FFMPEG_PATENTED_ENCODERS)) \
  411. $(call FFMPEG_DISABLE,muxer,$(FFMPEG_PATENTED_MUXERS)) \
  412. $(call FFMPEG_DISABLE,demuxer,$(FFMPEG_PATENTED_DEMUXERS)) \
  413. $(call FFMPEG_DISABLE,parser,$(FFMPEG_PATENTED_PARSERS))) \
  414. $(if $(CONFIG_PACKAGE_libopus),--enable-libopus)
  415. ifeq ($(CONFIG_SOFT_FLOAT),y)
  416. FFMPEG_CONFIGURE+= \
  417. --enable-small \
  418. \
  419. $(if $(CONFIG_PACKAGE_shine),--enable-libshine)
  420. else
  421. ifeq ($(ARCH),x86_64)
  422. FFMPEG_CONFIGURE+= --enable-hardcoded-tables
  423. else
  424. FFMPEG_CONFIGURE+= --enable-small
  425. endif
  426. FFMPEG_CONFIGURE+= $(if $(CONFIG_PACKAGE_lame-lib),--enable-libmp3lame)
  427. # x264 support and fdk-aac support can't coexist and be distributed.
  428. # Prioritize x264 over fdk-aac in default builds (maintain status-quo).
  429. ifneq ($(CONFIG_PACKAGE_libx264),)
  430. FFMPEG_CONFIGURE+= \
  431. --enable-gpl \
  432. --enable-libx264
  433. else
  434. FFMPEG_CONFIGURE+= $(if $(CONFIG_PACKAGE_fdk-aac),--enable-libfdk-aac)
  435. endif
  436. endif
  437. endif
  438. ifeq ($(BUILD_VARIANT),custom)
  439. FFMPEG_ENABLE= \
  440. $(foreach c, $(2), \
  441. $(if $($(3)_$(c)),--enable-$(1)="$(c)") \
  442. )
  443. ifeq ($(CONFIG_FFMPEG_CUSTOM_LARGE),y)
  444. FFMPEG_CONFIGURE+= \
  445. --enable-hardcoded-tables
  446. else
  447. FFMPEG_CONFIGURE+= \
  448. --enable-small
  449. endif
  450. ifeq ($(CONFIG_FFMPEG_CUSTOM_GPL),y)
  451. FFMPEG_CONFIGURE+= --enable-gpl
  452. endif
  453. ifeq ($(CONFIG_FFMPEG_CUSTOM_GPLV3),y)
  454. FFMPEG_CONFIGURE+= --enable-version3
  455. endif
  456. ifeq ($(CONFIG_FFMPEG_CUSTOM_NONFREE),y)
  457. FFMPEG_CONFIGURE+= --enable-nonfree
  458. endif
  459. FFMPEG_CONFIGURE+= \
  460. --disable-programs \
  461. --disable-avfilter \
  462. --disable-postproc \
  463. --disable-swresample \
  464. --disable-swscale \
  465. --disable-everything \
  466. $(call FFMPEG_ENABLE,encoder,$(FFMPEG_CUSTOM_ENCODERS),CONFIG_FFMPEG_CUSTOM_ENCODER) \
  467. $(call FFMPEG_ENABLE,decoder,$(FFMPEG_CUSTOM_DECODERS),CONFIG_FFMPEG_CUSTOM_DECODER) \
  468. $(call FFMPEG_ENABLE,muxer,$(FFMPEG_CUSTOM_MUXERS),CONFIG_FFMPEG_CUSTOM_MUXER) \
  469. $(call FFMPEG_ENABLE,demuxer,$(FFMPEG_CUSTOM_DEMUXERS),CONFIG_FFMPEG_CUSTOM_DEMUXER) \
  470. $(call FFMPEG_ENABLE,parser,$(FFMPEG_CUSTOM_PARSERS),CONFIG_FFMPEG_CUSTOM_PARSER) \
  471. $(call FFMPEG_ENABLE,protocol,$(FFMPEG_CUSTOM_PROTOCOLS),CONFIG_FFMPEG_CUSTOM_PROTOCOL) \
  472. ifeq ($(CONFIG_FFMPEG_CUSTOM_SELECT_adpcm),y)
  473. FFMPEG_CONFIGURE+= \
  474. --enable-decoder=adpcm_ima_wav \
  475. --enable-decoder=adpcm_ima_qt \
  476. --enable-decoder=adpcm_ms
  477. endif
  478. ifeq ($(CONFIG_FFMPEG_CUSTOM_SELECT_libfdk-aac),y)
  479. FFMPEG_CONFIGURE+= \
  480. --enable-libfdk-aac --enable-encoder=libfdk_aac
  481. endif
  482. ifeq ($(CONFIG_FFMPEG_CUSTOM_SELECT_libmp3lame),y)
  483. FFMPEG_CONFIGURE+= \
  484. --enable-libmp3lame --enable-encoder=libmp3lame
  485. endif
  486. ifeq ($(CONFIG_FFMPEG_CUSTOM_SELECT_libopus),y)
  487. FFMPEG_CONFIGURE+= \
  488. --enable-libopus --enable-decoder=libopus --enable-encoder=libopus
  489. endif
  490. ifeq ($(CONFIG_FFMPEG_CUSTOM_SELECT_libshine),y)
  491. FFMPEG_CONFIGURE+= \
  492. --enable-libshine --enable-encoder=libshine
  493. endif
  494. ifneq ($(CONFIG_FFMPEG_CUSTOM_SELECT_libx264),)
  495. FFMPEG_CONFIGURE+= \
  496. --enable-libx264 --enable-encoder=libx264
  497. endif
  498. endif
  499. ifeq ($(BUILD_VARIANT),audio-dec)
  500. FFMPEG_ENABLE= \
  501. $(foreach c, $(2), \
  502. --enable-$(1)="$(c)" \
  503. )
  504. FFMPEG_CONFIGURE+= \
  505. --enable-small \
  506. --enable-gpl \
  507. \
  508. --disable-programs \
  509. --disable-avfilter \
  510. --disable-postproc \
  511. --disable-swresample \
  512. --disable-swscale \
  513. --disable-everything \
  514. $(call FFMPEG_ENABLE,decoder,$(FFMPEG_AUDIO_DECODERS)) \
  515. $(call FFMPEG_ENABLE,demuxer,$(FFMPEG_AUDIO_DEMUXERS)) \
  516. $(call FFMPEG_ENABLE,protocol,$(FFMPEG_AUDIO_PROTOCOLS)) \
  517. --disable-decoder=pcm_bluray,pcm_dvd
  518. endif
  519. ifeq ($(BUILD_VARIANT),mini)
  520. FFMPEG_ENABLE= \
  521. $(foreach c, $(2), \
  522. --enable-$(1)="$(c)" \
  523. )
  524. FFMPEG_CONFIGURE+= \
  525. --enable-small \
  526. \
  527. --disable-programs \
  528. --disable-avdevice \
  529. --disable-avfilter \
  530. --disable-postproc \
  531. --disable-swresample \
  532. --disable-swscale \
  533. --disable-everything \
  534. $(call FFMPEG_ENABLE,decoder,$(FFMPEG_MINI_DECODERS)) \
  535. $(call FFMPEG_ENABLE,demuxer,$(FFMPEG_MINI_DEMUXERS)) \
  536. $(call FFMPEG_ENABLE,protocol,$(FFMPEG_MINI_PROTOCOLS)) \
  537. $(if $(CONFIG_BUILD_PATENTED), \
  538. $(call FFMPEG_ENABLE,decoder,$(FFMPEG_PATENTED_MINI_DECODERS)))
  539. endif
  540. ifneq ($(CONFIG_TARGET_x86),)
  541. TARGET_CFLAGS+= -fomit-frame-pointer
  542. endif
  543. define Build/Configure
  544. ( cd $(PKG_BUILD_DIR); $(FFMPEG_CONFIGURE) )
  545. endef
  546. define Build/Compile
  547. $(MAKE) -C $(PKG_BUILD_DIR) \
  548. DESTDIR="$(PKG_INSTALL_DIR)" \
  549. all install
  550. endef
  551. define Build/InstallDev/custom
  552. $(INSTALL_DIR) $(1)/usr/include
  553. $(CP) $(PKG_INSTALL_DIR)/usr/include/lib{avcodec,avdevice,avformat,avutil} $(1)/usr/include/
  554. $(INSTALL_DIR) $(1)/usr/lib
  555. $(CP) $(PKG_INSTALL_DIR)/usr/lib/lib{avcodec,avdevice,avformat,avutil}.{a,so*} $(1)/usr/lib/
  556. $(INSTALL_DIR) $(1)/usr/lib/pkgconfig
  557. $(CP) $(PKG_INSTALL_DIR)/usr/lib/pkgconfig/lib{avcodec,avdevice,avformat,avutil}.pc $(1)/usr/lib/pkgconfig/
  558. endef
  559. # Only ffmpeg with libx264 is GPL (yes libpostproc); all other builds are lgpl (no libpostproc)
  560. define Build/InstallDev/full
  561. $(INSTALL_DIR) $(1)/usr/include
  562. $(INSTALL_DIR) $(1)/usr/lib
  563. $(INSTALL_DIR) $(1)/usr/lib/pkgconfig
  564. $(CP) $(PKG_INSTALL_DIR)/usr/include/lib{avcodec,avdevice,avfilter,avformat,avresample,avutil,swresample,swscale} $(1)/usr/include/
  565. $(CP) $(PKG_INSTALL_DIR)/usr/lib/lib{avcodec,avdevice,avfilter,avformat,avresample,avutil,swresample,swscale}.{a,so*} $(1)/usr/lib/
  566. $(CP) $(PKG_INSTALL_DIR)/usr/lib/pkgconfig/lib{avcodec,avdevice,avfilter,avformat,avresample,avutil,swresample,swscale}.pc $(1)/usr/lib/pkgconfig/
  567. ifneq ($(CONFIG_SOFT_FLOAT),y)
  568. ifneq ($(CONFIG_PACKAGE_libx264),)
  569. $(CP) $(PKG_INSTALL_DIR)/usr/include/libpostproc $(1)/usr/include/
  570. $(CP) $(PKG_INSTALL_DIR)/usr/lib/libpostproc.{a,so*} $(1)/usr/lib/
  571. $(CP) $(PKG_INSTALL_DIR)/usr/lib/pkgconfig/libpostproc.pc $(1)/usr/lib/pkgconfig/
  572. endif
  573. endif
  574. endef
  575. define Build/InstallDev/mini
  576. $(INSTALL_DIR) $(1)/usr/include
  577. $(CP) $(PKG_INSTALL_DIR)/usr/include/lib{avcodec,avformat,avutil} $(1)/usr/include/
  578. $(INSTALL_DIR) $(1)/usr/lib
  579. $(CP) $(PKG_INSTALL_DIR)/usr/lib/lib{avcodec,avformat,avutil}.{a,so*} $(1)/usr/lib/
  580. $(INSTALL_DIR) $(1)/usr/lib/pkgconfig
  581. $(CP) $(PKG_INSTALL_DIR)/usr/lib/pkgconfig/lib{avcodec,avformat,avutil}.pc $(1)/usr/lib/pkgconfig/
  582. endef
  583. Build/InstallDev/audio-dec = $(Build/InstallDev/custom)
  584. # XXX: attempt at installing "best" dev files available
  585. ifeq ($(BUILD_VARIANT),custom)
  586. # XXX: only install "custom" dev files if -full & -mini are not selected
  587. ifeq ($(CONFIG_PACKAGE_libffmpeg-full)$(CONFIG_PACKAGE_libffmpeg-mini),)
  588. Build/InstallDev = $(Build/InstallDev/custom)
  589. endif
  590. endif
  591. ifeq ($(BUILD_VARIANT),audio-dec)
  592. # XXX: only install "audio-dec" dev files if -full & -mini are not selected
  593. ifeq ($(CONFIG_PACKAGE_libffmpeg-full)$(CONFIG_PACKAGE_libffmpeg-mini),)
  594. Build/InstallDev = $(Build/InstallDev/audio-dec)
  595. endif
  596. endif
  597. ifeq ($(BUILD_VARIANT),full)
  598. # XXX: always install "full" dev files if -full is selected
  599. Build/InstallDev = $(Build/InstallDev/full)
  600. endif
  601. ifeq ($(BUILD_VARIANT),mini)
  602. # XXX: only install "mini" dev files if -full is not selected
  603. ifeq ($(CONFIG_PACKAGE_libffmpeg-full),)
  604. Build/InstallDev = $(Build/InstallDev/mini)
  605. endif
  606. endif
  607. define Package/ffmpeg/install
  608. $(INSTALL_DIR) $(1)/usr/bin
  609. $(CP) $(PKG_INSTALL_DIR)/usr/bin/ffmpeg $(1)/usr/bin/
  610. endef
  611. define Package/ffprobe/install
  612. $(INSTALL_DIR) $(1)/usr/bin
  613. $(CP) $(PKG_INSTALL_DIR)/usr/bin/ffprobe $(1)/usr/bin/
  614. endef
  615. define Package/ffserver/install
  616. $(INSTALL_DIR) $(1)/usr/bin
  617. $(CP) $(PKG_INSTALL_DIR)/usr/bin/ffserver $(1)/usr/bin/
  618. endef
  619. define Package/libffmpeg-custom/install
  620. $(INSTALL_DIR) $(1)/usr/lib
  621. $(CP) $(PKG_INSTALL_DIR)/usr/lib/lib{avcodec,avdevice,avformat,avutil}.so.* $(1)/usr/lib/
  622. endef
  623. # Only ffmpeg with libx264 is GPL (yes libpostproc); all other builds are lgpl (no libpostproc)
  624. define Package/libffmpeg-full/install
  625. $(INSTALL_DIR) $(1)/usr/lib
  626. $(CP) $(PKG_INSTALL_DIR)/usr/lib/lib{avcodec,avdevice,avfilter,avformat,avresample,avutil,swresample,swscale}.so.* $(1)/usr/lib/
  627. ifneq ($(CONFIG_SOFT_FLOAT),y)
  628. ifneq ($(CONFIG_PACKAGE_libx264),)
  629. $(CP) $(PKG_INSTALL_DIR)/usr/lib/libpostproc.so.* $(1)/usr/lib/
  630. endif
  631. endif
  632. endef
  633. define Package/libffmpeg-mini/install
  634. $(INSTALL_DIR) $(1)/usr/lib
  635. $(CP) $(PKG_INSTALL_DIR)/usr/lib/lib{avcodec,avformat,avutil}.so.* $(1)/usr/lib/
  636. endef
  637. Package/libffmpeg-audio-dec/install = $(Package/libffmpeg-custom/install)
  638. $(eval $(call BuildPackage,ffmpeg))
  639. $(eval $(call BuildPackage,ffprobe))
  640. $(eval $(call BuildPackage,ffserver))
  641. $(eval $(call BuildPackage,libffmpeg-audio-dec))
  642. $(eval $(call BuildPackage,libffmpeg-full))
  643. $(eval $(call BuildPackage,libffmpeg-mini))
  644. $(eval $(call BuildPackage,libffmpeg-custom))