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