1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 168 169 170 171 172 173 174 175 176 177 178 179 180 181 182 183 184 185 186 187 188 189 190 191 192 193 194 195 196 197 198 199 200 201 202 203 204 205 206 207 208 209 210 211 212 213 214 215 216 217 218 219 220 221 222 223 224 225 226 227 228 229 230 231 232 233 234 235 236 237 238 239 240 241 242 243 244 245 246 247 248 249 250 251 252 253 254 255 256 257 258 259 260 261 262 263 264 265 266 267 268 269 270 271 272 273 274 275 276 277 278 279 280 281 282 283 284 285 286 287 288 289 290 291 292 293 294 295 296 297 298 299 300 301 302 303 304 305 306 307 308 309 310 311 312 313 314 315 316 317 318 319 320 321 322 323 324 325 326 327 328 329 330 331 332 333 334 335 336 337 338 339 340 341
|
#!/bin/sh
enable_debug=$1
ext="u"
if [ "${enable_debug}" = "debug" ]; then
ext="ud"
fi
fix_shared_object_depends() {
search_string=$1
## Get list of files to work on
dylibs=`ls ./codelite.app/Contents/MacOS/*.dylib`
sos2=`ls ./codelite.app/Contents/SharedSupport/plugins/*.dylib`
sos3=`ls ./codelite.app/Contents/SharedSupport/debuggers/*.dylib`
file_list="${dylibs} ${sos2} ${sos3} ./codelite.app/Contents/MacOS/codelite "
## Since the plugins must use the same wx configuration as the
## executable, we can run the following command only once and
## use the results to manipulate the plugins as well
orig_path=`otool -L ../bin/codelite | grep ${search_string} | awk '{print $1;}'`
## Loop over the files, and update the path of the wx library
for file in ${file_list}
do
echo "Fixing file $file..."
for path in ${orig_path}
do
new_path=`echo ${path} | xargs basename`
install_name_tool -change ${path} @executable_path/../MacOS/${new_path} ${file}
done
done
}
fix_non_plugins_depends() {
search_string=$1
## Get list of files to work on
dylibs=`ls ./codelite.app/Contents/MacOS/*.dylib`
sos2=`ls ./codelite.app/Contents/SharedSupport/plugins/*.dylib`
sos3=`ls ./codelite.app/Contents/SharedSupport/debuggers/*.dylib`
file_list="${dylibs} ${sos2} ${sos3} ./codelite.app/Contents/MacOS/codelite "
## add codelite-lldb if it exists
if test -f ./codelite.app/Contents/MacOS/codelite-lldb ; then
file_list="${file_list} ./codelite.app/Contents/MacOS/codelite-lldb"
fi
for SO in ${file_list}
do
orig_path=`otool -L ${SO} | grep ${search_string} | awk '{print $1;}'`
if [ ! -z ${orig_path} ]; then
## Loop over the files, and update the path of the wx library
for file in ${file_list}
do
new_path=`echo ${orig_path} | xargs basename`
install_name_tool -change ${orig_path} @executable_path/../MacOS/${new_path} ${file}
done
fi
done
}
fix_codelite_clang_deps() {
echo "fix_codelite_clang_deps..."
if test -f ./codelite.app/Contents/MacOS/codelite-clang ; then
echo otool -L ./codelite.app/Contents/MacOS/codelite-clang | grep libwx_* | awk '{print $1;}'
orig_path=`otool -L ./codelite.app/Contents/MacOS/codelite-clang | grep libwx_* | awk '{print $1;}'`
## Loop over the files, and update the path of the wx library
for path in ${orig_path}
do
new_path=`echo ${path} | xargs basename`
echo install_name_tool -change ${path} @executable_path/../MacOS/${new_path} ./codelite.app/Contents/MacOS/codelite-clang
install_name_tool -change ${path} @executable_path/../MacOS/${new_path} ./codelite.app/Contents/MacOS/codelite-clang
done
echo install_name_tool -change @rpath/libclang.dylib @executable_path/../MacOS/libclang.dylib ./codelite.app/Contents/MacOS/codelite-clang
install_name_tool -change @rpath/libclang.dylib @executable_path/../MacOS/libclang.dylib ./codelite.app/Contents/MacOS/codelite-clang
fi
echo "fix_codelite_clang_deps... done"
}
fix_codelite_lldb_deps() {
if test -f ./codelite.app/Contents/MacOS/codelite-lldb ; then
orig_path=`otool -L ./codelite.app/Contents/MacOS/codelite-lldb | grep libwx_* | awk '{print $1;}'`
## Fix wxWidgets dependencies
## Loop over the files, and update the path of the wx library
for path in ${orig_path}
do
new_path=`echo ${path} | xargs basename`
install_name_tool -change ${path} @executable_path/../MacOS/${new_path} ./codelite.app/Contents/MacOS/codelite-lldb
done
echo install_name_tool -change @rpath/liblldb.3.5.0.dylib @executable_path/../SharedSupport/liblldb.3.5.0.dylib ./codelite.app/Contents/MacOS/codelite-lldb
install_name_tool -change @rpath/liblldb.3.5.0.dylib @executable_path/../SharedSupport/liblldb.3.5.0.dylib ./codelite.app/Contents/MacOS/codelite-lldb
## Fix libcodelite, libplugin and libwxsqlite
fi
}
fix_codelite_indexer_deps() {
orig_path=`otool -L ./codelite.app/Contents/MacOS/codelite_indexer | grep libwx_* | awk '{print $1;}'`
## Loop over the files, and update the path of the wx library
for path in ${orig_path}
do
new_path=`echo ${path} | xargs basename`
install_name_tool -change ${path} @executable_path/../MacOS/${new_path} ./codelite.app/Contents/MacOS/codelite_indexer
done
}
fix_codelite_make_deps() {
orig_path=`otool -L ./codelite.app/Contents/MacOS/codelite-make | grep libwx_* | awk '{print $1;}'`
## Loop over the files, and update the path of the wx library
for path in ${orig_path}
do
new_path=`echo ${path} | xargs basename`
install_name_tool -change ${path} @executable_path/../MacOS/${new_path} ./codelite.app/Contents/MacOS/codelite-make
done
}
fix_codelite_terminal_deps() {
orig_path=`otool -L ./codelite.app/Contents/MacOS/codelite-terminal.app/Contents/MacOS/codelite-terminal | grep libwx_* | awk '{print $1;}'`
## Loop over the files, and update the path of the wx library
for path in ${orig_path}
do
new_path=`echo ${path} | xargs basename`
install_name_tool -change ${path} @executable_path/../../../${new_path} ./codelite.app/Contents/MacOS/codelite-terminal.app/Contents/MacOS/codelite-terminal
done
}
fix_wxrc_deps() {
if test -f ./codelite.app/Contents/SharedSupport/wxrc ; then
orig_path=`otool -L ./codelite.app/Contents/SharedSupport/wxrc | grep libwx_* | awk '{print $1;}'`
## Loop over the files, and update the path of the wx library
for path in ${orig_path}
do
new_path=`echo ${path} | xargs basename`
install_name_tool -change ${path} @executable_path/../MacOS/${new_path} ./codelite.app/Contents/SharedSupport/wxrc
done
fi
}
## extract the file name from the Makefile
exe_name=codelite
rm -rf codelite.app
mkdir -p ./codelite.app/Contents/MacOS
mkdir -p ./codelite.app/Contents/Resources
mkdir -p ./codelite.app/Contents/SharedSupport
mkdir -p ./codelite.app/Contents/SharedSupport/plugins
mkdir -p ./codelite.app/Contents/SharedSupport/plugins/resources/
mkdir -p ./codelite.app/Contents/SharedSupport/debuggers
mkdir -p ./codelite.app/Contents/SharedSupport/config
mkdir -p ./codelite.app/Contents/SharedSupport/config/cppcheck
wx_file_list=`otool -L ../bin/codelite | grep libwx_* | awk '{print $1;}'`
# fix the script
echo "Running install_name_tool..."
# copy the libs locally, the script will have an easier time finding them this way
mkdir -p lib
cp ../lib/*.dylib ./lib
## copy the wx dlls to the executable path which under Mac is located at ./codelite.app/Contents/MacOS/
for wx_file in ${wx_file_list}
do
cp ${wx_file} ./codelite.app/Contents/MacOS/
done
## Copy wxrc tool
wx_config=`which wx-config`
wxrc_tool=`dirname ${wx_config}`
wxrc_tool=${wxrc_tool}/utils/wxrc/wxrc
if test -f ${wxrc_tool} ; then
cp ${wxrc_tool} ./codelite.app/Contents/SharedSupport/
fi
cp ../bin/codelite ./codelite.app/Contents/MacOS/codelite
## codelite-terminal bundle
mkdir -p ./codelite.app/Contents/MacOS/codelite-terminal.app/Contents/MacOS
mkdir -p ./codelite.app/Contents/MacOS/codelite-terminal.app/Contents/Resources
cp ../../codelite_terminal/icon.icns ./codelite.app/Contents/MacOS/codelite-terminal.app/Contents/Resources
cp ../bin/codelite-terminal ./codelite.app/Contents/MacOS/codelite-terminal.app/Contents/MacOS/
cp ../../codelite_terminal/Info.plist ./codelite.app/Contents/MacOS/codelite-terminal.app/Contents/
## Fix clang
echo ../../sdk/clang/lib/libclang.dylib ./codelite.app/Contents/MacOS/
cp ../../sdk/clang/lib/libclang.dylib ./codelite.app/Contents/MacOS/
echo install_name_tool -change @rpath/libclang.dylib @executable_path/libclang.dylib ./codelite.app/Contents/MacOS/codelite
install_name_tool -change @rpath/libclang.dylib @executable_path/../MacOS/libclang.dylib ./codelite.app/Contents/MacOS/codelite
cp -r ../../Runtime/rc ./codelite.app/Contents/SharedSupport/
cp -r ../../Runtime/templates ./codelite.app/Contents/SharedSupport/
cp -r ../../Runtime/images ./codelite.app/Contents/SharedSupport/
cp -r ../../Runtime/lexers ./codelite.app/Contents/SharedSupport/
cp -r ../../Runtime/gdb_printers ./codelite.app/Contents/SharedSupport/
cp ../../Runtime/astyle.sample ./codelite.app/Contents/SharedSupport/
cp ../../Runtime/index.html ./codelite.app/Contents/SharedSupport/
cp ../../Runtime/svnreport.html ./codelite.app/Contents/SharedSupport/
cp ../../Runtime/*.icns ./codelite.app/Contents/Resources/
cp -pr ../../Runtime/src/*.gz ./codelite.app/Contents/Resources/
cp -pr ../../Runtime/codelite-icons.zip ./codelite.app/Contents/SharedSupport/
cp -pr ../../Runtime/codelite-icons-dark.zip ./codelite.app/Contents/SharedSupport/
cp -pr ../../Runtime/codelite-icons-fresh-farm.zip ./codelite.app/Contents/SharedSupport/
## copy empty layout file
cp ../../Runtime/config/codelite.layout.default ./codelite.app/Contents/SharedSupport/config/codelite.layout
cp ../../sdk/codelite_cppcheck/cfg/*.cfg ./codelite.app/Contents/SharedSupport/config/cppcheck/
cp ../../Runtime/config/accelerators.conf.default ./codelite.app/Contents/SharedSupport/config/
cp ../../Runtime/config/build_settings.xml.default.mac ./codelite.app/Contents/SharedSupport/config/build_settings.xml.default
cp ../../Runtime/config/plugins.xml.default ./codelite.app/Contents/SharedSupport/config
## copy default Mac configuration file
cp ../../Runtime/config/codelite.xml.default.mac ./codelite.app/Contents/SharedSupport/config/codelite.xml.default
## replace the executable name according to the configuration used in the build
cat ../../Runtime/Info.plist.template | sed s/EXE_NAME/codelite/g >> ./codelite.app/Contents/Info.plist
cp ../../Runtime/config/debuggers.xml.mac ./codelite.app/Contents/SharedSupport/config/debuggers.xml.default
## License
cp ../../Runtime/../LICENSE ./codelite.app/Contents/SharedSupport/
## Copy plugins...
cp ../lib/CodeFormatter.dylib ./codelite.app/Contents/SharedSupport/plugins/
cp ../lib/DebuggerGDB.dylib ./codelite.app/Contents/SharedSupport/debuggers/
cp ../lib/Wizards.dylib ./codelite.app/Contents/SharedSupport/plugins/
cp ../lib/Subversion.dylib ./codelite.app/Contents/SharedSupport/plugins/
cp ../lib/cscope.dylib ./codelite.app/Contents/SharedSupport/plugins/
cp ../lib/Copyright.dylib ./codelite.app/Contents/SharedSupport/plugins/
cp ../lib/UnitTestsPP.dylib ./codelite.app/Contents/SharedSupport/plugins/
cp ../lib/ExternalTools.dylib ./codelite.app/Contents/SharedSupport/plugins/
cp ../lib/Outline.dylib ./codelite.app/Contents/SharedSupport/plugins/
cp ../lib/ContinuousBuild.dylib ./codelite.app/Contents/SharedSupport/plugins/
cp ../lib/SnipWiz.dylib ./codelite.app/Contents/SharedSupport/plugins/
cp ../lib/wxFormBuilder.dylib ./codelite.app/Contents/SharedSupport/plugins/
cp ../lib/abbreviation.dylib ./codelite.app/Contents/SharedSupport/plugins/
cp ../lib/QMakePlugin.dylib ./codelite.app/Contents/SharedSupport/plugins/
cp ../lib/cppchecker.dylib ./codelite.app/Contents/SharedSupport/plugins/
cp ../lib/MacBundler.dylib ./codelite.app/Contents/SharedSupport/plugins/
cp ../lib/DatabaseExplorer.dylib ./codelite.app/Contents/SharedSupport/plugins/
cp ../lib/Tweaks.dylib ./codelite.app/Contents/SharedSupport/plugins/
cp ../lib/git.dylib ./codelite.app/Contents/SharedSupport/plugins/
cp ../lib/ZoomNavigator.dylib ./codelite.app/Contents/SharedSupport/plugins/
cp ../lib/SFTP.dylib ./codelite.app/Contents/SharedSupport/plugins/
cp ../lib/CMakePlugin.dylib ./codelite.app/Contents/SharedSupport/plugins/
cp ../lib/CodeLiteDiff.dylib ./codelite.app/Contents/SharedSupport/plugins/
cp ../lib/SpellCheck.dylib ./codelite.app/Contents/SharedSupport/plugins/
## Copy hunspell dylib to its proper location
echo cp ../../sdk/hunspell/lib/osx/libhunspell-1.3.dylib ./codelite.app/Contents/SharedSupport/
cp ../../sdk/hunspell/lib/osx/libhunspell-1.3.dylib ./codelite.app/Contents/SharedSupport/
## Fix hunspell dylib
hunspell_dylib_orig_path=`otool -L ./codelite.app/Contents/SharedSupport/plugins/SpellCheck.dylib |grep hunspell|awk '{print $1}'`
if [ ! -z ${hunspell_dylib_orig_path} ]; then
echo install_name_tool -change ${hunspell_dylib_orig_path} @executable_path/../SharedSupport/libhunspell-1.3.dylib ./codelite.app/Contents/SharedSupport/plugins/SpellCheck.dylib
install_name_tool -change ${hunspell_dylib_orig_path} @executable_path/../SharedSupport/libhunspell-1.3.dylib ./codelite.app/Contents/SharedSupport/plugins/SpellCheck.dylib
fi
## Copy hunspell default dictionaries
mkdir -p ./codelite.app/Contents/SharedSupport/dics
cp ../../SpellChecker/dics/* ./codelite.app/Contents/SharedSupport/dics
## Fix LLDB
echo "Installing LLDBDebugger..."
echo cp ../lib/LLDBDebugger.dylib ./codelite.app/Contents/SharedSupport/plugins/
cp ../lib/LLDBDebugger.dylib ./codelite.app/Contents/SharedSupport/plugins/
## copy our debug server
cp ../bin/codelite-lldb ./codelite.app/Contents/MacOS/
fix_codelite_lldb_deps
## Copy Apple's debugserver (its signed)
echo cp ../../Runtime/debugserver ./codelite.app/Contents/MacOS/
cp ../../Runtime/debugserver ./codelite.app/Contents/MacOS/
echo cp ../../sdk/clang/lib/clang-format.osx ./codelite.app/Contents/MacOS/codelite-clang-format
cp ../../sdk/clang/lib/clang-format.osx ./codelite.app/Contents/MacOS/codelite-clang-format
cp ../../sdk/lldb/unix/lib/liblldb.3.5.0.dylib ./codelite.app/Contents/SharedSupport/
install_name_tool -change @rpath/liblldb.3.5.0.dylib @executable_path/../SharedSupport/liblldb.3.5.0.dylib ./codelite.app/Contents/SharedSupport/plugins/LLDBDebugger.dylib
if [ -f ../lib/wxcrafter.dylib ]; then
cp ../lib/wxcrafter.dylib ./codelite.app/Contents/SharedSupport/plugins/
cp -pr ../../Runtime/../wxcrafter/wxgui.zip ./codelite.app/Contents/SharedSupport/
cp -pr ../../Runtime/../wxcrafter/wxcrafter.accelerators ./codelite.app/Contents/SharedSupport/plugins/resources
fi
cp ../lib/libplugin.dylib ./codelite.app/Contents/MacOS/
cp ../lib/liblibcodelite.dylib ./codelite.app/Contents/MacOS/
cp ../lib/libwxsqlite3.dylib ./codelite.app/Contents/MacOS/
cp ../lib/libdatabaselayersqlite.dylib ./codelite.app/Contents/MacOS/
cp ../lib/libwxshapeframework.dylib ./codelite.app/Contents/MacOS/
cp ../bin/codelite_indexer ./codelite.app/Contents/MacOS/
if test -f ../bin/codelite-clang ; then
cp ../bin/codelite-clang ./codelite.app/Contents/MacOS/
fi
cp ../bin/codelite-cc ./codelite.app/Contents/MacOS/
cp ../bin/codelite-echo ./codelite.app/Contents/MacOS/
cp ../bin/codelite-make ./codelite.app/Contents/MacOS/
cp ../bin/codelite_cppcheck ./codelite.app/Contents/MacOS/
cp ../../Runtime/plugins/resources/*.* ./codelite.app/Contents/SharedSupport/plugins/resources/
## Copy the locale files
for lang in locale/* ; do
lang=`basename $lang`
if test -f locale/$lang/codelite.mo ; then
mkdir -p ./codelite.app/Contents/Resources/$lang.lproj/
cp -f locale/$lang/codelite.mo ./codelite.app/Contents/Resources/$lang.lproj/
fi
done
fix_codelite_indexer_deps
fix_codelite_make_deps
fix_codelite_terminal_deps
fix_wxrc_deps
fix_codelite_clang_deps
fix_shared_object_depends libwx_
## the blow fixes the paths embedded in the executable located under codelite.app/Contents/MacOS/
## the function fix_non_plugins_depends accepts search string
fix_non_plugins_depends lib/liblibcodelite.dylib
fix_non_plugins_depends lib/libplugin.dylib
fix_non_plugins_depends lib/libwxsqlite3.dylib
fix_non_plugins_depends lib/libwxshapeframework.dylib
fix_non_plugins_depends lib/libdatabaselayersqlite.dylib
|