-
Notifications
You must be signed in to change notification settings - Fork 18
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #543 from jongough/updates
Updates
- Loading branch information
Showing
12 changed files
with
291 additions
and
29 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,4 @@ | ||
# Any change in this file will cause the macos cache to be invalidated | ||
# i. e., that the homebrew dependencies are downloaded and wxwidgets | ||
# rebuilt. For example, change the stock 'v1' to 'v2' | ||
v1 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,7 @@ | ||
# brew packages installed in macos ci build | ||
cmake | ||
gettext | ||
libexif | ||
python | ||
wget | ||
openssl@3 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,82 @@ | ||
#!/usr/bin/env bash | ||
|
||
|
||
# Build the MacOS artifacts | ||
|
||
|
||
# Copyright (c) 2021 Alec Leamas | ||
# | ||
# This program is free software; you can redistribute it and/or modify | ||
# it under the terms of the GNU General Public License as published by | ||
# the Free Software Foundation; either version 3 of the License, or | ||
# (at your option) any later version. | ||
|
||
set -x | ||
|
||
# Load local environment if it exists i. e., this is a local build | ||
if [ -f ~/.config/local-build.rc ]; then source ~/.config/local-build.rc; fi | ||
|
||
git submodule update --init opencpn-libs | ||
|
||
# If applicable, restore /usr/local from cache. | ||
if [[ -n "$CI" && -f /tmp/local.cache.tar ]]; then | ||
sudo rm -rf /usr/local/* | ||
sudo tar -C /usr -xf /tmp/local.cache.tar | ||
fi | ||
|
||
# Set up build directory | ||
rm -rf build && mkdir build | ||
|
||
# Create a log file. | ||
exec > >(tee build/build.log) 2>&1 | ||
|
||
export MACOSX_DEPLOYMENT_TARGET=10.10 | ||
|
||
# Return latest version of $1, optionally using option $2 | ||
pkg_version() { brew list --versions $2 $1 | tail -1 | awk '{print $2}'; } | ||
|
||
# | ||
# Check if the cache is with us. If not, re-install brew. | ||
brew list --versions libexif || brew update-reset | ||
|
||
# Install packaged dependencies | ||
for pkg in cmake gettext libarchive libexif python wget openssl@3; do | ||
brew list --versions $pkg || brew install $pkg || brew install $pkg || : | ||
brew link --overwrite $pkg || brew install $pkg | ||
done | ||
|
||
#Install prebuilt dependencies | ||
wget -q https://dl.cloudsmith.io/public/nohal/opencpn-plugins/raw/files/macos_deps_universal.tar.xz \ | ||
-O /tmp/macos_deps_universal.tar.xz | ||
sudo tar -C /usr/local -xJf /tmp/macos_deps_universal.tar.xz | ||
|
||
export OPENSSL_ROOT_DIR='/usr/local' | ||
|
||
# Build and package | ||
cd build | ||
cmake \ | ||
"-DCMAKE_BUILD_TYPE=${CMAKE_BUILD_TYPE:-Release}" \ | ||
-DCMAKE_INSTALL_PREFIX= \ | ||
-DCMAKE_OSX_DEPLOYMENT_TARGET=${MACOSX_DEPLOYMENT_TARGET} \ | ||
-DOCPN_TARGET_TUPLE="darwin-wx32;10;universal" \ | ||
-DCMAKE_OSX_ARCHITECTURES="arm64;x86_64" \ | ||
.. | ||
|
||
if [[ -z "$CI" ]]; then | ||
echo '$CI not found in environment, assuming local setup' | ||
echo "Complete build using 'cd build; make tarball' or so." | ||
exit 0 | ||
fi | ||
|
||
# nor-reproducible error on first invocation, seemingly tarball-conf-stamp | ||
# is not created as required. | ||
#make VERBOSE=1 tarball || make VERBOSE=1 tarball | ||
make | ||
make install | ||
make package | ||
make package | ||
|
||
# Create the cached /usr/local archive | ||
if [ -n "$CI" ]; then | ||
tar -C /usr -cf /tmp/local.cache.tar local | ||
fi |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,90 @@ | ||
# ~~~ | ||
# Summary: If required, rebuild wxwidgets for macos from source. | ||
# License: GPLv3+ | ||
# Copyright (c) 2022 Alec Leamas | ||
# ~~~ | ||
|
||
# This program is free software; you can redistribute it and/or modify it under | ||
# the terms of the GNU General Public License as published by the Free Software | ||
# Foundation; either version 3 of the License, or (at your option) any later | ||
# version. | ||
|
||
cmake_minimum_required(VERSION 3.20.0) | ||
|
||
set(wx_repo https://github.com/wxWidgets/wxWidgets.git) | ||
set(wx_tag v3.2.2.1) | ||
|
||
option(IGNORE_SYSTEM_WX "Never use system wxWidgets installation" FALSE) | ||
|
||
# Check if we have done the wxWidgets build already | ||
# | ||
if(DEFINED wx_config) | ||
return() | ||
endif() | ||
|
||
# Check if there is a usable wxwidgets anyway | ||
# | ||
set(cache_dir ${PROJECT_SOURCE_DIR}/cache) | ||
|
||
if(IGNORE_SYSTEM_WX) | ||
set(WX_CONFIG_PROG ${cache_dir}/lib/wx/config/osx_cocoa-unicode-3.2) | ||
else() | ||
find_program( | ||
WX_CONFIG_PROG | ||
NAMES wx-config osx_cocoa-unicode-3.2 | ||
HINTS ${PROJECT_SOURCE_DIR}/cache/lib/wx/config /usr/local/lib/wx/config) | ||
endif() | ||
if(WX_CONFIG_PROG) | ||
execute_process( | ||
COMMAND ${WX_CONFIG_PROG} --version | ||
RESULT_VARIABLE wx_status | ||
OUTPUT_VARIABLE wx_version | ||
ERROR_FILE /dev/null COMMAND_ECHO STDOUT | ||
OUTPUT_STRIP_TRAILING_WHITESPACE) | ||
else() | ||
set(wx_status 1) | ||
endif() | ||
|
||
if(${wx_status} EQUAL 0) | ||
set(wx_config | ||
${WX_CONFIG_PROG} | ||
CACHE FILEPATH "") | ||
set(ENV{WX_CONFIG} ${WX_CONFIG_PROG}) | ||
if(${wx_version} VERSION_GREATER_EQUAL 3.2) | ||
return() | ||
endif() | ||
endif() | ||
|
||
if(NOT EXISTS ${cache_dir}) | ||
file(MAKE_DIRECTORY ${cache_dir}) | ||
endif() | ||
|
||
# Download sources and get the source directory | ||
# | ||
include(FetchContent) | ||
FetchContent_Declare( | ||
wxwidgets | ||
GIT_REPOSITORY ${wx_repo} | ||
GIT_TAG ${wx_tag}) | ||
FetchContent_Populate(wxwidgets) | ||
FetchContent_GetProperties(wxwidgets SOURCE_DIR wxwidgets_src_dir) | ||
|
||
execute_process(COMMAND git submodule update --init 3rdparty/pcre | ||
WORKING_DIRECTORY ${wxwidgets_src_dir}) | ||
execute_process( | ||
COMMAND | ||
./configure --with-cxx=11 --with-macosx-version-min=10.10 --enable-unicode | ||
--with-osx-cocoa --enable-aui --disable-debug --with-opengl | ||
--enable-macosx_arch=arm64,x86_64 --enable-universal_binary=arm64,x86_64 | ||
--without-subdirs --prefix=${cache_dir} | ||
WORKING_DIRECTORY ${wxwidgets_src_dir}) | ||
math(_nproc ${OCPN_NPROC} * 2) # Assuming two threads/cpu | ||
execute_process(COMMAND make -j${_nproc} WORKING_DIRECTORY ${wxwidgets_src_dir}) | ||
execute_process(COMMAND sudo make install | ||
WORKING_DIRECTORY ${wxwidgets_src_dir}) | ||
|
||
set(wx_config ${cache_dir}/lib/wx/config/osx_cocoa-unicode-3.2) | ||
if(NOT EXISTS ${wx_config}) | ||
message(FATAL_ERROR "Cannot locate wx-config tool at ${wx_config}") | ||
endif() | ||
set(ENV{WX_CONFIG} ${wx_config}) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.