From 1f3bbef0357b89f82a65d1e67caa1980eee3f40b Mon Sep 17 00:00:00 2001 From: mitchell <70453897+667e-11@users.noreply.github.com> Date: Fri, 19 Nov 2010 17:46:46 -0500 Subject: Mac OSX textadept.app includes GTK-OSX; the framework is no longer needed. --- core/args.lua | 3 --- doc/manual/2_Installation.md | 17 ++++++++-------- doc/manual/3_Compiling.md | 46 ++++++++++++++++++++++++-------------------- src/Makefile | 37 ++++++++++++++++++++++++++--------- src/textadept.c | 7 +------ 5 files changed, 63 insertions(+), 47 deletions(-) diff --git a/core/args.lua b/core/args.lua index c7027e0d..cd1b682f 100644 --- a/core/args.lua +++ b/core/args.lua @@ -71,9 +71,6 @@ if WIN32 and #arg[0] > 0 then for i = 1, #params do arg[#arg + 1] = params[i] end end --- For Mac, remove junk parameter if necessary. -if OSX and arg[1] and arg[1]:find('^%-psn_0') then table.remove(arg, 1) end - -- Set _G._USERHOME. local userhome = os.getenv(not WIN32 and 'HOME' or 'USERPROFILE')..'/.textadept' for i = 1, #arg do diff --git a/doc/manual/2_Installation.md b/doc/manual/2_Installation.md index 05a548c0..8d6fc710 100644 --- a/doc/manual/2_Installation.md +++ b/doc/manual/2_Installation.md @@ -12,21 +12,22 @@ Most Linux systems already have GTK+ installed. If not, it is probably available through your package manager. Otherwise, compile and install it from the [GTK+ website][GTK-Linux]. +[GTK2]: http://gtk.org +[GTK-Linux]: http://www.gtk.org/download-linux.html + #### Mac OSX -There is a GTK+ [Mac OSX Framework][GTK-OSX] available in contrast to using GTK+ -from Fink or DarwinPorts/MacPorts in conjuction with X11. You will need to get -the [latest TESTING framework][GTK-OSX-Latest] that supports versioning. Note -that Textadept is designed for Intel Leopard Macs. +Prior to 3.5, the GTK+ [Mac OSX Framework][GTK-OSX] was needed. Newer versions +are all-inclusive and do not require anything. + +[GTK-OSX]: http://code.google.com/p/textadept/downloads/detail?name=Gtk-Framework-2.14.3-2-test1.dmg + +Note that Textadept is designed for Intel Leopard+ Macs. #### Windows Windows systems need the [GTK+ 2.0 Runtime][GTK-Runtime] installed. -[GTK2]: http://gtk.org -[GTK-Linux]: http://www.gtk.org/download-linux.html -[GTK-OSX]: http://gtk-osx.org -[GTK-OSX-Latest]: http://code.google.com/p/textadept/downloads/detail?name=Gtk-Framework-2.14.3-2-test1.dmg [GTK-Runtime]: http://sourceforge.net/projects/gtk-win/ ## Download diff --git a/doc/manual/3_Compiling.md b/doc/manual/3_Compiling.md index 82209463..b3461042 100644 --- a/doc/manual/3_Compiling.md +++ b/doc/manual/3_Compiling.md @@ -13,10 +13,9 @@ typically called `libgtk2.0-dev`. Otherwise, compile and install it from the (`gcc`) and [GNU Make][Make] (`make`). Both should be available for your Linux distribution through its package manager. -#### Mac OSX - -[XCode][XCode] is needed for Mac OSX as well as the -[GTK-OSX Framework][GTK-OSX-Latest]. +[GTK-Linux]: http://www.gtk.org/download-linux.html +[GCC]: http://gcc.gnu.org +[Make]: http://www.gnu.org/software/make/ #### Windows @@ -30,14 +29,19 @@ so, in addition to the GTK+ development libraries mentioned above, you will need along with win_iconv. The former should be available from your package manager. The latter you will have to download manually. -[GTK-Linux]: http://www.gtk.org/download-linux.html -[GCC]: http://gcc.gnu.org -[Make]: http://www.gnu.org/software/make/ -[XCode]: http://developer.apple.com/TOOLS/xcode/ -[GTK-OSX-Latest]: http://code.google.com/p/textadept/downloads/detail?name=Gtk-Framework-2.14.3-2-test1.dmg [GTK-Win32]: http://www.gtk.org/download-windows.html [MinGW]: http://mingw.org +#### Mac OSX + +[XCode][XCode] is needed for Mac OSX as well as [jhbuild][GTK-OSX]. After +building `meta-gtk-osx-bootstrap` and `meta-gtk-osx-core`, you will need to +build `meta-gtk-osx-themes`. Note that the entire compiling process can easily +take 30 minutes or more and ultimately consume nearly 1GB of disk space. + +[XCode]: http://developer.apple.com/TOOLS/xcode/ +[GTK-OSX]: http://sourceforge.net/apps/trac/gtk-osx/wiki/Build + ## Download Download the `textadept_x.x.src.zip`, regardless of what platform you are on. @@ -52,14 +56,6 @@ it to `/usr/bin/` or elsewhere in your `PATH`. BSD users please run `make BSD=1`. -#### Mac OSX - -In Mac OSX, open `xcode/textadept.xcodeproj` in XCode, change the active build -configuration combo box from `Debug` to `Release` (if necessary), click `Build`, -and copy the resulting `xcode/build/Release/textadept.app` to your user or -system `Applications` folder. - - #### Windows (Cross-Compiling from Linux) When cross-compiling from within Linux, first unzip the GTK+ for Windows bundle @@ -69,6 +65,17 @@ part of the filename. Finally, modify the `CC`, `CPP`, and `WINDRES` variables in the `WIN32` block of `src/Makefile` to match your MinGW installation and run `make WIN32=1` to build `../textadept.exe`. +#### Mac OSX + +After using `jhbuild`, GTK is in `~/gtk` so make a symlink from `~/gtk/inst` to +`src/gtkosx` in Textadept. Then run `make OSX=1` to build `../textadept.osx`. At +this point it is recommended to build a new `textadept.app` from an existing +one. Download the most recent app and replace `Contents/MacOS/textadept.osx`, +all `.dylib` files in `Contents/Resources/lib`, and all `.so` files in +`Contents/Resources/lib/gtk-2.0/[version]/{engines,immodules,loaders}` with your +own versions in `src/gtkosx/lib`. If you wish, you may also replace the files +in `Contents/Resources/{etc,share}`, but these rarely change. + ## Problems #### Mac OSX @@ -77,12 +84,9 @@ In Mac OSX, if the build fails because of a `redefinition of 'struct Sci_TextRange'` -error, you will need to open `src/scintilla-st/include/Scintilla.h` and comment +error, you will need to open `src/scintilla/include/Scintilla.h` and comment out the following lines (put `//` at the start of the line): #define CharacterRange Sci_CharacterRange #define TextRange Sci_TextRange #define TextToFind Sci_TextToFind - -`src/scintilla-st/src/LexLPeg.cxx` may need to have `TextRange tr` changed to -`Sci_TextRange tr` as well. diff --git a/src/Makefile b/src/Makefile index 94d97109..729e10b4 100644 --- a/src/Makefile +++ b/src/Makefile @@ -2,7 +2,7 @@ .SUFFIXES: .c .o .h .a .cxx -ifndef WIN32 +# Linux (default) CC = gcc CPP = g++ PKG_CONFIG = pkg-config @@ -17,7 +17,10 @@ LUA_CFLAGS = -DLUA_USE_LINUX TEXTADEPT = textadept TEXTADEPT_RC = EXPORTLUASYMS = -rdynamic -Wl,--retain-symbols-file -Wl,lua.sym -else +WINDRES = + +# Win32 (WIN32=1) +ifdef WIN32 CC = i486-mingw32-gcc -mms-bitfields CPP = i486-mingw32-g++ -mms-bitfields -mwindows PKG_CONFIG = pkg-config --define-variable=prefix=win32gtk @@ -31,6 +34,23 @@ EXPORTLUASYMS = -Wl,--retain-symbols-file -Wl,lua.sym WINDRES = i486-mingw32-windres endif +# Mac OSX (OSX=1) +ifdef OSX +CC = gcc -arch i386 -mdynamic-no-pic -mmacosx-version-min=10.5 \ + -isysroot /Developer/SDKs/MacOSX10.5.sdk +CPP = g++ -arch i386 -mdynamic-no-pic -mmacosx-version-min=10.5 \ + -isysroot /Developer/SDKs/MacOSX10.5.sdk +PKG_CONFIG = gtkosx/bin/pkg-config --define-variable=prefix=gtkosx +PKG_CONFIG_PATH = $(shell pwd)/gtkosx/lib/pkgconfig +PLAT_FLAGS = -DGTK -D__OSX__ +SCI_THREAD_FLAG = +LUA_CFLAGS = -DLUA_USE_MACOSX +TEXTADEPT = textadept.osx +TEXTADEPT_RC = +EXPORTLUASYMS = -rdynamic +WINDRES = +endif + ifndef DEBUG DEBUG_FLAG = -DNDEBUG else @@ -46,6 +66,9 @@ GTKFLAGS = $(shell PKG_CONFIG_PATH=$(PKG_CONFIG_PATH) $(PKG_CONFIG) \ --cflags gtk+-2.0) GTKLIBS = $(shell PKG_CONFIG_PATH=$(PKG_CONFIG_PATH) $(PKG_CONFIG) \ --libs gtk+-2.0 gthread-2.0) +ifdef OSX +GTKLIBS += -framework Carbon -framework Cocoa -ligemacintegration +endif TEXTADEPT_OBJS = textadept.o LUA_OBJS = lapi.o lcode.o ldebug.o ldo.o ldump.o lfunc.o lgc.o llex.o lmem.o \ @@ -144,21 +167,17 @@ release: ../$(TEXTADEPT) ../$(TEXTADEPT32) ../$(TEXTADEPTWIN32) \ tar czf $(PACKAGE32) $(RELEASEDIR32) # Mac OSX mkdir $(RELEASEDIRMAC) - mkdir -p $(TEXTADEPTAPP)/Contents/{MacOS,Resources} - cp ../xcode/{Info.plist,PkgInfo} $(TEXTADEPTAPP)/Contents - cp -r ../xcode/English.lproj $(TEXTADEPTAPP)/Contents/Resources - cp -r $(RELEASEDIR32)/* $(TEXTADEPTAPP)/Contents/Resources + cp -r ../osxapp $(TEXTADEPTAPP) + cp -r $(RELEASEDIR32)/* $(TEXTADEPTAPP)/Contents/Resources/ mv $(TEXTADEPTAPP)/Contents/Resources/core/images/textadept.icns \ $(TEXTADEPTAPP)/Contents/Resources/ - cp ../$(TEXTADEPTMAC) $(TEXTADEPTAPP)/Contents/MacOS/$(TEXTADEPT) - cp ../xcode/README.txt $(RELEASEDIRMAC) + cp ../$(TEXTADEPTMAC) $(TEXTADEPTAPP)/Contents/MacOS/ zip -r $(PACKAGEMAC) $(RELEASEDIRMAC) rm -r $(RELEASEDIRMAC) # Source rm $(RELEASEDIR32)/$(TEXTADEPT) cp -rL lua scintilla gcocoadialog LexLPeg.cxx $(RELEASEDIR32)/src/ rm -r $(RELEASEDIR32)/src/scintilla/.hg - cp -r ../xcode $(RELEASEDIR32)/ zip -r $(SRCPACKAGE) $(RELEASEDIR32) # Done rm -r $(RELEASEDIR32) diff --git a/src/textadept.c b/src/textadept.c index 59d2ca4b..ba32e109 100644 --- a/src/textadept.c +++ b/src/textadept.c @@ -21,8 +21,7 @@ #define main main_ #elif __OSX__ #include -#include "ige-mac-menu.h" -#define GDK_MOD1_MASK GDK_META_MASK +#include "igemacintegration/ige-mac-menu.h" #elif __BSD__ #include #include @@ -157,10 +156,6 @@ int main(int argc, char **argv) { CFRelease(path); CFRelease(bundle); } else textadept_home = calloc(1, 1); - // GTK-OSX does not parse ~/.gtkrc-2.0; parse it manually - char *user_home = g_strconcat(getenv("HOME"), "/.gtkrc-2.0", NULL); - gtk_rc_parse(user_home); - g_free(user_home); #elif __BSD__ textadept_home = malloc(FILENAME_MAX); int mib[] = { CTL_KERN, KERN_PROC, KERN_PROC_PATHNAME, -1 }; -- cgit v1.2.3