Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP
Newer
Older
100644 215 lines (131 sloc) 10.918 kb
9894969 @sorbits Initial commit
sorbits authored
1 # TextMate
2
3 This repository contains the source code for TextMate 2, a text editor for OS X 10.7+.
4
e495a6e @jtmkrueger Add example textmate image to README
jtmkrueger authored
5 ![textmate](https://raw.github.com/textmate/textmate/gh-pages/images/screenshot.png)
6
9894969 @sorbits Initial commit
sorbits authored
7 # Building
8
1a1a806 @sorbits Update README
sorbits authored
9 ## Important
10
11 If you just want to run TextMate 2 then download a [prebuilt binary][]. For 10.6 support you can try a [10.6 build][] (from the [10.6 fork][]) but it comes with no guarantee of actually working!
12
13 If you have problems building please **don’t** open an issue! Instead write the [textmate-dev][] mailing list or use the [#textmate][] IRC channel on [freenode.net][] where people might be able to help you.
14
15 [prebuilt binary]: https://github.com/textmate/textmate/downloads
16 [10.6 build]: https://github.com/nanoant/textmate/downloads
17 [10.6 fork]: https://github.com/nanoant/textmate/tree/10.6_32bit
18
19 ## Bootstrap
20
9894969 @sorbits Initial commit
sorbits authored
21 To bootstrap the build you need to run `./configure` (in the root of the source tree). You can set a few (environment) variables read by this script that change the generated build file:
22
23 * `builddir` — location of built files. Defaults to `~/build/TextMate`.
24 * `identity` — for Apple’s `codesign`. Defaults to ad-hoc signing, which does not use an identity at all.
1a1a806 @sorbits Update README
sorbits authored
25 * `boostdir` — location of boost includes. By default it will search various locations including MacPorts and Homebrew.
9894969 @sorbits Initial commit
sorbits authored
26
27 In the simplest case you would run:
28
67c17d8 @sorbits Move git clone + submodule update to README.
sorbits authored
29 git clone https://github.com/textmate/textmate.git
30 cd textmate
31 git submodule update --init
9894969 @sorbits Initial commit
sorbits authored
32 ./configure && ninja
33
b55a0ce @sorbits Fix typo
sorbits authored
34 Please note that if you downloaded the source code (rather than cloned via git) you likely miss the submodules and the build will therefore fail.
67c17d8 @sorbits Move git clone + submodule update to README.
sorbits authored
35
9894969 @sorbits Initial commit
sorbits authored
36 ## Prerequisites
37
38 To build the source the following must first be installed on your system:
39
40 * [ninja][] — build system similar to `make`
41 * [ragel][] — state machine compiler
42 * [boost][] — portable C++ source libraries
43 * [multimarkdown][] — marked-up plain text compiler
44 * [mercurial][] — distributed SCM system
45
46 To install using [MacPorts][] run:
47
48 sudo port install ninja ragel boost multimarkdown mercurial
49
50 If `port` fails with a build error then likely you need to agree (system-wide) to Apple’s Xcode license:
51
52 sudo xcodebuild -license
53
54 You can also install the above using [homebrew][]:
55
707b45b @shadowbq ninja now back in trunk of brew
shadowbq authored
56 brew install ragel boost multimarkdown hg ninja
9894969 @sorbits Initial commit
sorbits authored
57
58 In practice `hg` ([mercurial][]) is only required for the SCM library’s tests so you can skip this dependency if you don’t mind a failing test.
59
60 ### OS X 10.7 (Lion)
61
9637bc5 @sorbits Update build instructions for clang.
sorbits authored
62 If you are on OS X 10.7 you need `pgrep` and `pkill` (used by the “relaunch” build targets). To install using [MacPorts][]:
9894969 @sorbits Initial commit
sorbits authored
63
9637bc5 @sorbits Update build instructions for clang.
sorbits authored
64 sudo port install proctools
9894969 @sorbits Initial commit
sorbits authored
65
9637bc5 @sorbits Update build instructions for clang.
sorbits authored
66 Or using [homebrew][]:
7143f00 @burgua Update README.md
burgua authored
67
547aa70 @youngrok Update README.md
youngrok authored
68 brew install proctools
7143f00 @burgua Update README.md
burgua authored
69
9637bc5 @sorbits Update build instructions for clang.
sorbits authored
70 ### Clang 3.2 / 4.0
71
1a1a806 @sorbits Update README
sorbits authored
72 You also need a recent version of clang. This should be included with Xcode 4.4+ available for both Lion and Mountain Lion.
9637bc5 @sorbits Update build instructions for clang.
sorbits authored
73
1a1a806 @sorbits Update README
sorbits authored
74 If you have multiple versions of Xcode installed, be sure to run `sudo xcode-select -switch` so that `./configure` finds the most recent.
9637bc5 @sorbits Update build instructions for clang.
sorbits authored
75
1a1a806 @sorbits Update README
sorbits authored
76 We also require the [libc++][] library, so while you can install clang from MacPorts or Homebrew, you’d need to also install this library (or make it use the one from Xcode).
77
78 [libc++]: http://libcxx.llvm.org/
9637bc5 @sorbits Update build instructions for clang.
sorbits authored
79
9894969 @sorbits Initial commit
sorbits authored
80 ## Building from within TextMate
81
1f2b155 @sdefresne Fix links to ninja build system and Ninja Bundle
sdefresne authored
82 You should install the [Ninja][NinjaBundle] and [CxxTest][] bundles. Both can be installed via _Preferences__Bundles_.
9894969 @sorbits Initial commit
sorbits authored
83
009e0ac @mads379 Update README.md
mads379 authored
84 After this you can press ⌘B to build from within TextMate. In case you haven't already you also need to set up the `PATH` variable either in _Preferences__Variables_ or `~/.tm_properties` so it can find `ninja` and related tools; an example could be `$PATH:/opt/local/bin`.
9894969 @sorbits Initial commit
sorbits authored
85
86 The default target is `TextMate/run`. This will relaunch TextMate but when called from within TextMate, a dialog will appear before the current instance is killed. As there is full session restore, it is safe to relaunch even with unsaved changes.
87
88 If the current file is a test file then the target to build is changed to build the library to which the test belongs (this is done by setting `TM_NINJA_TARGET` in the `.tm_properties` file found in the root of the source tree).
89
90 Similarly, if the current file belongs to an application target (other than `TextMate.app`) then `TM_NINJA_TARGET` is set to build and run this application.
91
92 ## Build Targets
93
94 The build system classifies a target either as a library or an application. The latter can either be a bundled or non-bundled application. E.g. `mate` is non-bundled (just a `mate` executable) where `TextMate.app` is a bundled application.
95
96 For each output there are a few symbolic targets you can build. While the examples below refer to a specific library or application, they exist for all targets of same type.
97
98 For the `io` library:
99
100 ninja io # Build the io library and run tests.
101 ninja io/coerce # Build the io library and skip tests.
102 ninja io/clean # Remove the build folder for the io library.
103 ninja io/headers # Copy exported headers to $builddir/include.
104
105 For the `mate` (non-bundled) application:
106
107 ninja mate # Build the mate executable.
108 ninja mate/run # Build and run the mate executable.
109 ninja mate/clean # Remove the build folder for the mate executable.
110
111 For the `TextMate.app` application:
112
113 ninja TextMate # Build and sign TextMate.app.
114 ninja TextMate/run # Build, sign, and run TextMate.app.
115 ninja TextMate/clean # Remove the build folder for TextMate.app.
116 ninja TextMate/dsym # Create a tarball with extracted dSYM files.
117 ninja TextMate/tbz # Create a tarball of TextMate.app. Also produce the dsym tarball.
118 ninja TextMate/deploy # Push a nightly build. Fails without proper credentials :)
119
120 Note that `ninja TextMate/clean` only cleans the TextMate build folder (`$builddir/Applications/TextMate`) but all libraries and applications it depends on, are not cleaned.
121
122 To clean everything run:
123
124 ninja -t clean
125
126 # Contributing
127
128 You can send pull requests via GitHub. Patches should:
129
130 1. Follow the style of the existing code.
131 2. One commit should do exactly one thing.
132 3. Commit messages should start with a summary line below 80 characters followed by a blank line, and then the reasoning/analysis for why the change was made (if appropriate).
133 4. Commits that fix a bug in a previous commit (which has already been merged) should start with `fixup!` and then the summary line of the commit it fixes. If you are writing your commit message in TextMate then type `fix⇥` to get the prefix and a menu allowing you to pick the summary line from one of the last 15 commits.
134 5. Rebase your branch against the upstream’s master. We don’t want to pull redundant merge commits.
135 6. **Be clear about what license applies to your patch:** The files within this repository are under the [GPL 3][] (or later) but (as the original creator) we are still allowed to create non-free derivatives. However, if patches are given to us under GPL then those cannot make it into any non-free derivatives we may later wish to create. So to make it easier for us (and avoid any legal issues) we prefer if patches are released as public domain.
136
f4f6d9c @tiktuk Updated IRC channel name in README.
tiktuk authored
137 There is both the [textmate-dev][] mailing list and [#textmate][] IRC channel at [freenode.net][] where this project can be discussed.
9894969 @sorbits Initial commit
sorbits authored
138
51cb92b Added GitHub workflow info to README.md
Gerd Knops authored
139 ## GitHub Workflow
140
141 Developing patches should follow this workflow:
142
143 ### Initial Setup
144
145 1. Fork on GitHub (click Fork button)
146 2. Clone to computer: `git clone git@github.com:«github account»/textmate.git`
147 3. cd into your repo: `cd textmate`
148 4. Set up remote upstream: `git remote add -f upstream git://github.com/textmate/textmate.git`
149
150 ### Adding a Feature
151
152 1. Create a branch for the new feature: `git checkout -b my_new_feature`
153 2. Work on your feature, add and commit as usual
154
155 Creating a branch is not strictly necessary, but it makes it easy to delete your branch when the feature has been merged into upstream, diff your branch with the version that actually ended in upstream, and to submit pull requests for multiple features (branches).
156
157 ### Pushing to GitHub
158
159 8. Push branch to GitHub: `git push origin my_new_feature`
160 9. Issue pull request: Click Pull Request button on GitHub
161
162 ### Useful Commands
163
164 If a lot of changes has happened upstream you can replay your local changes on top of these, this is done with `rebase`, e.g.:
165
166 git fetch upstream
167 git rebase upstream/master
168
169 This will fetch changes and re-apply your commits on top of these.
170
171 This is generally better than merge, as it will give a clear picture of which commits are local to your branch. It will also “prune” any of your local commits if the same changes have been applied upstream.
172
173 You can use `-i` with `rebase` for an “interactive” rebase. This allows you to drop, re-arrange, merge, and reword commits, e.g.:
174
175 git rebase -i upstream/master
176
b9d8d61 @sorbits Add instructions about how to change a xib
sorbits authored
177 ## Changing a xib File
178
179 When you change a `xib` file then please look at the diff before you push. If the diff seems to have a lot of changes unrelated to what actually did change, please revert back to `HEAD` and open the pristine `xib` in Xcode and save that (without changing anything).
180
181 Commit this saved `xib` with a commit message of `Save xib file with Xcode «version»`. Here version is the version of Xcode you are using, but be sure you don’t downgrade the format. To check the version that `resources/English.lproj/MainMenu.xib` was last saved with, you can run (add appropriate grep if desired):
182
183 git log --oneline resources/English.lproj/MainMenu.xib
184
185 You can safely assume that all `xib` files without such message are saved with Xcode 4.4 or earlier (i.e. you won’t downgrade them).
186
187 After this, re-apply your change and commit. If the change is non-trivial it is a good idea to write how you made the change in the commit body. E.g. a commit message could be:
188
1a1a806 @sorbits Update README
sorbits authored
189 Disable install button when we can’t install
b9d8d61 @sorbits Add instructions about how to change a xib
sorbits authored
190
191 The install button’s “enabled” property
192 has been bound to the “canInstall”
193 property of File’s Owner.
194
9894969 @sorbits Initial commit
sorbits authored
195 # Legal
196
197 The source for TextMate is released under the GNU General Public License as published by the Free Software Foundation, either version 3 of the License, or (at your option) any later version.
198
199 TextMate is a trademark of Allan Odgaard.
200
201 [boost]: http://www.boost.org/
202 [ninja]: http://martine.github.com/ninja/
203 [multimarkdown]: http://fletcherpenney.net/multimarkdown/
204 [ragel]: http://www.complang.org/ragel/
205 [mercurial]: http://mercurial.selenic.com/
206 [clang 3.2]: http://clang.llvm.org/
207 [MacPorts]: http://www.macports.org/
208 [homebrew]: http://mxcl.github.com/homebrew/
56d763e @sorbits Update URL for ninja and CxxTest bundles
sorbits authored
209 [NinjaBundle]: https://github.com/textmate/ninja.tmbundle
210 [CxxTest]: https://github.com/textmate/cxxtest.tmbundle
9894969 @sorbits Initial commit
sorbits authored
211 [GPL 3]: http://www.gnu.org/copyleft/gpl.html
212 [textmate-dev]: http://lists.macromates.com/listinfo/textmate-dev
f4f6d9c @tiktuk Updated IRC channel name in README.
tiktuk authored
213 [#textmate]: irc://irc.freenode.net/#textmate
9894969 @sorbits Initial commit
sorbits authored
214 [freenode.net]: http://freenode.net/
Something went wrong with that request. Please try again.