From c90b0e86599eebf017e81cf64805268efb1708ed Mon Sep 17 00:00:00 2001 From: Gustavo Jose de Sousa Date: Thu, 7 Jan 2016 08:47:58 -0200 Subject: [PATCH] waf: add static_linking tool Some platforms (e.g. bebop) might need to create fully statically linked binaries. This serves to force a program to be statically linked. It has only been tested on GNU compilers, other compilers may have unexpected behavior. --- Tools/ardupilotwaf/static_linking.py | 17 +++++++++++++++++ 1 file changed, 17 insertions(+) create mode 100644 Tools/ardupilotwaf/static_linking.py diff --git a/Tools/ardupilotwaf/static_linking.py b/Tools/ardupilotwaf/static_linking.py new file mode 100644 index 0000000000..3402ee0b6c --- /dev/null +++ b/Tools/ardupilotwaf/static_linking.py @@ -0,0 +1,17 @@ +#!/usr/bin/env python +# encoding: utf-8 + +""" +WAF Tool to force programs to be statically linked +""" + +from waflib.TaskGen import after_method, feature + +@feature('static_linking') +@after_method('apply_link') +def force_static_linking(self): + env = self.link_task.env + env.STLIB += env.LIB + env.LIB = [] + env.STLIB_MARKER = '-static' + env.SHLIB_MARKER = ''