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". --- doc/12_Compiling.md | 6 +- modules/textadept/mime_types.conf | 8 +- scripts/gen_plist.lua | 93 ++++ scripts/osx/ta | 12 + scripts/osx/textadept | 24 + src/Info.plist | 974 ++++++++++++++++++++++++++++++++++++++ src/Makefile | 39 +- 7 files changed, 1137 insertions(+), 19 deletions(-) create mode 100755 scripts/gen_plist.lua create mode 100755 scripts/osx/ta create mode 100755 scripts/osx/textadept create mode 100644 src/Info.plist diff --git a/doc/12_Compiling.md b/doc/12_Compiling.md index 35ab5167..32c88aee 100644 --- a/doc/12_Compiling.md +++ b/doc/12_Compiling.md @@ -117,13 +117,13 @@ Lua library loading do not allow statically linking LuaJIT to Textadept. When cross-compiling from within Linux, first unzip the GTK+ for OSX bundle into a new *src/gtkosx/* directory. Then run `make osx` to build *../textadept.osx* -and *../textadeptjit.osx*. Build a new *Textadept.app* from an existing one by -downloading the most recent app and replacing *Contents/MacOS/textadept.osx* and -*Contents/MacOS/textadeptjit.osx* with your own versions. +and *../textadeptjit.osx*. Similarly, `make osx-curses` builds *../textadept-curses.osx* and *../textadeptjit-curses.osx*. +Build a new *Textadept.app* with `make osx-app`. + #### Compiling on OSX (Legacy) Textadept requires [XCode][] as well as [jhbuild][] (for GTK+). After building diff --git a/modules/textadept/mime_types.conf b/modules/textadept/mime_types.conf index c961fd46..4b6f6d3f 100644 --- a/modules/textadept/mime_types.conf +++ b/modules/textadept/mime_types.conf @@ -187,10 +187,10 @@ java java js javascript jsfl javascript -%JSP +% JSP jsp jsp -%JSON +% JSON json json % Latex @@ -329,9 +329,6 @@ rbw ruby /^%s*class%s+%S+%s*<%s*ActiveRecord::Base rails /^%s*class%s+%S+%s*<%s*ActiveRecord::Migration rails -% Ragel -rl ragel - % Sass CSS sass sass scss sass @@ -351,6 +348,7 @@ configure bash csh bash sh bash zsh bash +#bash bash #sh bash % Smalltalk 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" "$@" diff --git a/src/Info.plist b/src/Info.plist new file mode 100644 index 00000000..fad0e2bd --- /dev/null +++ b/src/Info.plist @@ -0,0 +1,974 @@ + + + + + CFBundleDevelopmentRegion + English + CFBundleDocumentTypes + + + CFBundleTypeExtensions + + as + asc + + CFBundleTypeName + Actionscript source + CFBundleTypeRole + Editor + + + CFBundleTypeExtensions + + ada + adb + ads + + CFBundleTypeName + ADA source + CFBundleTypeRole + Editor + + + CFBundleTypeExtensions + + g + + CFBundleTypeName + ANTLR source + CFBundleTypeRole + Editor + + + CFBundleTypeExtensions + + ans + inp + mac + + CFBundleTypeName + APDL source + CFBundleTypeRole + Editor + + + CFBundleTypeExtensions + + applescript + + CFBundleTypeName + Applescript source + CFBundleTypeRole + Editor + + + CFBundleTypeExtensions + + asa + asp + hta + + CFBundleTypeName + ASP source + CFBundleTypeRole + Editor + + + CFBundleTypeExtensions + + awk + + CFBundleTypeName + AWK source + CFBundleTypeRole + Editor + + + CFBundleTypeExtensions + + bat + cmd + + CFBundleTypeName + Batch source + CFBundleTypeRole + Editor + + + CFBundleTypeExtensions + + bib + + CFBundleTypeName + Bibtex source + CFBundleTypeRole + Editor + + + CFBundleTypeExtensions + + boo + + CFBundleTypeName + Boo source + CFBundleTypeRole + Editor + + + CFBundleTypeExtensions + + c + cc + C + cpp + cxx + c++ + h + hh + hpp + hxx + h++ + + CFBundleTypeName + C/C++ source + CFBundleTypeRole + Editor + + + CFBundleTypeExtensions + + cs + + CFBundleTypeName + C# source + CFBundleTypeRole + Editor + + + CFBundleTypeExtensions + + ck + + CFBundleTypeName + Chuck source + CFBundleTypeRole + Editor + + + CFBundleTypeExtensions + + cmake + cmake.in + ctest + ctest.in + + CFBundleTypeName + CMake source + CFBundleTypeRole + Editor + + + CFBundleTypeExtensions + + coffee + + CFBundleTypeName + CoffeeScript source + CFBundleTypeRole + Editor + + + CFBundleTypeExtensions + + css + + CFBundleTypeName + CSS source + CFBundleTypeRole + Editor + + + CFBundleTypeExtensions + + cu + cuh + + CFBundleTypeName + CUDA source + CFBundleTypeRole + Editor + + + CFBundleTypeExtensions + + d + di + + CFBundleTypeName + D source + CFBundleTypeRole + Editor + + + CFBundleTypeExtensions + + desktop + + CFBundleTypeName + Desktop source + CFBundleTypeRole + Editor + + + CFBundleTypeExtensions + + diff + patch + + CFBundleTypeName + diff source + CFBundleTypeRole + Editor + + + CFBundleTypeExtensions + + dot + + CFBundleTypeName + dot source + CFBundleTypeRole + Editor + + + CFBundleTypeExtensions + + e + eif + + CFBundleTypeName + Eiffel source + CFBundleTypeRole + Editor + + + CFBundleTypeExtensions + + erl + hrl + + CFBundleTypeName + Erlang source + CFBundleTypeRole + Editor + + + CFBundleTypeExtensions + + fs + + CFBundleTypeName + F# source + CFBundleTypeRole + Editor + + + CFBundleTypeExtensions + + f + forth + frt + fs + + CFBundleTypeName + Forth source + CFBundleTypeRole + Editor + + + CFBundleTypeExtensions + + for + fort + fpp + f77 + f90 + f95 + f03 + f08 + + CFBundleTypeName + Fortran source + CFBundleTypeRole + Editor + + + CFBundleTypeExtensions + + g + gd + gi + gap + + CFBundleTypeName + Gap source + CFBundleTypeRole + Editor + + + CFBundleTypeExtensions + + po + pot + + CFBundleTypeName + Gettext source + CFBundleTypeRole + Editor + + + CFBundleTypeExtensions + + glslf + glslv + + CFBundleTypeName + GLSL source + CFBundleTypeRole + Editor + + + CFBundleTypeExtensions + + dem + plt + + CFBundleTypeName + GNUPlot source + CFBundleTypeRole + Editor + + + CFBundleTypeExtensions + + groovy + gvy + + CFBundleTypeName + Groovy source + CFBundleTypeRole + Editor + + + CFBundleTypeExtensions + + gtkrc + + CFBundleTypeName + Gtkrc source + CFBundleTypeRole + Editor + + + CFBundleTypeExtensions + + hs + + CFBundleTypeName + Haskell source + CFBundleTypeRole + Editor + + + CFBundleTypeExtensions + + htm + html + shtm + shtml + xhtml + + CFBundleTypeName + HTML source + CFBundleTypeRole + Editor + + + CFBundleTypeExtensions + + idl + odl + + CFBundleTypeName + IDL source + CFBundleTypeRole + Editor + + + CFBundleTypeExtensions + + inf + + CFBundleTypeName + Inform source + CFBundleTypeRole + Editor + + + CFBundleTypeExtensions + + cfg + cnf + inf + ini + reg + + CFBundleTypeName + ini source + CFBundleTypeRole + Editor + + + CFBundleTypeExtensions + + io + + CFBundleTypeName + Io source + CFBundleTypeRole + Editor + + + CFBundleTypeExtensions + + bsh + java + + CFBundleTypeName + Java source + CFBundleTypeRole + Editor + + + CFBundleTypeExtensions + + js + jsfl + + CFBundleTypeName + Javascript source + CFBundleTypeRole + Editor + + + CFBundleTypeExtensions + + jsp + + CFBundleTypeName + JSP source + CFBundleTypeRole + Editor + + + CFBundleTypeExtensions + + json + + CFBundleTypeName + JSON source + CFBundleTypeRole + Editor + + + CFBundleTypeExtensions + + bbl + dtx + ins + ltx + tex + sty + + CFBundleTypeName + Latex source + CFBundleTypeRole + Editor + + + CFBundleTypeExtensions + + less + + CFBundleTypeName + Less source + CFBundleTypeRole + Editor + + + CFBundleTypeExtensions + + lily + ly + + CFBundleTypeName + Lilypond source + CFBundleTypeRole + Editor + + + CFBundleTypeExtensions + + cl + el + lisp + lsp + + CFBundleTypeName + Lisp source + CFBundleTypeRole + Editor + + + CFBundleTypeExtensions + + litcoffee + + CFBundleTypeName + Literate Coffeescript source + CFBundleTypeRole + Editor + + + CFBundleTypeExtensions + + lua + + CFBundleTypeName + Lua source + CFBundleTypeRole + Editor + + + CFBundleTypeExtensions + + GNUmakefile + iface + mak + makefile + Makefile + + CFBundleTypeName + Makefile source + CFBundleTypeRole + Editor + + + CFBundleTypeExtensions + + md + + CFBundleTypeName + Markdown source + CFBundleTypeRole + Editor + + + CFBundleTypeExtensions + + n + + CFBundleTypeName + Nemerle source + CFBundleTypeRole + Editor + + + CFBundleTypeExtensions + + nsh + nsi + nsis + + CFBundleTypeName + NSIS source + CFBundleTypeRole + Editor + + + CFBundleTypeExtensions + + m + mm + objc + + CFBundleTypeName + Objective C source + CFBundleTypeRole + Editor + + + CFBundleTypeExtensions + + caml + ml + mli + mll + mly + + CFBundleTypeName + OCAML source + CFBundleTypeRole + Editor + + + CFBundleTypeExtensions + + dpk + dpr + p + pas + + CFBundleTypeName + Pascal source + CFBundleTypeRole + Editor + + + CFBundleTypeExtensions + + al + perl + pl + pm + pod + + CFBundleTypeName + Perl source + CFBundleTypeRole + Editor + + + CFBundleTypeExtensions + + inc + php + php3 + php4 + phtml + + CFBundleTypeName + PHP source + CFBundleTypeRole + Editor + + + CFBundleTypeExtensions + + pike + pmod + + CFBundleTypeName + Pike source + CFBundleTypeRole + Editor + + + CFBundleTypeExtensions + + eps + ps + + CFBundleTypeName + Postscript source + CFBundleTypeRole + Editor + + + CFBundleTypeExtensions + + prolog + + CFBundleTypeName + Prolog source + CFBundleTypeRole + Editor + + + CFBundleTypeExtensions + + props + properties + + CFBundleTypeName + Properties source + CFBundleTypeRole + Editor + + + CFBundleTypeExtensions + + sc + py + pyw + + CFBundleTypeName + Python source + CFBundleTypeRole + Editor + + + CFBundleTypeExtensions + + R + Rout + Rhistory + Rt + Rout.save + Rout.fail + S + + CFBundleTypeName + R source + CFBundleTypeRole + Editor + + + CFBundleTypeExtensions + + r + reb + + CFBundleTypeName + Rebol source + CFBundleTypeRole + Editor + + + CFBundleTypeExtensions + + orx + rex + + CFBundleTypeName + Rexx source + CFBundleTypeRole + Editor + + + CFBundleTypeExtensions + + erb + rhtml + + CFBundleTypeName + RHTML source + CFBundleTypeRole + Editor + + + CFBundleTypeExtensions + + Rakefile + rake + rb + rbw + + CFBundleTypeName + Ruby source + CFBundleTypeRole + Editor + + + CFBundleTypeExtensions + + sass + scss + + CFBundleTypeName + Sass CSS source + CFBundleTypeRole + Editor + + + CFBundleTypeExtensions + + scala + + CFBundleTypeName + Scala source + CFBundleTypeRole + Editor + + + CFBundleTypeExtensions + + sch + scm + + CFBundleTypeName + Scheme source + CFBundleTypeRole + Editor + + + CFBundleTypeExtensions + + bash + bashrc + bash_profile + configure + csh + sh + zsh + + CFBundleTypeName + Shell source + CFBundleTypeRole + Editor + + + CFBundleTypeExtensions + + changes + st + sources + + CFBundleTypeName + Smalltalk source + CFBundleTypeRole + Editor + + + CFBundleTypeExtensions + + ddl + sql + + CFBundleTypeName + SQL source + CFBundleTypeRole + Editor + + + CFBundleTypeExtensions + + tcl + tk + + CFBundleTypeName + TCL source + CFBundleTypeRole + Editor + + + CFBundleTypeExtensions + + vala + + CFBundleTypeName + Vala source + CFBundleTypeRole + Editor + + + CFBundleTypeExtensions + + v + ver + + CFBundleTypeName + Verilog source + CFBundleTypeRole + Editor + + + CFBundleTypeExtensions + + vh + vhd + vhdl + + CFBundleTypeName + VHDL source + CFBundleTypeRole + Editor + + + CFBundleTypeExtensions + + asa + bas + cls + ctl + dob + dsm + dsr + frm + pag + vb + vba + vbs + + CFBundleTypeName + Visual Basic source + CFBundleTypeRole + Editor + + + CFBundleTypeExtensions + + dtd + svg + xml + xsd + xsl + xslt + xul + + CFBundleTypeName + XML source + CFBundleTypeRole + Editor + + + 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 + + + diff --git a/src/Makefile b/src/Makefile index 52d596b9..6b601cdb 100644 --- a/src/Makefile +++ b/src/Makefile @@ -373,6 +373,18 @@ cleandoc: basedir = textadept_$(shell grep "_RELEASE =" ../core/init.lua | \ cut -d ' ' -f 4- | sed -e 's/"//; s/ /_/g;') modules = css hypertext java rails rhtml ruby php python +osxapp = Textadept.app +osxapp_bin = $(osxapp)/Contents/MacOS +osxapp_res = $(osxapp)/Contents/Resources +osxapp_libs = libatk-1.0.0.dylib libcairo.2.dylib libexpat.1.dylib \ + libffi.5.dylib libfontconfig.1.dylib libfreetype.6.dylib \ + libgdk_pixbuf-2.0.0.dylib libgdk-quartz-2.0.0.dylib \ + libgio-2.0.0.dylib libglib-2.0.0.dylib libgmodule-2.0.0.dylib \ + libgobject-2.0.0.dylib libgthread-2.0.0.dylib \ + libgtkmacintegration.2.dylib libgtk-quartz-2.0.0.dylib \ + libintl.8.dylib libpango-1.0.0.dylib libpangocairo-1.0.0.dylib \ + libpangoft2-1.0.0.dylib libpixman-1.0.dylib libpng14.14.dylib \ + charset.alias gdk-pixbuf-2.0 gtk-2.0 pango release: ../textadept ../textadeptjit ../textadept-curses \ ../textadeptjit-curses ../textadept32 ../textadeptjit32 \ @@ -407,14 +419,20 @@ $(basedir).win64: ../textadept64.exe | $(basedir) for t in `ls $@/textadept*`; do mv $$t `echo $$t | sed -e 's/64\././;'`; done cp win64gtk/bin/*.dll $@ && cp -r win64gtk/etc win64gtk/lib win64gtk/share $@ rm -r $@/lib/*.a $@/lib/glib-2.0 $@/lib/gtk-2.0/include $@/lib/pkgconfig -$(basedir).osx: ../textadept.osx ../textadeptjit.osx ../textadept-curses.osx \ - ../textadeptjit-curses.osx | $(basedir) - mkdir $@ && cp -rL gtkosx/app $@/Textadept.app - cp $^ $@/Textadept.app/Contents/MacOS/ - cp -rL $|/* $@/Textadept.app/Contents/Resources/ - mv $@/Textadept.app/Contents/Resources/core/images/textadept.icns \ - $@/Textadept.app/Contents/Resources/ - mv $@/Textadept.app/Contents/MacOS/ta $@ +osx-app: ../textadept.osx ../textadeptjit.osx ../textadept-curses.osx \ + ../textadeptjit-curses.osx | $(basedir) + mkdir -p $(osxapp_bin) $(osxapp_res) + cp Info.plist $(osxapp_bin)/../ + cp ../scripts/osx/textadept $^ $(osxapp_bin)/ + cp -rL $|/* $(osxapp_res)/ + mv $(osxapp_res)/core/images/textadept.icns $(osxapp_res)/ + cp -r gtkosx/etc gtkosx/share $(osxapp_res)/ && mkdir $(osxapp_res)/lib/ + cp -r $(addprefix gtkosx/lib/, $(osxapp_libs)) $(osxapp_res)/lib/ + rm -r $(osxapp_res)/lib/gtk-2.0/include $(osxapp_res)/lib/gtk-2.0/modules + rm $(osxapp_res)/lib/gtk-2.0/2.10.0/printbackends/* +$(basedir).osx: osx-app | $(basedir) + mkdir $@ && mv $< $@ + cp ../scripts/osx/ta $@ $(basedir).src: | $(basedir) cp -r $| $@ cp -rL lua luajit scintilla gtdialog LexLPeg.cxx termkey cdk $@/src @@ -422,9 +440,8 @@ $(basedir).src: | $(basedir) rm -r $@/src/scintilla/.hg $(basedir).modules: mkdir -p $@/modules - for module in $(modules); do \ - hg clone /home/mitchell/code/textadept/modules/$$module \ - $@/modules/$$module; \ + for mod in $(modules); do \ + hg clone /home/mitchell/code/textadept/modules/$$mod $@/modules/$$mod; \ done # Release Packages. -- cgit v1.2.3