[packaging] Fixup mistake from f7c9be
[mono-project.git] / packaging / Windows / defs / managed-components
blobae98eefdd2e128635e5d84ed8489cafdb41e4703
1 #!/bin/bash -xe
3 REPODIR=$(dirname $(realpath $0))/../repos/managed-components
5 error()
7 echo "$(date "+%F@%T") :: $1" 1>&2
8 exit 1
11 report()
13 echo "$(date "+%F@%T") :: $1"
16 download()
18 mkdir -p ${REPODIR}
19 report "Downloading Xar"
20 wget --quiet -O ${REPODIR}/xar.tar.gz https://storage.googleapis.com/google-code-archive-downloads/v2/code.google.com/xar/xar-1.5.2.tar.gz || error "*** Could not download Xar ***"
21 report "Downloading x64 hostfxr.dll"
22 wget --quiet -O ${REPODIR}/hostfxr-x64.zip https://www.nuget.org/api/v2/package/runtime.win-x64.Microsoft.NETCore.DotNetHostResolver/2.0.0-preview2-25407-01 || error "*** Could not download 64bit hostfxr.dll ***"
23 report "Downloading x86 hostfxr.dll"
24 wget --quiet -O ${REPODIR}/hostfxr-x86.zip https://www.nuget.org/api/v2/package/runtime.win-x86.Microsoft.NETCore.DotNetHostResolver/2.0.0-preview2-25407-01 || error "*** Could not download 64bit hostfxr.dll ***"
25 report "Copying Mono MDK for Mac"
26 cp $1 ${REPODIR}/mono.xar
29 clean()
31 pushd ${REPODIR}
32 report "Deleting interstitial output"
33 rm -rf ${REPODIR}/mono-mac \
34 ${REPODIR}/xar \
35 ${REPODIR}/hostfxr-x64 \
36 ${REPODIR}/hostfxr-x86 \
37 ${REPODIR}/Distribution \
38 ${REPODIR}/mono.pkg \
39 ${REPODIR}/Resources \
40 ${REPODIR}/Library \
41 ${REPODIR}/../../tmp/mono-mac
42 popd
45 build()
47 pushd ${REPODIR}
48 if [ ! -x "${REPODIR}/xar/src/xar" ]
49 then report "Building Xar"
50 mkdir -p xar
51 tar xf xar.tar.gz -C xar/ --strip-components=1
52 pushd xar/
53 ./configure
54 make
55 popd
57 report "Unpacking x64 hostfxr.dll"
58 mkdir -p hostfxr-x64
59 unzip -j "${REPODIR}/hostfxr-x64.zip" "runtimes/win-x64/native/hostfxr.dll" -d "hostfxr-x64"
60 report "Unpacking x86 hostfxr.dll"
61 mkdir -p hostfxr-x86
62 unzip -j "${REPODIR}/hostfxr-x86.zip" "runtimes/win-x86/native/hostfxr.dll" -d "hostfxr-x86"
63 report "Unpacking Mono for Mac"
64 xar/src/xar -x -f mono.xar
65 zcat mono.pkg/Payload | bsdcpio -i
66 mv Library/Frameworks/Mono.framework/Versions/5.* mono-mac
67 popd
70 install()
72 rsync -a --copy-links ${REPODIR}/mono-mac/lib/ironpython ${REPODIR}/../../tmp/mono/lib/
73 rsync -a --copy-links ${REPODIR}/mono-mac/lib/ironruby ${REPODIR}/../../tmp/mono/lib/
74 rsync -a --copy-links ${REPODIR}/mono-mac/lib/xsp ${REPODIR}/../../tmp/mono/lib/
75 rsync -a --copy-links ${REPODIR}/mono-mac/lib/mono/Microsoft* ${REPODIR}/../../tmp/mono/lib/mono/
76 rsync -a --copy-links ${REPODIR}/mono-mac/lib/mono/msbuild ${REPODIR}/../../tmp/mono/lib/mono/
77 rm -f ${REPODIR}/../../tmp/mono/lib/mono/msbuild/15.0/bin/SdkResolvers/Microsoft.DotNet.MSBuildSdkResolver/libhostfxr.dylib
78 if [ "$1" = "x64" ]; then
79 cp ${REPODIR}/hostfxr-x64/hostfxr.dll ${REPODIR}/../../tmp/mono/lib/mono/msbuild/15.0/bin/SdkResolvers/Microsoft.DotNet.MSBuildSdkResolver/
80 else
81 cp ${REPODIR}/hostfxr-x86/hostfxr.dll ${REPODIR}/../../tmp/mono/lib/mono/msbuild/15.0/bin/SdkResolvers/Microsoft.DotNet.MSBuildSdkResolver/
83 rsync -a --copy-links ${REPODIR}/mono-mac/lib/mono/nuget ${REPODIR}/../../tmp/mono/lib/mono/
84 rsync -a --copy-links ${REPODIR}/mono-mac/lib/mono/xbuild-frameworks ${REPODIR}/../../tmp/mono/lib/mono/
85 rsync -a --copy-links ${REPODIR}/mono-mac/lib/mono/xbuild/Microsoft/NuGet/Microsoft.NuGet* ${REPODIR}/../../tmp/mono/lib/mono/xbuild/ # note: we can't copy the symlink in xbuild/ so we copy the file it points to
86 rsync -a --copy-links ${REPODIR}/mono-mac/lib/mono/xbuild/NuGet* ${REPODIR}/../../tmp/mono/lib/mono/xbuild/
87 rsync -a --copy-links ${REPODIR}/mono-mac/lib/mono/xbuild/Newtonsoft.Json* ${REPODIR}/../../tmp/mono/lib/mono/xbuild/
88 rsync -a --copy-links ${REPODIR}/mono-mac/lib/mono/xbuild/15.0 ${REPODIR}/../../tmp/mono/lib/mono/xbuild/
89 rsync -a --copy-links ${REPODIR}/mono-mac/lib/mono/xbuild/Microsoft/Portable/VisualStudio ${REPODIR}/../../tmp/mono/lib/mono/xbuild/Microsoft/Portable/
90 rsync -a --copy-links ${REPODIR}/mono-mac/lib/mono/xbuild/Microsoft/VisualStudio/v/FSharp ${REPODIR}/../../tmp/mono/lib/mono/xbuild/Microsoft/VisualStudio/v/
91 rsync -a --copy-links ${REPODIR}/mono-mac/lib/mono/xbuild/Microsoft/VisualStudio/v11.0/FSharp ${REPODIR}/../../tmp/mono/lib/mono/xbuild/Microsoft/VisualStudio/v11.0/
92 rsync -a --copy-links ${REPODIR}/mono-mac/lib/mono/xbuild/Microsoft/VisualStudio/v12.0/FSharp ${REPODIR}/../../tmp/mono/lib/mono/xbuild/Microsoft/VisualStudio/v12.0/
93 rsync -a --copy-links ${REPODIR}/mono-mac/lib/mono/xbuild/Microsoft/VisualStudio/v14.0/FSharp ${REPODIR}/../../tmp/mono/lib/mono/xbuild/Microsoft/VisualStudio/v14.0/
94 rsync -a --copy-links ${REPODIR}/mono-mac/lib/mono/xbuild/Microsoft/VisualStudio/v15.0/FSharp ${REPODIR}/../../tmp/mono/lib/mono/xbuild/Microsoft/VisualStudio/v15.0/
95 rsync -a --copy-links ${REPODIR}/mono-mac/lib/mono/gac/FSharp.Core/4.4.1.0__b03f5f7f11d50a3a/FSharp* ${REPODIR}/../../tmp/mono/lib/mono/4.5/
96 rsync -a --copy-links ${REPODIR}/mono-mac/lib/mono/gac/nunit*/2.4.8.0__96d09a1eb7f44a77/*.dll* ${REPODIR}/../../tmp/mono/lib/mono/4.5/
97 rsync -a --copy-links ${REPODIR}/mono-mac/lib/mono/4.5/Microsoft.VisualBasic.dll ${REPODIR}/../../tmp/mono/lib/mono/4.5/
98 rsync -a --copy-links ${REPODIR}/mono-mac/lib/mono/4.5/Mono.Cecil.VB* ${REPODIR}/../../tmp/mono/lib/mono/4.5/
99 rsync -a --copy-links ${REPODIR}/mono-mac/lib/mono/4.5/Mono.WebServer2.dll ${REPODIR}/../../tmp/mono/lib/mono/4.5/
100 rsync -a --copy-links ${REPODIR}/mono-mac/lib/mono/4.5/vbnc.* ${REPODIR}/../../tmp/mono/lib/mono/4.5/
101 rsync -a --copy-links ${REPODIR}/mono-mac/lib/mono/4.5/xsp4.exe ${REPODIR}/../../tmp/mono/lib/mono/4.5/
102 rsync -a --copy-links ${REPODIR}/mono-mac/lib/mono/4.5/fastcgi-mono-server4.exe ${REPODIR}/../../tmp/mono/lib/mono/4.5/
103 rsync -a --copy-links ${REPODIR}/mono-mac/lib/mono/4.5/mod-mono-server4.exe ${REPODIR}/../../tmp/mono/lib/mono/4.5/
104 rsync -a --copy-links ${REPODIR}/mono-mac/lib/mono/4.5/mono-fpm.exe ${REPODIR}/../../tmp/mono/lib/mono/4.5/
105 rsync -a --copy-links ${REPODIR}/mono-mac/lib/mono/fsharp ${REPODIR}/../../tmp/mono/lib/mono/
106 rsync -a --copy-links ${REPODIR}/mono-mac/lib/mono/4.0-api/Microsoft.VisualBasic.dll ${REPODIR}/../../tmp/mono/lib/mono/4.0-api/
107 rsync -a --copy-links ${REPODIR}/mono-mac/bin/ir* ${REPODIR}/../../tmp/mono/bin/
108 rsync -a --copy-links ${REPODIR}/mono-mac/bin/ipy* ${REPODIR}/../../tmp/mono/bin/
109 rsync -a --copy-links ${REPODIR}/mono-mac/bin/fsharp* ${REPODIR}/../../tmp/mono/bin/
110 rsync -a --copy-links ${REPODIR}/mono-mac/bin/xsp* ${REPODIR}/../../tmp/mono/bin/
111 rsync -a --copy-links ${REPODIR}/mono-mac/bin/nuget ${REPODIR}/../../tmp/mono/bin/
112 rsync -a --copy-links ${REPODIR}/mono-mac/bin/msbuild ${REPODIR}/../../tmp/mono/bin/
113 sed -i 's#/Library.*mono#../..#' ${REPODIR}/../../tmp/mono/lib/mono/Microsoft\ F\#/v4.*/*
114 sed -i 's#/Library.*mono#../../../../..#' ${REPODIR}/../../tmp/mono/lib/mono/Microsoft\ SDKs/F\#/3.*/Framework/v4.*/*
115 sed -i 's#/Library.*mono#../../../../..#' ${REPODIR}/../../tmp/mono/lib/mono/Microsoft\ SDKs/F\#/4.*/Framework/v4.*/*
116 sed -i 's#/Library.*mono#../../../../..#' ${REPODIR}/../../tmp/mono/lib/mono/xbuild/Microsoft/VisualStudio/v*/FSharp/*
117 rsync -a --copy-links ${REPODIR}/../../tmp/mono/lib/mono/Microsoft\ F\#/v4.0/* ${REPODIR}/../../tmp/mono/lib/mono/Microsoft\ F\#/v4.0/
118 rsync -a --copy-links ${REPODIR}/../../tmp/mono/lib/mono/Microsoft\ SDKs/F\#/3.0/Framework/v4.0/* ${REPODIR}/../../tmp/mono/lib/mono/Microsoft\ SDKs/F\#/3.0/Framework/v4.0/
119 rsync -a --copy-links ${REPODIR}/../../tmp/mono/lib/mono/Microsoft\ SDKs/F\#/3.1/Framework/v4.0/* ${REPODIR}/../../tmp/mono/lib/mono/Microsoft\ SDKs/F\#/3.1/Framework/v4.0/
120 rsync -a --copy-links ${REPODIR}/../../tmp/mono/lib/mono/Microsoft\ SDKs/F\#/4.0/Framework/v4.0/* ${REPODIR}/../../tmp/mono/lib/mono/Microsoft\ SDKs/F\#/4.0/Framework/v4.0/
121 rsync -a --copy-links ${REPODIR}/../../tmp/mono/lib/mono/Microsoft\ SDKs/F\#/4.1/Framework/v4.0/* ${REPODIR}/../../tmp/mono/lib/mono/Microsoft\ SDKs/F\#/4.1/Framework/v4.0/
122 pushd ${REPODIR}/../../tmp/mono/bin
123 rm -f xsp
124 for i in ir ir64 irw irw64 xsp2 xsp4 fsharpc fsharpi fsharpiAnyCpu nuget msbuild ipy ipy64 ipyw ipyw64
125 do echo "Processing $i"
126 sed -i 's#/Library.*mono #\"\$\{BASH_SOURCE%/\*\}\"/mono #' $i
127 sed -i 's#/Library.*cli #\"\$\{BASH_SOURCE%/\*\}\"/cli #' $i
128 if [ -n "$(grep -hoE '[\" ]/Library.*\.(exe|dll)' $i)" ]
129 then EXENAME=$(basename `grep -hoE -m 1 '[\" ]/Library.*\.(exe|dll)' $i | sed 's/^\"//'`)
130 RUNTIME=$(dirname `grep -hoE -m 1 '[\" ]/Library.*\.(exe|dll)' $i` | sed 's/^\"//' | sed 's#/Library.*/[0-9]\+\.[0-9]\+\.[0-9]\+/lib/##' | sed '/^mono\//! s#^#..\\\\#' | sed 's#^mono/##')
131 sed "s#@@RUNTIME@@#${RUNTIME}\\\\#g" ${REPODIR}/../../resources/wrapper.bat > $i.bat
132 sed -i "s#@@COMMAND@@#${EXENAME}#g" $i.bat
133 sed -i 's#/#\\#g' $i.bat
135 sed -i 's#/Library.*/[0-9]\+\.[0-9]\+\.[0-9]\+/lib/#\"\$\(cygpath -w \"\$\{BASH_SOURCE%/\*\}\"/../lib/\)\"#g#' $i
136 sed -i 's#\"\"#\"#g' $i
137 sed -i 's#)\"#)#g' $i
138 sed -i 's#exe #exe\" #' $i
139 sed -i 's#dll #dll\" #' $i
140 sed -i 's#basename \$0#basename \"\$0\"#' $i
141 done
142 cp xsp4 xsp
143 cp xsp4.bat xsp.bat
144 chmod a+x *
145 cd ..
146 for i in lib/mono/4.5/Mono.Cecil.VB*.dll lib/mono/4.5/Microsoft.VisualBasic.dll lib/mono/*/xsp*.exe lib/mono/4.5/fastcgi-mono-server4.exe lib/mono/4.5/mod-mono-server4.exe lib/mono/4.5/mono-fpm.exe lib/mono/*/FSharp*.dll lib/mono/*/Mono.WebServer*.dll ../../repos/managed-components/mono-mac/lib/mono/gac/FSharp.Core/3.*/FSharp.Core.dll ../../repos/managed-components/mono-mac/lib/mono/gac/FSharp.Core/4.*/FSharp.Core.dll
147 do bin/gacutil -i $i
148 done
149 rsync -a --copy-links lib/mono/4.5/FSharp.Core.*data lib/mono/gac/FSharp.Core/4.4.1.0__*/
150 rsync -a --copy-links lib/mono/4.5/FSharp.Core.*data lib/mono/gac/FSharp.Core/4.4.0.0__*/
151 rsync -a --copy-links lib/mono/4.5/FSharp.Core.*data lib/mono/gac/FSharp.Core/4.3.1.0__*/
152 rsync -a --copy-links lib/mono/4.5/FSharp.Core.*data lib/mono/gac/FSharp.Core/4.3.0.0__*/
154 # make sure we didn't miss any files with Mac paths
155 if grep -R 'Mono\.framework' . --exclude=xbuild.1 --exclude=MSBuild.dll.config; then
156 echo "Found Mac paths in files, please make sure they're fixed."
157 exit 1
160 popd
163 prerequisites()
165 which bsdcpio 2>/dev/null || error "*** bsdcpio is not in \$PATH ***"
166 which wget 2>/dev/null || error "*** wget is not in \$PATH ***"
167 which xml2-config 2>/dev/null || error "*** xml2-config is not in \$PATH ***"
168 which unzip 2>/dev/null || error "*** unzip is not in \$PATH ***"
169 if [ ! -e "/usr/include/openssl/crypto.h" ]
170 then error "*** openssl-devel is not installed ***"