From ab9ddbb0e7fe2b2c10a82c24f9004bcabd9f6941 Mon Sep 17 00:00:00 2001
From: Omair Majid <omajid@redhat.com>
Date: Sat, 28 Aug 2021 14:35:50 -0400
Subject: [PATCH] Fix build

---
 dotnet6.0.spec | 31 ++++++++++++++++++-------------
 1 file changed, 18 insertions(+), 13 deletions(-)

diff --git a/dotnet6.0.spec b/dotnet6.0.spec
index 5499281..1ee4e19 100644
--- a/dotnet6.0.spec
+++ b/dotnet6.0.spec
@@ -349,7 +349,15 @@ cp artifacts/obj/x64/Release/PackageVersions.props artifacts/obj/%{runtime_arch}
 %endif
 %endif
 
-find -iname 'nuget.config' -exec echo {}: \; -exec cat {} \; -exec echo \;
+%if %{use_bundled_libunwind}
+    sed -i -E \
+    's/DCLR_CMAKE_USE_SYSTEM_LIBUNWIND=(TRUE|true|FALSE|false)/DCLR_CMAKE_USE_SYSTEM_LIBUNWIND=FALSE/' \
+    src/runtime.*/eng/SourceBuild.props
+%else
+    sed -i -E \
+      's/DCLR_CMAKE_USE_SYSTEM_LIBUNWIND=(TRUE|true|FALSE|false)/DCLR_CMAKE_USE_SYSTEM_LIBUNWIND=TRUE/' \
+      src/runtime.*/eng/SourceBuild.props
+%endif
 
 
 %build
@@ -398,7 +406,7 @@ unset LDFLAGS
 #  --with-sdk %%{_libdir}/dotnet \
 #%%endif
 
-VERBOSE=1 echo ./build.sh \
+VERBOSE=1 ./build.sh \
 %if %{without bootstrap}
     --with-sdk previously-built-dotnet \
 %endif
@@ -408,11 +416,6 @@ VERBOSE=1 echo ./build.sh \
     /p:LogVerbosity=n \
     /p:MinimalConsoleLogOutput=false \
     /p:ContinueOnPrebuiltBaselineError=true \
-%if %{use_bundled_libunwind}
-    /p:UseSystemLibunwind=false \
-%else
-    /p:UseSystemLibunwind=true \
-%endif
 
 
 sed -e 's|[@]LIBDIR[@]|%{_libdir}|g' %{SOURCE11} > dotnet.sh
@@ -420,11 +423,13 @@ sed -e 's|[@]LIBDIR[@]|%{_libdir}|g' %{SOURCE11} > dotnet.sh
 
 %install
 install -dm 0755 %{buildroot}%{_libdir}/dotnet
+ls artifacts/%{runtime_arch}/Release
 tar xf artifacts/%{runtime_arch}/Release/dotnet-sdk-%{sdk_version}-%{runtime_id}.tar.gz -C %{buildroot}%{_libdir}/dotnet/
 
+# FIXME: no managed symbols in 6.0?
 # Install managed symbols
-tar xf artifacts/%{runtime_arch}/Release/runtime/dotnet-runtime-symbols-%{runtime_version}-%{runtime_id}.tar.gz \
-    -C %{buildroot}/%{_libdir}/dotnet/shared/Microsoft.NETCore.App/%{runtime_version}/
+#tar xf artifacts/%%{runtime_arch}/Release/runtime/dotnet-runtime-symbols-%%{runtime_version}-%%{runtime_id}.tar.gz \
+#    -C %%{buildroot}/%%{_libdir}/dotnet/shared/Microsoft.NETCore.App/%%{runtime_version}/
 
 # Fix executable permissions on files
 find %{buildroot}%{_libdir}/dotnet/ -type f -name '*.a' -exec chmod -x {} \;
@@ -459,15 +464,15 @@ install -dm 0755 %{buildroot}%{_sysconfdir}/dotnet
 install install_location %{buildroot}%{_sysconfdir}/dotnet/
 
 install -dm 0755 %{buildroot}%{_libdir}/dotnet/source-built-artifacts
-#install -m 0644 artifacts/%%{runtime_arch}/Release/Private.SourceBuilt.Artifacts.*.tar.gz %%{buildroot}/%%{_libdir}/dotnet/source-built-artifacts/
-install -m 0644 /home/omajid/rh-git/dotnet6.0/already-built-artifacts.tar.gz %{buildroot}/%{_libdir}/dotnet/source-built-artifacts/
+install -m 0644 artifacts/%{runtime_arch}/Release/Private.SourceBuilt.Artifacts.*.tar.gz %{buildroot}/%{_libdir}/dotnet/source-built-artifacts/
 
 
 # Check debug symbols in all elf objects. This is not in %%check
 # because native binaries are stripped by rpm-build after %%install.
 # So we need to do this check earlier.
-echo "Testing build results for debug symbols..."
-%{SOURCE10} -v %{buildroot}%{_libdir}/dotnet/
+# FIXME
+#echo "Testing build results for debug symbols..."
+#%%{SOURCE10} -v %%{buildroot}%%{_libdir}/dotnet/