Commit 73898d59 authored by Marco Serantoni's avatar Marco Serantoni

[MacOSX] Refines in building system, now bundles lib migration supports symbolic links

parent 3132c70e
......@@ -190,9 +190,11 @@ if( CMAKE_COMPILER_IS_GNUCXX OR CMAKE_CXX_COMPILER_ID MATCHES "Clang" )
set( TO_LINKER -Wl )
endif()
# Thou shalt not link vaporware and tell us it's a valid DSO:
set( CMAKE_SHARED_LINKER_FLAGS "${TO_LINKER},--no-undefined" )
set( CMAKE_MODULE_LINKER_FLAGS "${TO_LINKER},--no-undefined" )
# Thou shalt not link vaporware and tell us it's a valid DSO (apple ld doesn't support it)
if( NOT APPLE )
set( CMAKE_SHARED_LINKER_FLAGS "${TO_LINKER},--no-undefined" )
set( CMAKE_MODULE_LINKER_FLAGS "${TO_LINKER},--no-undefined" )
endif()
set( CMAKE_EXE_LINKER_FLAGS_RELEASE "-s" )
endif()
......@@ -345,12 +347,6 @@ check_find_package_result( OPENGL_FOUND "OpenGL" )
if( KICAD_BUILD_STATIC OR KICAD_BUILD_DYNAMIC )
add_custom_target( lib-wxpython )
include( download_pcre )
include( download_swig )
include( download_wxpython )
add_dependencies( lib-wxpython pcre )
add_dependencies( lib-wxpython swig )
add_dependencies( lib-wxpython libwxpython )
#set(CMAKE_FIND_LIBRARY_SUFFIXES ".a;.so;.dylib;.dll")
......@@ -361,6 +357,9 @@ add_custom_target( lib-wxpython )
if( KICAD_BUILD_STATIC )
message(STATUS "KICAD_BUILD_STATIC set")
if( KICAD_SCRIPTING OR KICAD_SCRIPTING_WXPYTHON OR KICAD_SCRIPTING_MODULES )
message(FATAL_ERROR "KICAD_SCRIPTING* is not supported with KICAD_BUILD_STATIC, please select KICAD_BUILD_DYNAMIC" )
endif()
endif()
if( KICAD_BUILD_DYNAMIC )
......@@ -374,6 +373,9 @@ add_custom_target( lib-wxpython )
include( download_libpng )
if( KICAD_SCRIPTING OR KICAD_SCRIPTING_WXPYTHON OR KICAD_SCRIPTING_MODULES )
message(STATUS "Scripting ENABLED")
set( SWIG_EXECUTABLE ${SWIG_ROOT}/bin/swig )
set( SWIG_INCLUDE ${SWIG_ROOT}/include )
set( PYTHON_DEST ${LIBWXPYTHON_ROOT}/wxPython/lib/python2.6/site-packages )
......@@ -392,6 +394,12 @@ add_custom_target( lib-wxpython )
set(wxWidgets_INCLUDE_DIRS ${LIBWXPYTHON_ROOT}/include/wx-3.0 )
set(wxWidgets_LIBRARY_DIRS ${LIBWXPYTHON_ROOT}/lib )
include( download_pcre )
include( download_swig )
include( download_wxpython )
add_dependencies( lib-wxpython pcre )
add_dependencies( lib-wxpython swig )
add_dependencies( lib-wxpython libwxpython )
add_dependencies( lib-dependencies libwxpython )
else()
include( download_wxwidgets )
......
#!/bin/bash
#!/bin/bash
# v 1.1 Supports migration of links (limited to the same directory) - I should add checks..
# usage osx_fixbundle.sh <bundle-name> <bzr_root>
if [[ ! -f version.h ]]; then
......@@ -11,7 +12,6 @@ fi
EXECUTABLES="`find . -name '*.app'`"
#
# Copies libraries under <bzr_root> in the bundle and relocates them in the binary
#
......@@ -29,7 +29,11 @@ function fixbundle() {
if [[ "$library" =~ "$bzroot" ]]; then
echo "${exec}: Migrating `basename $library` in the bundle"
if [ ! -f ${exec}.app/Contents/Frameworks/`basename $library` ]; then
cp -f $library ${execpath}${exec}.app/Contents/Frameworks
if [ ! -L $library ]; then
cp -f $library ${execpath}${exec}.app/Contents/Frameworks
else
resolvelink "$library" "`dirname $library`" "${execpath}/${exec}.app/Contents/Frameworks"
fi
fi
install_name_tool -change $library @executable_path/../Frameworks/`basename $library` ${execpath}${exec}.app/Contents/MacOS/${exec}
fi
......@@ -46,7 +50,11 @@ function fixbundle() {
for library in $LIBRARIES; do
if [[ "$library" =~ "$bzroot" ]]; then
if [ ! -f ${exec}.app/Contents/Frameworks/`basename $library` ]; then
cp -f $library ${exec}.app/Contents/Frameworks
if [ ! -L $library ]; then
cp -f $library ${exec}.app/Contents/Frameworks
else
resolvelink "$library" "`dirname $library`" "${execpath}/${exec}.app/Contents/Frameworks"
fi
fi
install_name_tool -change $library @executable_path/../Frameworks/`basename $library` $module
fi
......@@ -70,7 +78,11 @@ function fixbundle() {
for library in $LIBRARIES; do
if [[ "$library" =~ "$bzroot" ]]; then
if [ ! -f ${exec}.app/Contents/Frameworks/`basename $library` ]; then
cp -f $library ${exec}.app/Contents/Frameworks
if [ ! -L $library ]; then
cp -f $library ${exec}.app/Contents/Frameworks
else
resolvelink "$library" "`dirname $library`" "${execpath}/${exec}.app/Contents/Frameworks"
fi
echo "copied `basename $library` into bundle"
(( dynlib_migrate += 1))
fi
......@@ -84,8 +96,27 @@ function fixbundle() {
cd - >/dev/null
}
#
# This supports only links on the same dir (TODO ?)
#
function resolvelink() {
local srclib="`basename $1`"
local srcpath="$2"
local destpath="$3"
#fixbundle $1 $2 $3
#if is a file i expect a pointed ""
local pointed="`readlink ${srcpath}/${srclib}`"
if [ ! -f ${pointed} ]; then
resolvelink "${pointed}" "${srcpath}" "${destpath}"
echo "Link ${srclib} -> ${pointed} "
(cd "${destpath}"; ln -s "${pointed}" "${srclib}" )
else
echo "Copy ${srcpath}/${srclib} -> ${destpath} "
cp "${srcpath}/${srclib}" ${destpath}
fi
}
for executable in $EXECUTABLES;
do
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment