Skip to content

Commit

Permalink
attemt to fix macos build script
Browse files Browse the repository at this point in the history
  • Loading branch information
cryptozoidberg committed Dec 23, 2017
1 parent 083358b commit 4b644b8
Show file tree
Hide file tree
Showing 4 changed files with 129 additions and 6 deletions.
5 changes: 5 additions & 0 deletions CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,11 @@ set_property(GLOBAL PROPERTY USE_FOLDERS ON)
set(CMAKE_CONFIGURATION_TYPES "Debug;Release")
enable_testing()

if(APPLE)
set(CMAKE_OSX_DEPLOYMENT_TARGET 10.10.5)
endif()


include_directories(src contrib contrib/epee/include "${CMAKE_BINARY_DIR}/version")
add_definitions(-DSTATICLIB)

Expand Down
7 changes: 7 additions & 0 deletions src/connectivity_tool/conn_tool.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -412,6 +412,7 @@ int main(int argc, char* argv[])
command_line::add_arg(desc_params, arg_get_daemon_info);
command_line::add_arg(desc_params, arg_get_aliases);
command_line::add_arg(desc_params, arg_upate_maintainers_info);
command_line::add_arg(desc_params, command_line::arg_version);

po::options_description desc_all;
desc_all.add(desc_general).add(desc_params);
Expand All @@ -434,6 +435,12 @@ int main(int argc, char* argv[])
if (!r)
return 1;


