Skip to content

Commit

Permalink
(wip) closing in on that wraith of an OS
Browse files Browse the repository at this point in the history
  • Loading branch information
MementoRC committed Feb 1, 2025
1 parent a663b6e commit 4d819f2
Show file tree
Hide file tree
Showing 10 changed files with 37 additions and 69 deletions.
18 changes: 11 additions & 7 deletions recipes/renode-cli/build.bat
Original file line number Diff line number Diff line change
Expand Up @@ -8,13 +8,17 @@ set "install_prefix=%PREFIX%\opt\%PKG_NAME%"
set "framework_version=8.0"

rem Patch the project files to use the correct .NET version
find lib src tests -name "*.csproj" -exec sed -i -E \
-e "s/([>;])net6.0([<;])/\1net${framework_version}\2/" \
-e "s|^((\s+)<PropertyGroup>)|\1\n\2\2<NoWarn>CS0168;CS0219;CS8981;SYSLIB0050;SYSLIB0051</NoWarn>|" \
-e 's|^(\s+)<(Package)?Reference\s+Include="Mono.Posix".*\n||g' \
{} \;
find . -type d -name "obj" -exec rm -rf {} +
find . -type d -name "bin" -exec rm -rf {} +
:: for /f "delims=" %%i in ('find lib src tests -name "*.csproj"') do (
:: sed -i -E "s/([>;])net6.0([<;])/\1net${framework_version}\2/" "%%i"
:: sed -i -E "s|^((\s+)<PropertyGroup>)|\1\n\2\2<NoWarn>CS0168;CS0219;CS8981;SYSLIB0050;SYSLIB0051</NoWarn>|" "%%i"
:: )
:: %BUILD_PREFIX%\Library\usr\bin\find.exe lib src tests -name "*.csproj" -exec sed -i -E ^
:: -e "s/([>;])net6.0([<;])/\1net${framework_version}\2/" ^
:: -e "s|^((\s+)<PropertyGroup>)|\1\n\2\2<NoWarn>CS0168;CS0219;CS8981;SYSLIB0050;SYSLIB0051</NoWarn>|" ^
:: -e 's|^(\s+)<(Package)?Reference\s+Include="Mono.Posix".*\n||g' ^
:: {} \;
:: %BUILD_PREFIX%\Library\usr\bin\find.exe . -type d -name "obj" -exec rm -rf {} \;
:: %BUILD_PREFIX%\Library\usr\bin\find.exe . -type d -name "bin" -exec rm -rf {} \;
sed -i -E "s/(ReleaseHeadless\|Any .+ = )Debug/\1Release/" Renode_NET.sln

rem Prevent CMake build since we provide the binaries
Expand Down
22 changes: 10 additions & 12 deletions recipes/renode-cli/helpers/renode_build_with_dotnet.ps1
Original file line number Diff line number Diff line change
@@ -1,10 +1,8 @@
#!/usr/bin/env pwsh

param (
[string]$framework_version
)

$OUTPUT_DIRECTORY = "${env:SRC_DIR}/output"
$OUTPUT_DIRECTORY = "${env:SRC_DIR}\output"
$CONFIGURATION = "Release"
$BUILD_PLATFORM = "Any CPU"
$HEADLESS = $true
Expand Down Expand Up @@ -39,24 +37,24 @@ $DirectoryBuildTargetsContent = @"
</Project>
"@

$DirectoryBuildTargetsPath = "${env:SRC_DIR}/Directory.Build.targets"
$DirectoryBuildTargetsPath = "${env:SRC_DIR}\Directory.Build.targets"
Set-Content -Path $DirectoryBuildTargetsPath -Value $DirectoryBuildTargetsContent

$env:DOTNET_CLI_TELEMETRY_OPTOUT = 1
$CS_COMPILER = "dotnet build"
$TARGET = "${env:SRC_DIR}/Renode_NET.sln"
$TARGET = "${env:SRC_DIR}\Renode_NET.sln"
$BUILD_TYPE = "dotnet"

$OUT_BIN_DIR = "${env:SRC_DIR}/output/bin/$CONFIGURATION"
$BUILD_TYPE_FILE = "$OUT_BIN_DIR/build_type"
$OUT_BIN_DIR = "${env:SRC_DIR}\output\bin\$CONFIGURATION"
$BUILD_TYPE_FILE = "$OUT_BIN_DIR\build_type"

# Copy properties file according to the running OS
New-Item -ItemType Directory -Force -Path $OUTPUT_DIRECTORY
Remove-Item -Force -Path "$OUTPUT_DIRECTORY/properties.csproj"
$PROP_FILE = "${env:CURRENT_PATH:=.}/src/Infrastructure/src/Emulator/Cores/linux-properties.csproj"
Copy-Item -Path $PROP_FILE -Destination "$OUTPUT_DIRECTORY/properties.csproj"
# Remove-Item -Force -Path "$OUTPUT_DIRECTORY\properties.csproj"
$PROP_FILE = "${env:SRC_DIR}\src\Infrastructure\src\Emulator\Cores\windows-properties_NET.csproj"
Copy-Item -Path $PROP_FILE -Destination "$OUTPUT_DIRECTORY\properties.csproj"

$CORES_PATH = "${env:SRC_DIR}/src/Infrastructure/src/Emulator/Cores"
$CORES_PATH = "${env:SRC_DIR}\src\Infrastructure\src\Emulator\Cores"

