slackbuilds/games/zbom/0001-Respect-solarus-instal...

58 lines
1.9 KiB
Diff

From 265c1fcc47b4981f5ed6eaa127d87924fa8e13b1 Mon Sep 17 00:00:00 2001
From: orbea <orbea@riseup.net>
Date: Mon, 19 Aug 2019 15:50:42 -0700
Subject: [PATCH] Respect solarus install variables.
---
CMakeLists.txt | 18 ++++++++++++++----
1 file changed, 14 insertions(+), 4 deletions(-)
diff --git a/CMakeLists.txt b/CMakeLists.txt
index 6a9f7bb2..bbea7efd 100644
--- a/CMakeLists.txt
+++ b/CMakeLists.txt
@@ -3,6 +3,16 @@ project(ZBOM)
set(quest_name "zbom")
+set(SOLARUS_INSTALL_DATAROOTDIR "share" CACHE PATH "dataroot dir")
+set(SOLARUS_INSTALL_DATADIR "${SOLARUS_INSTALL_DATAROOTDIR}/solarus" CACHE PATH "data dir")
+set(SOLARUS_INSTALL_BINDIR "bin" CACHE PATH "bin dir")
+
+if (IS_ABSOLUTE ${SOLARUS_INSTALL_DATADIR})
+ set(SOLARUS_INSTALL_ABSOLUTE_DATADIR ${SOLARUS_INSTALL_DATADIR})
+else()
+ set(SOLARUS_INSTALL_ABSOLUTE_DATADIR ${CMAKE_INSTALL_PREFIX}/${SOLARUS_INSTALL_DATADIR})
+endif()
+
# data files list
file(GLOB_RECURSE data_files
RELATIVE ${CMAKE_CURRENT_SOURCE_DIR}/data
@@ -46,8 +56,8 @@ add_custom_target(${quest_name}_data
# create a script that executes the engine with this quest
add_custom_command(
OUTPUT ${quest_name}
- COMMAND echo '\#!/bin/bash' > ${quest_name}
- COMMAND echo 'solarus ${CMAKE_INSTALL_PREFIX}/share/solarus/${quest_name} $*' >> ${quest_name}
+ COMMAND echo '\#!/bin/sh' > ${quest_name}
+ COMMAND echo 'solarus-run ${SOLARUS_INSTALL_ABSOLUTE_DATADIR}/${quest_name} $$*' >> ${quest_name}
)
add_custom_target(${quest_name}_command
ALL
@@ -56,10 +66,10 @@ add_custom_target(${quest_name}_command
# install the data archive
install(FILES ${CMAKE_CURRENT_BINARY_DIR}/data.solarus
- DESTINATION share/solarus/${quest_name}
+ DESTINATION ${SOLARUS_INSTALL_DATADIR}/${quest_name}
)
# install the script
install(PROGRAMS ${CMAKE_CURRENT_BINARY_DIR}/${quest_name}
- DESTINATION bin
+ DESTINATION ${SOLARUS_INSTALL_BINDIR}
)
--
2.22.0