[packages/devilutionX] up to 1.3.0

atler atler at pld-linux.org
Mon Nov 15 01:15:43 CET 2021


commit b417ad4aa4a23e5cc6302039aec68c07fcbf41ef
Author: Jan Palus <atler at pld-linux.org>
Date:   Mon Nov 15 01:11:53 2021 +0100

    up to 1.3.0
    
    - prepare dependencies manually since otherwise they are fetched over
      network (also see https://github.com/diasurgical/devilutionX/issues/3412)
    - updatream patch for using system SDL2_image (from
      https://github.com/diasurgical/devilutionX/pull/3386)
    - patch to avoid static linking of libstdc++

 devilutionX.spec       |  42 +++++++++-----
 no_static.patch        |  13 +++++
 system_sdl_image.patch | 148 +++++++++++++++++++++++++++++++++++++++++++++++++
 3 files changed, 189 insertions(+), 14 deletions(-)
---
diff --git a/devilutionX.spec b/devilutionX.spec
index c3ff003..9020774 100644
--- a/devilutionX.spec
+++ b/devilutionX.spec
@@ -1,36 +1,56 @@
 Summary:	Diablo build for modern operating systems
 Name:		devilutionX
-Version:	1.2.1
+Version:	1.3.0
 Release:	1
 License:	Unlicense
 Group:		X11/Applications/Games
 Source0:	https://github.com/diasurgical/devilutionX/archive/%{version}/%{name}-%{version}.tar.gz
-# Source0-md5:	03470a886e3fc028401655e88ddea5de
+# Source0-md5:	23791a40dfc5b6fbe6a935a3b76d5bc3
+Source1:	https://github.com/diasurgical/asio/archive/ebeff99f539da23d27c2e8d4bdbc1ee011968644.tar.gz
+# Source1-md5:	4195600342abf307b8a9a571b87d687f
+Source2:	https://github.com/realnc/SDL_audiolib/archive/aa79660eba4467a44f9dcaecf26b0f0a000abfd7.tar.gz
+# Source2-md5:	7c79bb0d97f8469bbe5339061e910095
+Source3:	https://github.com/brofield/simpleini/archive/7bca74f6535a37846162383e52071f380c99a43a.zip
+# Source3-md5:	af067f743dd5c7aac3212ca22da6f621
+Patch0:		system_sdl_image.patch
+Patch1:		no_static.patch
 URL:		https://github.com/diasurgical/devilutionX/
 BuildRequires:	SDL2-devel
+BuildRequires:	SDL2_image-devel >= 2.0.5
 BuildRequires:	SDL2_mixer-devel
-BuildRequires:	SDL2_ttf-devel
 BuildRequires:	cmake >= 3.13
+BuildRequires:	libfmt-devel >= 7.0.0
+BuildRequires:	libpng-devel
 BuildRequires:	libsodium-devel
-BuildRequires:	libstdc++-devel >= 6:4.8.1
+BuildRequires:	libstdc++-devel >= 6:7
 BuildRequires:	rpmbuild(macros) >= 1.605
+BuildRequires:	smpq
 Requires(post,postun):	fontpostinst
+Requires:	SDL2_image >= 2.0.5
 Requires:	hicolor-icon-theme
+Requires:	libfmt >= 7.0.0
 BuildRoot:	%{tmpdir}/%{name}-%{version}-root-%(id -u -n)
 
-%define		_ttffontsdir	%{_fontsdir}/TTF
-
 %description
 Diablo build for modern operating systems.
 
 %prep
 %setup -q
+%patch0 -p1
+%patch1 -p1
+
+install -d build/_deps/asio-subbuild/asio-populate-prefix/src
+cp -p  %{SOURCE1} build/_deps/asio-subbuild/asio-populate-prefix/src
+install -d build/_deps/sdl_audiolib-subbuild/sdl_audiolib-populate-prefix/src
+cp -p %{SOURCE2} build/_deps/sdl_audiolib-subbuild/sdl_audiolib-populate-prefix/src
+install -d build/_deps/simpleini-subbuild/simpleini-populate-prefix/src
+cp -p %{SOURCE3} build/_deps/simpleini-subbuild/simpleini-populate-prefix/src
 
 %build
 cd build
 %cmake .. \
-	-DTTF_FONT_DIR='"%{_ttffontsdir}/"' \
-	-DVERSION_NUM="%{version}"
+	-DVERSION_NUM="%{version}" \
+	-DDISABLE_ZERO_TIER:BOOL=ON
 %{__make}
 
 %install
@@ -38,18 +58,13 @@ rm -rf $RPM_BUILD_ROOT
 %{__make} -C build install \
 	DESTDIR=$RPM_BUILD_ROOT
 
-install -d $RPM_BUILD_ROOT%{_ttffontsdir}
-mv $RPM_BUILD_ROOT%{_prefix}/share/fonts/truetype/*.ttf $RPM_BUILD_ROOT%{_ttffontsdir}
-
 %clean
 rm -rf $RPM_BUILD_ROOT
 
 %post
-fontpostinst TTF
 %update_icon_cache hicolor
 
 %postun
-fontpostinst TTF
 %update_icon_cache hicolor
 
 %files
@@ -58,7 +73,6 @@ fontpostinst TTF
 %attr(755,root,root) %{_bindir}/devilutionx
 %{_desktopdir}/devilutionx.desktop
 %{_desktopdir}/devilutionx-hellfire.desktop
-%{_ttffontsdir}/CharisSILB.ttf
 %{_iconsdir}/hicolor/512x512/apps/devilutionx.png
 %{_iconsdir}/hicolor/512x512/apps/devilutionx-hellfire.png
 %dir %{_datadir}/diasurgical
diff --git a/no_static.patch b/no_static.patch
new file mode 100644
index 0000000..b2679bf
--- /dev/null
+++ b/no_static.patch
@@ -0,0 +1,13 @@
+--- devilutionX-1.3.0/CMakeLists.txt.orig	2021-11-15 00:25:32.419795160 +0100
++++ devilutionX-1.3.0/CMakeLists.txt	2021-11-15 00:32:41.947541133 +0100
+@@ -1054,10 +1054,6 @@
+   target_link_libraries(libdevilutionx PUBLIC ${GPERFTOOLS_LIBRARIES})
+ endif()
+ 
+-if(CMAKE_CXX_COMPILER_ID MATCHES "GNU" AND NOT GPERF AND NOT HAIKU AND NOT VITA)
+-  target_link_libraries(libdevilutionx PUBLIC "$<$<NOT:$<CONFIG:Debug>>:-static-libgcc;-static-libstdc++>")
+-endif()
+-
+ if(WIN32)
+   target_link_libraries(libdevilutionx PUBLIC shlwapi wsock32 ws2_32 wininet)
+ 
diff --git a/system_sdl_image.patch b/system_sdl_image.patch
new file mode 100644
index 0000000..f98a8ce
--- /dev/null
+++ b/system_sdl_image.patch
@@ -0,0 +1,148 @@
+From da77dbc0d1f981863f466edd69a77dc1eebad3cc Mon Sep 17 00:00:00 2001
+From: staphen <staphen at gmail.com>
+Date: Wed, 3 Nov 2021 22:38:08 -0400
+Subject: [PATCH] Add CMake option to use system SDL_image
+
+---
+ 3rdParty/SDL_image/CMakeLists.txt |  8 ++++++-
+ CMake/FindSDL2_image.cmake        | 26 +++++++++++++++++++++++
+ CMakeLists.txt                    | 35 +++++++++++++++++++++++++++----
+ vcpkg.json                        |  3 ++-
+ 4 files changed, 66 insertions(+), 6 deletions(-)
+ create mode 100644 CMake/FindSDL2_image.cmake
+
+diff --git a/3rdParty/SDL_image/CMakeLists.txt b/3rdParty/SDL_image/CMakeLists.txt
+index 4cdeef0004a..b96650747c5 100644
+--- a/3rdParty/SDL_image/CMakeLists.txt
++++ b/3rdParty/SDL_image/CMakeLists.txt
+@@ -14,7 +14,12 @@ else()
+ endif()
+ FetchContent_MakeAvailableExcludeFromAll(SDL_image)
+ 
+-add_library(SDL_image STATIC ${CMAKE_CURRENT_LIST_DIR}/IMG.c ${sdl_image_SOURCE_DIR}/IMG_png.c)
++if(DEVILUTIONX_STATIC_SDL_IMAGE)
++  add_library(SDL_image STATIC ${CMAKE_CURRENT_LIST_DIR}/IMG.c ${sdl_image_SOURCE_DIR}/IMG_png.c)
++else()
++  add_library(SDL_image SHARED ${CMAKE_CURRENT_LIST_DIR}/IMG.c ${sdl_image_SOURCE_DIR}/IMG_png.c)
++endif()
++
+ target_include_directories(SDL_image PRIVATE ${sdl_image_SOURCE_DIR})
+ target_compile_definitions(SDL_image PRIVATE LOAD_PNG SDL_IMAGE_USE_COMMON_BACKEND)
+ target_link_libraries(SDL_image PNG::PNG)
+@@ -23,4 +28,5 @@ if(USE_SDL1)
+   target_link_libraries(SDL_image ${SDL_LIBRARY})
+ else()
+   target_link_libraries(SDL_image SDL2::SDL2)
++  add_library(SDL2::SDL2_image ALIAS SDL_image)
+ endif()
+diff --git a/CMake/FindSDL2_image.cmake b/CMake/FindSDL2_image.cmake
+new file mode 100644
+index 00000000000..dd790028676
+--- /dev/null
++++ b/CMake/FindSDL2_image.cmake
+@@ -0,0 +1,26 @@
++find_package(PkgConfig)
++pkg_check_modules(PC_SDL2_image QUIET SDL2_image>=2.0.0)
++
++find_path(SDL2_image_INCLUDE_DIR SDL_image.h
++          HINTS ${PC_SDL2_image_INCLUDEDIR} ${PC_SDL2_image_INCLUDE_DIRS})
++          
++find_library(SDL2_image_LIBRARY
++             NAMES SDL2_image libSDL2_image
++             HINTS ${PC_SDL2_image_LIBDIR} ${PC_SDL2_image_LIBRARY_DIRS})
++
++include(FindPackageHandleStandardArgs)
++find_package_handle_standard_args(SDL2_image DEFAULT_MSG
++                                  SDL2_image_INCLUDE_DIR SDL2_image_LIBRARY)
++
++if(SDL2_image_FOUND AND NOT TARGET SDL2::SDL2_image)
++  add_library(SDL2::SDL2_image UNKNOWN IMPORTED)
++  set_target_properties(SDL2::SDL2_image PROPERTIES
++                        IMPORTED_LOCATION ${SDL2_image_LIBRARY}
++                        INTERFACE_INCLUDE_DIRECTORIES ${SDL2_image_INCLUDE_DIR})
++endif()
++
++if(SDL2_image_FOUND)
++  mark_as_advanced(SDL2_image_INCLUDE_DIR SDL2_image_LIBRARY)
++  set(SDL2_image_LIBRARIES ${SDL2_image_LIBRARY})
++  set(SDL2_image_INCLUDE_DIRS ${SDL2_image_INCLUDE_DIR})
++endif()
+diff --git a/CMakeLists.txt b/CMakeLists.txt
+index 2121409e95b..116da573f33 100644
+--- a/CMakeLists.txt
++++ b/CMakeLists.txt
+@@ -93,6 +93,10 @@ option(DEVILUTIONX_SYSTEM_LIBPNG "Use system-provided libpng" ON)
+ cmake_dependent_option(DEVILUTIONX_STATIC_LIBPNG "Link static libpng" OFF
+                        "DEVILUTIONX_SYSTEM_LIBPNG AND NOT DIST" ON)
+ 
++option(DEVILUTIONX_SYSTEM_SDL_IMAGE "Use system-provided SDL_image" ON)
++cmake_dependent_option(DEVILUTIONX_STATIC_SDL_IMAGE "Link static SDL_image" OFF
++                       "DEVILUTIONX_SYSTEM_SDL_IMAGE AND NOT DIST" ON)
++
+ if(NOT VERSION_NUM)
+   include(CMake/git.cmake)
+   get_git_tag(VERSION_NUM)
+@@ -313,7 +317,29 @@ if(NOT NONET AND NOT DISABLE_TCP)
+   endif()
+ endif()
+ 
+-add_subdirectory(3rdParty/SDL_image)
++if(DEVILUTIONX_SYSTEM_SDL_IMAGE)
++  if(USE_SDL1)
++    find_package(SDL_image QUIET)
++  else()
++    # vcpkg uses sdl2-image as the package name
++    find_package(sdl2-image QUIET)
++    set(SDL_image_FOUND ${sdl2-image_FOUND})
++
++    if(NOT SDL_image_FOUND)
++      # Fall back on PkgConfig via FindSDL2_image.cmake
++      find_package(SDL2_image QUIET)
++      set(SDL_image_FOUND ${SDL2_image_FOUND})
++    endif()
++  endif()
++  if(SDL_image_FOUND)
++    message("-- Found SDL_image")
++  else()
++    message("-- Suitable system SDL_image package not found, will use SDL_image from source")
++  endif()
++endif()
++if(NOT SDL_image_FOUND)
++  add_subdirectory(3rdParty/SDL_image)
++endif()
+ 
+ if(NOT NOSOUND)
+   if(DEVILUTIONX_SYSTEM_SDL_AUDIOLIB)
+@@ -986,14 +1012,15 @@ endif()
+ 
+ if(USE_SDL1)
+   target_link_libraries(libdevilutionx PUBLIC
+-    ${SDL_LIBRARY})
++    ${SDL_LIBRARY}
++    SDL_image)
+   target_compile_definitions(libdevilutionx PUBLIC USE_SDL1)
+ else()
+   target_link_libraries(libdevilutionx PUBLIC
+     SDL2::SDL2
+-    ${SDL2_MAIN})
++    ${SDL2_MAIN}
++    SDL2::SDL2_image)
+ endif()
+-target_link_libraries(libdevilutionx PUBLIC SDL_image)
+ 
+ if(NOT NOSOUND)
+   target_link_libraries(libdevilutionx PUBLIC SDL_audiolib)
+diff --git a/vcpkg.json b/vcpkg.json
+index 0d2243d0959..5719e58fe15 100644
+--- a/vcpkg.json
++++ b/vcpkg.json
+@@ -4,7 +4,8 @@
+     "dependencies": [
+         "fmt",
+         "libpng",
+-        "sdl2"
++        "sdl2",
++        "sdl2-image"
+     ],
+     "features": {
+         "encryption": {
================================================================

---- gitweb:

http://git.pld-linux.org/gitweb.cgi/packages/devilutionX.git/commitdiff/b417ad4aa4a23e5cc6302039aec68c07fcbf41ef



More information about the pld-cvs-commit mailing list