Generate pkg-config for Hammer
Create a pkg-config file and install it to $prefix/lib/pkgconfig
This commit is contained in:
parent
76b445ddb1
commit
f220524b5a
5 changed files with 30 additions and 2 deletions
|
|
@ -8,7 +8,7 @@ vars = Variables(None, ARGUMENTS)
|
|||
vars.Add(PathVariable('DESTDIR', "Root directory to install in (useful for packaging scripts)", None, PathVariable.PathIsDirCreate))
|
||||
vars.Add(PathVariable('prefix', "Where to install in the FHS", "/usr/local", PathVariable.PathAccept))
|
||||
|
||||
env = Environment(ENV = {'PATH' : os.environ['PATH']}, variables = vars)
|
||||
env = Environment(ENV = {'PATH' : os.environ['PATH']}, variables = vars, tools=['default', 'scanreplace'], toolpath=['tools'])
|
||||
|
||||
def calcInstallPath(*elements):
|
||||
path = os.path.abspath(os.path.join(*map(env.subst, elements)))
|
||||
|
|
@ -28,7 +28,8 @@ if 'DESTDIR' in env:
|
|||
|
||||
env['libpath'] = calcInstallPath("$prefix", "lib")
|
||||
env['incpath'] = calcInstallPath("$prefix", "include", "hammer")
|
||||
# TODO: Add pkgconfig
|
||||
env['pkgconfigpath'] = calcInstallPath("$prefix", "lib", "pkgconfig")
|
||||
env.ScanReplace('libhammer.pc.in')
|
||||
|
||||
env.MergeFlags("-std=gnu99 -Wall -Wextra -Werror -Wno-unused-parameter -Wno-attributes")
|
||||
|
||||
|
|
@ -89,3 +90,4 @@ env.Command('test', 'build/$VARIANT/src/test_suite', 'env LD_LIBRARY_PATH=build/
|
|||
|
||||
env.Alias("install", "$libpath")
|
||||
env.Alias("install", "$incpath")
|
||||
env.Alias("install", "$pkgconfigpath")
|
||||
|
|
|
|||
10
libhammer.pc.in
Normal file
10
libhammer.pc.in
Normal file
|
|
@ -0,0 +1,10 @@
|
|||
prefix=/usr
|
||||
exec_prefix=${prefix}
|
||||
includedir=${prefix}/include
|
||||
libdir=${exec_prefix}/lib
|
||||
|
||||
Name: libhammer
|
||||
Description: The Hammer parsing library
|
||||
Version: 0.9.0
|
||||
Cflags: -I${includedir}/hammer
|
||||
Libs: -L${libdir} -lhammer
|
||||
|
|
@ -64,6 +64,7 @@ libhammer_static = env.StaticLibrary('hammer', parsers + backends + misc_hammer_
|
|||
|
||||
env.Install("$libpath", [libhammer_static, libhammer_shared])
|
||||
env.Install("$incpath", dist_headers)
|
||||
env.Install("$pkgconfigpath", "../../../libhammer.pc")
|
||||
|
||||
testenv = env.Clone()
|
||||
testenv.ParseConfig('pkg-config --cflags --libs glib-2.0')
|
||||
|
|
|
|||
15
tools/scanreplace.py
Normal file
15
tools/scanreplace.py
Normal file
|
|
@ -0,0 +1,15 @@
|
|||
from string import Template
|
||||
|
||||
def replace_action(target, source, env):
|
||||
open(str(target[0]), 'w').write(Template(open(str(source[0]), 'r').read()).safe_substitute(env))
|
||||
return 0
|
||||
|
||||
def replace_string(target, source, env):
|
||||
return "building '%s' from '%s'" % (str(target[0]), str(source[0]))
|
||||
|
||||
def generate(env, **kw):
|
||||
action = env.Action(replace_action, replace_string)
|
||||
env['BUILDERS']['ScanReplace'] = env.Builder(action=action, src_suffix='.in', single_source=True)
|
||||
|
||||
def exists(env):
|
||||
return 1
|
||||
BIN
tools/scanreplace.pyc
Normal file
BIN
tools/scanreplace.pyc
Normal file
Binary file not shown.
Loading…
Add table
Add a link
Reference in a new issue