From ec2ef467c8fb8cd642d5155fbbafd1cebd7acbd3 Mon Sep 17 00:00:00 2001 From: Takuya ASADA Date: Mon, 25 Apr 2016 23:27:39 +0900 Subject: [PATCH] configure.py: configure.py: add --static-thrift option to link libthrift statically This is needed for Ubuntu packaging, to drop dependency to libthrift0 on installation time. Signed-off-by: Takuya ASADA Message-Id: <1461594460-2403-1-git-send-email-syuu@scylladb.com> --- configure.py | 10 ++++++++-- 1 file changed, 8 insertions(+), 2 deletions(-) diff --git a/configure.py b/configure.py index 52f62789d7..d5ca3dd996 100755 --- a/configure.py +++ b/configure.py @@ -255,6 +255,8 @@ arg_parser.add_argument('--debuginfo', action = 'store', dest = 'debuginfo', typ help = 'Enable(1)/disable(0)compiler debug information generation') arg_parser.add_argument('--static-stdc++', dest = 'staticcxx', action = 'store_true', help = 'Link libgcc and libstdc++ statically') +arg_parser.add_argument('--static-thrift', dest = 'staticthrift', action = 'store_true', + help = 'Link libthrift statically') arg_parser.add_argument('--tests-debuginfo', action = 'store', dest = 'tests_debuginfo', type = int, default = 0, help = 'Enable(1)/disable(0)compiler debug information generation for tests') arg_parser.add_argument('--python', action = 'store', dest = 'python', default = 'python3', @@ -722,6 +724,10 @@ user_cflags = args.user_cflags user_ldflags = args.user_ldflags if args.staticcxx: user_ldflags += " -static-libgcc -static-libstdc++" +if args.staticthrift: + thrift_libs = "-Wl,-Bstatic -lthrift -Wl,-Bdynamic" +else: + thrift_libs = "-lthrift" outdir = 'build' buildfile = 'build.ninja' @@ -832,14 +838,14 @@ with open(buildfile, 'w') as f: f.write('build $builddir/{}/{}: {}.{} {} {}\n'.format(mode, binary, tests_link_rule, mode, str.join(' ', objs), 'seastar/build/{}/libseastar.a'.format(mode))) if has_thrift: - f.write(' libs = -lthrift -lboost_system $libs\n') + f.write(' libs = {} -lboost_system $libs\n'.format(thrift_libs)) f.write('build $builddir/{}/{}_g: link.{} {} {}\n'.format(mode, binary, mode, str.join(' ', objs), 'seastar/build/{}/libseastar.a'.format(mode))) else: f.write('build $builddir/{}/{}: link.{} {} {}\n'.format(mode, binary, mode, str.join(' ', objs), 'seastar/build/{}/libseastar.a'.format(mode))) if has_thrift: - f.write(' libs = -lthrift -lboost_system $libs\n') + f.write(' libs = {} -lboost_system $libs\n'.format(thrift_libs)) for src in srcs: if src.endswith('.cc'): obj = '$builddir/' + mode + '/' + src.replace('.cc', '.o')