aboutsummaryrefslogtreecommitdiffstats
path: root/testing/binaryen/fix-install-paths.patch
blob: f885fbfcaae59bf352c582f3d0ec6ce7d2fd04de (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
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
From: Jakub Jirutka <jakub@jirutka.cz>
Date: Sat, 1 Apr 2017 02:00:34 +0200
Subject: [PATCH] Fix install locations per FHS and allow to customize them

Include built-in cmake module GNUInstallDirs that defines customizable
CMAKE_INSTALL_* variables with common defaults per FHS.

Upstream-Issue: https://github.com/WebAssembly/binaryen/pull/958
---
--- a/CMakeLists.txt
+++ b/CMakeLists.txt
@@ -1,5 +1,6 @@
 PROJECT(binaryen C CXX)
 CMAKE_MINIMUM_REQUIRED(VERSION 2.8.7)
+INCLUDE(GNUInstallDirs)
 
 IF(NOT CMAKE_BUILD_TYPE)
   MESSAGE(STATUS "No build type selected, default to Release")
@@ -138,11 +139,11 @@ ELSE()
   ADD_LIBRARY(binaryen SHARED ${binaryen_SOURCES})
 ENDIF()
 TARGET_LINK_LIBRARIES(binaryen ${all_passes} wasm asmjs ast support)
-INSTALL(TARGETS binaryen DESTINATION lib)
+INSTALL(TARGETS binaryen DESTINATION ${CMAKE_INSTALL_LIBDIR})
 
-INSTALL(FILES src/binaryen-c.h DESTINATION include)
-INSTALL(FILES bin/wasm.js DESTINATION bin)
-INSTALL(FILES bin/binaryen.js DESTINATION bin)
+INSTALL(FILES src/binaryen-c.h DESTINATION ${CMAKE_INSTALL_INCLUDEDIR})
+INSTALL(FILES bin/wasm.js DESTINATION ${CMAKE_INSTALL_DATADIR}/${PROJECT_NAME})
+INSTALL(FILES bin/binaryen.js DESTINATION ${CMAKE_INSTALL_DATADIR}/${PROJECT_NAME})
 INSTALL(DIRECTORY src/js DESTINATION src)
 
 SET(wasm-shell_SOURCES
@@ -154,7 +155,7 @@ ADD_EXECUTABLE(wasm-shell
 TARGET_LINK_LIBRARIES(wasm-shell wasm asmjs emscripten-optimizer ${all_passes} ast support)
 SET_PROPERTY(TARGET wasm-shell PROPERTY CXX_STANDARD 11)
 SET_PROPERTY(TARGET wasm-shell PROPERTY CXX_STANDARD_REQUIRED ON)
-INSTALL(TARGETS wasm-shell DESTINATION bin)
+INSTALL(TARGETS wasm-shell DESTINATION ${CMAKE_INSTALL_BINDIR})
 
 SET(wasm-opt_SOURCES
   src/tools/wasm-opt.cpp
@@ -164,7 +165,7 @@ ADD_EXECUTABLE(wasm-opt
 TARGET_LINK_LIBRARIES(wasm-opt wasm asmjs emscripten-optimizer ${all_passes} ast support)
 SET_PROPERTY(TARGET wasm-opt PROPERTY CXX_STANDARD 11)
 SET_PROPERTY(TARGET wasm-opt PROPERTY CXX_STANDARD_REQUIRED ON)
-INSTALL(TARGETS wasm-opt DESTINATION bin)
+INSTALL(TARGETS wasm-opt DESTINATION ${CMAKE_INSTALL_BINDIR})
 
 SET(asm2wasm_SOURCES
   src/tools/asm2wasm.cpp
@@ -175,7 +176,7 @@ ADD_EXECUTABLE(asm2wasm
 TARGET_LINK_LIBRARIES(asm2wasm emscripten-optimizer ${all_passes} wasm asmjs ast support)
 SET_PROPERTY(TARGET asm2wasm PROPERTY CXX_STANDARD 11)
 SET_PROPERTY(TARGET asm2wasm PROPERTY CXX_STANDARD_REQUIRED ON)
-INSTALL(TARGETS asm2wasm DESTINATION bin)
+INSTALL(TARGETS asm2wasm DESTINATION ${CMAKE_INSTALL_BINDIR})
 
 SET(s2wasm_SOURCES
   src/tools/s2wasm.cpp
@@ -187,7 +188,7 @@ ADD_EXECUTABLE(s2wasm
 TARGET_LINK_LIBRARIES(s2wasm passes wasm asmjs ast support)
 SET_PROPERTY(TARGET s2wasm PROPERTY CXX_STANDARD 11)
 SET_PROPERTY(TARGET s2wasm PROPERTY CXX_STANDARD_REQUIRED ON)
-INSTALL(TARGETS s2wasm DESTINATION bin)
+INSTALL(TARGETS s2wasm DESTINATION ${CMAKE_INSTALL_BINDIR})
 
 SET(wasm_as_SOURCES
   src/tools/wasm-as.cpp
@@ -197,7 +198,7 @@ ADD_EXECUTABLE(wasm-as
 TARGET_LINK_LIBRARIES(wasm-as wasm asmjs passes ast support)
 SET_PROPERTY(TARGET wasm-as PROPERTY CXX_STANDARD 11)
 SET_PROPERTY(TARGET wasm-as PROPERTY CXX_STANDARD_REQUIRED ON)
-INSTALL(TARGETS wasm-as DESTINATION bin)
+INSTALL(TARGETS wasm-as DESTINATION ${CMAKE_INSTALL_BINDIR})
 
 SET(wasm_dis_SOURCES
   src/tools/wasm-dis.cpp
@@ -207,4 +208,4 @@ ADD_EXECUTABLE(wasm-dis
 TARGET_LINK_LIBRARIES(wasm-dis passes wasm asmjs ast support)
 SET_PROPERTY(TARGET wasm-dis PROPERTY CXX_STANDARD 11)
 SET_PROPERTY(TARGET wasm-dis PROPERTY CXX_STANDARD_REQUIRED ON)
-INSTALL(TARGETS wasm-dis DESTINATION bin)
+INSTALL(TARGETS wasm-dis DESTINATION ${CMAKE_INSTALL_BINDIR})