(macOS) Added localization support

This commit is contained in:
Leon Styhre 2024-06-30 15:44:09 +02:00
parent c576968e65
commit 6256f44455
5 changed files with 42 additions and 1 deletions

View file

@ -470,6 +470,7 @@ if(APPLE)
${CMAKE_CURRENT_SOURCE_DIR}/external/FFmpeg ${CMAKE_CURRENT_SOURCE_DIR}/external/FFmpeg
${CMAKE_CURRENT_SOURCE_DIR}/external/freeimage/FreeImage/Source ${CMAKE_CURRENT_SOURCE_DIR}/external/freeimage/FreeImage/Source
${CMAKE_CURRENT_SOURCE_DIR}/external/freetype/include ${CMAKE_CURRENT_SOURCE_DIR}/external/freetype/include
${CMAKE_CURRENT_SOURCE_DIR}/external/gettext/gettext-runtime/intl
${CMAKE_CURRENT_SOURCE_DIR}/external/libgit2/include ${CMAKE_CURRENT_SOURCE_DIR}/external/libgit2/include
${CMAKE_CURRENT_SOURCE_DIR}/external/pugixml/src ${CMAKE_CURRENT_SOURCE_DIR}/external/pugixml/src
${CMAKE_CURRENT_SOURCE_DIR}/external/SDL) ${CMAKE_CURRENT_SOURCE_DIR}/external/SDL)
@ -541,6 +542,7 @@ if(APPLE)
${PROJECT_SOURCE_DIR}/libfreeimage.a ${PROJECT_SOURCE_DIR}/libfreeimage.a
${PROJECT_SOURCE_DIR}/libfreetype.6.dylib ${PROJECT_SOURCE_DIR}/libfreetype.6.dylib
${PROJECT_SOURCE_DIR}/libgit2.1.7.dylib ${PROJECT_SOURCE_DIR}/libgit2.1.7.dylib
${PROJECT_SOURCE_DIR}/libintl.8.dylib
${PROJECT_SOURCE_DIR}/libpugixml.a ${PROJECT_SOURCE_DIR}/libpugixml.a
${PROJECT_SOURCE_DIR}/libSDL2-2.0.0.dylib) ${PROJECT_SOURCE_DIR}/libSDL2-2.0.0.dylib)
elseif(WIN32) elseif(WIN32)

View file

@ -236,6 +236,8 @@ elseif(APPLE)
PERMISSIONS ${APPLE_DYLIB_PERMISSIONS} DESTINATION ../MacOS) PERMISSIONS ${APPLE_DYLIB_PERMISSIONS} DESTINATION ../MacOS)
install(FILES ${CMAKE_SOURCE_DIR}/libgit2.1.7.dylib install(FILES ${CMAKE_SOURCE_DIR}/libgit2.1.7.dylib
PERMISSIONS ${APPLE_DYLIB_PERMISSIONS} DESTINATION ../MacOS) PERMISSIONS ${APPLE_DYLIB_PERMISSIONS} DESTINATION ../MacOS)
install(FILES ${CMAKE_SOURCE_DIR}/libintl.8.dylib
PERMISSIONS ${APPLE_DYLIB_PERMISSIONS} DESTINATION ../MacOS)
install(FILES ${CMAKE_SOURCE_DIR}/libjpeg.62.dylib install(FILES ${CMAKE_SOURCE_DIR}/libjpeg.62.dylib
PERMISSIONS ${APPLE_DYLIB_PERMISSIONS} DESTINATION ../MacOS) PERMISSIONS ${APPLE_DYLIB_PERMISSIONS} DESTINATION ../MacOS)
install(FILES ${CMAKE_SOURCE_DIR}/libopenjp2.7.dylib install(FILES ${CMAKE_SOURCE_DIR}/libopenjp2.7.dylib

View file

@ -8,7 +8,11 @@
add_custom_target(locale ALL COMMENT "Compiling localization message catalogs") add_custom_target(locale ALL COMMENT "Compiling localization message catalogs")
if(APPLE)
set(MSGFMT_BINARY ${PROJECT_SOURCE_DIR}/external/local_install/bin/msgfmt)
else()
find_program(MSGFMT_BINARY msgfmt) find_program(MSGFMT_BINARY msgfmt)
endif()
if(NOT MSGFMT_BINARY) if(NOT MSGFMT_BINARY)
message (FATAL_ERROR "Couldn't find msgfmt binary") message (FATAL_ERROR "Couldn't find msgfmt binary")

View file

@ -33,6 +33,26 @@ echo "Building all dependencies in the ./external directory...\n"
export PKG_CONFIG_PATH=$(pwd)/../local_install/lib/pkgconfig export PKG_CONFIG_PATH=$(pwd)/../local_install/lib/pkgconfig
echo "Building gettext"
if [ ! -d gettext ]; then
echo "gettext directory is missing, aborting."
exit
fi
cd gettext
./configure --prefix=$(pwd)/../local_install
make clean
make -j${JOBS}
cd gettext-runtime/intl/.libs
install_name_tool -id "@rpath/libintl.8.dylib" libintl.8.dylib
cp libintl.8.dylib ../../../../../
cd ../../../
make install
cd ..
echo "Building libpng" echo "Building libpng"
if [ ! -d libpng ]; then if [ ! -d libpng ]; then

View file

@ -21,6 +21,19 @@ cd external
rm -rf local_install rm -rf local_install
mkdir local_install mkdir local_install
echo "Setting up gettext"
rm -rf gettext*
curl -LO https://ftp.gnu.org/pub/gnu/gettext/gettext-0.22.5.tar.gz
tar xvzf gettext-0.22.5.tar.gz
if [ ! -d gettext-0.22.5 ]; then
echo "gettext directory is missing, aborting."
exit
fi
mv gettext-0.22.5 gettext
rm gettext-0.22.5.tar.gz
echo "Setting up libpng" echo "Setting up libpng"
rm -rf libpng code rm -rf libpng code
git clone https://git.code.sf.net/p/libpng/code.git git clone https://git.code.sf.net/p/libpng/code.git