$PARAMS += "p:Configuration=${CONFIGURATION}${BUILD_TARGET}"
$PARAMS += "p:GenerateFullPaths=true"
Expand All @@ -80,4 +78,4 @@ Set-Content -Path $BUILD_TYPE_FILE -Value $BUILD_TYPE
# copy llvm library
$LLVM_LIB = "libllvm-disas"
$LIB_EXT = "dll"
Copy-Item -Path "lib/resources/llvm/$LLVM_LIB.$LIB_EXT" -Destination "$OUT_BIN_DIR/libllvm-disas.$LIB_EXT"
Copy-Item -Path "lib\resources\llvm\$LLVM_LIB.$LIB_EXT" -Destination "$OUT_BIN_DIR\libllvm-disas.$LIB_EXT"
6 changes: 3 additions & 3 deletions recipes/renode-cli/recipe.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -11,11 +11,11 @@ source:
- url: https://github.com/renode/renode/releases/download/v${{ version }}/renode_${{ version }}_source.tar.xz
sha256: 40c50afe8db86a9c63f4a86b93116a6babd43bf241cfaac47b2c0d2cbc2b15a8
patches:
- patches/update-IronPython-Renode_NET.csproj.patch
- patches/update-cores.template_NET.csproj.patch
- patches/update-IronPython-Unittest_NET.csproj.patch
- if: unix
then:
- patches/update-IronPython-Renode_NET.csproj.patch
- patches/update-cores.template_NET.csproj.patch
- patches/update-IronPython-Unittest_NET.csproj.patch
- patches/resolve-posix-unix.patch

build:
Expand Down
14 changes: 7 additions & 7 deletions recipes/renode-cores/build.bat
Original file line number Diff line number Diff line change
Expand Up @@ -37,12 +37,12 @@ icacls "%PREFIX%\Library\lib\%PKG_NAME%" /grant Users:(OI)(CI)F /T
robocopy "%CORES_BIN_PATH%\lib" "%PREFIX%\Library\lib\%PKG_NAME%" /E /COPY:DATSO

:: Setting conda host environment variables
if not exist "%PREFIX%\etc\conda\activate.d\" mkdir "%PREFIX%\etc\conda\activate.d\"
if not exist "%PREFIX%\etc\conda\deactivate.d\" mkdir "%PREFIX%\etc\conda\deactivate.d\"

copy "%RECIPE_DIR%\scripts\activate.bat" "%PREFIX%\etc\conda\activate.d\%PKG_NAME%-activate.bat" > nul
if %ERRORLEVEL% neq 0 exit /b %ERRORLEVEL%
copy "%RECIPE_DIR%\scripts\deactivate.bat" "%PREFIX%\etc\conda\deactivate.d\%PKG_NAME%-deactivate.bat" > nul
if %ERRORLEVEL% neq 0 exit /b %ERRORLEVEL%
:: if not exist "%PREFIX%\etc\conda\activate.d\" mkdir "%PREFIX%\etc\conda\activate.d\"
:: if not exist "%PREFIX%\etc\conda\deactivate.d\" mkdir "%PREFIX%\etc\conda\deactivate.d\"
::
:: copy "%RECIPE_DIR%\scripts\activate.bat" "%PREFIX%\etc\conda\activate.d\%PKG_NAME%-activate.bat" > nul
:: if %ERRORLEVEL% neq 0 exit /b %ERRORLEVEL%
:: copy "%RECIPE_DIR%\scripts\deactivate.bat" "%PREFIX%\etc\conda\deactivate.d\%PKG_NAME%-deactivate.bat" > nul
:: if %ERRORLEVEL% neq 0 exit /b %ERRORLEVEL%

endlocal
10 changes: 5 additions & 5 deletions recipes/renode-cores/build.sh
Original file line number Diff line number Diff line change
Expand Up @@ -24,8 +24,8 @@ tar -c -C "${CORES_BIN_PATH}/lib" . | tar -x -C "${PREFIX}/lib/${PKG_NAME}"

# Copy the [de]activate scripts to $PREFIX/etc/conda/[de]activate.d.
# This will allow them to be run on environment activation.
for CHANGE in "activate" "deactivate"
do
mkdir -p "${PREFIX}/etc/conda/${CHANGE}.d"
cp "${RECIPE_DIR}/scripts/${CHANGE}.sh" "${PREFIX}/etc/conda/${CHANGE}.d/${PKG_NAME}-${CHANGE}.sh"
done
# for CHANGE in "activate" "deactivate"
# do
# mkdir -p "${PREFIX}/etc/conda/${CHANGE}.d"
# cp "${RECIPE_DIR}/scripts/${CHANGE}.sh" "${PREFIX}/etc/conda/${CHANGE}.d/${PKG_NAME}-${CHANGE}.sh"
# done
8 changes: 1 addition & 7 deletions recipes/renode-cores/recipe.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -64,13 +64,7 @@ tests:
- ${{ "Library/" if not unix }}lib/renode-cores/translate-sparc-le.so
- ${{ "Library/" if not unix }}lib/renode-cores/translate-x86_64-le.so
- ${{ "Library/" if not unix }}lib/renode-cores/translate-xtensa-le.so
- if: unix
then:
- etc/conda/activate.d/renode-cores-activate.sh
- etc/conda/deactivate.d/renode-cores-deactivate.sh
else:
- etc/conda/activate.d/renode-cores-activate.bat
- etc/conda/deactivate.d/renode-cores-deactivate.bat

about:
homepage: https://github.com/renode/renode
summary: "Antmicro's open source simulation and virtual development framework for complex embedded systems"
Expand Down
8 changes: 0 additions & 8 deletions recipes/renode-cores/scripts/activate.bat

This file was deleted.

4 changes: 0 additions & 4 deletions recipes/renode-cores/scripts/activate.sh

This file was deleted.

8 changes: 0 additions & 8 deletions recipes/renode-cores/scripts/deactivate.bat

This file was deleted.

8 changes: 0 additions & 8 deletions recipes/renode-cores/scripts/deactivate.sh

This file was deleted.

0 comments on commit 4d819f2

Please sign in to comment.