-
Notifications
You must be signed in to change notification settings - Fork 0
/
Dockerfile
116 lines (100 loc) · 3.84 KB
/
Dockerfile
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
ARG WINE_VER
FROM wine:$WINE_VER
USER root
# clang-cl shims
RUN mkdir /etc/vcclang && \
touch /etc/vcclang/vcvars32 && \
touch /etc/vcclang/vcvars64
ADD dockertools/clang-cl /usr/local/bin/clang-cl
ADD dockertools/lld-link /usr/local/bin/lld-link
RUN clang-cl --version
RUN lld-link --version
# vcwine
RUN mkdir /etc/vcwine && \
touch /etc/vcwine/vcvars32 && \
touch /etc/vcwine/vcvars64
ADD dockertools/vcwine /usr/local/bin/vcwine
# bring over the msvc snapshots
ARG MSVC
ENV MSVC=$MSVC
ADD --chown=wine:wine build/msvc$MSVC/snapshots snapshots
USER wine
RUN ls -la $HOME
RUN ls -la $HOME/snapshots/*
# import the msvc snapshot files
RUN umask $WINE_UMASK && \
cd $WINEPREFIX/drive_c && \
unzip -n $HOME/snapshots/CMP/files.zip
RUN umask $WINE_UMASK && \
cd $WINEPREFIX/drive_c && mkdir -p Windows && \
cd $WINEPREFIX/drive_c/Windows && mkdir -p INF System32 SysWOW64 WinSxS && \
mv INF inf && \
mv System32 system32 && \
mv SysWOW64 syswow64 && \
mv WinSxS winsxs && \
cd $WINEPREFIX/drive_c && \
cp -R $WINEPREFIX/drive_c/Windows/* $WINEPREFIX/drive_c/windows && \
rm -rf $WINEPREFIX/drive_c/Windows
# import msvc environment snapshot
USER root
ADD --chown=wine:wine dockertools/diffenv diffenv
ADD --chown=wine:wine dockertools/make-vcclang-vars make-vcclang-vars
RUN ./diffenv $PWD/snapshots/SNAPSHOT-01/env.txt $PWD/snapshots/SNAPSHOT-02/vcvars32.txt /etc/vcwine/vcvars32 && \
./make-vcclang-vars /etc/vcwine/vcvars32 /etc/vcclang/vcvars32
RUN ./diffenv $PWD/snapshots/SNAPSHOT-01/env.txt $PWD/snapshots/SNAPSHOT-02/vcvars64.txt /etc/vcwine/vcvars64 && \
./make-vcclang-vars /etc/vcwine/vcvars64 /etc/vcclang/vcvars64
RUN rm diffenv make-vcclang-vars
USER wine
# clean up
RUN rm -rf $HOME/snapshots
# 64-bit linking has trouble finding cvtres, so help it out
RUN umask $WINE_UMASK && \
find $WINEPREFIX -iname x86_amd64 | xargs -Ifile cp "file/../cvtres.exe" "file"
# workaround bugs in wine's cmd that prevents msvc setup bat files from working
ADD --chown=wine:wine dockertools/hackvcvars hackvcvars
RUN umask $WINE_UMASK && \
find $WINEPREFIX/drive_c -iname v[cs]\*.bat | xargs -Ifile $HOME/hackvcvars "file" && \
find $WINEPREFIX/drive_c -iname win\*.bat | xargs -Ifile $HOME/hackvcvars "file" && \
rm hackvcvars
USER root
RUN apt-get -y update && apt-get -y install rename
USER wine
# fix inconsistent casing in msvc filenames
RUN umask $WINE_UMASK && \
find $WINEPREFIX -name Include -execdir mv Include include \; || \
find $WINEPREFIX -name Lib -execdir mv Lib lib \; || \
find $WINEPREFIX -name \*.Lib -execdir rename 'y/A-Z/a-z/' {} \; || \
find $WINEPREFIX -name \*.Lib -exec rename 'y/A-Z/a-z/' {} \; || \
find $WINEPREFIX -iname vctip.exe -exec rm {} \;
# make sure we can compile with MSVC
ADD --chown=wine:wine test test
RUN umask $WINE_UMASK && \
cd test && \
MSVCARCH=32 vcwine cl helloworld.cpp && vcwine helloworld.exe && \
MSVCARCH=64 vcwine cl helloworld.cpp && vcwine helloworld.exe && \
vcwine cl helloworld.cpp && vcwine helloworld.exe && \
cd .. && rm -rf test
# get _MSC_VER for use with clang-cl
ADD --chown=wine:wine dockertools/msc_ver.cpp msc_ver.cpp
RUN umask $WINE_UMASK && \
vcwine cl msc_ver.cpp && \
echo -n "MSC_VER=`vcwine msc_ver.exe`" > msc_ver.txt
USER root
RUN cat msc_ver.txt >> /etc/vcclang/vcvars32 && \
cat msc_ver.txt >> /etc/vcclang/vcvars64 && \
rm msc_ver.*
USER wine
# make sure we can compile with clang-cl
ADD --chown=wine:wine test test
RUN umask $WINE_UMASK && \
cd test && \
if [ "$MSVC" -gt "10" ] ; then clang-cl helloworld.cpp && vcwine helloworld.exe ; fi && \
cd .. && rm -rf test
# reboot for luck
RUN umask $WINE_UMASK && winetricks win10
RUN umask $WINE_UMASK && wineboot -r
# entrypoint
ENV MSVCARCH=64
ADD dockertools/vcentrypoint /usr/local/bin/vcentrypoint
USER root
ENTRYPOINT []