Skip to content

Commit

Permalink
Move to a monolithic ENGLISH.LNG
Browse files Browse the repository at this point in the history
  • Loading branch information
Nopey committed Nov 4, 2024
1 parent 1c0c1e8 commit 321d51a
Show file tree
Hide file tree
Showing 6 changed files with 101 additions and 154 deletions.
121 changes: 66 additions & 55 deletions .github/workflows/compilation.yml
Original file line number Diff line number Diff line change
Expand Up @@ -98,18 +98,6 @@ jobs:
with:
repository: 'microsoft/vcpkg'
path: 'vcpkg'
- uses: lukka/get-cmake@latest
- uses: ilammy/msvc-dev-cmd@v1
- name: Install VCPKG Dependencies, Configure CMake
run: >
cmake -S . -B build-msvc
-G "Ninja"
--toolchain vcpkg/scripts/buildsystems/vcpkg.cmake
-DCMAKE_BUILD_TYPE="Release"
-DVCPKG_BUILD_TYPE="release"
-DVCPKG_TARGET_TRIPLET="x64-windows-static"
- name: Build openomf
run: cmake --build build-msvc --target openomf

- name: Restore omf2097-assets.zip
id: cache-assets
Expand All @@ -133,11 +121,25 @@ jobs:
run: |
Expand-Archive omf2097-assets.zip -PassThru
mkdir install/openomf/resources
Move-Item -Path omf2097-assets/OMF2097/ENGLISH.DAT,omf2097-assets/OMF2097/GERMAN.DAT -Destination resources -Force -PassThru
Move-Item -Path omf2097-assets/OMF2097/* -Destination install/openomf/resources/ -Force -PassThru
- name: Install openomf
run: cmake --install build-msvc --prefix install

- uses: lukka/get-cmake@latest
- uses: ilammy/msvc-dev-cmd@v1
- name: Install VCPKG Dependencies, Configure CMake
run: >
cmake -S . -B build-msvc
-G "Ninja"
--toolchain vcpkg/scripts/buildsystems/vcpkg.cmake
-DCMAKE_BUILD_TYPE="Release"
-DVCPKG_BUILD_TYPE="release"
-DVCPKG_TARGET_TRIPLET="x64-windows-static"
- name: Build openomf
run: cmake --build build-msvc --target openomf

- name: Get short SHA
shell: bash
id: slug
Expand Down Expand Up @@ -173,17 +175,6 @@ jobs:
libconfuse-dev libenet-dev libsdl2-dev libxmp-dev libpng-dev libepoxy-dev
libminiupnpc-dev libnatpmp-dev

- name: Generate Release
run: |
mkdir build-release && cd build-release
cmake -DCMAKE_BUILD_TYPE=Release -DCMAKE_INSTALL_PREFIX=release/usr ..
make -j $(getconf _NPROCESSORS_ONLN)
make -j $(getconf _NPROCESSORS_ONLN) install
- name: Get short SHA
id: slug
run: echo "sha8=`echo ${GITHUB_SHA} | cut -c1-8`" >> $GITHUB_OUTPUT

- name: Restore omf2097-assets.zip
id: cache-assets
uses: actions/cache/restore@v4
Expand All @@ -203,7 +194,21 @@ jobs:
key: omf2097-assets.zip

- name: Extract omf 2097 assets
run: unzip -j omf2097-assets.zip -d build-release/release/usr/share/games/openomf
run: |
mkdir -p build-release/release/usr/share/games/openomf
unzip -j omf2097-assets.zip -d build-release/release/usr/share/games/openomf
mv build-release/release/usr/share/games/openomf/{ENGLISH.DAT,GERMAN.DAT} resources/
- name: Generate Release
run: |
mkdir -p build-release && cd build-release
cmake -DCMAKE_BUILD_TYPE=Release -DCMAKE_INSTALL_PREFIX=release/usr ..
make -j $(getconf _NPROCESSORS_ONLN)
make -j $(getconf _NPROCESSORS_ONLN) install
- name: Get short SHA
id: slug
run: echo "sha8=`echo ${GITHUB_SHA} | cut -c1-8`" >> $GITHUB_OUTPUT

- name: Generate TGZ package
run: tar cvfz ${GITHUB_WORKSPACE}/openomf_${{ env.OPENOMF_VERSION }}-${{ steps.slug.outputs.sha8 }}_linux_amd64.tar.gz -C build-release/release/ .
Expand Down Expand Up @@ -252,13 +257,6 @@ jobs:
brew update
brew install cmake argtable cunit sdl2_mixer confuse enet sdl2 libxmp libpng libepoxy miniupnpc libnatpmp
- name: Generate Release
run: |
mkdir build-release && cd build-release
cmake -DCMAKE_BUILD_TYPE=Release -DCMAKE_INSTALL_PREFIX=release/usr ..
make -j $(getconf _NPROCESSORS_ONLN)
make -j $(getconf _NPROCESSORS_ONLN) install
- name: Restore omf2097-assets.zip
id: cache-assets
uses: actions/cache/restore@v4
Expand All @@ -276,9 +274,19 @@ jobs:
with:
path: omf2097-assets.zip
key: omf2097-assets.zip

- name: Extract omf 2097 assets
run: unzip -j omf2097-assets.zip -d build-release/release/usr/share/games/openomf
run: |
mkdir -p build-release/release/usr/share/games/openomf
unzip -j omf2097-assets.zip -d build-release/release/usr/share/games/openomf
mv build-release/release/usr/share/games/openomf/{ENGLISH.DAT,GERMAN.DAT} resources/
- name: Generate Release
run: |
mkdir -p build-release && cd build-release
cmake -DCMAKE_BUILD_TYPE=Release -DCMAKE_INSTALL_PREFIX=release/usr ..
make -j $(getconf _NPROCESSORS_ONLN)
make -j $(getconf _NPROCESSORS_ONLN) install
- name: Get short SHA
id: slug
Expand Down Expand Up @@ -316,27 +324,6 @@ jobs:
wget -q https://github.com/omf2097/openomf-win-build/archive/refs/heads/main.zip
unzip -q main.zip && rm main.zip
- name: Generate Windows Release
run: |
mkdir build-release && cd build-release
export WINEPATH="${GITHUB_WORKSPACE}/openomf-win-build-main/bin/"
cmake -DCMAKE_BUILD_TYPE=Release \
-DCMAKE_INSTALL_PREFIX=release \
-DCMAKE_TOOLCHAIN_FILE="${GITHUB_WORKSPACE}/cmake-scripts/mingw-w64-toolchain.cmake" \
-DCMAKE_PREFIX_PATH="${GITHUB_WORKSPACE}/openomf-win-build-main/" \
-DCMAKE_INCLUDE_PATH="${GITHUB_WORKSPACE}/openomf-win-build-main/include/" \
-DCMAKE_LIBRARY_PATH="${GITHUB_WORKSPACE}/openomf-win-build-main/lib/" \
-DCMAKE_FIND_ROOT_PATH="${GITHUB_WORKSPACE}/openomf-win-build-main/" \
-DOMF_COMMAND_WRAPPER="wine" \
"${GITHUB_WORKSPACE}"
make -j $(getconf _NPROCESSORS_ONLN)
make -j $(getconf _NPROCESSORS_ONLN) install
cp ${GITHUB_WORKSPACE}/openomf-win-build-main/bin/*.dll release/openomf/
- name: Get short SHA
id: slug
run: echo "sha8=`echo ${GITHUB_SHA} | cut -c1-8`" >> $GITHUB_OUTPUT

- name: Restore omf2097-assets.zip
id: cache-assets
uses: actions/cache/restore@v4
Expand All @@ -356,7 +343,31 @@ jobs:
key: omf2097-assets.zip

- name: Extract omf 2097 assets
run: unzip -j omf2097-assets.zip -d build-release/release/openomf/resources
run: |
mkdir -p build-release/release/usr/share/games/openomf
unzip -j omf2097-assets.zip -d build-release/release/usr/share/games/openomf
mv build-release/release/usr/share/games/openomf/{ENGLISH.DAT,GERMAN.DAT} resources/
- name: Generate Windows Release
run: |
mkdir -p build-release && cd build-release
export WINEPATH="${GITHUB_WORKSPACE}/openomf-win-build-main/bin/"
cmake -DCMAKE_BUILD_TYPE=Release \
-DCMAKE_INSTALL_PREFIX=release \
-DCMAKE_TOOLCHAIN_FILE="${GITHUB_WORKSPACE}/cmake-scripts/mingw-w64-toolchain.cmake" \
-DCMAKE_PREFIX_PATH="${GITHUB_WORKSPACE}/openomf-win-build-main/" \
-DCMAKE_INCLUDE_PATH="${GITHUB_WORKSPACE}/openomf-win-build-main/include/" \
-DCMAKE_LIBRARY_PATH="${GITHUB_WORKSPACE}/openomf-win-build-main/lib/" \
-DCMAKE_FIND_ROOT_PATH="${GITHUB_WORKSPACE}/openomf-win-build-main/" \
-DOMF_COMMAND_WRAPPER="wine" \
"${GITHUB_WORKSPACE}"
make -j $(getconf _NPROCESSORS_ONLN)
make -j $(getconf _NPROCESSORS_ONLN) install
cp ${GITHUB_WORKSPACE}/openomf-win-build-main/bin/*.dll release/openomf/
- name: Get short SHA
id: slug
run: echo "sha8=`echo ${GITHUB_SHA} | cut -c1-8`" >> $GITHUB_OUTPUT

- name: Generate ZIP package
run: |
Expand Down
21 changes: 11 additions & 10 deletions cmake-scripts/BuildLanguages.cmake
Original file line number Diff line number Diff line change
Expand Up @@ -55,32 +55,33 @@ set(BUILD_LANG_COMMANDS)
set(BUILD_LANG_SOURCES)
foreach(LANG ${OMF_LANGS})
set(TXT2 "${PROJECT_SOURCE_DIR}/resources/${LANG}2.TXT")
set(DAT2 "${CMAKE_CURRENT_BINARY_DIR}/resources/${LANG}.DAT2")
set(BASE_DAT "${CMAKE_CURRENT_BINARY_DIR}/resources/${LANG}.DAT")
set(LNG "${CMAKE_CURRENT_BINARY_DIR}/resources/${LANG}.LNG")
find_file("${LANG}_DAT" "${LANG}.DAT" PATHS "${CMAKE_CURRENT_BINARY_DIR}/resources" "${PROJECT_SOURCE_DIR}/resources" REQUIRED)
set(BASE_DAT "${${LANG}_DAT}")
list(APPEND BUILD_LANG_SORUCES "${TXT2}")
list(APPEND BUILD_LANG_COMMANDS
DEPENDS "${TXT2}"
BYPRODUCTS "${DAT2}"
BYPRODUCTS "${LNG}"
COMMAND ${CMAKE_COMMAND} -E echo_append "${LANG}, "
COMMAND ${OMF_COMMAND_WRAPPER} "$<TARGET_FILE:languagetool>" --import "${TXT2}" --import "${BASE_TXT}" --base "${BASE_DAT}" --base-count "${LANG_STR_COUNT}" --output "${DAT2}" --check-count ${LANG2_STR_COUNT}
COMMAND ${OMF_COMMAND_WRAPPER} "$<TARGET_FILE:languagetool>" --import "${TXT2}" --import "${BASE_TXT}" --base "${BASE_DAT}" --base-count "${LANG_STR_COUNT}" --output "${LNG}" --check-count ${LANG2_STR_COUNT}
)
install(FILES "${DAT2}" DESTINATION "${LANGUAGE_INSTALL_PATH}")
install(FILES "${LNG}" DESTINATION "${LANGUAGE_INSTALL_PATH}")
endforeach()
foreach(LANG ${OPENOMF_LANGS})
set(TXT "${PROJECT_SOURCE_DIR}/resources/${LANG}.TXT")
set(TXT2 "${PROJECT_SOURCE_DIR}/resources/${LANG}2.TXT")
set(DAT "${CMAKE_CURRENT_BINARY_DIR}/resources/${LANG}.DAT")
set(LNG "${CMAKE_CURRENT_BINARY_DIR}/resources/${LANG}.LNG")
set(LNG2 "${CMAKE_CURRENT_BINARY_DIR}/resources/${LANG}.LNG2")
list(APPEND BUILD_LANG_SORUCES "${TXT}" "${TXT2}")
list(APPEND BUILD_LANG_COMMANDS
DEPENDS "${TXT}" "${TXT2}"
BYPRODUCTS "${LNG}" "{LNG2}"
BYPRODUCTS "${DAT}" "{LNG}"
COMMAND ${CMAKE_COMMAND} -E echo_append "${LANG}, "
COMMAND ${OMF_COMMAND_WRAPPER} "$<TARGET_FILE:languagetool>" --import "${TXT}" --output "${LNG}" --check-count ${LANG_STR_COUNT}
COMMAND ${OMF_COMMAND_WRAPPER} "$<TARGET_FILE:languagetool>" --import "${TXT}" --output "${DAT}" --check-count ${LANG_STR_COUNT}
# XXX HACK: Using DANISH.TXT as base of DANISH2 until we merge the two.
COMMAND ${OMF_COMMAND_WRAPPER} "$<TARGET_FILE:languagetool>" --import "${TXT2}" --import "${BASE_TXT}" --base "${LNG}" --base-count "${LANG_STR_COUNT}" --output "${LNG2}" --check-count ${LANG2_STR_COUNT}
COMMAND ${OMF_COMMAND_WRAPPER} "$<TARGET_FILE:languagetool>" --import "${TXT2}" --import "${BASE_TXT}" --base "${DAT}" --base-count "${LANG_STR_COUNT}" --output "${LNG}" --check-count ${LANG2_STR_COUNT}
)
install(FILES "${LNG}" "${LNG2}" DESTINATION "${LANGUAGE_INSTALL_PATH}")
install(FILES "${LNG}" DESTINATION "${LANGUAGE_INSTALL_PATH}")
endforeach()


Expand Down
2 changes: 0 additions & 2 deletions src/game/scenes/mainmenu/menu_language.c
Original file line number Diff line number Diff line change
Expand Up @@ -75,8 +75,6 @@ component *menu_language_create(scene *s) {
list dirlist;
// Seek all files
list_create(&dirlist);
list_append(&dirlist, "ENGLISH.DAT", strlen("ENGLISH.DAT") + 1);
list_append(&dirlist, "GERMAN.DAT", strlen("GERMAN.DAT") + 1);
scan_directory_suffix(&dirlist, dirname, ".LNG");
local->language_filenames = omf_malloc(list_size(&dirlist) * sizeof(char *));
local->language_names = omf_malloc(list_size(&dirlist) * sizeof(char *));
Expand Down
2 changes: 1 addition & 1 deletion src/game/utils/settings.c
Original file line number Diff line number Diff line change
Expand Up @@ -56,7 +56,7 @@ typedef struct {

// clang-format off
static const field f_language[] = {
F_STRING(settings_language, language, "ENGLISH.DAT"),
F_STRING(settings_language, language, "ENGLISH.LNG"),
};

const field f_video[] = {
Expand Down
Loading

0 comments on commit 321d51a

Please sign in to comment.