From 019aea3d63f58e5a7ee2718f12723e0f5f4e22e5 Mon Sep 17 00:00:00 2001
From: Max Kellermann <max@duempel.org>
Date: Mon, 23 Nov 2015 10:43:06 +0100
Subject: [PATCH] {android,win32}/build.py: move code to python/build/libs.py

---
 android/build.py     | 115 ++++---------------------------------------
 python/build/libs.py | 109 ++++++++++++++++++++++++++++++++++++++++
 win32/build.py       | 111 ++++-------------------------------------
 3 files changed, 129 insertions(+), 206 deletions(-)
 create mode 100644 python/build/libs.py

diff --git a/android/build.py b/android/build.py
index 56ef1f790..18f80ca88 100755
--- a/android/build.py
+++ b/android/build.py
@@ -107,113 +107,18 @@ class AndroidNdkToolchain:
         # default one on the build host
         self.env['PKG_CONFIG_LIBDIR'] = os.path.join(install_prefix, 'lib/pkgconfig')
 
-from build.project import Project
-from build.autotools import AutotoolsProject
-from build.ffmpeg import FfmpegProject
-from build.boost import BoostProject
-
 # a list of third-party libraries to be used by MPD on Android
+from build.libs import *
 thirdparty_libs = [
-    AutotoolsProject(
-        'http://downloads.xiph.org/releases/ogg/libogg-1.3.2.tar.xz',
-        '5c3a34309d8b98640827e5d0991a4015',
-        'lib/libogg.a',
-        ['--disable-shared', '--enable-static'],
-    ),
-
-    AutotoolsProject(
-        'http://downloads.xiph.org/releases/vorbis/libvorbis-1.3.5.tar.xz',
-        '28cb28097c07a735d6af56e598e1c90f',
-        'lib/libvorbis.a',
-        ['--disable-shared', '--enable-static'],
-    ),
-
-    AutotoolsProject(
-        'http://downloads.xiph.org/releases/opus/opus-1.1.tar.gz',
-        'c5a8cf7c0b066759542bc4ca46817ac6',
-        'lib/libopus.a',
-        ['--disable-shared', '--enable-static'],
-        use_clang=True,
-    ),
-
-    AutotoolsProject(
-        'http://downloads.xiph.org/releases/flac/flac-1.3.1.tar.xz',
-        'b9922c9a0378c88d3e901b234f852698',
-        'lib/libFLAC.a',
-        [
-            '--disable-shared', '--enable-static',
-            '--disable-xmms-plugin', '--disable-cpplibs',
-        ],
-        use_clang=True,
-    ),
-
-    AutotoolsProject(
-        'ftp://ftp.mars.org/pub/mpeg/libid3tag-0.15.1b.tar.gz',
-        'e5808ad997ba32c498803822078748c3',
-        'lib/libid3tag.a',
-        ['--disable-shared', '--enable-static'],
-        autogen=True,
-    ),
-
-    AutotoolsProject(
-        'ftp://ftp.mars.org/pub/mpeg/libmad-0.15.1b.tar.gz',
-        '1be543bc30c56fb6bea1d7bf6a64e66c',
-        'lib/libmad.a',
-        ['--disable-shared', '--enable-static'],
-        autogen=True,
-    ),
-
-    FfmpegProject(
-        'http://ffmpeg.org/releases/ffmpeg-2.8.2.tar.xz',
-        '5041ffe661392b0685d2248114791fde',
-        'lib/libavcodec.a',
-        [
-            '--disable-shared', '--enable-static',
-            '--enable-gpl',
-            '--enable-small',
-            '--disable-pthreads',
-            '--disable-programs',
-            '--disable-doc',
-            '--disable-avdevice',
-            '--disable-swresample',
-            '--disable-swscale',
-            '--disable-postproc',
-            '--disable-avfilter',
-            '--disable-network',
-            '--disable-encoders',
-            '--disable-protocols',
-            '--disable-outdevs',
-            '--disable-filters',
-        ],
-    ),
-
-    AutotoolsProject(
-        'http://curl.haxx.se/download/curl-7.45.0.tar.lzma',
-        'c9a0a77f71fdc6b0f925bc3e79eb77f6',
-        'lib/libcurl.a',
-        [
-            '--disable-shared', '--enable-static',
-            '--disable-debug',
-            '--enable-http',
-            '--enable-ipv6',
-            '--disable-ftp', '--disable-file',
-            '--disable-ldap', '--disable-ldaps',
-            '--disable-rtsp', '--disable-proxy', '--disable-dict', '--disable-telnet',
-            '--disable-tftp', '--disable-pop3', '--disable-imap', '--disable-smtp',
-            '--disable-gopher',
-            '--disable-manual',
-            '--disable-threaded-resolver', '--disable-verbose', '--disable-sspi',
-            '--disable-crypto-auth', '--disable-ntlm-wb', '--disable-tls-srp', '--disable-cookies',
-            '--without-ssl', '--without-gnutls', '--without-nss', '--without-libssh2',
-        ],
-        use_clang=True,
-    ),
-
-    BoostProject(
-        'http://netcologne.dl.sourceforge.net/project/boost/boost/1.59.0/boost_1_59_0.tar.bz2',
-        '6aa9a5c6a4ca1016edd0ed1178e3cb87',
-        'include/boost/version.hpp',
-    ),
+    libogg,
+    libvorbis,
+    opus,
+    flac,
+    libid3tag,
+    libmad,
+    ffmpeg,
+    curl,
+    boost,
 ]
 
 # build the third-party libraries
