diff options
Diffstat (limited to 'scripts')
-rwxr-xr-x | scripts/gen_plist.lua | 93 | ||||
-rwxr-xr-x | scripts/osx/ta | 12 | ||||
-rwxr-xr-x | scripts/osx/textadept | 24 |
3 files changed, 129 insertions, 0 deletions
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 = {[[ +<?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>CFBundleDocumentTypes</key> + <array>]]} +for i = 1, #languages do + lang, exts = languages[i], extensions[languages[i]] + if #exts > 0 then + xml[#xml + 1] = "\t\t<dict>" + xml[#xml + 1] = "\t\t\t<key>CFBundleTypeExtensions</key>" + xml[#xml + 1] = "\t\t\t<array>" + for j = 1, #exts do + xml[#xml + 1] = "\t\t\t\t<string>"..exts[j].."</string>" + end + xml[#xml + 1] = "\t\t\t</array>" + xml[#xml + 1] = "\t\t\t<key>CFBundleTypeName</key>" + xml[#xml + 1] = "\t\t\t<string>"..lang.." source</string>" + xml[#xml + 1] = "\t\t\t<key>CFBundleTypeRole</key>" + xml[#xml + 1] = "\t\t\t<string>Editor</string>" + xml[#xml + 1] = "\t\t</dict>" + end +end +xml[#xml + 1] = [[ + <dict> + <key>CFBundleTypeExtensions</key> + <array> + <string>*</string> + </array> + <key>CFBundleTypeName</key> + <string>Document</string> + <key>CFBundleTypeRole</key> + <string>Editor</string> + </dict> + <dict> + <key>CFBundleTypeName</key> + <string>Document</string> + <key>CFBundleTypeOSTypes</key> + <array> + <string>****</string> + </array> + <key>CFBundleTypeRole</key> + <string>Editor</string> + </dict> + </array> + <key>CFBundleExecutable</key> + <string>textadept</string> + <key>CFBundleIconFile</key> + <string>textadept.icns</string> + <key>CFBundleIdentifier</key> + <string>com.textadept</string> + <key>CFBundleInfoDictionaryVersion</key> + <string>6.0</string> + <key>CFBundleName</key> + <string>Textadept</string> + <key>CFBundlePackageType</key> + <string>APPL</string> + <key>CFBundleSignature</key> + <string>????</string> + <key>CFBundleVersion</key> + <string>7.0 alpha</string> + <key>NSHighResolutionCapable</key> + <true/> +</dict> +</plist> +]] +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" "$@" |