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
2daa3eb6
Commit
2daa3eb6
authored
Nov 20, 2015
by
Max Kellermann
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
{android,win32}/build.py: add toolchain classes
parent
3079aa1f
Expand all
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
82 additions
and
78 deletions
+82
-78
build.py
android/build.py
+0
-0
build.py
win32/build.py
+82
-78
No files found.
android/build.py
View file @
2daa3eb6
This diff is collapsed.
Click to expand it.
win32/build.py
View file @
2daa3eb6
...
...
@@ -30,27 +30,30 @@ arch_path = os.path.join(lib_path, host_arch)
build_path
=
os
.
path
.
join
(
arch_path
,
'build'
)
root_path
=
os
.
path
.
join
(
arch_path
,
'root'
)
# redirect pkg-config to use our root directory instead of the default
# one on the build host
os
.
environ
[
'PKG_CONFIG_LIBDIR'
]
=
os
.
path
.
join
(
root_path
,
'lib/pkgconfig'
)
gcc_toolchain
=
'/usr'
def
select_toolchain
():
global
cc
,
cxx
,
ar
,
nm
,
strip
,
cflags
,
cxxflags
,
cppflags
,
ldflags
,
libs
target_arch
=
''
cc
=
os
.
path
.
join
(
gcc_toolchain
,
'bin'
,
host_arch
+
'-gcc'
)
cxx
=
os
.
path
.
join
(
gcc_toolchain
,
'bin'
,
host_arch
+
'-g++'
)
ar
=
os
.
path
.
join
(
gcc_toolchain
,
'bin'
,
host_arch
+
'-ar'
)
nm
=
os
.
path
.
join
(
gcc_toolchain
,
'bin'
,
host_arch
+
'-nm'
)
strip
=
os
.
path
.
join
(
gcc_toolchain
,
'bin'
,
host_arch
+
'-strip'
)
cflags
=
'-O2 -g '
+
target_arch
cxxflags
=
'-O2 -g '
+
target_arch
cppflags
=
'-I'
+
root_path
+
'/include'
ldflags
=
'-L'
+
root_path
+
'/lib'
libs
=
''
class
CrossGccToolchain
:
def
__init__
(
self
,
toolchain_path
,
arch
,
install_prefix
):
self
.
arch
=
arch
self
.
install_prefix
=
install_prefix
toolchain_bin
=
os
.
path
.
join
(
toolchain_path
,
'bin'
)
self
.
cc
=
os
.
path
.
join
(
toolchain_bin
,
arch
+
'-gcc'
)
self
.
cxx
=
os
.
path
.
join
(
toolchain_bin
,
arch
+
'-g++'
)
self
.
ar
=
os
.
path
.
join
(
toolchain_bin
,
arch
+
'-ar'
)
self
.
nm
=
os
.
path
.
join
(
toolchain_bin
,
arch
+
'-nm'
)
self
.
strip
=
os
.
path
.
join
(
toolchain_bin
,
arch
+
'-strip'
)
common_flags
=
''
self
.
cflags
=
'-O2 -g '
+
common_flags
self
.
cxxflags
=
'-O2 -g '
+
common_flags
self
.
cppflags
=
'-isystem '
+
os
.
path
.
join
(
install_prefix
,
'include'
)
self
.
ldflags
=
'-L'
+
os
.
path
.
join
(
root_path
,
'lib'
)
self
.
libs
=
''
self
.
env
=
dict
(
os
.
environ
)
# redirect pkg-config to use our root directory instead of the
# default one on the build host
self
.
env
[
'PKG_CONFIG_LIBDIR'
]
=
os
.
path
.
join
(
install_prefix
,
'lib/pkgconfig'
)
def
file_md5
(
path
):
"""Calculate the MD5 checksum of a file and return it in hexadecimal notation."""
...
...
@@ -116,10 +119,9 @@ class Project:
def
download
(
self
):
return
download_tarball
(
self
.
url
,
self
.
md5
)
def
is_installed
(
self
):
global
root_path
def
is_installed
(
self
,
toolchain
):
tarball
=
self
.
download
()
installed
=
os
.
path
.
join
(
root_path
,
self
.
installed
)
installed
=
os
.
path
.
join
(
toolchain
.
install_prefix
,
self
.
installed
)
tarball_mtime
=
os
.
path
.
getmtime
(
tarball
)
try
:
return
os
.
path
.
getmtime
(
installed
)
>=
tarball_mtime
...
...
@@ -161,7 +163,7 @@ class AutotoolsProject(Project):
self
.
autogen
=
autogen
self
.
cppflags
=
cppflags
def
build
(
self
):
def
build
(
self
,
toolchain
):
src
=
self
.
unpack
()
if
self
.
autogen
:
subprocess
.
check_call
([
'/usr/bin/aclocal'
],
cwd
=
src
)
...
...
@@ -171,46 +173,46 @@ class AutotoolsProject(Project):
build
=
self
.
make_build_path
()
select_toolchain
()
configure
=
[
os
.
path
.
join
(
src
,
'configure'
),
'CC='
+
cc
,
'CXX='
+
cxx
,
'CFLAGS='
+
cflags
,
'CXXFLAGS='
+
cxxflags
,
'CPPFLAGS='
+
cppflags
+
' '
+
self
.
cppflags
,
'LDFLAGS='
+
ldflags
,
'LIBS='
+
libs
,
'AR='
+
ar
,
'STRIP='
+
strip
,
'--host='
+
host_
arch
,
'--prefix='
+
root_path
,
'CC='
+
toolchain
.
cc
,
'CXX='
+
toolchain
.
cxx
,
'CFLAGS='
+
toolchain
.
cflags
,
'CXXFLAGS='
+
toolchain
.
cxxflags
,
'CPPFLAGS='
+
toolchain
.
cppflags
+
' '
+
self
.
cppflags
,
'LDFLAGS='
+
toolchain
.
ldflags
,
'LIBS='
+
toolchain
.
libs
,
'AR='
+
toolchain
.
ar
,
'STRIP='
+
toolchain
.
strip
,
'--host='
+
toolchain
.
arch
,
'--prefix='
+
toolchain
.
install_prefix
,
'--enable-silent-rules'
,
]
+
self
.
configure_args
subprocess
.
check_call
(
configure
,
cwd
=
build
)
subprocess
.
check_call
([
'/usr/bin/make'
,
'--quiet'
,
'-j12'
],
cwd
=
build
)
subprocess
.
check_call
([
'/usr/bin/make'
,
'--quiet'
,
'install'
],
cwd
=
build
)
subprocess
.
check_call
(
configure
,
cwd
=
build
,
env
=
toolchain
.
env
)
subprocess
.
check_call
([
'/usr/bin/make'
,
'--quiet'
,
'-j12'
],
cwd
=
build
,
env
=
toolchain
.
env
)
subprocess
.
check_call
([
'/usr/bin/make'
,
'--quiet'
,
'install'
],
cwd
=
build
,
env
=
toolchain
.
env
)
class
ZlibProject
(
Project
):
def
__init__
(
self
,
url
,
md5
,
installed
,
**
kwargs
):
Project
.
__init__
(
self
,
url
,
md5
,
installed
,
**
kwargs
)
def
build
(
self
):
def
build
(
self
,
toolchain
):
src
=
self
.
unpack
(
out_of_tree
=
False
)
select_toolchain
()
subprocess
.
check_call
([
'/usr/bin/make'
,
'--quiet'
,
'-f'
,
'win32/Makefile.gcc'
,
'PREFIX='
+
host_
arch
+
'-'
,
'PREFIX='
+
toolchain
.
arch
+
'-'
,
'-j12'
,
'install'
,
'DESTDIR='
+
root_path
+
'/'
,
'DESTDIR='
+
toolchain
.
install_prefix
+
'/'
,
'INCLUDE_PATH=include'
,
'LIBRARY_PATH=lib'
,
'BINARY_PATH=bin'
,
'SHARED_MODE=1'
],
cwd
=
src
)
cwd
=
src
,
env
=
toolchain
.
env
)
class
FfmpegProject
(
Project
):
def
__init__
(
self
,
url
,
md5
,
installed
,
configure_args
=
[],
...
...
@@ -220,31 +222,32 @@ class FfmpegProject(Project):
self
.
configure_args
=
configure_args
self
.
cppflags
=
cppflags
def
build
(
self
):
def
build
(
self
,
toolchain
):
src
=
self
.
unpack
()
build
=
self
.
make_build_path
()
select_toolchain
()
configure
=
[
os
.
path
.
join
(
src
,
'configure'
),
'--cc='
+
cc
,
'--cxx='
+
cxx
,
'--nm='
+
nm
,
'--extra-cflags='
+
cflags
+
' '
+
cppflags
+
' '
+
self
.
cppflags
,
'--extra-cxxflags='
+
cxxflags
+
' '
+
cppflags
+
' '
+
self
.
cppflags
,
'--extra-ldflags='
+
ldflags
,
'--extra-libs='
+
libs
,
'--ar='
+
ar
,
'--cc='
+
toolchain
.
cc
,
'--cxx='
+
toolchain
.
cxx
,
'--nm='
+
toolchain
.
nm
,
'--extra-cflags='
+
toolchain
.
cflags
+
' '
+
toolchain
.
cppflags
+
' '
+
self
.
cppflags
,
'--extra-cxxflags='
+
toolchain
.
cxxflags
+
' '
+
toolchain
.
cppflags
+
' '
+
self
.
cppflags
,
'--extra-ldflags='
+
toolchain
.
ldflags
,
'--extra-libs='
+
toolchain
.
libs
,
'--ar='
+
toolchain
.
ar
,
'--enable-cross-compile'
,
'--arch=x86'
,
'--target-os=mingw32'
,
'--cross-prefix='
+
host_
arch
+
'-'
,
'--prefix='
+
root_path
,
'--cross-prefix='
+
toolchain
.
arch
+
'-'
,
'--prefix='
+
toolchain
.
install_prefix
,
]
+
self
.
configure_args
subprocess
.
check_call
(
configure
,
cwd
=
build
)
subprocess
.
check_call
([
'/usr/bin/make'
,
'--quiet'
,
'-j12'
],
cwd
=
build
)
subprocess
.
check_call
([
'/usr/bin/make'
,
'--quiet'
,
'install'
],
cwd
=
build
)
subprocess
.
check_call
(
configure
,
cwd
=
build
,
env
=
toolchain
.
env
)
subprocess
.
check_call
([
'/usr/bin/make'
,
'--quiet'
,
'-j12'
],
cwd
=
build
,
env
=
toolchain
.
env
)
subprocess
.
check_call
([
'/usr/bin/make'
,
'--quiet'
,
'install'
],
cwd
=
build
,
env
=
toolchain
.
env
)
class
BoostProject
(
Project
):
def
__init__
(
self
,
url
,
md5
,
installed
,
...
...
@@ -255,12 +258,12 @@ class BoostProject(Project):
name
=
'boost'
,
version
=
version
,
**
kwargs
)
def
build
(
self
):
def
build
(
self
,
toolchain
):
src
=
self
.
unpack
()
# install the headers manually; don't build any library
# (because right now, we only use header-only libraries)
includedir
=
os
.
path
.
join
(
root_path
,
'include'
)
includedir
=
os
.
path
.
join
(
toolchain
.
install_prefix
,
'include'
)
for
dirpath
,
dirnames
,
filenames
in
os
.
walk
(
os
.
path
.
join
(
src
,
'boost'
)):
relpath
=
dirpath
[
len
(
src
)
+
1
:]
destdir
=
os
.
path
.
join
(
includedir
,
relpath
)
...
...
@@ -373,26 +376,27 @@ thirdparty_libs = [
]
# build the third-party libraries
toolchain
=
CrossGccToolchain
(
'/usr'
,
host_arch
,
root_path
)
for
x
in
thirdparty_libs
:
if
not
x
.
is_installed
():
x
.
build
()
if
not
x
.
is_installed
(
toolchain
):
x
.
build
(
toolchain
)
# configure and build MPD
select_toolchain
()
configure
=
[
os
.
path
.
join
(
mpd_path
,
'configure'
),
'CC='
+
cc
,
'CXX='
+
cxx
,
'CFLAGS='
+
cflags
,
'CXXFLAGS='
+
cxxflags
,
'CPPFLAGS='
+
cppflags
,
'LDFLAGS='
+
ldflags
+
' -static'
,
'LIBS='
+
libs
,
'AR='
+
ar
,
'STRIP='
+
strip
,
'--host='
+
host_
arch
,
'--prefix='
+
root_path
,
'CC='
+
toolchain
.
cc
,
'CXX='
+
toolchain
.
cxx
,
'CFLAGS='
+
toolchain
.
cflags
,
'CXXFLAGS='
+
toolchain
.
cxxflags
,
'CPPFLAGS='
+
toolchain
.
cppflags
,
'LDFLAGS='
+
toolchain
.
ldflags
+
' -static'
,
'LIBS='
+
toolchain
.
libs
,
'AR='
+
toolchain
.
ar
,
'STRIP='
+
toolchain
.
strip
,
'--host='
+
toolchain
.
arch
,
'--prefix='
+
toolchain
.
install_prefix
,
'--enable-silent-rules'
,
...
...
@@ -400,5 +404,5 @@ configure = [
]
+
configure_args
subprocess
.
check_call
(
configure
)
subprocess
.
check_call
([
'/usr/bin/make'
,
'--quiet'
,
'-j12'
])
subprocess
.
check_call
(
configure
,
env
=
toolchain
.
env
)
subprocess
.
check_call
([
'/usr/bin/make'
,
'--quiet'
,
'-j12'
]
,
env
=
toolchain
.
env
)
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