diff --git a/python/build/libs.py b/python/build/libs.py
new file mode 100644
index 000000000..04b463d7b
--- /dev/null
+++ b/python/build/libs.py
@@ -0,0 +1,109 @@
+from build.project import Project
+from build.zlib import ZlibProject
+from build.autotools import AutotoolsProject
+from build.ffmpeg import FfmpegProject
+from build.boost import BoostProject
+
+libogg = AutotoolsProject(
+    'http://downloads.xiph.org/releases/ogg/libogg-1.3.2.tar.xz',
+    '5c3a34309d8b98640827e5d0991a4015',
+    'lib/libogg.a',
+    ['--disable-shared', '--enable-static'],
+)
+
+libvorbis = AutotoolsProject(
+    'http://downloads.xiph.org/releases/vorbis/libvorbis-1.3.5.tar.xz',
+    '28cb28097c07a735d6af56e598e1c90f',
+    'lib/libvorbis.a',
+    ['--disable-shared', '--enable-static'],
+)
+
+opus = AutotoolsProject(
+    'http://downloads.xiph.org/releases/opus/opus-1.1.tar.gz',
+    'c5a8cf7c0b066759542bc4ca46817ac6',
+    'lib/libopus.a',
+    ['--disable-shared', '--enable-static'],
+)
+
+flac = AutotoolsProject(
+    'http://downloads.xiph.org/releases/flac/flac-1.3.1.tar.xz',
+    'b9922c9a0378c88d3e901b234f852698',
+    'lib/libFLAC.a',
+    [
+        '--disable-shared', '--enable-static',
+        '--disable-xmms-plugin', '--disable-cpplibs',
+    ],
+)
+
+zlib = ZlibProject(
+    'http://zlib.net/zlib-1.2.8.tar.xz',
+    '28f1205d8dd2001f26fec1e8c2cebe37',
+    'lib/libz.a',
+)
+
+libid3tag = AutotoolsProject(
+    'ftp://ftp.mars.org/pub/mpeg/libid3tag-0.15.1b.tar.gz',
+    'e5808ad997ba32c498803822078748c3',
+    'lib/libid3tag.a',
+    ['--disable-shared', '--enable-static'],
+    autogen=True,
+)
+
+libmad = AutotoolsProject(
+    'ftp://ftp.mars.org/pub/mpeg/libmad-0.15.1b.tar.gz',
+    '1be543bc30c56fb6bea1d7bf6a64e66c',
+    'lib/libmad.a',
+    ['--disable-shared', '--enable-static'],
+    autogen=True,
+)
+
+ffmpeg = FfmpegProject(
+    'http://ffmpeg.org/releases/ffmpeg-2.8.2.tar.xz',
+    '5041ffe661392b0685d2248114791fde',
+    'lib/libavcodec.a',
+    [
+        '--disable-shared', '--enable-static',
+        '--enable-gpl',
+        '--enable-small',
+        '--disable-pthreads',
+        '--disable-programs',
+        '--disable-doc',
+        '--disable-avdevice',
+        '--disable-swresample',
+        '--disable-swscale',
+        '--disable-postproc',
+        '--disable-avfilter',
+        '--disable-network',
+        '--disable-encoders',
+        '--disable-protocols',
+        '--disable-outdevs',
+        '--disable-filters',
+    ],
+)
+
+curl = AutotoolsProject(
+    'http://curl.haxx.se/download/curl-7.45.0.tar.lzma',
+    'c9a0a77f71fdc6b0f925bc3e79eb77f6',
+    'lib/libcurl.a',
+    [
+        '--disable-shared', '--enable-static',
+        '--disable-debug',
+        '--enable-http',
+        '--enable-ipv6',
+        '--disable-ftp', '--disable-file',
+        '--disable-ldap', '--disable-ldaps',
+        '--disable-rtsp', '--disable-proxy', '--disable-dict', '--disable-telnet',
+        '--disable-tftp', '--disable-pop3', '--disable-imap', '--disable-smtp',
+        '--disable-gopher',
+        '--disable-manual',
+        '--disable-threaded-resolver', '--disable-verbose', '--disable-sspi',
+        '--disable-crypto-auth', '--disable-ntlm-wb', '--disable-tls-srp', '--disable-cookies',
+        '--without-ssl', '--without-gnutls', '--without-nss', '--without-libssh2',
+    ],
+)
+
+boost = BoostProject(
+    'http://netcologne.dl.sourceforge.net/project/boost/boost/1.59.0/boost_1_59_0.tar.bz2',
+    '6aa9a5c6a4ca1016edd0ed1178e3cb87',
+    'include/boost/version.hpp',
+)
diff --git a/win32/build.py b/win32/build.py
index a4fc411a8..0914d78f7 100755
--- a/win32/build.py
+++ b/win32/build.py
@@ -55,109 +55,18 @@ class CrossGccToolchain:
         # default one on the build host
         self.env['PKG_CONFIG_LIBDIR'] = os.path.join(install_prefix, 'lib/pkgconfig')
 
