File: ar.py

package info (click to toggle)
xiphos 4.0.4%2Bdfsg1-1
  • links: PTS, VCS
  • area: main
  • in suites: stretch
  • size: 17,288 kB
  • ctags: 4,500
  • sloc: ansic: 29,213; cpp: 13,069; python: 12,734; xml: 3,170; sh: 39; makefile: 36
file content (26 lines) | stat: -rw-r--r-- 716 bytes parent folder | download | duplicates (14)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
#! /usr/bin/env python
# encoding: utf-8

import os,sys
import Task,Utils
from Configure import conftest
ar_str='${AR} ${ARFLAGS} ${AR_TGT_F}${TGT} ${AR_SRC_F}${SRC}'
cls=Task.simple_task_type('static_link',ar_str,color='YELLOW',ext_in='.o',ext_out='.bin',shell=False)
cls.maxjobs=1
cls.install=Utils.nada
old=cls.run
def wrap(self):
	try:os.remove(self.outputs[0].abspath(self.env))
	except OSError:pass
	return old(self)
setattr(cls,'run',wrap)
def detect(conf):
	conf.find_program('ar',var='AR')
	conf.find_program('ranlib',var='RANLIB')
	conf.env.ARFLAGS='rcs'
def find_ar(conf):
	v=conf.env
	conf.check_tool('ar')
	if not v['AR']:conf.fatal('ar is required for static libraries - not found')

conftest(find_ar)