Create macOS bundle for simplified installation #58
This commit is contained in:
16
.gitignore
vendored
16
.gitignore
vendored
@@ -1,14 +1,16 @@
|
|||||||
|
.DS_Store
|
||||||
.cache/
|
.cache/
|
||||||
|
.vs/
|
||||||
|
Info.plist
|
||||||
build*/
|
build*/
|
||||||
compile_commands.json
|
compile_commands.json
|
||||||
cspell.json
|
cspell.json
|
||||||
.vs/
|
|
||||||
support/Dockerfile
|
|
||||||
dist/
|
|
||||||
deps/
|
deps/
|
||||||
scripts/cleanup.cmd
|
dist/
|
||||||
scripts/cleanup.sh
|
|
||||||
version.rc
|
|
||||||
version.cpp
|
|
||||||
override.sh
|
override.sh
|
||||||
repertory.iss
|
repertory.iss
|
||||||
|
scripts/cleanup.cmd
|
||||||
|
scripts/cleanup.sh
|
||||||
|
support/Dockerfile
|
||||||
|
version.cpp
|
||||||
|
version.rc
|
||||||
|
@@ -1,7 +1,20 @@
|
|||||||
set(CMAKE_CXX_FLAGS "-include common.hpp ${CMAKE_CXX_FLAGS}")
|
set(CMAKE_CXX_FLAGS "-include common.hpp ${CMAKE_CXX_FLAGS}")
|
||||||
|
|
||||||
|
if (PROJECT_IS_DARWIN)
|
||||||
|
configure_file(
|
||||||
|
${CMAKE_SOURCE_DIR}/${PROJECT_NAME}/Info.plist.in
|
||||||
|
${CMAKE_SOURCE_DIR}/${PROJECT_NAME}/Info.plist
|
||||||
|
@ONLY
|
||||||
|
)
|
||||||
|
endif()
|
||||||
|
|
||||||
add_project_library(lib${PROJECT_NAME} "" "" "${PROJECT_ADDITIONAL_SOURCES}")
|
add_project_library(lib${PROJECT_NAME} "" "" "${PROJECT_ADDITIONAL_SOURCES}")
|
||||||
|
|
||||||
add_project_executable(${PROJECT_NAME} lib${PROJECT_NAME} lib${PROJECT_NAME})
|
add_project_executable(${PROJECT_NAME} lib${PROJECT_NAME} lib${PROJECT_NAME})
|
||||||
|
if (PROJECT_IS_DARWIN)
|
||||||
|
set_target_properties(${PROJECT_NAME} PROPERTIES
|
||||||
|
MACOSX_BUNDLE_INFO_PLIST ${CMAKE_CURRENT_SOURCE_DIR}/${PROJECT_NAME}/Info.plist
|
||||||
|
)
|
||||||
|
endif()
|
||||||
|
|
||||||
add_project_test_executable(${PROJECT_NAME}_test lib${PROJECT_NAME} lib${PROJECT_NAME})
|
add_project_test_executable(${PROJECT_NAME}_test lib${PROJECT_NAME} lib${PROJECT_NAME})
|
||||||
|
19
repertory/Info.plist.in
Normal file
19
repertory/Info.plist.in
Normal file
@@ -0,0 +1,19 @@
|
|||||||
|
<?xml version="1.0" encoding="UTF-8"?>
|
||||||
|
<!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN"
|
||||||
|
"http://www.apple.com/DTDs/PropertyList-1.0.dtd">
|
||||||
|
<plist version="1.0">
|
||||||
|
<dict>
|
||||||
|
<key>CFBundleExecutable</key>
|
||||||
|
<string>@PROJECT_NAME@</string>
|
||||||
|
<key>CFBundleIdentifier</key>
|
||||||
|
<string>com.fifthgrid.blockstorage.@PROJECT_NAME@</string>
|
||||||
|
<key>CFBundleName</key>
|
||||||
|
<string>@PROJECT_NAME@</string>
|
||||||
|
<key>CFBundleVersion</key>
|
||||||
|
<string>@PROJECT_MAJOR_VERSION@.@PROJECT_MINOR_VERSION@.@PROJECT_REVISION_VERSION@-@PROJECT_RELEASE_ITER@_@PROJECT_GIT_REV@</string>
|
||||||
|
<key>CFBundlePackageType</key>
|
||||||
|
<string>APPL</string>
|
||||||
|
<key>LSUIElement</key>
|
||||||
|
<true/>
|
||||||
|
</dict>
|
||||||
|
</plist>
|
@@ -49,12 +49,22 @@ auto main(int argc, char **argv) -> int {
|
|||||||
std::ranges::copy(args_span, std::back_inserter(args));
|
std::ranges::copy(args_span, std::back_inserter(args));
|
||||||
}
|
}
|
||||||
|
|
||||||
|
int ret{0};
|
||||||
|
|
||||||
if (argc == 1) {
|
if (argc == 1) {
|
||||||
|
#if defined(__APPLE__)
|
||||||
|
args.push_back("-ui");
|
||||||
|
#else // !defined(__APPLE__)
|
||||||
args.push_back("-h");
|
args.push_back("-h");
|
||||||
|
#endif // defined(__APPLE__)
|
||||||
}
|
}
|
||||||
|
|
||||||
int ret{0};
|
if (utils::cli::has_option(args, utils::cli::options::help_option)) {
|
||||||
if (utils::cli::has_option(args, utils::cli::options::ui_option)) {
|
cli::actions::help<repertory_drive>(args);
|
||||||
|
} else if (utils::cli::has_option(args,
|
||||||
|
utils::cli::options::version_option)) {
|
||||||
|
cli::actions::version<repertory_drive>(args);
|
||||||
|
} else if (utils::cli::has_option(args, utils::cli::options::ui_option)) {
|
||||||
ui::mgmt_app_config config{
|
ui::mgmt_app_config config{
|
||||||
utils::cli::has_option(args, utils::cli::options::hidden_option),
|
utils::cli::has_option(args, utils::cli::options::hidden_option),
|
||||||
utils::cli::has_option(args, utils::cli::options::launch_only_option),
|
utils::cli::has_option(args, utils::cli::options::launch_only_option),
|
||||||
@@ -71,7 +81,11 @@ auto main(int argc, char **argv) -> int {
|
|||||||
ret = static_cast<std::int32_t>(exit_code::ui_failed);
|
ret = static_cast<std::int32_t>(exit_code::ui_failed);
|
||||||
} else {
|
} else {
|
||||||
httplib::Server server;
|
httplib::Server server;
|
||||||
|
#if defined(__APPLE__)
|
||||||
|
if (not server.set_mount_point("/ui", "../Resources/web")) {
|
||||||
|
#else // !defined(__APPLE__)
|
||||||
if (not server.set_mount_point("/ui", "./web")) {
|
if (not server.set_mount_point("/ui", "./web")) {
|
||||||
|
#endif // defined(__APPLE__)
|
||||||
ret = static_cast<std::int32_t>(exit_code::ui_failed);
|
ret = static_cast<std::int32_t>(exit_code::ui_failed);
|
||||||
} else {
|
} else {
|
||||||
ui::handlers handlers(&config, &server);
|
ui::handlers handlers(&config, &server);
|
||||||
@@ -133,8 +147,7 @@ auto main(int argc, char **argv) -> int {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
} else if ((prov == provider_type::s3) || (prov == provider_type::sia) ||
|
} else {
|
||||||
(prov == provider_type::encrypt)) {
|
|
||||||
std::string data;
|
std::string data;
|
||||||
res = utils::cli::parse_string_option(
|
res = utils::cli::parse_string_option(
|
||||||
args, utils::cli::options::name_option, data);
|
args, utils::cli::options::name_option, data);
|
||||||
@@ -160,12 +173,6 @@ auto main(int argc, char **argv) -> int {
|
|||||||
|
|
||||||
int mount_result{};
|
int mount_result{};
|
||||||
if (res == exit_code::success) {
|
if (res == exit_code::success) {
|
||||||
if (utils::cli::has_option(args, utils::cli::options::help_option)) {
|
|
||||||
cli::actions::help<repertory_drive>(args);
|
|
||||||
} else if (utils::cli::has_option(args,
|
|
||||||
utils::cli::options::version_option)) {
|
|
||||||
cli::actions::version<repertory_drive>(args);
|
|
||||||
} else {
|
|
||||||
res = exit_code::option_not_found;
|
res = exit_code::option_not_found;
|
||||||
for (std::size_t idx = 0U;
|
for (std::size_t idx = 0U;
|
||||||
(res == exit_code::option_not_found) &&
|
(res == exit_code::option_not_found) &&
|
||||||
@@ -173,8 +180,8 @@ auto main(int argc, char **argv) -> int {
|
|||||||
idx++) {
|
idx++) {
|
||||||
try {
|
try {
|
||||||
res = cli::actions::perform_action(
|
res = cli::actions::perform_action(
|
||||||
utils::cli::options::option_list[idx], args, data_directory,
|
utils::cli::options::option_list[idx], args, data_directory, prov,
|
||||||
prov, unique_id, user, password);
|
unique_id, user, password);
|
||||||
} catch (const std::exception &ex) {
|
} catch (const std::exception &ex) {
|
||||||
res = exit_code::exception;
|
res = exit_code::exception;
|
||||||
} catch (...) {
|
} catch (...) {
|
||||||
@@ -187,7 +194,6 @@ auto main(int argc, char **argv) -> int {
|
|||||||
remote_host, remote_port, unique_id);
|
remote_host, remote_port, unique_id);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
|
||||||
|
|
||||||
ret = ((res == exit_code::mount_result) ? mount_result
|
ret = ((res == exit_code::mount_result) ? mount_result
|
||||||
: static_cast<std::int32_t>(res));
|
: static_cast<std::int32_t>(res));
|
||||||
|
@@ -61,7 +61,9 @@ fi
|
|||||||
|
|
||||||
for APP in ${PROJECT_APP_LIST[@]}; do
|
for APP in ${PROJECT_APP_LIST[@]}; do
|
||||||
if [ "${PROJECT_BUILD_SHARED_LIBS}" == "ON" ]; then
|
if [ "${PROJECT_BUILD_SHARED_LIBS}" == "ON" ]; then
|
||||||
if [ "${PROJECT_IS_MINGW}" != "1" ]; then
|
if [ "${PROJECT_IS_MINGW}" == "1" ]; then
|
||||||
|
rsync -av --progress "${PROJECT_BUILD_DIR}/build/${APP}${PROJECT_APP_BINARY_EXT}" "${PROJECT_DIST_DIR}/"
|
||||||
|
else
|
||||||
rm "${PROJECT_DIST_DIR}/${APP}${PROJECT_APP_BINARY_EXT}"
|
rm "${PROJECT_DIST_DIR}/${APP}${PROJECT_APP_BINARY_EXT}"
|
||||||
if [ "${PROJECT_ENABLE_CURL}" == "ON" ]; then
|
if [ "${PROJECT_ENABLE_CURL}" == "ON" ]; then
|
||||||
mv "${PROJECT_DIST_DIR}/cacert.pem" "${PROJECT_DIST_DIR}/bin/cacert.pem"
|
mv "${PROJECT_DIST_DIR}/cacert.pem" "${PROJECT_DIST_DIR}/bin/cacert.pem"
|
||||||
@@ -77,18 +79,27 @@ export LD_LIBRARY_PATH="\${PROJECT_SCRIPTS_DIR}/lib:\${PROJECT_SCRIPTS_DIR}/lib6
|
|||||||
\${PROJECT_SCRIPTS_DIR}/bin/${APP}${PROJECT_APP_BINARY_EXT} \$*
|
\${PROJECT_SCRIPTS_DIR}/bin/${APP}${PROJECT_APP_BINARY_EXT} \$*
|
||||||
EOF
|
EOF
|
||||||
chmod +x "${PROJECT_DIST_DIR}/${APP}${PROJECT_APP_BINARY_EXT}"
|
chmod +x "${PROJECT_DIST_DIR}/${APP}${PROJECT_APP_BINARY_EXT}"
|
||||||
else
|
|
||||||
rsync -av --progress "${PROJECT_BUILD_DIR}/build/${APP}${PROJECT_APP_BINARY_EXT}" "${PROJECT_DIST_DIR}/"
|
|
||||||
fi
|
fi
|
||||||
else
|
elif [ ! -d "${PROJECT_BUILD_DIR}/build/${APP}.app" ]; then
|
||||||
rsync -av --progress "${PROJECT_BUILD_DIR}/build/${APP}${PROJECT_APP_BINARY_EXT}" "${PROJECT_DIST_DIR}/"
|
rsync -av --progress "${PROJECT_BUILD_DIR}/build/${APP}${PROJECT_APP_BINARY_EXT}" "${PROJECT_DIST_DIR}/"
|
||||||
fi
|
fi
|
||||||
done
|
done
|
||||||
|
|
||||||
|
if [ -d "${PROJECT_BUILD_DIR}/build/${PROJECT_NAME}.app" ]; then
|
||||||
|
rsync -av --progress "${PROJECT_BUILD_DIR}/build/${PROJECT_NAME}.app/" \
|
||||||
|
"${PROJECT_DIST_DIR}/${PROJECT_NAME}.app/"
|
||||||
|
fi
|
||||||
|
|
||||||
if [ -f "${PROJECT_SOURCE_DIR}/web/${PROJECT_NAME}/pubspec.yaml" ]; then
|
if [ -f "${PROJECT_SOURCE_DIR}/web/${PROJECT_NAME}/pubspec.yaml" ]; then
|
||||||
|
if [ -d "${PROJECT_DIST_DIR}/${PROJECT_NAME}.app" ]; then
|
||||||
|
rsync -av --progress "${PROJECT_SOURCE_DIR}/web/${PROJECT_NAME}/build/web/" \
|
||||||
|
"${PROJECT_DIST_DIR}/${PROJECT_NAME}.app/Contents/Resources/web/"
|
||||||
|
cp "${PROJECT_DIST_DIR}/cacert.pem" "${PROJECT_DIST_DIR}/${PROJECT_NAME}.app/Contents/MacOS/cacert.pem"
|
||||||
|
else
|
||||||
rsync -av --progress "${PROJECT_SOURCE_DIR}/web/${PROJECT_NAME}/build/web/" \
|
rsync -av --progress "${PROJECT_SOURCE_DIR}/web/${PROJECT_NAME}/build/web/" \
|
||||||
"${PROJECT_DIST_DIR}/web/"
|
"${PROJECT_DIST_DIR}/web/"
|
||||||
fi
|
fi
|
||||||
|
fi
|
||||||
|
|
||||||
if [ "${PROJECT_IS_MINGW}" == "1" ]; then
|
if [ "${PROJECT_IS_MINGW}" == "1" ]; then
|
||||||
. "${PROJECT_SCRIPTS_DIR}/copy_mingw64_deps.sh" "$1" "$2" "$3" "$4" "$5"
|
. "${PROJECT_SCRIPTS_DIR}/copy_mingw64_deps.sh" "$1" "$2" "$3" "$4" "$5"
|
||||||
|
@@ -50,10 +50,12 @@ popd
|
|||||||
rsync -av --progress ${PROJECT_DIST_DIR}/ ${TEMP_DIR}/${PROJECT_NAME}/ || error_exit "failed to rsync" 1
|
rsync -av --progress ${PROJECT_DIST_DIR}/ ${TEMP_DIR}/${PROJECT_NAME}/ || error_exit "failed to rsync" 1
|
||||||
|
|
||||||
for APP in ${PROJECT_APP_LIST[@]}; do
|
for APP in ${PROJECT_APP_LIST[@]}; do
|
||||||
if [ "${PROJECT_BUILD_SHARED_LIBS}" == "ON" ] && [ "${PROJECT_IS_MINGW}" != "1" ]; then
|
if [ -d "${TEMP_DIR}/${PROJECT_NAME}/${APP}.app" ]; then
|
||||||
strip ${TEMP_DIR}/${PROJECT_NAME}/bin/${APP}${PROJECT_APP_BINARY_EXT}
|
strip "${TEMP_DIR}/${PROJECT_NAME}/${APP}.app/Contents/MacOS/${APP}${PROJECT_APP_BINARY_EXT}"
|
||||||
|
elif [ "${PROJECT_BUILD_SHARED_LIBS}" == "ON" ] && [ "${PROJECT_IS_MINGW}" != "1" ]; then
|
||||||
|
strip "${TEMP_DIR}/${PROJECT_NAME}/bin/${APP}${PROJECT_APP_BINARY_EXT}"
|
||||||
else
|
else
|
||||||
strip ${TEMP_DIR}/${PROJECT_NAME}/${APP}${PROJECT_APP_BINARY_EXT}
|
strip "${TEMP_DIR}/${PROJECT_NAME}/${APP}${PROJECT_APP_BINARY_EXT}"
|
||||||
fi
|
fi
|
||||||
done
|
done
|
||||||
|
|
||||||
|
Reference in New Issue
Block a user