-from build.project import Project
-from build.zlib import ZlibProject
-from build.autotools import AutotoolsProject
-from build.ffmpeg import FfmpegProject
-from build.boost import BoostProject
-
 # a list of third-party libraries to be used by MPD on Android
+from build.libs import *
 thirdparty_libs = [
-    AutotoolsProject(
-        'http://downloads.xiph.org/releases/ogg/libogg-1.3.2.tar.xz',
-        '5c3a34309d8b98640827e5d0991a4015',
-        'lib/libogg.a',
-        ['--disable-shared', '--enable-static'],
-    ),
-
-    AutotoolsProject(
-        'http://downloads.xiph.org/releases/vorbis/libvorbis-1.3.5.tar.xz',
-        '28cb28097c07a735d6af56e598e1c90f',
-        'lib/libvorbis.a',
-        ['--disable-shared', '--enable-static'],
-    ),
-
-    AutotoolsProject(
-        'http://downloads.xiph.org/releases/opus/opus-1.1.tar.gz',
-        'c5a8cf7c0b066759542bc4ca46817ac6',
-        'lib/libopus.a',
-        ['--disable-shared', '--enable-static'],
-    ),
-
-    AutotoolsProject(
-        'http://downloads.xiph.org/releases/flac/flac-1.3.1.tar.xz',
-        'b9922c9a0378c88d3e901b234f852698',
-        'lib/libFLAC.a',
-        [
-            '--disable-shared', '--enable-static',
-            '--disable-xmms-plugin', '--disable-cpplibs',
-        ],
-    ),
-
-    ZlibProject(
-        'http://zlib.net/zlib-1.2.8.tar.xz',
-        '28f1205d8dd2001f26fec1e8c2cebe37',
-        'lib/libz.a',
-    ),
-
-    AutotoolsProject(
-        'ftp://ftp.mars.org/pub/mpeg/libid3tag-0.15.1b.tar.gz',
-        'e5808ad997ba32c498803822078748c3',
-        'lib/libid3tag.a',
-        ['--disable-shared', '--enable-static'],
-        autogen=True,
-    ),
-
-    FfmpegProject(
-        'http://ffmpeg.org/releases/ffmpeg-2.8.2.tar.xz',
-        '5041ffe661392b0685d2248114791fde',
-        'lib/libavcodec.a',
-        [
-            '--disable-shared', '--enable-static',
-            '--enable-gpl',
-            '--enable-small',
-            '--disable-pthreads',
-            '--disable-programs',
-            '--disable-doc',
-            '--disable-avdevice',
-            '--disable-swresample',
-            '--disable-swscale',
-            '--disable-postproc',
-            '--disable-avfilter',
-            '--disable-network',
-            '--disable-encoders',
-            '--disable-protocols',
-            '--disable-outdevs',
-            '--disable-filters',
-        ],
-    ),
-
-    AutotoolsProject(
-        'http://curl.haxx.se/download/curl-7.45.0.tar.lzma',
-        'c9a0a77f71fdc6b0f925bc3e79eb77f6',
-        'lib/libcurl.a',
-        [
-            '--disable-shared', '--enable-static',
-            '--disable-debug',
-            '--enable-http',
-            '--enable-ipv6',
-            '--disable-ftp', '--disable-file',
-            '--disable-ldap', '--disable-ldaps',
-            '--disable-rtsp', '--disable-proxy', '--disable-dict', '--disable-telnet',
-            '--disable-tftp', '--disable-pop3', '--disable-imap', '--disable-smtp',
-            '--disable-gopher',
-            '--disable-manual',
-            '--disable-threaded-resolver', '--disable-verbose', '--disable-sspi',
-            '--disable-crypto-auth', '--disable-ntlm-wb', '--disable-tls-srp', '--disable-cookies',
-            '--without-ssl', '--without-gnutls', '--without-nss', '--without-libssh2',
-        ],
-    ),
-
-    BoostProject(
-        'http://netcologne.dl.sourceforge.net/project/boost/boost/1.59.0/boost_1_59_0.tar.bz2',
-        '6aa9a5c6a4ca1016edd0ed1178e3cb87',
-        'include/boost/version.hpp',
-    ),
+    libogg,
+    libvorbis,
+    opus,
+    flac,
+    zlib,
+    libid3tag,
+    ffmpeg,
+    curl,
+    boost,
 ]
 
 # build the third-party libraries