summaryrefslogtreecommitdiffstats
path: root/games/zbom/0001-Respect-solarus-install-variables.patch
blob: a16325f99809dc3affa9d4e3caee444251c7f18e (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
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