Ticket #31424: README.MAC.DEVELOPERS.txt

File README.MAC.DEVELOPERS.txt, 8.8 KB (added by nonstop.server@…, 13 years ago)
Line 
1PasswordSafe can be built and run on Mac OS X with Xcode.  The
2Xcode directory under PasswordSafe source checkout contains the
3Xcode project file for building it.
4
5Requirements
6============
7
81. Xcode
92. wxWidgets
103. Perl
11
12Xcode
13=====
14
15I've only tried building with Xcode 3.2.x that ships with Snow Leopard, not Xcode 4. You can
16try building with Xcode 4, but some targets require gcc/g++ 4.0 and 10.4u sdk.  If you
17don't have those, try building some of the other targets (see below).
18
19wxWidgets
20========
21 
22Unless you want a 64-bit build of pwsafe, use the latest stable 2.8 release
23of pwsafe.  64-bit builds require 2.9 release of wxWidgets which is still
24under development and isn't very stable (in my experience, as compared to 2.8).
25
26Also note that Mac OS X ships with some version of wxWidgets (2.8.8 on Snow Leopard),
27but only the debug binaries. We haven't tried building with Apple's
28build of wxWidgets.  We always built wxWidges ourselves, partly because
29we needed the release builds also, and partly because we wanted to link
30statically so that we could distribute the binaries on as many platforms
31as possible.
32
33Perl
34====
35Mac OS X (at least till 10.6) ships with perl, which should suffice.
36
37
38Building PasswordSafe
39=====================
40
41There are three steps to building PasswordSafe on Mac OS X:
42
431. Building wxWidgets
442. Generate xcconfig files
453. Build PasswordSafe
46
47The first two need to be performed only once, unless you rebuild wxWidgets for some reason.
48
49
50Building wxWidgets
51=================
52How you build wxWidgets depends on the version of Mac OS X you are building on, and
53the platform (hardware & OS) on which you want to run your build of PasswordSafe.  PasswordSafe
54can be built in four flavours (four different Xcode targets):
55
56                wxWidgets
57 Target         required      xcconfig files               Binary types     Deployment target    Base SDK
58 --------------------------------------------------------------------------------------------------------
59 pwsafe           2.8     pwsafe-debug.xcconfig             i386 + ppc       10.4+                10.4
60                          pwsafe-release.xcconfig           
61
62 pwsafe-i386      2.8     pwsafe-i386-debug.xcconfig        i386             10.4+                10.4
63                          pwsafe-i386-release.xcconfig     
64
65 pwsafe64         2.9     pwsafe64-debug.xcconfig           X86_64           Compiler Default     Current Mac OS
66                          pwsafe64-release.xcconfig         
67
68 pwsafe-llvm      2.8     pwsafe-llvm-debug.xcconfig        i386             Compiler Default     Current Mac OS
69                          pwsafe-llvm-release.xcconfig     
70 --------------------------------------------------------------------------------------------------------
71
72
73If you want to run PasswordSafe on older versions of Mac OS X (10.4+), including the ppc
74architecture, build the 'pwsafe' target.
75
76If you want to run it on the older versions of Mac OS X (10.4) but only on i386 hardware, select
77the 'pwsafe-i386' target.
78
79If you need a 64-bit version of PasswordSafe, build the pwsafe64 target.  Note that you
80need wxWidgets 2.9 release and also build it appropriately (see below).
81
82the 'pwsafe-llvm' is an experimental target to build PasswordSafe with the llvm compiler.
83This is only of interest if you are developing PasswordSafe on OS X and want to use
84the static analysis abilities of clang (which are not available for C++ with the stock
85llvm 1.7 shipped with OS X 10.6 or Xcode 3.2.x).  But the builds seem faster using llvm.
86
87
88Building wxWidgets for pwsafe & pwsafe-i386 targets
89===================================================
90
91Since these targets are intended to run on 10.4 and above, we set these up to build
92with 10.4 sdk.  Which in turn implies that wxWidgets 2.8 also needs to be built with 10.4 sdk.
93That involves passing a ton of parameters to the "./configure" script for building wxWidgets.
94There's a shell script (osx-build-wx) to aid with doing that, in the 'Misc' folder.  You only
95need to do this
96
971. Download wxMac-2.8.12.tar.gz (or the latest 2.8 version)
982. tar xzf wxMac-2.8.12.tar.gz
993. cd wxMac-2.8.11
1004. mkdir static-release ; cd static-release ; ...../Misc/osx-build-wx
1015. mkdir static-debug ; cd static-debug ; ....../Misc/osx-build-wx DEBUG
102
103This will build the static (.a's) version of wxWidgets.  The debug build
104would end up in static-debug and release in static-release. It is necessary
105to build them in separate directories otherwise the "wx-config" script from one will
106overwrite the other.  Of course, you don't need both Debug and Release builds
107of wxWidgets unless you need both Debug and Release builds of PasswordSafe.
108
109It is possible that PasswordSafe & wxWidgets are be built with 10.6 sdk and still run on 10.4+ if the
110deployment target is set appropriately in Xcode, but I have no way of trying that.
111I'm also not aware of what precautions to take in the code to not add any dependencies
112that cannot be satisfied on 10.4
113
114
115Building wxWidgets for pwsafe64 target
116======================================
117
118Essentially, you need a 64-bit build of wxWidgets, which is only possible with 2.9 series of wxWidgets or later.
119
1201. Download wxWidgets-2.9.2.tar.gz (or the latest 2.9 release)
1212. tar xzf wxWidgets-2.9.2.tar.gz
1223. cd wxWidgets-2.9.2
1234. mkdir static64-debug ; cd static64-debug
1245  ../configure --prefix=`pwd` --disable-shared --enable-unicode --enable-debug --with-osx_cocoa
1255. make
126
127That last bit about "--with-osx_cocoa" is what ensures you get a 64-bit build of wxWidgets.  For
128Release configuration, just change "--enable-debug" with "--disable-debug".  Of course, if you're
129only going to build one of Debug or Release configurations of PasswordSafe, you only need to build
130the corresponding configuration of wxWidgets.
131
132
133Building wxWidgets for pwsafe-llvm target
134========================================
135
136I use an llvm-built version of wxWidgets when I build pwsafe-llvm, but its
137probably not necessary.  The gcc and llvm libraries/binaries are compatible
138with each other.  Still, if you want to build wxWidgets with llvm, do this:
139
1401. Download wxMac-2.8.12.tar.gz (or the latest 2.8 release)
1412. tar xzf wxWidgets-2.8.12.tar.gz
1423. cd wxWidgets-2.8.12
1434. mkdir static-llvm-debug ; cd static-llvm-debug ;
1445. ../configure --prefix=`pwd` CC='llvm-gcc-4.2` CXX='llvm-g++-4.2' CFLAGS='-arch i386' CXXFLAGS='-arch i386' CPPFLAGS='-arch i386' LDFLAGS='-arch i386' OBJCFLAGS='-arch i386' OBJCXXFLAGS='-arch i386' --enable-debug --disable-shared --disable-copmat24 --enable-unicode
1456. make
146
147For the release build, do the same, except replace "--enabe-debug" with "--disable-debug".
148 
149
150
151Generate xcconfig files
152=========================
153
154Having built wxWidgets, unless you are willing to "make install" wxWidgets and overwrite
155whatever shipped with your os, you will have to tell Xcode where to pick up your wxWidgets
156headers/libs from. wxWidgets makes it easy by creating a script called 'wx-config' during its
157build process (command-line makefile based builds only) that spits out the correct location
158of headers/libs as well as compiler and liker settings compatible with that build of wxWidgets.
159This is used in UNIX makefiles to compile/link with the desired build of wxWidgets where its
160trivial to read in the settings from outputs of external commands.
161
162Since Xcode can't pick up settings from output of external commands , we use a script to
163put those settings into configuration files that Xcode can use. Xcode target configurations
164can be "based on" xcconfig files, which are essentially sets of name-value pairs.  For a
165target/configuration, Xcode will use settings from the xcconfig file, if found. Else, it
166will use the values specified in its GUI.
167
168The "Xcode/generate-configs" script generates xcconfig data from the wx-config files.
169Go to the Xcode subdirectory of your pwsafe source checkout, and do this
170
171./generate-configs -d full_path_to_wx-config  > xcconfig_file
172
173For Release builds, the first parameter should be "-r" instead of "-d"
174
175Substitue "xcconfig_file" with the correct xcconfig file name from the above table.  Each
176target and each configuration has its own xcconfig file.  Make sure you have them
177in the "Xcode" sub-directory of your PasswordSafe source tree.
178
179
180Building PasswordSafe
181=====================
182
183You can either open pwsafe.xcodeproj in Xcode and build your preferred target.  Or
184you can do so from the command line.  In the Xcode directory, do this:
185
186xcodebuild -target <your target> -configuration <Debug or Release>
187
188Keep your fingers crossed :-).  Once built, the app would be there in one of "build",
189"build64" or "build-llvm" folders.  You should be able to use your
190PasswordSafe databases from Windows/Linux without any problems.
191
192If things don't work, or you wish to improve them nonetheless, please get
193in touch with developers.
194
195Note that some of the XML related functionality is still not in place for the
196OS X build.  We will get those in sometime.
197