Skip to content

Instantly share code, notes, and snippets.

Show Gist options
  • Select an option

  • Save shimondoodkin/543104 to your computer and use it in GitHub Desktop.

Select an option

Save shimondoodkin/543104 to your computer and use it in GitHub Desktop.
i can build a simple pango cairo program with
cc -o pangocairo $(pkg-config --cflags --libs pangocairo) pangocairo.c
how to add a lib pangociro to waf script
shimon@shimon-desktop:~/Documents/corcpptest/node-async$ cat wscript
import Options
from os import unlink, symlink, popen
from os.path import exists
#import TaskGen, Utils, Utils, Runner, Options, Build
#from TaskGen import extension, taskgen, before, after, feature
#from Configure import conf, conftest
srcdir = "."
blddir = "build"
VERSION = "0.0.1"
def set_options(opt):
opt.tool_options("compiler_cxx")
def configure(conf):
conf.check_tool("compiler_cxx")
conf.check_tool("node_addon")
if not conf.check_cfg(package='pangocairo', args='--cflags --libs', uselib_store='PANGOCAIRO'):
conf.fatal("can't check cfg pangocairo ...")
conf.write_config_header('config.h')
# else:
# conf.fatal(PANGOCAIRO)
# -I/usr/include/pango-1.0
# -I/usr/include/cairo
# -I/usr/include/glib-2.0
# -I/usr/lib/glib-2.0/include
# -I/usr/include/pixman-1
# -I/usr/include/freetype2
# -I/usr/include/directfb
# -I/usr/include/libpng12
# -lpangocairo-1.0
# -lpango-1.0
# -lcairo
# -lgobject-2.0
# -lgmodule-2.0
# -lgthread-2.0
# -lrt
# -lglib-2.0
# libpangocairo = conf.check_cc(lib='ssl',
# header_name='openssl/ssl.h',
# function_name='SSL_library_init',
# libpath=['/usr/lib', '/usr/local/lib', '/opt/local/lib', '/usr/sfw/lib'],
# uselib_store='OPENSSL')
def build(bld):
obj = bld.new_task_gen("cxx", "shlib", "node_addon")
obj.target = "pangocairo"
obj.source = "pangocairo.C"
# obj.lib="pangocairo"
obj.uselibs = "PANGOCAIRO"
obj.cxxflags = ["-D_FILE_OFFSET_BITS=64", "-D_LARGEFILE_SOURCE"]
def shutdown():
if Options.commands['clean']:
if exists('pangocairo.node'): unlink('pangocairo.node')
else:
if exists('build/default/pangocairo.node') and not exists('pangocairo.node'):
symlink('build/default/pangocairo.node', 'pangocairo.node')
shimon@shimon-desktop:~/Documents/corcpptest/node-async$ cat build/c4che/build.config.py
version = 0x105016
tools = [{'tool': 'ar', 'tooldir': None, 'funs': None}, {'tool': 'cxx', 'tooldir': None, 'funs': None}, {'tool': 'gxx', 'tooldir': None, 'funs': None}, {'tool': 'compiler_cxx', 'tooldir': None, 'funs': None}, {'tool': 'node_addon', 'tooldir': None, 'funs': None}]
shimon@shimon-desktop:~/Documents/corcpptest/node-async$ cat build/c4che/default.cache.py
AR = '/usr/bin/ar'
ARFLAGS = 'rcs'
CCDEFINES_PANGOCAIRO = ['_REENTRANT']
CCFLAGS = ['-g']
CCFLAGS_MACBUNDLE = ['-fPIC']
CCFLAGS_PANGOCAIRO = ['-pthread']
CC_VERSION = ('4', '4', '3')
COMPILER_CXX = 'g++'
CPP = '/usr/bin/cpp'
CPPFLAGS_NODE = '-DEV_MULTIPLICITY=0'
CPPPATH_NODE = '/usr/local/include/node'
CPPPATH_PANGOCAIRO = ['/usr/include/pango-1.0', '/usr/include/cairo', '/usr/include/glib-2.0', '/usr/lib/glib-2.0/include', '/usr/include/pixman-1', '/usr/include/freetype2', '/usr/include/directfb', '/usr/include/libpng12']
CPPPATH_ST = '-I%s'
CXX = ['/usr/bin/g++']
CXXDEFINES_PANGOCAIRO = ['_REENTRANT']
CXXDEFINES_ST = '-D%s'
CXXFLAGS = ['-g']
CXXFLAGS_DEBUG = ['-g']
CXXFLAGS_PANGOCAIRO = ['-pthread']
CXXFLAGS_RELEASE = ['-O2']
CXXLNK_SRC_F = ''
CXXLNK_TGT_F = ['-o', '']
CXX_NAME = 'gcc'
CXX_SRC_F = ''
CXX_TGT_F = ['-c', '-o', '']
DEST_BINFMT = 'elf'
DEST_CPU = 'x86'
DEST_OS = 'linux'
FULLSTATIC_MARKER = '-static'
HAVE_PANGOCAIRO = 1
LIBDIR = '/home/shimon/.node_libraries'
LIBPATH_NODE = '/usr/local/lib'
LIBPATH_ST = '-L%s'
LIB_PANGOCAIRO = ['pangocairo-1.0', 'pango-1.0', 'cairo', 'gobject-2.0', 'gmodule-2.0', 'gthread-2.0', 'rt', 'glib-2.0']
LIB_ST = '-l%s'
LINKFLAGS_MACBUNDLE = ['-bundle', '-undefined', 'dynamic_lookup']
LINKFLAGS_PANGOCAIRO = ['-pthread']
LINK_CXX = ['/usr/bin/g++']
NODE_PATH = '/home/shimon/.node_libraries'
PREFIX = '/usr/local'
PREFIX_NODE = '/usr/local'
RANLIB = '/usr/bin/ranlib'
RPATH_ST = '-Wl,-rpath,%s'
SHLIB_MARKER = '-Wl,-Bdynamic'
SONAME_ST = '-Wl,-h,%s'
STATICLIBPATH_ST = '-L%s'
STATICLIB_MARKER = '-Wl,-Bstatic'
STATICLIB_ST = '-l%s'
cfg_files = ['config.h']
defines = {'HAVE_PANGOCAIRO': 1}
macbundle_PATTERN = '%s.bundle'
program_PATTERN = '%s'
shlib_CXXFLAGS = ['-fPIC', '-DPIC']
shlib_LINKFLAGS = ['-shared']
shlib_PATTERN = 'lib%s.so'
staticlib_LINKFLAGS = ['-Wl,-Bstatic']
staticlib_PATTERN = 'lib%s.a'
shimon@shimon-desktop:~/Documents/corcpptest/node-async$ cat build/default/config.h
/* Configuration header created by Waf - do not edit */
#ifndef _CONFIG_H_WAF
#define _CONFIG_H_WAF
#define HAVE_PANGOCAIRO 1
#endif /* _CONFIG_H_WAF */
shimon@shimon-desktop:~/Documents/corcpptest/node-async$ cat build/
c4che/ config.log default/
shimon@shimon-desktop:~/Documents/corcpptest/node-async$ cat build/
c4che/ config.log default/
shimon@shimon-desktop:~/Documents/corcpptest/node-async$ cat build/config.log
# project noname (0.0.1) configured on Sun Aug 22 05:07:38 2010 by
# waf 1.5.16 (abi 7, python 20605f0 on linux2)
# using /usr/local/bin/node-waf configure
#
----------------------------------------
Checking for program g++ or c++
find program=['g++', 'c++'] paths=[] var='CXX'
-> '/usr/bin/g++'
----------------------------------------
Checking for program cpp
find program=['cpp'] paths=[] var='CPP'
-> '/usr/bin/cpp'
----------------------------------------
Checking for program ar
find program=['ar'] paths=[] var='AR'
-> '/usr/bin/ar'
----------------------------------------
Checking for program ranlib
find program=['ranlib'] paths=[] var='RANLIB'
-> '/usr/bin/ranlib'
----------------------------------------
Checking for g++
ok
----------------------------------------
Checking for node path
not found
----------------------------------------
Checking for node prefix
ok /usr/local
----------------------------------------
Checking for pangocairo
pkg-config --errors-to-stdout --print-errors --cflags --libs pangocairo
-pthread -D_REENTRANT -I/usr/include/pango-1.0 -I/usr/include/cairo -I/usr/include/glib-2.0 -I/usr/lib/glib-2.0/include -I/usr/include/pixman-1 -I/usr/include/freetype2 -I/usr/include/directfb -I/usr/include/libpng12 -pthread -lpangocairo-1.0 -lpango-1.0 -lcairo -lgobject-2.0 -lgmodule-2.0 -lgthread-2.0 -lrt -lglib-2.0
yes
shimon@shimon-desktop:~/Documents/corcpptest/node-async$ node-waf configure
Checking for program g++ or c++ : /usr/bin/g++
Checking for program cpp : /usr/bin/cpp
Checking for program ar : /usr/bin/ar
Checking for program ranlib : /usr/bin/ranlib
Checking for g++ : ok
Checking for node path : not found
Checking for node prefix : ok /usr/local
Checking for pangocairo : yes
'configure' finished successfully (0.224s)
shimon@shimon-desktop:~/Documents/corcpptest/node-async$ node-waf build
Waf: Entering directory `/home/shimon/Documents/corcpptest/node-async/build'
[1/2] cxx: pangocairo.C -> build/default/pangocairo_1.o
../pangocairo.C:14:30: error: pango/pangocairo.h: No such file or directory
../pangocairo.C:16: error: variable or field ‘fancy_cairo_stroke’ declared void
../pangocairo.C:16: error: ‘cairo_t’ was not declared in this scope
../pangocairo.C:16: error: ‘cr’ was not declared in this scope
../pangocairo.C:17: error: variable or field ‘fancy_cairo_stroke_preserve’ declared void
../pangocairo.C:17: error: ‘cairo_t’ was not declared in this scope
../pangocairo.C:17: error: ‘cr’ was not declared in this scope
../pangocairo.C:23: error: variable or field ‘_fancy_cairo_stroke’ declared void
../pangocairo.C:23: error: ‘cairo_t’ was not declared in this scope
../pangocairo.C:23: error: ‘cr’ was not declared in this scope
../pangocairo.C:23: error: ‘cairo_bool_t’ was not declared in this scope
Waf: Leaving directory `/home/shimon/Documents/corcpptest/node-async/build'
Build failed: -> task failed (err #1):
{task: cxx pangocairo.C -> pangocairo_1.o}
@shimondoodkin

Copy link
Copy Markdown
Author

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment