0
0

Delete article

Deleted articles cannot be recovered.

Draft of this article would be also deleted.

Are you sure you want to delete this article?

More than 5 years have passed since last update.

Ubuntu 12.04のlibavパッケージからGPLを取り除く

Posted at

この記事はACCESS Advent Calendar 4日目の記事です。

こんにちは ACCESS開発本部IoT開発部の加藤 (@aKenjiKato ) です。

libavパッケージにGPLが入っていると困るって時ありますよね。 ありますよね

そんなときのためにGPLを抜いたパッケージの作り方をご紹介します。
とはいっても、ちょっといじってパッケージを再ビルドするだけですが。


まずは、パッケージビルドのツールをインストールします。

sudo apt-get -y install devscripts

次に、パッケージビルド時に必要なパッケージをインストールします。

sudo apt-get build-dep libav

パッケージビルドに必要なファイルをダウンロードする
ディレクトリが激しく汚れるので、作業用ディレクトリを確保しておく。

mkdir tmp
cd tmp
dget -u http://archive.ubuntu.com/ubuntu/pool/main/liba/libav/libav_0.8.17-0ubuntu0.12.04.1.dsc

libav-0.8.17ディレクトリにソースコードが展開されるので、その中をいじって、GPLライセンスのものをビルドしないようにします。

--- libav-0.8.17/debian/confflags.orig    2012-01-21 17:32:52.000000000 +0900
+++ libav-0.8.17/debian/confflags    2015-11-15 16:57:27.146918149 +0900
@@ -138,11 +138,11 @@
 v3_confflags += $(call cond_enable_v3,/usr/include/opencore-amrwb/dec_if.h,libopencore-amrwb)

 # AAC is considered non-free upstream
-confflags += $(call cond_enable_nf,/usr/include/faac.h,libfaac)
+# confflags += $(call cond_enable_nf,/usr/include/faac.h,libfaac)

 # comment out following line for LGPL versions of the libraries
-confflags += $(gpl_confflags)
-confflags += $(v3_confflags)
+# confflags += $(gpl_confflags)
+# confflags += $(v3_confflags)

 # Enable IEEE 1394 (FireWire) support on Linux only
 ifneq (,$(findstring linux,$(DEB_HOST_GNU_TYPE)))
--- libav-0.8.17/debian/control.orig    2012-06-12 23:17:57.000000000 +0900
+++ libav-0.8.17/debian/control    2015-11-15 17:15:33.896807632 +0900
@@ -112,7 +112,7 @@
  libavdevice53 (= ${binary:Version}),
  libavformat53 (= ${binary:Version}),
  libavutil51 (= ${binary:Version}),
- libpostproc52 (= ${binary:Version}),
+# libpostproc52 (= ${binary:Version}),
  libswscale2 (= ${binary:Version}),
  ${misc:Depends}
 Description: Debug symbols for Libav related packages
@@ -245,18 +245,18 @@
  .
  This is the video filtering library from Libav.

-Package: libpostproc52
-Architecture: any
-Multi-Arch: same
-Pre-Depends: ${misc:Pre-Depends}
-Depends:
- ${misc:Depends},
- ${shlibs:Depends}
-Description: Libav video postprocessing library
- Libav is a complete, cross-platform solution to decode, encode, record,
- convert and stream audio and video.
- .
- This is the video postprocessing library from Libav.
+# Package: libpostproc52
+# Architecture: any
+# Multi-Arch: same
+# Pre-Depends: ${misc:Pre-Depends}
+# Depends:
+#  ${misc:Depends},
+#  ${shlibs:Depends}
+# Description: Libav video postprocessing library
+#  Libav is a complete, cross-platform solution to decode, encode, record,
+#  convert and stream audio and video.
+#  .
+#  This is the video postprocessing library from Libav.

 Package: libswscale2
 Architecture: any
@@ -370,22 +370,22 @@
  This package contains the header files and static libraries needed to
  compile applications or shared objects that use libavfilter.

-Package: libpostproc-dev
-Section: libdevel
-Architecture: any
-Depends:
- libavutil-dev (= ${binary:Version}),
- libpostproc52 (<= ${source:Upstream-Version}-99) | libpostproc-extra-52 (<= ${source:Upstream-Version}.99),
- libpostproc52 (>= ${binary:Version}) | libpostproc-extra-52 (>= ${source:Upstream-Version}),
- ${misc:Depends}
-Description: Development files for libpostproc
- Libav is a complete, cross-platform solution to decode, encode, record,
- convert and stream audio and video.
- .
- This is the video postprocessing library from Libav.
- .
- This package contains the header files and static libraries needed to
- compile applications or shared objects that use libpostproc.
+# Package: libpostproc-dev
+# Section: libdevel
+# Architecture: any
+# Depends:
+#  libavutil-dev (= ${binary:Version}),
+#  libpostproc52 (<= ${source:Upstream-Version}-99) | libpostproc-extra-52 (<= ${source:Upstream-Version}.99),
+#  libpostproc52 (>= ${binary:Version}) | libpostproc-extra-52 (>= ${source:Upstream-Version}),
+#  ${misc:Depends}
+# Description: Development files for libpostproc
+#  Libav is a complete, cross-platform solution to decode, encode, record,
+#  convert and stream audio and video.
+#  .
+#  This is the video postprocessing library from Libav.
+#  .
+#  This package contains the header files and static libraries needed to
+#  compile applications or shared objects that use libpostproc.

 Package: libswscale-dev
 Section: libdevel

パッケージをビルドします。

# libav-0.8.17 以下にて
dpkg-buildpackage -r -uc -b

ビルド中に実行されるconfigureのログでLGPLのライブラリになった旨が表示されるはずです。

ビルドが終わると、tmp以下にLGPLになったdebファイルが出来上がります。
おつかれさまでした。


明日は @ikeyasu さんです。
明日もよろしくお願いいたします。

0
0
0

Register as a new user and use Qiita more conveniently

  1. You get articles that match your needs
  2. You can efficiently read back useful information
  3. You can use dark theme
What you can do with signing up
0
0

Delete article

Deleted articles cannot be recovered.

Draft of this article would be also deleted.

Are you sure you want to delete this article?