Meson: Some little fixes (#9783)

* fix shlr libraries names
* fix missing headers for Windows dist
* fix missing format files for Windows dist
* add <static_runtime> option
* add argument with list of additional meson options for sys/meson.py
This commit is contained in:
Paul I 2018-03-31 00:35:12 +03:00 committed by xarkes
parent c4acac59be
commit 4f7687287f
5 changed files with 41 additions and 41 deletions

View File

@ -71,9 +71,9 @@ build_script:
- appveyor AddMessage "Compiling radare2 %R2_VERSION% (%builder%)"
- if %builder% == msvc_cccl_64 ( sys\msvc.bat && make windist WINBITS=%builder% )
- cmd: if %builder% == vs2015_64 ( set "PATH=C:\mingw\bin;C:\mingw\msys\1.0\bin;%PYTHON%;%PATH%" && call "C:\Program Files (x86)\Microsoft Visual Studio 14.0\VC\vcvarsall.bat" x64 && python sys\meson.py --backend vs2015 --release --xp --install="%DIST_FOLDER%" && zip -r %ARTIFACT_ZIP% %DIST_FOLDER% )
- cmd: if %builder% == vs2015_64 ( set "PATH=C:\mingw\bin;C:\mingw\msys\1.0\bin;%PYTHON%;%PATH%" && call "C:\Program Files (x86)\Microsoft Visual Studio 14.0\VC\vcvarsall.bat" x64 && python sys\meson.py --backend vs2015 --release --xp --install="%DIST_FOLDER%" --options static_runtime=true && zip -r %ARTIFACT_ZIP% %DIST_FOLDER% )
- cmd: if %builder% == vs2015_32 ( set "PATH=C:\mingw\bin;C:\mingw\msys\1.0\bin;%PYTHON%;%PATH%" && call "C:\Program Files (x86)\Microsoft Visual Studio 14.0\VC\vcvarsall.bat" x86 && python sys\meson.py --backend vs2015 --release --xp --install="%DIST_FOLDER%" && zip -r %ARTIFACT_ZIP% %DIST_FOLDER% )
- cmd: if %builder% == vs2015_32 ( set "PATH=C:\mingw\bin;C:\mingw\msys\1.0\bin;%PYTHON%;%PATH%" && call "C:\Program Files (x86)\Microsoft Visual Studio 14.0\VC\vcvarsall.bat" x86 && python sys\meson.py --backend vs2015 --release --xp --install="%DIST_FOLDER%" --options static_runtime=true && zip -r %ARTIFACT_ZIP% %DIST_FOLDER% )
- cmd: if %builder% == vs2015_64_dyn ( set "PATH=C:\mingw\bin;C:\mingw\msys\1.0\bin;%PYTHON%;%PATH%" && call "C:\Program Files (x86)\Microsoft Visual Studio 14.0\VC\vcvarsall.bat" x64 && python sys\meson.py --release --shared --install="%DIST_FOLDER%" && zip -r %ARTIFACT_ZIP% %DIST_FOLDER% )

View File

@ -71,23 +71,16 @@ utl = cc.find_library('util', required: false)
mth = cc.find_library('m', required: false)
platform_deps = []
platform_inc = include_directories(['.', 'libr/include'])
platform_inc = ['.', 'libr/include']
if host_machine.system() == 'windows'
platform_deps = [cc.find_library('ws2_32')]
platform_inc = include_directories(['.', 'libr/include', 'libr/include/msvc'])
if get_option('default_library') == 'static'
if get_option('buildtype') == 'release' and not meson.is_subproject()
add_project_arguments('/MT', language: 'c')
endif
message(' ------ WINDOWS VERSION: BUILD STATIC ------')
else
message(' ------ WINDOWS VERSION: BUILD SHARED ------')
endif
elif host_machine.system() == 'linux'
if get_option('default_library') == 'static'
message(' ------ LINUX VERSION: BUILD STATIC ------')
else
message(' ------ LINUX VERSION: BUILD SHARED ------')
platform_inc += ['libr/include/msvc']
endif
platform_inc = include_directories(platform_inc)
if get_option('static_runtime')
if cc.get_id() == 'msvc'
add_project_arguments('/MT', language: 'c')
endif
endif
@ -163,7 +156,7 @@ libr_pc = configure_file(
)
install_data(libr_pc, install_dir: join_paths(get_option('libdir'), 'pkgconfig'))
subdir('shlr/')
subdir('shlr')
subdir('libr/util')
subdir('libr/hash')

1
meson_options.txt Normal file
View File

@ -0,0 +1 @@
option('static_runtime', type: 'boolean', value: false)

View File

@ -9,7 +9,7 @@ bochs_files = [
'bochs/src/libbochs.c'
]
libr2bochs = static_library('libr2bochs', bochs_files,
libr2bochs = static_library('r2bochs', bochs_files,
include_directories: [
platform_inc,
include_directories([
@ -33,7 +33,7 @@ gdb_files = [
'gdb/src/gdbserver/core.c',
]
libr2gdb = static_library('libr2gdb', gdb_files,
libr2gdb = static_library('r2gdb', gdb_files,
include_directories: [
platform_inc,
include_directories([
@ -53,7 +53,7 @@ java_files = [
#'java/main.c',
]
libr2java = static_library('libr2java', java_files,
libr2java = static_library('r2java', java_files,
include_directories: [
platform_inc,
include_directories([
@ -71,7 +71,7 @@ qnx_files = [
'qnx/src/utils.c',
]
libr2qnx = static_library('libr2qnx', qnx_files,
libr2qnx = static_library('r2qnx', qnx_files,
include_directories: [
platform_inc,
include_directories([
@ -87,7 +87,7 @@ tcc_files = [
'tcc/tccpp.c'
]
libr2tcc = static_library('libr2tcc', tcc_files,
libr2tcc = static_library('r2tcc', tcc_files,
include_directories: [
platform_inc,
include_directories([
@ -101,7 +101,7 @@ spp_files = [
'spp/spp.c'
]
libr2spp = static_library('libr2spp', spp_files,
libr2spp = static_library('r2spp', spp_files,
include_directories: [
platform_inc,
include_directories([
@ -135,7 +135,7 @@ sdb_files = [
'sdb/src/util.c'
]
libr2sdb = static_library('libr2sdb', sdb_files,
libr2sdb = static_library('r2sdb', sdb_files,
include_directories: [
platform_inc,
include_directories([
@ -150,7 +150,7 @@ lz4_files = [
'lz4/lz4.c',
]
libr2lz4 = static_library('libr2lz4', lz4_files,
libr2lz4 = static_library('r2lz4', lz4_files,
include_directories: [
platform_inc,
include_directories([
@ -260,7 +260,7 @@ zlib_files = [
'zip/zlib/zutil.c'
]
libr2zip = static_library('libr2zip', zlib_files,
libr2zip = static_library('r2zip', zlib_files,
include_directories: [
platform_inc,
include_directories([
@ -322,7 +322,7 @@ cs_files = [
'capstone/utils.c',
]
libr2capstone = static_library('libr2capstone', cs_files,
libr2capstone = static_library('r2capstone', cs_files,
c_args: [
'-DCAPSTONE_X86_ATT_DISABLE_NO',
'-DCAPSTONE_X86_REDUCE_NO',
@ -400,7 +400,7 @@ grub_files = [
'grub/partmap/sunpc.c',
]
libr2grub = static_library('libr2grub', grub_files,
libr2grub = static_library('r2grub', grub_files,
include_directories: [
platform_inc,
include_directories([
@ -418,7 +418,7 @@ windbg_files = [
'windbg/windbg.c',
]
libr2windbg = static_library('libr2windbg', windbg_files,
libr2windbg = static_library('r2windbg', windbg_files,
include_directories: [
platform_inc,
include_directories([
@ -432,7 +432,7 @@ ar_files = [
'ar/ar.c'
]
libr2ar = static_library('libr2ar', ar_files,
libr2ar = static_library('r2ar', ar_files,
include_directories: [
platform_inc,
include_directories([

View File

@ -168,11 +168,12 @@ def win_dist(args):
PATH_FMT['BUILDDIR'] = builddir
makedirs(r'{DIST}')
copy(r'{BUILDDIR}\binr\**\*.exe', r'{DIST}')
copy(r'{BUILDDIR}\libr\**\*.dll', r'{DIST}')
copy(r'{BUILDDIR}\binr\*\*.exe', r'{DIST}')
copy(r'{BUILDDIR}\libr\*\*.dll', r'{DIST}')
if args.copylib:
copy(r'{BUILDDIR}\libr\**\*.lib', r'{DIST}')
copy(r'{BUILDDIR}\libr\**\*.a', r'{DIST}')
makedirs(r'{DIST}\lib')
copy(r'{BUILDDIR}\libr\*\*.lib', r'{DIST}\lib')
copy(r'{BUILDDIR}\libr\*\*.a', r'{DIST}\lib')
win_dist_libr2()
def win_dist_libr2(**path_fmt):
@ -190,16 +191,15 @@ def win_dist_libr2(**path_fmt):
makedirs(r'{DIST}\include\libr\sdb')
makedirs(r'{DIST}\include\libr\r_util')
copy(r'{ROOT}\libr\include\*.h', r'{DIST}\include\libr')
copy(r'{BUILDDIR}\r_version.h', r'{DIST}\include\libr')
copy(r'{BUILDDIR}\r_userconf.h', r'{DIST}\include\libr')
copy(r'{ROOT}\libr\include\sdb\*.h', r'{DIST}\include\libr\sdb')
copy(r'{ROOT}\libr\include\r_util\*.h', r'{DIST}\include\libr\r_util')
makedirs(r'{DIST}\share\doc\radare2')
copy(r'{ROOT}\doc\fortunes.*', r'{DIST}\share\doc\radare2')
copytree(r'{ROOT}\libr\bin\d', r'{DIST}\share\radare2\{R2_VERSION}\format',
exclude=('Makefile', 'meson.build', 'dll'))
makedirs(r'{DIST}\share\radare2\{R2_VERSION}\format\dll')
copy(r'{ROOT}\libr\bin\d\elf32', r'{DIST}\share\radare2\{R2_VERSION}\format')
copy(r'{ROOT}\libr\bin\d\elf64', r'{DIST}\share\radare2\{R2_VERSION}\format')
copy(r'{ROOT}\libr\bin\d\elf_enums', r'{DIST}\share\radare2\{R2_VERSION}\format')
copy(r'{ROOT}\libr\bin\d\pe32', r'{DIST}\share\radare2\{R2_VERSION}\format')
copy(r'{ROOT}\libr\bin\d\trx', r'{DIST}\share\radare2\{R2_VERSION}\format')
copy(r'{BUILDDIR}\libr\bin\d\*.sdb', r'{DIST}\share\radare2\{R2_VERSION}\format\dll')
copytree(r'{ROOT}\libr\cons\d', r'{DIST}\share\radare2\{R2_VERSION}\cons',
exclude=('Makefile', 'meson.build'))
@ -210,9 +210,10 @@ def build(args):
""" Build radare2 """
log.info('Building radare2')
r2_builddir = os.path.join(ROOT, args.dir)
options = ['-D%s' % x for x in args.options]
if not os.path.exists(r2_builddir):
meson(ROOT, r2_builddir, prefix=args.prefix, backend=args.backend,
release=args.release, shared=args.shared)
release=args.release, shared=args.shared, options=options)
if args.backend != 'ninja':
vs_dedup(r2_builddir)
if args.xp:
@ -261,6 +262,7 @@ def main():
else:
parser.add_argument('--install', action='store_true',
help='Install radare2 after building')
parser.add_argument('--options', nargs='*', default=[])
args = parser.parse_args()
# Check arguments
@ -275,6 +277,10 @@ def main():
sys.exit(1)
if os.name == 'nt' and not args.prefix:
args.prefix = os.path.join(ROOT, args.dir, 'priv_install_dir')
for o in args.options:
if not '=' in o:
log.error('Invalid option: %s', o)
sys.exit(1)
# Build it!
log.debug('Arguments: %s', args)