summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorvarmaa <varmaa@8b7adc99-b347-0410-ae0a-d9e86c8d69b5>2008-05-04 15:50:08 +0000
committervarmaa <varmaa@8b7adc99-b347-0410-ae0a-d9e86c8d69b5>2008-05-04 15:50:08 +0000
commit6db4cac240a61996b29e1cdfe1e6ad0acb82ed8f (patch)
tree2f3a5e7739e3623866df399943f08031e877bc52
parent62e60428a225a040d67facf5b78c1e0a18e350d4 (diff)
downloadenso-6db4cac240a61996b29e1cdfe1e6ad0acb82ed8f.tar.gz
enso-6db4cac240a61996b29e1cdfe1e6ad0acb82ed8f.tar.bz2
The cairo build process is now fully integrated with the rest of the build process on OS X.
git-svn-id: https://enso.googlecode.com/svn/trunk@144 8b7adc99-b347-0410-ae0a-d9e86c8d69b5
-rw-r--r--src/platform/osx/SConscript22
-rw-r--r--src/platform/osx/cairo/SConscript (renamed from src/platform/osx/cairo/SConstruct)29
-rw-r--r--src/platform/osx/pycairo/SConscript8
3 files changed, 36 insertions, 23 deletions
diff --git a/src/platform/osx/SConscript b/src/platform/osx/SConscript
index b3d7de5..ccb0f27 100644
--- a/src/platform/osx/SConscript
+++ b/src/platform/osx/SConscript
@@ -43,20 +43,12 @@ def getOutput( params ):
# cairo
-# Ideally, this would be integrated into this SCons build process, but
-# I ran into some unexpected dependency issues, so I'm just calling a
-# separate SCons instance. -AV
-
-print "Building SCons..."
-retval = subprocess.call(["scons"], cwd=Dir("cairo").abspath)
-if retval != 0:
- raise Exception("Building cairo failed.")
-print "Done."
-
-env.Append(
- CPPPATH = [Dir("cairo/cairo-1.6.4-dist/include/cairo")],
- LIBPATH = [Dir("cairo/cairo-1.6.4-dist/lib")]
- )
+SConscript( "cairo/SConscript", exports="env" )
+Import( "cairo" )
+
+env = env.Copy()
+
+env.Append( CPPPATH = [cairo["include_dir"]], LIBPATH = [cairo["lib_dir"]] )
# Flag needed for Python C extension modules, so that missing
# Python symbols are looked-up (and found) when the module is loaded.
@@ -69,7 +61,7 @@ qcbEnv = env.Copy()
qcbEnv.Append(
CPPPATH=["pycairo"],
LINKFLAGS=FIND_MISSING_SYMS_AT_RUNTIME_FLAGS,
- LIBS=["cairo"],
+ LIBS=[cairo["lib"]],
FRAMEWORKS=["AppKit"],
)
diff --git a/src/platform/osx/cairo/SConstruct b/src/platform/osx/cairo/SConscript
index 7e7b45e..9a5dbef 100644
--- a/src/platform/osx/cairo/SConstruct
+++ b/src/platform/osx/cairo/SConscript
@@ -1,4 +1,4 @@
-env = Environment()
+Import("env")
def download(target, source, env):
import urllib2
@@ -18,8 +18,9 @@ def download(target, source, env):
# Pseudo-builder; ideally we'd use env.AddMethod() for this, but older
# versions of SCons don't support it.
def download_and_build(env, name, libname, configure_flags="",
- dependencies=()):
+ dependencies=(), created_files=()):
tarball = "%s.tar.gz" % name
+ thisdir = Dir(".")
srcdir = Dir(name)
builddir = Dir("%s-build" % name)
distdir = Dir("%s-dist" % name)
@@ -32,7 +33,8 @@ def download_and_build(env, name, libname, configure_flags="",
env.Command(
configure,
tarball,
- "tar -zxvf ${SOURCE}"
+ "tar -zxvf ${SOURCE.abspath} -C ${THISDIR}",
+ THISDIR = thisdir
)
env.Clean(configure, srcdir)
@@ -41,7 +43,7 @@ def download_and_build(env, name, libname, configure_flags="",
configure,
"mkdir -p ${BUILDDIR} && "
"cd ${BUILDDIR} && "
- "../${SRCDIR}/configure --prefix=${DISTDIR.abspath} "
+ "${SRCDIR.abspath}/configure --prefix=${DISTDIR.abspath} "
' LDFLAGS="-header-pad_max_install_names" ${CONFIGURE_FLAGS}',
SRCDIR = srcdir,
BUILDDIR = builddir,
@@ -53,8 +55,13 @@ def download_and_build(env, name, libname, configure_flags="",
for dependency in dependencies:
env.Depends(makefile, dependency)
+ buildtargets = [lib]
+ for filename in created_files:
+ absfilename = "/".join([distdir.abspath, filename])
+ buildtargets.append(File(absfilename))
+
env.Command(
- lib,
+ buildtargets,
makefile,
"cd ${BUILDDIR} && make && make install",
BUILDDIR = builddir
@@ -84,5 +91,15 @@ cairo_lib, cairo_dir = download_and_build(
'PKG_CONFIG="%(fake_pkgconfig)s"' % \
{"pixman_dir" : pixman_dir.abspath,
"fake_pkgconfig" : fake_pkgconfig.abspath},
- dependencies = [pixman_lib]
+ dependencies = [pixman_lib],
+ created_files = ["include/cairo/cairo.h"]
)
+
+cairo = {
+ "lib" : cairo_lib,
+ "include_dir" : Dir("%s/include/cairo" % cairo_dir.abspath),
+ "lib_dir" : Dir("%s/lib" % cairo_dir.abspath),
+ "include_file" : File("%s/include/cairo/cairo.h" % cairo_dir.abspath),
+ }
+
+Export("cairo")
diff --git a/src/platform/osx/pycairo/SConscript b/src/platform/osx/pycairo/SConscript
index 7daa390..bd8ae5b 100644
--- a/src/platform/osx/pycairo/SConscript
+++ b/src/platform/osx/pycairo/SConscript
@@ -1,4 +1,5 @@
Import( "pycairoEnv" )
+Import( "cairo" )
import glob
@@ -6,10 +7,13 @@ sourceList = [
glob.glob( "*.c" )
]
+objects = pycairoEnv.SharedObject( sourceList )
+pycairoEnv.Depends( objects, cairo["include_file"] )
+
pycairoLib = pycairoEnv.LoadableModule(
target="_cairo.so",
- source=sourceList,
- LIBS=["python", "cairo"]
+ source=objects,
+ LIBS=["python", cairo["lib"]]
)
pycairoEnv.Install( "#enso/platform/osx/cairo", pycairoLib )