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
786ac87b
Commit
786ac87b
authored
May 12, 2018
by
Max Kellermann
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
python/build: add support for Meson/ninja based projects
parent
c76f4ac8
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
95 additions
and
0 deletions
+95
-0
meson.py
python/build/meson.py
+95
-0
No files found.
python/build/meson.py
0 → 100644
View file @
786ac87b
import
os.path
,
subprocess
,
sys
from
build.project
import
Project
class
MesonProject
(
Project
):
def
__init__
(
self
,
url
,
md5
,
installed
,
configure_args
=
[],
**
kwargs
):
Project
.
__init__
(
self
,
url
,
md5
,
installed
,
**
kwargs
)
self
.
configure_args
=
configure_args
def
_make_cross_file
(
self
,
toolchain
):
if
toolchain
.
is_windows
:
system
=
'windows'
else
:
system
=
'linux'
if
toolchain
.
is_arm
:
cpu_family
=
'arm'
if
toolchain
.
is_armv7
:
cpu
=
'armv7'
else
:
cpu
=
'armv6'
else
:
cpu_family
=
'x86'
if
'x86_64'
in
toolchain
.
arch
:
cpu
=
'x86_64'
else
:
cpu
=
'i686'
# TODO: support more CPUs
endian
=
'little'
# TODO: write pkg-config wrapper
path
=
os
.
path
.
join
(
toolchain
.
build_path
,
'meson.cross'
)
with
open
(
path
,
'w'
)
as
f
:
f
.
write
(
"""
[binaries]
c = '
%
s'
cpp = '
%
s'
ar = '
%
s'
strip = '
%
s'
[properties]
root = '
%
s'
c_args =
%
s
c_link_args =
%
s
cpp_args =
%
s
cpp_link_args =
%
s
[host_machine]
system = '
%
s'
cpu_family = '
%
s'
cpu = '
%
s'
endian = '
%
s'
"""
%
(
toolchain
.
cc
,
toolchain
.
cxx
,
toolchain
.
ar
,
toolchain
.
strip
,
toolchain
.
install_prefix
,
repr
((
toolchain
.
cppflags
+
' '
+
toolchain
.
cflags
)
.
split
()),
repr
(
toolchain
.
ldflags
.
split
()),
repr
((
toolchain
.
cppflags
+
' '
+
toolchain
.
cxxflags
)
.
split
()),
repr
(
toolchain
.
ldflags
.
split
()),
system
,
cpu_family
,
cpu
,
endian
))
return
path
def
configure
(
self
,
toolchain
):
src
=
self
.
unpack
(
toolchain
)
cross_file
=
self
.
_make_cross_file
(
toolchain
)
build
=
self
.
make_build_path
(
toolchain
)
configure
=
[
'meson'
,
src
,
build
,
'--prefix'
,
toolchain
.
install_prefix
,
# this is necessary because Meson uses Debian's build machine
# MultiArch path (e.g. "lib/x86_64-linux-gnu") for cross
# builds, which is obviously wrong
'--libdir'
,
'lib'
,
'--buildtype'
,
'plain'
,
'--default-library=static'
,
'--cross-file'
,
cross_file
,
]
+
self
.
configure_args
subprocess
.
check_call
(
configure
,
env
=
toolchain
.
env
)
return
build
def
build
(
self
,
toolchain
):
build
=
self
.
configure
(
toolchain
)
subprocess
.
check_call
([
'ninja'
,
'install'
],
cwd
=
build
,
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