if (command_line::get_arg(vm, command_line::arg_version))
{
std::cout << CURRENCY_NAME << " v" << PROJECT_VERSION_LONG << ENDL;
return 0;
}
if(command_line::has_arg(vm, arg_request_stat_info) || command_line::has_arg(vm, arg_request_net_state))
{
return handle_request_stat(vm, command_line::get_arg(vm, arg_peer_id)) ? 0:1;
Expand Down
63 changes: 57 additions & 6 deletions utils/build_script_mac_osx.sh
100644 → 100755
Original file line number Diff line number Diff line change
@@ -1,4 +1,10 @@
cd boolberry

export PROJECT_ROOT="/Users/roky/projects/boolberry"
export QT_PATH="/Users/roky/Qt5.5.0/5.5"
export LOCAL_BOOST_LIBS_PATH="/Users/roky/projects/boolberry/deploy/boost_libs"


cd "$PROJECT_ROOT"
if [ $? -ne 0 ]; then
echo "Failed to cd boolberry"
exit $?
Expand All @@ -12,15 +18,15 @@ fi

rm -rf build; mkdir -p build/release; cd build/release;

cmake -D BUILD_GUI=TRUE -D CMAKE_PREFIX_PATH=/Users/roky/Qt/5.3/clang_64 -D CMAKE_BUILD_TYPE=Release ../..
cmake -D BUILD_GUI=TRUE -D CMAKE_PREFIX_PATH="$QT_PATH/clang_64" -D CMAKE_BUILD_TYPE=Release ../..
if [ $? -ne 0 ]; then
echo "Failed to cmake"
exit $?
fi



make qt-boolb
make -j qt-boolb
if [ $? -ne 0 ]; then
echo "Failed to make qt-boolb"
exit $?
Expand All @@ -33,7 +39,19 @@ if [ $? -ne 0 ]; then
exit $?
fi

/Users/roky/Qt/5.3/clang_64/bin/macdeployqt qt-boolb.app

# copy boost files
mkdir -p qt-boolb.app/Contents/Frameworks/boost_libs
cp -R "$LOCAL_BOOST_LIBS_PATH/" qt-boolb.app/Contents/Frameworks/boost_libs/
if [ $? -ne 0 ]; then
echo "Failed to cp workaround to MacOS"
exit 1
fi




$QT_PATH/clang_64/bin/macdeployqt qt-boolb.app
if [ $? -ne 0 ]; then
echo "Failed to macdeployqt qt-boolb.app"
exit $?
Expand All @@ -51,12 +69,45 @@ if [ $? -ne 0 ]; then
exit $?
fi

zip -r -y "bbr-macos-x64-v0.2.0.zip" qt-boolb.app

read version_str <<< $(DYLD_LIBRARY_PATH=$LOCAL_BOOST_LIBS_PATH ./connectivity_tool --version | awk '/^Boolberry / { print $2 }')
echo "Version built: $version_str"



echo "############### Prepearing archive... ################"
mkdir package_folder
if [ $? -ne 0 ]; then
echo "Failed to zip app"
exit $?
exit 1
fi

cp ../../../../Applications package_folder
if [ $? -ne 0 ]; then
echo "Failed to copy applications link"
exit 1
fi

mv qt-boolb.app package_folder
if [ $? -ne 0 ]; then
echo "Failed to top app package"
exit 1
fi


hdiutil create -format UDZO -srcfolder package_folder -volname Boolberry "Boolberry-macos-x64-$version_str.dmg"
if [ $? -ne 0 ]; then
echo "Failed to create dmg"
exit 1
fi


#zip -r -y "bbr-macos-x64-v0.2.0.zip" qt-boolb.app
#if [ $? -ne 0 ]; then
# echo "Failed to zip app"
# exit $?
# fi

cd ../..
echo "Build success"

60 changes: 60 additions & 0 deletions utils/fix_boost_libs.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,60 @@
set -e


function get_absolute_path()
{
python -c "import os.path; print os.path.abspath('$1')"
}

function get_relative_path() # $1 - path to a file, $2 - base dir
{
python -c "import os.path; print os.path.relpath('$1', os.path.dirname('$2'))"
}

function update_links_in_boost_libs_in_libs() # $1 - path to boost libs, $2 - path to libs folder
{
install_name_tool -change libboost_system.dylib $1/libboost_system.dylib $2/libboost_thread.dylib
install_name_tool -change libboost_system.dylib $1/libboost_system.dylib $2/libboost_filesystem.dylib
install_name_tool -change libboost_system.dylib $1/libboost_system.dylib $2/libboost_locale.dylib
install_name_tool -change libboost_system.dylib $1/libboost_system.dylib $2/libboost_chrono.dylib

}

function update_links_in_boost_libs_in_binary() # $1 - path to boost libs, $2 - binary to update
{
if [ -z "$1" ] || [ -z "$2" ]
then
echo "update_links_in_boost_libs_in_binary is called with no or bad argumens"
return 1
fi
install_name_tool -change libboost_atomic.dylib $1/libboost_atomic.dylib $2
install_name_tool -change libboost_program_options.dylib $1/libboost_program_options.dylib $2
install_name_tool -change libboost_date_time.dylib $1/libboost_date_time.dylib $2
install_name_tool -change libboost_chrono.dylib $1/libboost_chrono.dylib $2
install_name_tool -change libboost_regex.dylib $1/libboost_regex.dylib $2
install_name_tool -change libboost_system.dylib $1/libboost_system.dylib $2
install_name_tool -change libboost_filesystem.dylib $1/libboost_filesystem.dylib $2
install_name_tool -change libboost_thread.dylib $1/libboost_thread.dylib $2
install_name_tool -change libboost_serialization.dylib $1/libboost_serialization.dylib $2
install_name_tool -change libboost_locale.dylib $1/libboost_locale.dylib $2
return 0
}

# return immediately if this script was called from another script
[ "$(basename $0)" != "$(basename $BASH_SOURCE)" ] && return


if [[ $# -ne 2 ]]; then
echo "error: wrong args"
echo "usage: $0 <path to boost library dir> <path to binary>"
echo " -- update links lib paths in binary and libs to relative-to-binary paths, using given lib dir as final lib folder"
exit 1
fi

path_to_library=$1
path_to_bin=$2
relative_bin_to_lib=$(get_relative_path $path_to_library $path_to_bin)
update_links_in_boost_libs_in_binary @executable_path/$relative_bin_to_lib $path_to_bin
update_links_in_boost_libs_in_libs @executable_path/$relative_bin_to_lib $path_to_library

exit 0

0 comments on commit 4b644b8

Please sign in to comment.