Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix build with recent Xcode #571

Merged
merged 1 commit into from
Jan 24, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
5 changes: 4 additions & 1 deletion .github/workflows/build.yml
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,10 @@ jobs:
run: |
brew update
brew install doxygen boost xsd || brew link --overwrite xsd
brew unlink xerces-c [email protected] [email protected]
brew unlink xerces-c
brew unlink [email protected] || true
brew unlink [email protected] || true
brew unlink [email protected] || true
- name: Cache
uses: actions/cache@v3
id: cache
Expand Down
6 changes: 5 additions & 1 deletion CMakeLists.txt
Original file line number Diff line number Diff line change
@@ -1,6 +1,10 @@
cmake_minimum_required(VERSION 3.16)
if(NOT EXISTS ${CMAKE_SOURCE_DIR}/cmake/modules/VersionInfo.cmake)
message(FATAL_ERROR "cmake submodule directory empty, did you 'git clone --recursive'?")
endif()

if(POLICY CMP0122)
cmake_policy(SET CMP0122 NEW)
cmake_policy(SET CMP0122 NEW)
endif()
project(libdigidocpp VERSION 3.17.0)
set(CMAKE_MODULE_PATH ${CMAKE_SOURCE_DIR}/cmake/modules)
Expand Down
67 changes: 48 additions & 19 deletions prepare_osx_build_environment.sh
Original file line number Diff line number Diff line change
Expand Up @@ -107,10 +107,43 @@ function xerces {
rm -rf ${XERCES_DIR}
tar xf ${XERCES_DIR}.tar.xz
cd ${XERCES_DIR}
sed -ie 's!SUBDIRS = doc src tests samples!SUBDIRS = src!' Makefile.in
./configure --prefix=${TARGET_PATH} ${CONFIGURE} --enable-transcoder-iconv --disable-netaccessor-curl
make -s
sudo make install
sed -ie 's!add_subdirectory(doc)!!' CMakeLists.txt
sed -ie 's!add_subdirectory(tests)!!' CMakeLists.txt
sed -ie 's!add_subdirectory(samples)!!' CMakeLists.txt
case "${ARGS}" in
*android*)
cmake -S . \
-DCMAKE_TOOLCHAIN_FILE=${ANDROID_NDK_HOME}/build/cmake/android.toolchain.cmake \
-DANDROID_PLATFORM=${API} \
-DANDROID_ABI=${ARCH_ABI} \
-DCMAKE_INSTALL_PREFIX=${TARGET_PATH} \
-DCMAKE_BUILD_TYPE=Release \
-DBUILD_SHARED_LIBS=NO
;;
*ios*|*simulator*)
cmake -S . \
-DCMAKE_OSX_SYSROOT=${SYSROOT} \
-DCMAKE_OSX_ARCHITECTURES="${ARCHS// /;}" \
-DCMAKE_INSTALL_PREFIX=${TARGET_PATH} \
-DCMAKE_BUILD_TYPE=Release \
-DBUILD_SHARED_LIBS=NO \
-Dtranscoder=iconv \
-Dnetwork-accessor=socket
;;
*)
cmake -S . \
-DCMAKE_OSX_ARCHITECTURES="${ARCHS// /;}" \
-DCMAKE_INSTALL_PREFIX=${TARGET_PATH} \
-DCMAKE_BUILD_TYPE=Release \
-DBUILD_SHARED_LIBS=YES \
-DCMAKE_MACOSX_RPATH=NO \
-DCMAKE_BUILD_WITH_INSTALL_NAME_DIR=YES \
-DCMAKE_INSTALL_NAME_DIR=${TARGET_PATH}/lib \
-Dtranscoder=iconv \
-Dnetwork-accessor=socket
;;
esac
cmake --build . && sudo cmake --install .
cd -
}

Expand All @@ -131,44 +164,40 @@ function xalan {
mv tmp src/xalanc/CMakeLists.txt
case "${ARGS}" in
*android*)
cmake \
cmake -S . \
-DCMAKE_TOOLCHAIN_FILE=${ANDROID_NDK_HOME}/build/cmake/android.toolchain.cmake \
-DANDROID_PLATFORM=${API} \
-DANDROID_ABI=${ARCH_ABI} \
-DCMAKE_INSTALL_PREFIX=${TARGET_PATH} \
-DCMAKE_FIND_ROOT_PATH=${TARGET_PATH} \
-DCMAKE_BUILD_TYPE=Release \
-DBUILD_SHARED_LIBS=NO \
. && make -s MsgCreator
&& cmake --build . --target MsgCreator
cp ../patches/MsgCreator src/xalanc/Utils/MsgCreator
make -s && sudo make install
;;
*ios*|*simulator*)
cmake \
cmake -S . \
-DCMAKE_OSX_SYSROOT=${SYSROOT} \
-DCMAKE_OSX_ARCHITECTURES="${ARCHS// /;}" \
-DCMAKE_INSTALL_PREFIX=${TARGET_PATH} \
-DCMAKE_BUILD_TYPE=Release \
-DBUILD_SHARED_LIBS=NO \
. && make -s MsgCreator
&& cmake --build . --target MsgCreator
cp ../patches/MsgCreator src/xalanc/Utils/MsgCreator
make -s && sudo make install
;;
*)
cmake \
-DCMAKE_MACOSX_RPATH=NO \
cmake -S . \
-DCMAKE_OSX_ARCHITECTURES="${ARCHS// /;}" \
-DCMAKE_INSTALL_PREFIX=${TARGET_PATH} \
-DCMAKE_BUILD_TYPE=Release \
-DBUILD_SHARED_LIBS=YES \
. && make -s && sudo make install
sudo install_name_tool -id ${TARGET_PATH}/lib/libxalanMsg.112.dylib \
${TARGET_PATH}/lib/libxalanMsg.*.0.dylib
sudo install_name_tool -id ${TARGET_PATH}/lib/libxalan-c.112.dylib \
-change libxalanMsg.112.dylib ${TARGET_PATH}/lib/libxalanMsg.112.dylib \
${TARGET_PATH}/lib/libxalan-c.*.0.dylib
-DCMAKE_MACOSX_RPATH=NO \
-DCMAKE_BUILD_WITH_INSTALL_NAME_DIR=YES \
-DCMAKE_INSTALL_NAME_DIR=${TARGET_PATH}/lib \
-Dtranscoder=default
;;
esac
cmake --build . && sudo cmake --install .
cd -
}

Expand All @@ -187,7 +216,7 @@ function xml_security {
CXXFLAGS="${CXXFLAGS} -fvisibility=hidden -fvisibility-inlines-hidden" \
xerces_CFLAGS="-I${TARGET_PATH}/include" xerces_LIBS="-L${TARGET_PATH}/lib -lxalanMsg -lxalan-c -lxerces-c" \
openssl_CFLAGS="-I${TARGET_PATH}/include" openssl_LIBS="-L${TARGET_PATH}/lib -lcrypto" \
./configure --prefix=${TARGET_PATH} ${CONFIGURE} --with-xalan=${TARGET_PATH}
./configure --prefix=${TARGET_PATH} ${CONFIGURE} --with-xalan=${TARGET_PATH} --without-nss lt_cv_apple_cc_single_mod=yes
sed -ie 's!PROGRAMS = $(bin_PROGRAMS) $(noinst_PROGRAMS)!PROGRAMS = !; s!bin_PROGRAMS = $(am__EXEEXT_2)!bin_PROGRAMS = !' xsec/Makefile
make -s
sudo make install
Expand Down