-
Notifications
You must be signed in to change notification settings - Fork 6.5k
/
portfile.cmake
155 lines (137 loc) · 5.76 KB
/
portfile.cmake
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
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
vcpkg_from_github(
OUT_SOURCE_PATH SOURCE_PATH
REPO tcltk/tcl
REF 0fa6a4e5aad821a5c34fdfa070c37c3f1ffc8c8e
SHA512 9d7f35309fe8b1a7c116639aaea50cc01699787c7afb432389bee2b9ad56a67034c45d90c9585ef1ccf15bdabf0951cbef86257c0c6aedbd2591bbfae3e93b76
PATCHES force-shell-install.patch
)
if (VCPKG_TARGET_IS_WINDOWS)
if(VCPKG_TARGET_ARCHITECTURE MATCHES "x64")
set(TCL_BUILD_MACHINE_STR MACHINE=AMD64)
else()
set(TCL_BUILD_MACHINE_STR MACHINE=IX86)
endif()
# Handle features
set(TCL_BUILD_OPTS OPTS=pdbs)
set(TCL_BUILD_STATS STATS=none)
set(TCL_BUILD_CHECKS CHECKS=none)
if (VCPKG_LIBRARY_LINKAGE STREQUAL static)
set(TCL_BUILD_OPTS ${TCL_BUILD_OPTS},static,staticpkg)
endif()
if (VCPKG_CRT_LINKAGE STREQUAL dynamic)
set(TCL_BUILD_OPTS ${TCL_BUILD_OPTS},msvcrt)
endif()
if ("thrdalloc" IN_LIST FEATURES)
set(TCL_BUILD_OPTS ${TCL_BUILD_OPTS},thrdalloc)
endif()
if ("profile" IN_LIST FEATURES)
set(TCL_BUILD_OPTS ${TCL_BUILD_OPTS},profile)
endif()
if ("unchecked" IN_LIST FEATURES)
set(TCL_BUILD_OPTS ${TCL_BUILD_OPTS},unchecked)
endif()
if ("utfmax" IN_LIST FEATURES)
set(TCL_BUILD_OPTS ${TCL_BUILD_OPTS},time64bit)
endif()
vcpkg_install_nmake(
SOURCE_PATH ${SOURCE_PATH}
PROJECT_SUBPATH win
OPTIONS
${TCL_BUILD_MACHINE_STR}
${TCL_BUILD_STATS}
${TCL_BUILD_CHECKS}
OPTIONS_DEBUG
${TCL_BUILD_OPTS},symbols
INSTALLDIR=${CURRENT_PACKAGES_DIR}/debug
SCRIPT_INSTALL_DIR=${CURRENT_PACKAGES_DIR}/tools/tcl/debug/lib/tcl9.0
OPTIONS_RELEASE
release
${TCL_BUILD_OPTS}
INSTALLDIR=${CURRENT_PACKAGES_DIR}
SCRIPT_INSTALL_DIR=${CURRENT_PACKAGES_DIR}/tools/tcl/lib/tcl9.0
)
# Install
# Note: tcl shell requires it to be in a folder adjacent to the /lib/ folder, i.e. in a /bin/ folder
if (NOT VCPKG_BUILD_TYPE OR VCPKG_BUILD_TYPE STREQUAL release)
file(GLOB_RECURSE TOOL_BIN
"${CURRENT_PACKAGES_DIR}/bin/*.exe"
"${CURRENT_PACKAGES_DIR}/bin/*.dll"
)
file(COPY ${TOOL_BIN} DESTINATION "${CURRENT_PACKAGES_DIR}/tools/tcl/bin/")
# Remove .exes only after copying
file(GLOB_RECURSE TOOL_EXES
${CURRENT_PACKAGES_DIR}/bin/*.exe
)
file(REMOVE ${TOOL_EXES})
file(GLOB_RECURSE TOOLS
"${CURRENT_PACKAGES_DIR}/lib/dde1.4/*"
"${CURRENT_PACKAGES_DIR}/lib/nmake/*"
"${CURRENT_PACKAGES_DIR}/lib/reg1.3/*"
"${CURRENT_PACKAGES_DIR}/lib/tcl8/*"
"${CURRENT_PACKAGES_DIR}/lib/tcl8.6/*"
"${CURRENT_PACKAGES_DIR}/lib/tdbcsqlite31.1.0/*"
)
foreach(TOOL ${TOOLS})
get_filename_component(DST_DIR ${TOOL} PATH)
file(COPY "${TOOL}" DESTINATION ${DST_DIR})
endforeach()
file(REMOVE_RECURSE "${CURRENT_PACKAGES_DIR}/lib/dde1.4"
"${CURRENT_PACKAGES_DIR}/lib/nmake"
"${CURRENT_PACKAGES_DIR}/lib/reg1.3"
"${CURRENT_PACKAGES_DIR}/lib/tcl8"
"${CURRENT_PACKAGES_DIR}/lib/tcl8.6"
"${CURRENT_PACKAGES_DIR}/lib/tdbcsqlite31.1.0"
)
file(CHMOD_RECURSE
"${CURRENT_PACKAGES_DIR}/tools/tcl/lib/tcl9.0/msgs" "${CURRENT_PACKAGES_DIR}/tools/tcl/lib/tcl9.0/tzdata"
PERMISSIONS
OWNER_READ OWNER_WRITE
GROUP_READ GROUP_WRITE
WORLD_READ WORLD_WRITE
)
endif()
if (NOT VCPKG_BUILD_TYPE OR VCPKG_BUILD_TYPE STREQUAL debug)
file(GLOB_RECURSE TOOL_BIN
"${CURRENT_PACKAGES_DIR}/debug/bin/*.exe"
"${CURRENT_PACKAGES_DIR}/debug/bin/*.dll"
)
file(COPY ${TOOL_BIN} DESTINATION "${CURRENT_PACKAGES_DIR}/tools/tcl/debug/bin/")
# Remove .exes only after copying
file(GLOB_RECURSE EXES
"${CURRENT_PACKAGES_DIR}/debug/bin/*.exe"
)
file(REMOVE ${EXES})
file(REMOVE_RECURSE "${CURRENT_PACKAGES_DIR}/debug/lib/dde1.4"
"${CURRENT_PACKAGES_DIR}/debug/lib/nmake"
"${CURRENT_PACKAGES_DIR}/debug/lib/reg1.3"
"${CURRENT_PACKAGES_DIR}/debug/lib/tcl8"
"${CURRENT_PACKAGES_DIR}/debug/lib/tcl8.6"
"${CURRENT_PACKAGES_DIR}/debug/lib/tdbcsqlite31.1.0"
)
file(CHMOD_RECURSE
"${CURRENT_PACKAGES_DIR}/tools/tcl/debug/lib/tcl9.0/msgs" "${CURRENT_PACKAGES_DIR}/tools/tcl/debug/lib/tcl9.0/tzdata"
PERMISSIONS
OWNER_READ OWNER_WRITE
GROUP_READ GROUP_WRITE
WORLD_READ WORLD_WRITE
)
endif()
if(VCPKG_LIBRARY_LINKAGE STREQUAL static)
file(REMOVE_RECURSE "${CURRENT_PACKAGES_DIR}/bin" "${CURRENT_PACKAGES_DIR}/debug/bin")
endif()
file(REMOVE_RECURSE "${CURRENT_PACKAGES_DIR}/debug/include")
else()
file(REMOVE "${SOURCE_PATH}/unix/configure")
vcpkg_configure_make(
SOURCE_PATH "${SOURCE_PATH}"
PROJECT_SUBPATH unix
)
vcpkg_install_make()
vcpkg_fixup_pkgconfig()
if(VCPKG_LIBRARY_LINKAGE STREQUAL static)
file(REMOVE_RECURSE "${CURRENT_PACKAGES_DIR}/bin" "${CURRENT_PACKAGES_DIR}/debug/bin")
endif()
file(REMOVE_RECURSE "${CURRENT_PACKAGES_DIR}/debug/include" "${CURRENT_PACKAGES_DIR}/debug/share")
endif()
file(REMOVE "${CURRENT_PACKAGES_DIR}/lib/tclConfig.sh" "${CURRENT_PACKAGES_DIR}/debug/lib/tclConfig.sh")
vcpkg_install_copyright(FILE_LIST "${SOURCE_PATH}/license.terms")