Browse Source

RetroFW / OpenDingux build configurations (#264)

pull/346/head
Gleb Mazovetskiy 7 years ago committed by Anders Jenbo
parent
commit
2d8a778840
  1. 11
      CMakeLists.txt
  2. 6
      Packaging/OpenDingux/.editorconfig
  3. 1
      Packaging/OpenDingux/.gitignore
  4. 3
      Packaging/OpenDingux/README.md
  5. 54
      Packaging/OpenDingux/build-opendingux-sdl1.sh
  6. 54
      Packaging/OpenDingux/build-retrofw.sh
  7. 9
      Packaging/OpenDingux/buildroot_opendingux_musl_defconfig
  8. 9
      Packaging/OpenDingux/buildroot_retrofw_defconfig
  9. 10
      Packaging/OpenDingux/control
  10. 5
      Packaging/OpenDingux/devilutionx.man.txt
  11. 3
      Packaging/OpenDingux/diablo.ini
  12. 54
      Packaging/OpenDingux/package.sh
  13. 30
      README.md

11
CMakeLists.txt

@ -79,7 +79,7 @@ if(HAIKU)
set(ASAN OFF) set(ASAN OFF)
endif() endif()
if(DIST) if(DIST OR DINGUX)
set(sodium_USE_STATIC_LIBS ON) set(sodium_USE_STATIC_LIBS ON)
endif() endif()
@ -308,10 +308,15 @@ foreach(target devilution devilutionx)
target_compile_options(${target} PUBLIC -fsanitize=address -fsanitize-recover=address) target_compile_options(${target} PUBLIC -fsanitize=address -fsanitize-recover=address)
target_link_libraries(${target} PUBLIC -fsanitize=address -fsanitize-recover=address) target_link_libraries(${target} PUBLIC -fsanitize=address -fsanitize-recover=address)
endif() endif()
if(UBSAN) if(UBSAN)
target_compile_options(${target} PUBLIC -fsanitize=undefined) target_compile_options(${target} PUBLIC -fsanitize=undefined)
target_link_libraries(${target} PUBLIC -fsanitize=undefined) target_link_libraries(${target} PUBLIC -fsanitize=undefined)
endif() endif()
if(DINGUX)
target_compile_definitions(${target} PRIVATE DINGUX)
endif()
endforeach(target devilution devilutionx) endforeach(target devilution devilutionx)
if(DIST AND CMAKE_CXX_COMPILER_ID MATCHES "GCC") if(DIST AND CMAKE_CXX_COMPILER_ID MATCHES "GCC")
@ -399,3 +404,7 @@ if(APPLE)
include(CPack) include(CPack)
endif() endif()
if(DINGUX)
set_target_properties(devilutionx PROPERTIES OUTPUT_NAME "devilutionx.dge")
endif()

6
Packaging/OpenDingux/.editorconfig

@ -0,0 +1,6 @@
[*]
indent_style = tab
end_of_line = lf
charset = utf-8
trim_trailing_whitespace = true
insert_final_newline = true

1
Packaging/OpenDingux/.gitignore vendored

@ -0,0 +1 @@
/tmp/

3
Packaging/OpenDingux/README.md

@ -0,0 +1,3 @@
# DevilutionX OpenDingux Port
See README.md in the root directory for build instructions.

54
Packaging/OpenDingux/build-opendingux-sdl1.sh

@ -0,0 +1,54 @@
#!/usr/bin/env bash
set -euo pipefail
declare -r DIR="$(dirname "${BASH_SOURCE[0]}")"
cd "$DIR"
declare -r ABSDIR="$(pwd)"
declare -r BUILDROOT_VER=buildroot-2018.02.9
BUILDROOT="${BUILDROOT:-$HOME/${BUILDROOT_VER}-opendingux-musl}"
declare -r BUILDROOT_ARCHIVE="$HOME/${BUILDROOT_VER}.tar.gz"
set -x
main() {
set -x
prepare_buildroot
build
package
}
prepare_buildroot() {
if [[ -d $BUILDROOT ]]; then
return
fi
if [[ ! -f $BUILDROOT_ARCHIVE ]]; then
\curl https://buildroot.org/downloads/${BUILDROOT_VER}.tar.gz -o "$BUILDROOT_ARCHIVE"
fi
tar xf "$BUILDROOT_ARCHIVE" -C "$(dirname "$BUILDROOT_ARCHIVE")"
mv "${BUILDROOT_ARCHIVE%.tar.gz}" "$BUILDROOT"
cp buildroot_opendingux_musl_defconfig "$BUILDROOT/configs/opendingux_musl_defconfig"
cd "$BUILDROOT"
echo 'LIBSODIUM_CONF_OPTS += --enable-static' >> package/libsodium/libsodium.mk
make opendingux_musl_defconfig
BR2_JLEVEL=0 make toolchain libsodium libzip sdl sdl_mixer sdl_ttf
cd -
}
build() {
mkdir -p ../../build
cd ../../build
rm -f CMakeCache.txt
cmake .. -DDINGUX=ON -DUSE_SDL1=ON -DBINARY_RELEASE=ON \
-DCMAKE_TOOLCHAIN_FILE="$BUILDROOT/output/host/share/buildroot/toolchainfile.cmake"
cd -
}
package() {
./package.sh ../../build/devilutionx-opendingux-musl-sdl1.ipk
}
main

54
Packaging/OpenDingux/build-retrofw.sh

@ -0,0 +1,54 @@
#!/usr/bin/env bash
set -euo pipefail
declare -r DIR="$(dirname "${BASH_SOURCE[0]}")"
cd "$DIR"
declare -r ABSDIR="$(pwd)"
declare -r BUILDROOT_VER=buildroot-2018.02.9
BUILDROOT="${BUILDROOT:-$HOME/${BUILDROOT_VER}-retrofw}"
declare -r BUILDROOT_ARCHIVE="$HOME/${BUILDROOT_VER}.tar.gz"
set -x
main() {
set -x
prepare_buildroot
build
package
}
prepare_buildroot() {
if [[ -d $BUILDROOT ]]; then
return
fi
if [[ ! -f $BUILDROOT_ARCHIVE ]]; then
\curl https://buildroot.org/downloads/${BUILDROOT_VER}.tar.gz -o "$BUILDROOT_ARCHIVE"
fi
tar xf "$BUILDROOT_ARCHIVE" -C "$(dirname "$BUILDROOT_ARCHIVE")"
mv "${BUILDROOT_ARCHIVE%.tar.gz}" "$BUILDROOT"
cp buildroot_retrofw_defconfig "$BUILDROOT/configs/retrofw_defconfig"
cd "$BUILDROOT"
echo 'LIBSODIUM_CONF_OPTS += --enable-static' >> package/libsodium/libsodium.mk
make retrofw_defconfig
BR2_JLEVEL=0 make toolchain libsodium libzip sdl sdl_mixer sdl_ttf
cd -
}
build() {
mkdir -p ../../build
cd ../../build
rm -f CMakeCache.txt
cmake .. -DDINGUX=ON -DUSE_SDL1=ON -DBINARY_RELEASE=ON \
-DCMAKE_TOOLCHAIN_FILE="$BUILDROOT/output/host/share/buildroot/toolchainfile.cmake"
cd -
}
package() {
./package.sh ../../build/devilutionx-retrofw-uclibc-sdl1.ipk
}
main

9
Packaging/OpenDingux/buildroot_opendingux_musl_defconfig

@ -0,0 +1,9 @@
BR2_mipsel=y
# BR2_MIPS_SOFT_FLOAT is not set
BR2_TOOLCHAIN_BUILDROOT_MUSL=y
BR2_TOOLCHAIN_BUILDROOT_CXX=y
BR2_PACKAGE_SDL=y
BR2_PACKAGE_SDL_MIXER=y
BR2_PACKAGE_SDL_TTF=y
BR2_PACKAGE_LIBZIP=y
BR2_PACKAGE_LIBSODIUM=y

9
Packaging/OpenDingux/buildroot_retrofw_defconfig

@ -0,0 +1,9 @@
BR2_mipsel=y
# BR2_MIPS_SOFT_FLOAT is not set
BR2_TOOLCHAIN_BUILDROOT_WCHAR=y
BR2_TOOLCHAIN_BUILDROOT_CXX=y
BR2_PACKAGE_SDL=y
BR2_PACKAGE_SDL_MIXER=y
BR2_PACKAGE_SDL_TTF=y
BR2_PACKAGE_LIBZIP=y
BR2_PACKAGE_LIBSODIUM=y

10
Packaging/OpenDingux/control

@ -0,0 +1,10 @@
Package: devilutionx
Version: 0.0.1
Architecture: mipsel
Section: games
Maintainer: glex.spb@gmail.com
Description: A port of DevilutionX for OpenDingux / RetroFW.
Priority: optional
Homepage: https://github.com/diasurgical/devilutionX
Depends:
Source: https://github.com/diasurgical/devilutionX

5
Packaging/OpenDingux/devilutionx.man.txt

@ -0,0 +1,5 @@
Copy diabdat.mpq from your CD, or GoG install folder to:
/home/retrofw/games/devilutionx/diabdat.mpq
Game saves and diablo.ini are located at:
/home/retrofw/.local/share/diasurgical/devilution

3
Packaging/OpenDingux/diablo.ini

@ -0,0 +1,3 @@
[devilutionx]
upscale=0
fullscreen=0

54
Packaging/OpenDingux/package.sh

@ -0,0 +1,54 @@
#!/usr/bin/env bash
set -euo pipefail
cd "$(dirname "${BASH_SOURCE[0]}")"
readonly OUT="${1:-../../build/devilutionx.ipk}"
readonly IN="${2:-../../build/devilutionx.dge}"
readonly PKG_TARGET=devilutionx
readonly TMP="tmp/${PKG_TARGET}"
pkg_control_get() {
sed -n control -e 's/^.*'"$1"': //p'
}
readonly PKG_SECTION="$(pkg_control_get Section)"
readonly PKG_INSTALL_DIR="home/retrofw/${PKG_SECTION}/${PKG_TARGET}"
readonly PKG_LOCAL_DIR="home/retrofw/.local/share/diasurgical/devilution"
readonly PKG_MENU_LNK_OUT="home/retrofw/apps/gmenu2x/sections/${PKG_SECTION}/${PKG_TARGET}.lnk"
echo 1>&2 Packaging ${OUT} from ${TMP}...
set -x
rm -rf "${TMP}"
mkdir -p "${TMP}"
# data.tar.gz
mkdir -p "${TMP}/root/${PKG_INSTALL_DIR}" "${TMP}/root/${PKG_LOCAL_DIR}"
cp "$IN" "${TMP}/root/${PKG_INSTALL_DIR}/${PKG_TARGET}.dge"
cp ../resources/Diablo_32.png "${TMP}/root/${PKG_INSTALL_DIR}/devilutionx.png"
cp devilutionx.man.txt ../resources/CharisSILB.ttf ../resources/LICENSE.CharisSILB.txt "${TMP}/root/${PKG_INSTALL_DIR}"
cp diablo.ini "${TMP}/root/${PKG_LOCAL_DIR}/diablo.ini"
mkdir -p "${TMP}/root/$(dirname "$PKG_MENU_LNK_OUT")"
printf "%s\n" \
"title=DevilutionX" \
"description=$(pkg_control_get Description)" \
"exec=/${PKG_INSTALL_DIR}/${PKG_TARGET}.dge" \
> "${TMP}/root/${PKG_MENU_LNK_OUT}"
tar --owner=0 --group=0 -czvf "${TMP}/data.tar.gz" -C "${TMP}/root/" .
# control.tar.gz
sed -e "s/^Version:.*/Version: $(date +%Y%m%d)/" control > "${TMP}/control"
printf "%s\n" \
"/$PKG_MENU_LNK_OUT" \
"/${PKG_LOCAL_DIR}/diablo.ini" \
>> ${TMP}/conffiles
tar --owner=0 --group=0 -czvf "${TMP}/control.tar.gz" -C "${TMP}/" control conffiles
printf '2.0\n' > "${TMP}/debian-binary"
ar r "$OUT" \
"${TMP}/control.tar.gz" \
"${TMP}/data.tar.gz" \
"${TMP}/debian-binary"

30
README.md

@ -139,6 +139,36 @@ cmake --build . -j $(nproc)
``` ```
</details> </details>
<details><summary>OpenDingux / RetroFW</summary>
DevilutionX uses buildroot to build packages for OpenDingux and RetroFW.
The build script does the following:
1. Downloads and configures the buildroot if necessary.
2. Builds the executable (using CMake).
3. Packages the executable and all related resources into an `.ipk` package.
The buildroot uses ~4 GiB of disk space and can take almost an hour to build.
### OpenDingux
The OpenDingux build uses the buildroot at `$HOME/buildroot-2018.02.9-opendingux-musl`.
~~~ bash
Packaging/OpenDingux/build-opendingux-sdl1.sh
~~~
### RetroFW
The OpenDingux build uses the buildroot at `$HOME/buildroot-2018.02.9-retrofw`.
~~~ bash
Packaging/OpenDingux/build-retrofw.sh
~~~
</details>
## CMake arguments ## CMake arguments
### General ### General
The default build type is `Debug`. This can be changed with `-DBINARY_RELEASE=ON`. Independently of this, the debug mode of the Diablo engine is always enabled by default. It can be disabled with `-DDEBUG=OFF`. Finally, in debug builds the address sanitizer is enabled by default. This can be disabled with `-DASAN=OFF`. The default build type is `Debug`. This can be changed with `-DBINARY_RELEASE=ON`. Independently of this, the debug mode of the Diablo engine is always enabled by default. It can be disabled with `-DDEBUG=OFF`. Finally, in debug builds the address sanitizer is enabled by default. This can be disabled with `-DASAN=OFF`.

Loading…
Cancel
Save