From e511c67fa74162308c6986d05487fd633ff37da0 Mon Sep 17 00:00:00 2001 From: mitchell <70453897+667e-11@users.noreply.github.com> Date: Sun, 9 Jun 2013 21:03:53 -0400 Subject: New makefile 'osx-app' rule for building Textadept.app. Also added some OSX scripts from the bundle to the repository. Requires the latest "GTK+ for OSX bundle". --- scripts/gen_plist.lua | 93 +++++++++++++++++++++++++++++++++++++++++++++++++++ scripts/osx/ta | 12 +++++++ scripts/osx/textadept | 24 +++++++++++++ 3 files changed, 129 insertions(+) create mode 100755 scripts/gen_plist.lua create mode 100755 scripts/osx/ta create mode 100755 scripts/osx/textadept (limited to 'scripts') diff --git a/scripts/gen_plist.lua b/scripts/gen_plist.lua new file mode 100755 index 00000000..fc47203c --- /dev/null +++ b/scripts/gen_plist.lua @@ -0,0 +1,93 @@ +#!/usr/bin/lua +-- Copyright 2007-2013 Mitchell mitchell.att.foicica.com. See LICENSE. + +-- This script generates the "Info.plist" file for the Mac OSX App bundle. + +local lang, exts +local languages, extensions = {}, {} + +-- Read languages and extensions. +local f = io.open('../modules/textadept/mime_types.conf') +for line in f:lines() do + if line:find('^%%') then + lang, exts = line:match('^%%%s*(.+)$'), {} + if lang then languages[#languages + 1], extensions[lang] = lang, exts end + elseif line:find('^%a') then + exts[#exts + 1] = line:match('^%S+') + end +end +f:close() + +-- Generate and write the XML. +local xml = {[[ + + + + + CFBundleDevelopmentRegion + English + CFBundleDocumentTypes + ]]} +for i = 1, #languages do + lang, exts = languages[i], extensions[languages[i]] + if #exts > 0 then + xml[#xml + 1] = "\t\t" + xml[#xml + 1] = "\t\t\tCFBundleTypeExtensions" + xml[#xml + 1] = "\t\t\t" + for j = 1, #exts do + xml[#xml + 1] = "\t\t\t\t"..exts[j].."" + end + xml[#xml + 1] = "\t\t\t" + xml[#xml + 1] = "\t\t\tCFBundleTypeName" + xml[#xml + 1] = "\t\t\t"..lang.." source" + xml[#xml + 1] = "\t\t\tCFBundleTypeRole" + xml[#xml + 1] = "\t\t\tEditor" + xml[#xml + 1] = "\t\t" + end +end +xml[#xml + 1] = [[ + + CFBundleTypeExtensions + + * + + CFBundleTypeName + Document + CFBundleTypeRole + Editor + + + CFBundleTypeName + Document + CFBundleTypeOSTypes + + **** + + CFBundleTypeRole + Editor + + + CFBundleExecutable + textadept + CFBundleIconFile + textadept.icns + CFBundleIdentifier + com.textadept + CFBundleInfoDictionaryVersion + 6.0 + CFBundleName + Textadept + CFBundlePackageType + APPL + CFBundleSignature + ???? + CFBundleVersion + 7.0 alpha + NSHighResolutionCapable + + + +]] +f = io.open('../src/Info.plist', 'w') +f:write(table.concat(xml, '\n')) +f:close() diff --git a/scripts/osx/ta b/scripts/osx/ta new file mode 100755 index 00000000..9b2d8f43 --- /dev/null +++ b/scripts/osx/ta @@ -0,0 +1,12 @@ +#!/bin/bash +# Copyright 2007-2013 Mitchell mitchell.att.foicica.com. See LICENSE. + +if [[ "$1" == "-h" || "$1" == "--help" ]]; then + echo "ta - shell script to launch Textadept.app" + echo "Usage: ta [args] [filenames]" + echo "Run textadept --help for available args." +elif [ "${1:0:1}" == "-" ]; then + open -n -a Textadept.app --args $@ +else + open -a Textadept.app $@ +fi diff --git a/scripts/osx/textadept b/scripts/osx/textadept new file mode 100755 index 00000000..2c933465 --- /dev/null +++ b/scripts/osx/textadept @@ -0,0 +1,24 @@ +#!/bin/sh +# Copyright 2007-2013 Mitchell mitchell.att.foicica.com. See LICENSE. + +# Set the GTK environment variables of resources within Textadept.app. +bundle=$(cd "$(dirname "$0")/../../" && pwd) +bundle_res="$bundle/Contents/Resources" +export DYLD_LIBRARY_PATH="$bundle_res/lib:$DYLD_LIBRARY_PATH" +export GTK_DATA_PREFIX="$bundle_res" +export GTK_EXE_PREFIX="$bundle_res" +export GTK_PATH="$bundle_res" +export GTK2_RC_FILES="$bundle_res/etc/gtk-2.0/gtkrc" +export GTK_IM_MODULE_FILE="$bundle_res/etc/gtk-2.0/gtk.immodules" +export GDK_PIXBUF_MODULE_FILE="$bundle_res/etc/gtk-2.0/gdk-pixbuf.loaders" +export PANGO_LIBDIR="$bundle_res/lib" +export PANGO_SYSCONFDIR="$bundle_res/etc" +export CHARSETALIASDIR="$bundle_res/lib" + +# Strip out the argument added by OSX. +if [ x`echo "x$1" | sed -e "s/^x-psn_.*//"` == x ]; then shift 1; fi + +# Run Textadept. +textadept=textadept.osx +if [ ! -z $TEXTADEPTJIT ]; then textadept=textadeptjit.osx; fi +exec "$bundle/Contents/MacOS/$textadept" "$@" -- cgit v1.2.3