-
Notifications
You must be signed in to change notification settings - Fork 2
/
Copy pathpackage-release.sh
executable file
·239 lines (178 loc) · 6.27 KB
/
package-release.sh
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
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
#!/bin/bash
set -e
shopt -s extglob
if [ -z "$1" ] || [ -z "$2" ]; then
echo "Usage: $0 release destdir"
exit 1
fi
git submodule update --init --recursive
VERSION="$1"
NVLIBS_SRC_DIR=$(dirname "$(readlink -f "$0")")
NVLIBS_BUILD_DIR=$(realpath "$2")"/nvidia-libs-$VERSION"
if [ -e "$NVLIBS_BUILD_DIR" ]; then
echo "Build directory $NVLIBS_BUILD_DIR already exists"
exit 1
fi
# Make version file
meson --prefix "$NVLIBS_BUILD_DIR" \
--strip \
"$NVLIBS_BUILD_DIR/build"
cd "$NVLIBS_BUILD_DIR/build"
ninja
cp "$NVLIBS_BUILD_DIR/build/version" "$NVLIBS_BUILD_DIR/version"
rm -R "$NVLIBS_BUILD_DIR/build"
# Build NVCUDA
NVCUDA_SRC_DIR=$NVLIBS_SRC_DIR"/nvcuda"
function build_arch {
cd "$NVCUDA_SRC_DIR"
meson --cross-file "$NVCUDA_SRC_DIR/build-wine$1.txt" \
--buildtype release \
--prefix "$NVLIBS_BUILD_DIR" \
--libdir "x$1" \
--strip \
"$NVLIBS_BUILD_DIR/build.$1"
cd "$NVLIBS_BUILD_DIR/build.$1"
ninja install
rm -R "$NVLIBS_BUILD_DIR/build.$1"
}
build_arch 64
build_arch 32
# Build NVENC
NVENC_SRC_DIR=$NVLIBS_SRC_DIR"/nvenc"
function build_arch {
cd "$NVENC_SRC_DIR"
meson --cross-file "$NVENC_SRC_DIR/build-wine$1.txt" \
--buildtype release \
--prefix "$NVLIBS_BUILD_DIR" \
--libdir "x$1" \
--strip \
"$NVLIBS_BUILD_DIR/build.$1"
cd "$NVLIBS_BUILD_DIR/build.$1"
ninja install
rm -R "$NVLIBS_BUILD_DIR/build.$1"
}
build_arch 64
build_arch 32
# Build wine-nvoptix
NVOPTIX_SRC_DIR=$NVLIBS_SRC_DIR"/wine-nvoptix"
cd $NVOPTIX_SRC_DIR
meson --cross-file "$NVOPTIX_SRC_DIR/build-wine64.txt" \
--buildtype release \
--prefix "$NVLIBS_BUILD_DIR" \
--libdir x64 \
--strip \
"$NVLIBS_BUILD_DIR/build"
cd "$NVLIBS_BUILD_DIR/build"
ninja install
rm -R "$NVLIBS_BUILD_DIR/build"
# Build nvofapi-relay
NVOFAPI_SRC_DIR=$NVLIBS_SRC_DIR"/nvofapi-relay"
cd $NVOFAPI_SRC_DIR
meson --cross-file "$NVOFAPI_SRC_DIR/build-wine64.txt" \
--buildtype release \
--prefix "$NVLIBS_BUILD_DIR" \
--libdir "x64" \
--strip \
"$NVLIBS_BUILD_DIR/build"
cd "$NVLIBS_BUILD_DIR/build"
ninja install
rm -R "$NVLIBS_BUILD_DIR/build"
# Build wine-nvml
NVML_SRC_DIR=$NVLIBS_SRC_DIR"/wine-nvml"
cd $NVML_SRC_DIR"/src"
./make_nvml
function build_arch {
cd $NVML_SRC_DIR
meson --cross-file "$NVML_SRC_DIR/cross-mingw$1.txt" \
--buildtype release \
--prefix "$NVLIBS_BUILD_DIR" \
--libdir "x$1" \
--strip \
"$NVLIBS_BUILD_DIR/build.mingw$1"
cd "$NVLIBS_BUILD_DIR/build.mingw$1"
ninja install
cd $NVML_SRC_DIR
meson --cross-file "$NVML_SRC_DIR/cross-wine$1.txt" \
--buildtype release \
--prefix "$NVLIBS_BUILD_DIR" \
--libdir "x$1" \
--strip \
"$NVLIBS_BUILD_DIR/build.wine$1"
cd "$NVLIBS_BUILD_DIR/build.wine$1"
ninja install
rm -R "$NVLIBS_BUILD_DIR/build.mingw$1"
rm -R "$NVLIBS_BUILD_DIR/build.wine$1"
}
build_arch 64
# Build dxvk-nvapi
NVAPI_SRC_DIR=$NVLIBS_SRC_DIR"/dxvk-nvapi"
crossfile="build-win"
cd $NVAPI_SRC_DIR
function prepare {
python3 validate-methods.py \
src/nvapi.cpp \
src/nvapi_sys.cpp \
src/nvapi_disp.cpp \
src/nvapi_mosaic.cpp \
src/nvapi_drs.cpp \
src/nvapi_gpu.cpp \
src/nvapi_d3d.cpp \
src/nvapi_d3d11.cpp \
src/nvapi_d3d12.cpp \
src/nvapi_vulkan.cpp \
src/nvapi_interface.cpp \
src/nvapi_interface_private.h \
external/nvapi/nvapi_interface.h
# remove existing version.h, because otherwise the existing one gets into the build instead of the generated one
if [ -e version.h ]; then
rm version.h
fi
}
function build_arch {
cd "$NVAPI_SRC_DIR"
meson --cross-file "$NVAPI_SRC_DIR/$crossfile$1.txt" \
--buildtype release \
--prefix "$NVLIBS_BUILD_DIR" \
--strip \
--bindir "x$1" \
--libdir "x$1" \
-Denable_tests=true \
"$NVLIBS_BUILD_DIR/build.$1"
cd "$NVLIBS_BUILD_DIR/build.$1"
ninja install
cp version.h "$NVAPI_SRC_DIR"
rm -R "$NVLIBS_BUILD_DIR/build.$1"
}
prepare
build_arch 64
build_arch 32
# Build Vulkan reflax layer
cd "$NVAPI_SRC_DIR"
rm -f "$NVAPI_SRC_DIR"/layer/{version,config}.h
meson setup \
--buildtype "release" \
--prefix "$NVLIBS_BUILD_DIR/layer" \
--libdir '' \
--strip \
-Dabsolute_library_path=false \
-Dlibrary_path_prefix=./ \
-Dmanifest_install_dir=. \
"$NVLIBS_BUILD_DIR/build.layer" \
"$NVAPI_SRC_DIR/layer"
cd "$NVLIBS_BUILD_DIR/build.layer"
ninja install
cp "$NVLIBS_BUILD_DIR"/build.layer/{version,config}.h "$NVAPI_SRC_DIR/layer"
rm -R "$NVLIBS_BUILD_DIR/build.layer"
# Copy installscripts and README
cp $NVLIBS_SRC_DIR/*.sh "$NVLIBS_BUILD_DIR/"
rm $NVLIBS_BUILD_DIR/package-release.sh
chmod +x $NVLIBS_BUILD_DIR/*.sh
cp "$NVLIBS_SRC_DIR/Readme_nvml.txt" "$NVLIBS_BUILD_DIR/Readme_nvml.txt"
cp "$NVLIBS_SRC_DIR/README.md" "$NVLIBS_BUILD_DIR/README.md"
# Move test
mkdir -p "$NVLIBS_BUILD_DIR/bin" && mv "$NVLIBS_BUILD_DIR/x64/nvapi64-tests.exe" "$NVLIBS_BUILD_DIR/bin/"
# cleanup
cd $NVLIBS_BUILD_DIR
find . -name \*.a -type f -delete
find . -name "*.dll.so" -type f -exec bash -c 'mv "$0" "${0%.so}"' {} \;
echo "Done building!"