Skip to content
Projects
Groups
Snippets
Help
This project
Loading...
Sign in / Register
Toggle navigation
M
mpd
Project
Project
Details
Activity
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Registry
Registry
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
Иван Мажукин
mpd
Commits
86486336
Commit
86486336
authored
Nov 20, 2015
by
Max Kellermann
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
{android,win32}/build.py: add tarball_path and src_path to toolchain class
Reduce dependencies on global variables.
parent
ec2a2522
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
44 additions
and
35 deletions
+44
-35
build.py
android/build.py
+22
-17
build.py
win32/build.py
+22
-18
No files found.
android/build.py
View file @
86486336
...
...
@@ -45,7 +45,12 @@ build_arch = 'linux-x86_64'
# set up the NDK toolchain
class
AndroidNdkToolchain
:
def
__init__
(
self
,
use_cxx
,
use_clang
):
def
__init__
(
self
,
tarball_path
,
src_path
,
build_path
,
use_cxx
,
use_clang
):
self
.
tarball_path
=
tarball_path
self
.
src_path
=
src_path
self
.
build_path
=
build_path
self
.
ndk_arch
=
'arm'
android_abi
=
'armeabi-v7a'
ndk_platform
=
'android-14'
...
...
@@ -135,12 +140,11 @@ class Project:
self
.
use_cxx
=
use_cxx
self
.
use_clang
=
use_clang
def
download
(
self
):
global
tarball_path
return
download_and_verify
(
self
.
url
,
self
.
md5
,
tarball_path
)
def
download
(
self
,
toolchain
):
return
download_and_verify
(
self
.
url
,
self
.
md5
,
toolchain
.
tarball_path
)
def
is_installed
(
self
,
toolchain
):
tarball
=
self
.
download
()
tarball
=
self
.
download
(
toolchain
)
installed
=
os
.
path
.
join
(
toolchain
.
install_prefix
,
self
.
installed
)
tarball_mtime
=
os
.
path
.
getmtime
(
tarball
)
try
:
...
...
@@ -148,12 +152,11 @@ class Project:
except
FileNotFoundError
:
return
False
def
unpack
(
self
):
global
src_path
return
untar
(
self
.
download
(),
src_path
,
self
.
base
)
def
unpack
(
self
,
toolchain
):
return
untar
(
self
.
download
(
toolchain
),
toolchain
.
src_path
,
self
.
base
)
def
make_build_path
(
self
):
path
=
os
.
path
.
join
(
build_path
,
self
.
base
)
def
make_build_path
(
self
,
toolchain
):
path
=
os
.
path
.
join
(
toolchain
.
build_path
,
self
.
base
)
try
:
shutil
.
rmtree
(
path
)
except
FileNotFoundError
:
...
...
@@ -172,14 +175,14 @@ class AutotoolsProject(Project):
self
.
cppflags
=
cppflags
def
build
(
self
,
toolchain
):
src
=
self
.
unpack
()
src
=
self
.
unpack
(
toolchain
)
if
self
.
autogen
:
subprocess
.
check_call
([
'/usr/bin/aclocal'
],
cwd
=
src
)
subprocess
.
check_call
([
'/usr/bin/automake'
,
'--add-missing'
,
'--force-missing'
,
'--foreign'
],
cwd
=
src
)
subprocess
.
check_call
([
'/usr/bin/autoconf'
],
cwd
=
src
)
subprocess
.
check_call
([
'/usr/bin/libtoolize'
,
'--force'
],
cwd
=
src
)
build
=
self
.
make_build_path
()
build
=
self
.
make_build_path
(
toolchain
)
configure
=
[
os
.
path
.
join
(
src
,
'configure'
),
...
...
@@ -210,8 +213,8 @@ class FfmpegProject(Project):
self
.
cppflags
=
cppflags
def
build
(
self
,
toolchain
):
src
=
self
.
unpack
()
build
=
self
.
make_build_path
()
src
=
self
.
unpack
(
toolchain
)
build
=
self
.
make_build_path
(
toolchain
)
configure
=
[
os
.
path
.
join
(
src
,
'configure'
),
...
...
@@ -244,7 +247,7 @@ class BoostProject(Project):
**
kwargs
)
def
build
(
self
,
toolchain
):
src
=
self
.
unpack
()
src
=
self
.
unpack
(
toolchain
)
# install the headers manually; don't build any library
# (because right now, we only use header-only libraries)
...
...
@@ -367,12 +370,14 @@ thirdparty_libs = [
# build the third-party libraries
for
x
in
thirdparty_libs
:
toolchain
=
AndroidNdkToolchain
(
use_cxx
=
x
.
use_cxx
,
use_clang
=
x
.
use_clang
)
toolchain
=
AndroidNdkToolchain
(
tarball_path
,
src_path
,
build_path
,
use_cxx
=
x
.
use_cxx
,
use_clang
=
x
.
use_clang
)
if
not
x
.
is_installed
(
toolchain
):
x
.
build
(
toolchain
)
# configure and build MPD
toolchain
=
AndroidNdkToolchain
(
use_cxx
=
True
,
use_clang
=
True
)
toolchain
=
AndroidNdkToolchain
(
tarball_path
,
src_path
,
build_path
,
use_cxx
=
True
,
use_clang
=
True
)
configure
=
[
os
.
path
.
join
(
mpd_path
,
'configure'
),
...
...
win32/build.py
View file @
86486336
...
...
@@ -30,8 +30,12 @@ build_path = os.path.join(arch_path, 'build')
root_path
=
os
.
path
.
join
(
arch_path
,
'root'
)
class
CrossGccToolchain
:
def
__init__
(
self
,
toolchain_path
,
arch
,
install_prefix
):
def
__init__
(
self
,
toolchain_path
,
arch
,
tarball_path
,
src_path
,
build_path
,
install_prefix
):
self
.
arch
=
arch
self
.
tarball_path
=
tarball_path
self
.
src_path
=
src_path
self
.
build_path
=
build_path
self
.
install_prefix
=
install_prefix
toolchain_bin
=
os
.
path
.
join
(
toolchain_path
,
'bin'
)
...
...
@@ -80,11 +84,11 @@ class Project:
self
.
md5
=
md5
self
.
installed
=
installed
def
download
(
self
):
return
download_and_verify
(
self
.
url
,
self
.
md5
,
tarball_path
)
def
download
(
self
,
toolchain
):
return
download_and_verify
(
self
.
url
,
self
.
md5
,
t
oolchain
.
t
arball_path
)
def
is_installed
(
self
,
toolchain
):
tarball
=
self
.
download
()
tarball
=
self
.
download
(
toolchain
)
installed
=
os
.
path
.
join
(
toolchain
.
install_prefix
,
self
.
installed
)
tarball_mtime
=
os
.
path
.
getmtime
(
tarball
)
try
:
...
...
@@ -92,16 +96,15 @@ class Project:
except
FileNotFoundError
:
return
False
def
unpack
(
self
,
out_of_tree
=
True
):
global
src_path
,
build_path
def
unpack
(
self
,
toolchain
,
out_of_tree
=
True
):
if
out_of_tree
:
parent_path
=
src_path
parent_path
=
toolchain
.
src_path
else
:
parent_path
=
build_path
return
untar
(
self
.
download
(),
parent_path
,
self
.
base
)
parent_path
=
toolchain
.
build_path
return
untar
(
self
.
download
(
toolchain
),
parent_path
,
self
.
base
)
def
make_build_path
(
self
):
path
=
os
.
path
.
join
(
build_path
,
self
.
base
)
def
make_build_path
(
self
,
toolchain
):
path
=
os
.
path
.
join
(
toolchain
.
build_path
,
self
.
base
)
try
:
shutil
.
rmtree
(
path
)
except
FileNotFoundError
:
...
...
@@ -120,14 +123,14 @@ class AutotoolsProject(Project):
self
.
cppflags
=
cppflags
def
build
(
self
,
toolchain
):
src
=
self
.
unpack
()
src
=
self
.
unpack
(
toolchain
)
if
self
.
autogen
:
subprocess
.
check_call
([
'/usr/bin/aclocal'
],
cwd
=
src
)
subprocess
.
check_call
([
'/usr/bin/automake'
,
'--add-missing'
,
'--force-missing'
,
'--foreign'
],
cwd
=
src
)
subprocess
.
check_call
([
'/usr/bin/autoconf'
],
cwd
=
src
)
subprocess
.
check_call
([
'/usr/bin/libtoolize'
,
'--force'
],
cwd
=
src
)
build
=
self
.
make_build_path
()
build
=
self
.
make_build_path
(
toolchain
)
configure
=
[
os
.
path
.
join
(
src
,
'configure'
),
...
...
@@ -157,7 +160,7 @@ class ZlibProject(Project):
Project
.
__init__
(
self
,
url
,
md5
,
installed
,
**
kwargs
)
def
build
(
self
,
toolchain
):
src
=
self
.
unpack
(
out_of_tree
=
False
)
src
=
self
.
unpack
(
toolchain
,
out_of_tree
=
False
)
subprocess
.
check_call
([
'/usr/bin/make'
,
'--quiet'
,
'-f'
,
'win32/Makefile.gcc'
,
...
...
@@ -179,8 +182,8 @@ class FfmpegProject(Project):
self
.
cppflags
=
cppflags
def
build
(
self
,
toolchain
):
src
=
self
.
unpack
()
build
=
self
.
make_build_path
()
src
=
self
.
unpack
(
toolchain
)
build
=
self
.
make_build_path
(
toolchain
)
configure
=
[
os
.
path
.
join
(
src
,
'configure'
),
...
...
@@ -215,7 +218,7 @@ class BoostProject(Project):
**
kwargs
)
def
build
(
self
,
toolchain
):
src
=
self
.
unpack
()
src
=
self
.
unpack
(
toolchain
)
# install the headers manually; don't build any library
# (because right now, we only use header-only libraries)
...
...
@@ -332,7 +335,8 @@ thirdparty_libs = [
]
# build the third-party libraries
toolchain
=
CrossGccToolchain
(
'/usr'
,
host_arch
,
root_path
)
toolchain
=
CrossGccToolchain
(
'/usr'
,
host_arch
,
tarball_path
,
src_path
,
build_path
,
root_path
)
for
x
in
thirdparty_libs
:
if
not
x
.
is_installed
(
toolchain
):
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment