summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorvarmaa <varmaa@8b7adc99-b347-0410-ae0a-d9e86c8d69b5>2008-05-04 04:17:33 +0000
committervarmaa <varmaa@8b7adc99-b347-0410-ae0a-d9e86c8d69b5>2008-05-04 04:17:33 +0000
commit62e60428a225a040d67facf5b78c1e0a18e350d4 (patch)
treea8fb1b21591e76cd72ba1727e138ddc5ded669a0
parent5449490edb0fb3654dee55de464c92d9374e8c1b (diff)
downloadenso-62e60428a225a040d67facf5b78c1e0a18e350d4.tar.gz
enso-62e60428a225a040d67facf5b78c1e0a18e350d4.tar.bz2
Added media, metadata, and code to the build system necessary for building an App bundle for Enso on OS X.
git-svn-id: https://enso.googlecode.com/svn/trunk@143 8b7adc99-b347-0410-ae0a-d9e86c8d69b5
-rw-r--r--media/fonts/GenI102.TTFbin0 -> 314476 bytes
-rw-r--r--media/fonts/GenR102.TTFbin0 -> 320740 bytes
-rwxr-xr-xmedia/fonts/OFL.txt99
-rw-r--r--media/images/Enso.icnsbin0 -> 110020 bytes
-rw-r--r--src/platform/osx/.svnignore2
-rw-r--r--src/platform/osx/SConscript25
-rw-r--r--src/platform/osx/appdata/Info.plist28
-rw-r--r--src/platform/osx/appdata/InfoPlist.stringsbin0 -> 222 bytes
-rw-r--r--src/platform/osx/appdata/PkgInfo1
-rw-r--r--src/platform/osx/appdata/SConscript12
-rw-r--r--src/platform/osx/main.m42
11 files changed, 207 insertions, 2 deletions
diff --git a/media/fonts/GenI102.TTF b/media/fonts/GenI102.TTF
new file mode 100644
index 0000000..ed832f7
--- /dev/null
+++ b/media/fonts/GenI102.TTF
Binary files differ
diff --git a/media/fonts/GenR102.TTF b/media/fonts/GenR102.TTF
new file mode 100644
index 0000000..efb0f35
--- /dev/null
+++ b/media/fonts/GenR102.TTF
Binary files differ
diff --git a/media/fonts/OFL.txt b/media/fonts/OFL.txt
new file mode 100755
index 0000000..cf8e7ba
--- /dev/null
+++ b/media/fonts/OFL.txt
@@ -0,0 +1,99 @@
+This Font Software is Copyright (c) 2003-2005, SIL International (http://scripts.sil.org/).
+All Rights Reserved.
+
+"Gentium" is a Reserved Font Name for this Font Software.
+"SIL" is a Reserved Font Name for this Font Software.
+
+This Font Software is licensed under the SIL Open Font License, Version 1.0.
+No modification of the license is permitted, only verbatim copy is allowed.
+This license is copied below, and is also available with a FAQ at:
+http://scripts.sil.org/OFL
+
+
+-----------------------------------------------------------
+SIL OPEN FONT LICENSE Version 1.0 - 22 November 2005
+-----------------------------------------------------------
+
+PREAMBLE
+The goals of the Open Font License (OFL) are to stimulate worldwide
+development of cooperative font projects, to support the font creation
+efforts of academic and linguistic communities, and to provide an open
+framework in which fonts may be shared and improved in partnership with
+others.
+
+The OFL allows the licensed fonts to be used, studied, modified and
+redistributed freely as long as they are not sold by themselves. The
+fonts, including any derivative works, can be bundled, embedded,
+redistributed and sold with any software provided that the font
+names of derivative works are changed. The fonts and derivatives,
+however, cannot be released under any other type of license.
+
+DEFINITIONS
+"Font Software" refers to any and all of the following:
+ - font files
+ - data files
+ - source code
+ - build scripts
+ - documentation
+
+"Reserved Font Name" refers to the Font Software name as seen by
+users and any other names as specified after the copyright statement.
+
+"Standard Version" refers to the collection of Font Software
+components as distributed by the Copyright Holder.
+
+"Modified Version" refers to any derivative font software made by
+adding to, deleting, or substituting -- in part or in whole --
+any of the components of the Standard Version, by changing formats
+or by porting the Font Software to a new environment.
+
+"Author" refers to any designer, engineer, programmer, technical
+writer or other person who contributed to the Font Software.
+
+PERMISSION & CONDITIONS
+Permission is hereby granted, free of charge, to any person obtaining
+a copy of the Font Software, to use, study, copy, merge, embed, modify,
+redistribute, and sell modified and unmodified copies of the Font
+Software, subject to the following conditions:
+
+1) Neither the Font Software nor any of its individual components,
+in Standard or Modified Versions, may be sold by itself.
+
+2) Standard or Modified Versions of the Font Software may be bundled,
+redistributed and sold with any software, provided that each copy
+contains the above copyright notice and this license. These can be
+included either as stand-alone text files, human-readable headers or
+in the appropriate machine-readable metadata fields within text or
+binary files as long as those fields can be easily viewed by the user.
+
+3) No Modified Version of the Font Software may use the Reserved Font
+Name(s), in part or in whole, unless explicit written permission is
+granted by the Copyright Holder. This restriction applies to all
+references stored in the Font Software, such as the font menu name and
+other font description fields, which are used to differentiate the
+font from others.
+
+4) The name(s) of the Copyright Holder or the Author(s) of the Font
+Software shall not be used to promote, endorse or advertise any
+Modified Version, except to acknowledge the contribution(s) of the
+Copyright Holder and the Author(s) or with their explicit written
+permission.
+
+5) The Font Software, modified or unmodified, in part or in whole,
+must be distributed using this license, and may not be distributed
+under any other license.
+
+TERMINATION
+This license becomes null and void if any of the above conditions are
+not met.
+
+DISCLAIMER
+THE FONT SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
+EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO ANY WARRANTIES OF
+MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT
+OF COPYRIGHT, PATENT, TRADEMARK, OR OTHER RIGHT. IN NO EVENT SHALL THE
+COPYRIGHT HOLDER BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY,
+INCLUDING ANY GENERAL, SPECIAL, INDIRECT, INCIDENTAL, OR CONSEQUENTIAL
+DAMAGES, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
+FROM, OUT OF THE USE OR INABILITY TO USE THE FONT SOFTWARE OR FROM
+OTHER DEALINGS IN THE FONT SOFTWARE.
diff --git a/media/images/Enso.icns b/media/images/Enso.icns
new file mode 100644
index 0000000..2bcad82
--- /dev/null
+++ b/media/images/Enso.icns
Binary files differ
diff --git a/src/platform/osx/.svnignore b/src/platform/osx/.svnignore
new file mode 100644
index 0000000..2d26bf0
--- /dev/null
+++ b/src/platform/osx/.svnignore
@@ -0,0 +1,2 @@
+EnsoKeyNotifier
+main
diff --git a/src/platform/osx/SConscript b/src/platform/osx/SConscript
index 09db1d1..b3d7de5 100644
--- a/src/platform/osx/SConscript
+++ b/src/platform/osx/SConscript
@@ -47,8 +47,7 @@ def getOutput( params ):
# I ran into some unexpected dependency issues, so I'm just calling a
# separate SCons instance. -AV
-import subprocess
-print "Building cairo..."
+print "Building SCons..."
retval = subprocess.call(["scons"], cwd=Dir("cairo").abspath)
if retval != 0:
raise Exception("Building cairo failed.")
@@ -110,3 +109,25 @@ pycairoEnv.Append( LINKFLAGS=FIND_MISSING_SYMS_AT_RUNTIME_FLAGS )
pycairoEnv["CCFLAGS"].remove( "-Werror" )
SConscript( "pycairo/SConscript", exports="pycairoEnv" )
+
+# App
+
+enso = env.Program( "main.m",
+ FRAMEWORKS=["Cocoa", "Python"] )
+env.InstallAs( "#bin/Enso.app/Contents/MacOS/Enso", enso )
+env.Install( "#bin/Enso.app/Contents/Resources/bin",
+ keyNotifier )
+env.InstallAs( "#bin/Enso.app/Contents/Resources/main.py",
+ "#scripts/run_enso.py" )
+
+SConscript( "appdata/SConscript", exports="env" )
+
+# Wanted to use the Mkdir() action here, but it's throwing some
+# bizarre exception, so we'll just use the command line.
+Execute( "mkdir -p %s" % Dir("#bin/Enso.app/Contents/Resources/enso") )
+
+basepath = Dir("#").abspath
+ensoSymlink = basepath + "/bin/Enso.app/Contents/Resources/enso"
+
+Execute( "rm -rf %s" % ensoSymlink )
+Execute( "ln -s -f %s %s" % (Dir("#enso").abspath, ensoSymlink) )
diff --git a/src/platform/osx/appdata/Info.plist b/src/platform/osx/appdata/Info.plist
new file mode 100644
index 0000000..4f0dd24
--- /dev/null
+++ b/src/platform/osx/appdata/Info.plist
@@ -0,0 +1,28 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd">
+<plist version="1.0">
+<dict>
+ <key>CFBundleDevelopmentRegion</key>
+ <string>English</string>
+ <key>CFBundleExecutable</key>
+ <string>Enso</string>
+ <key>CFBundleIconFile</key>
+ <string>Enso.icns</string>
+ <key>CFBundleIdentifier</key>
+ <string>com.ensoproject.Enso</string>
+ <key>CFBundleInfoDictionaryVersion</key>
+ <string>6.0</string>
+ <key>CFBundleName</key>
+ <string>Enso</string>
+ <key>CFBundlePackageType</key>
+ <string>APPL</string>
+ <key>CFBundleShortVersionString</key>
+ <string>1.0</string>
+ <key>CFBundleSignature</key>
+ <string>ENSO</string>
+ <key>CFBundleVersion</key>
+ <string>1.0</string>
+ <key>ATSApplicationFontsPath</key>
+ <string>Fonts</string>
+</dict>
+</plist>
diff --git a/src/platform/osx/appdata/InfoPlist.strings b/src/platform/osx/appdata/InfoPlist.strings
new file mode 100644
index 0000000..f4c0836
--- /dev/null
+++ b/src/platform/osx/appdata/InfoPlist.strings
Binary files differ
diff --git a/src/platform/osx/appdata/PkgInfo b/src/platform/osx/appdata/PkgInfo
new file mode 100644
index 0000000..9e8b439
--- /dev/null
+++ b/src/platform/osx/appdata/PkgInfo
@@ -0,0 +1 @@
+APPLENSO
diff --git a/src/platform/osx/appdata/SConscript b/src/platform/osx/appdata/SConscript
new file mode 100644
index 0000000..2b5e3e9
--- /dev/null
+++ b/src/platform/osx/appdata/SConscript
@@ -0,0 +1,12 @@
+Import("env")
+
+env.Install("#bin/Enso.app/Contents", "PkgInfo")
+env.Install("#bin/Enso.app/Contents", "Info.plist")
+env.Install("#bin/Enso.app/Contents/Resources/English.lproj",
+ "InfoPlist.strings")
+env.Install("#bin/Enso.app/Contents/Resources/Fonts",
+ "#media/fonts/GenI102.TTF")
+env.Install("#bin/Enso.app/Contents/Resources/Fonts",
+ "#media/fonts/GenR102.TTF")
+env.Install("#bin/Enso.app/Contents/Resources",
+ "#media/images/Enso.icns")
diff --git a/src/platform/osx/main.m b/src/platform/osx/main.m
new file mode 100644
index 0000000..8de013c
--- /dev/null
+++ b/src/platform/osx/main.m
@@ -0,0 +1,42 @@
+#import <Python/Python.h>
+#import <Cocoa/Cocoa.h>
+
+int main(int argc, char *argv[])
+{
+ NSAutoreleasePool *pool = [[NSAutoreleasePool alloc] init];
+
+ NSBundle *mainBundle = [NSBundle mainBundle];
+ NSString *resourcePath = [mainBundle resourcePath];
+ NSArray *pythonPathArray = [NSArray arrayWithObjects: resourcePath, [resourcePath stringByAppendingPathComponent:@"PyObjC"], nil];
+
+ setenv("PYTHONPATH", [[pythonPathArray componentsJoinedByString:@":"] UTF8String], 1);
+
+ NSArray *possibleMainExtensions = [NSArray arrayWithObjects: @"py", @"pyc", @"pyo", nil];
+ NSString *mainFilePath = nil;
+
+ for (NSString *possibleMainExtension in possibleMainExtensions) {
+ mainFilePath = [mainBundle pathForResource: @"main" ofType: possibleMainExtension];
+ if ( mainFilePath != nil ) break;
+ }
+
+ if ( !mainFilePath ) {
+ [NSException raise: NSInternalInconsistencyException format: @"%s:%d main() Failed to find the Main.{py,pyc,pyo} file in the application wrapper's Resources directory.", __FILE__, __LINE__];
+ }
+
+ Py_SetProgramName("/usr/bin/python");
+ Py_Initialize();
+ PySys_SetArgv(argc, (char **)argv);
+
+ const char *mainFilePathPtr = [mainFilePath UTF8String];
+ FILE *mainFile = fopen(mainFilePathPtr, "r");
+ int result = PyRun_SimpleFile(mainFile, (char *)[[mainFilePath lastPathComponent] UTF8String]);
+
+// TODO: Do something humane when an error occurs.
+// if ( result != 0 )
+// [NSException raise: NSInternalInconsistencyException
+// format: @"%s:%d main() PyRun_SimpleFile failed with file '%@'. See console for errors.", __FILE__, __LINE__, mainFilePath];
+
+ [pool drain];
+
+ return result;
+}