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.
This commit is contained in:
Gustavo Jose de Sousa 2016-01-07 08:47:58 -02:00 committed by Lucas De Marchi
parent 41e2a8cf1e
commit c90b0e8659
1 changed files with 17 additions and 0 deletions

View File

@ -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 = ''