From 57c089d8784a6eacf56fdc9aea42c11bd345dfc3 Mon Sep 17 00:00:00 2001 From: Kiirx Date: Sun, 14 Jan 2024 11:56:31 +0100 Subject: [PATCH 1/3] =?UTF-8?q?=F0=9F=A9=B9=20MakeFile=20various=20tweaks?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- Makefile | 47 ++++++++++++++++++++++++++++------------------- 1 file changed, 28 insertions(+), 19 deletions(-) diff --git a/Makefile b/Makefile index 33436bee2c..78414b0cd7 100644 --- a/Makefile +++ b/Makefile @@ -17,38 +17,47 @@ GIT = git DOTNET = dotnet GITFLAGS = clone --depth=1 -DOTNETFLAGS = -v:q -nologo +DOTNETFLAGS = -nologo -v:q -c:Debug + +GREEN = \033[0;32m +YELLOW = \033[1;33m +DEFAULT = \033[0m .PHONY: all all: $(IL2CPU_DIR) $(XSHARP_DIR) $(COMMON_DIR) + @# Elapsed time is stored in a temporary file, deleted post-install. + @date +%s > _time_$@.txt @$(MAKE) build @$(MAKE) publish @sudo $(MAKE) install @$(MAKE) nuget-install - @echo "============================================" - @echo "| Cosmos has been installed successfully! |" - @echo "============================================" + @printf "============================================\n" + @printf "| ${YELLOW}Cosmos${DEFAULT} has been installed successfully! |\n" + @printf "============================================\n" + @printf "Took ${YELLOW}$$(($$(date +%s)-$$(cat _time_$@.txt)))s${DEFAULT} to build\n" + @rm _time_$@.txt $(IL2CPU_DIR): - @echo "Cloning Cosmos/IL2CPU" - @$(GIT) $(GITFLAGS) --branch=$(IL2CPU_BRANCH) $(IL2CPU_URL) $(THISDIR)/../IL2CPU + @printf "Cloning ${GREEN}Cosmos/IL2CPU${DEFAULT}\n" + @$(GIT) $(GITFLAGS) --branch=$(IL2CPU_BRANCH) $(IL2CPU_URL) $(IL2CPU_DIR) $(XSHARP_DIR): - @echo "Cloning Cosmos/XSharp" - @$(GIT) $(GITFLAGS) --branch=$(XSHARP_BRANCH) $(XSHARP_URL) $(THISDIR)/../XSharp + @printf "Cloning ${GREEN}Cosmos/XSharp${DEFAULT}\n" + @$(GIT) $(GITFLAGS) --branch=$(XSHARP_BRANCH) $(XSHARP_URL) $(XSHARP_DIR) $(COMMON_DIR): - @echo "Cloning Cosmos/Common" - @$(GIT) $(GITFLAGS) --branch=$(COMMON_BRANCH) $(COMMON_URL) $(THISDIR)/../Common + @printf "Cloning ${GREEN}Cosmos/Common${DEFAULT}\n" + @$(GIT) $(GITFLAGS) --branch=$(COMMON_BRANCH) $(COMMON_URL) $(COMMON_DIR) + .PHONY: build build: - @echo "Building IL2CPU" + @printf "Building ${GREEN}IL2CPU${DEFAULT}\n" @$(DOTNET) clean $(IL2CPU_DIR) @$(DOTNET) build $(IL2CPU_DIR) $(DOTNETFLAGS) @$(DOTNET) pack $(IL2CPU_DIR) $(DOTNETFLAGS) - @echo "Building Cosmos" + @printf "Building ${GREEN}Cosmos${DEFAULT}\n" @$(DOTNET) clean $(THISDIR)/source/Cosmos.Common @$(DOTNET) clean $(THISDIR)/source/Cosmos.Debug.Kernel @@ -74,7 +83,7 @@ build: @$(DOTNET) pack $(THISDIR)/source/Cosmos.Build.Tasks $(DOTNETFLAGS) @$(DOTNET) pack $(THISDIR)/source/Cosmos.Plugs $(DOTNETFLAGS) - @echo "Building X#" + @printf "Building ${GREEN}X#${DEFAULT}\n" @$(DOTNET) clean $(XSHARP_DIR)/source/XSharp/XSharp @$(DOTNET) clean $(XSHARP_DIR)/source/Spruce @@ -84,23 +93,23 @@ build: .PHONY: publish publish: - @echo "Publishing IL2CPU" + @printf "Publishing ${GREEN}IL2CPU${DEFAULT}\n" $(DOTNET) publish $(IL2CPU_DIR)/source/IL2CPU -r linux-x64 --self-contained $(DOTNETFLAGS) - @echo "Publishing Cosmos" + @printf "Publishing ${GREEN}Cosmos${DEFAULT}\n" @$(DOTNET) publish $(THISDIR)/source/Cosmos.Core_Plugs $(DOTNETFLAGS) @$(DOTNET) publish $(THISDIR)/source/Cosmos.Debug.Kernel.Plugs.Asm $(DOTNETFLAGS) @$(DOTNET) publish $(THISDIR)/source/Cosmos.HAL2 $(DOTNETFLAGS) @$(DOTNET) publish $(THISDIR)/source/Cosmos.System2_Plugs $(DOTNETFLAGS) @$(DOTNET) publish $(THISDIR)/source/Cosmos.Plugs $(DOTNETFLAGS) - @echo "Publishing X#" + @printf "Publishing ${GREEN}X#${DEFAULT}\n" @$(DOTNET) publish $(XSHARP_DIR)/source/XSharp/XSharp $(DOTNETFLAGS) @$(DOTNET) publish $(XSHARP_DIR)/source/Spruce $(DOTNETFLAGS) .PHONY: install install: - @echo "Installing to" $(DESTDIR) + @printf "Installing to ${YELLOW}$(DESTDIR)${DEFAULT}\n" @mkdir -p $(DESTDIR)/Cosmos @mkdir -p $(DESTDIR)/XSharp/DebugStub @mkdir -p $(DESTDIR)/Build/ISO @@ -126,11 +135,11 @@ install: @cp -r $(THISDIR)/Build/HyperV/*.vhdx $(DESTDIR)/Build/HyperV/ @cp -r $(THISDIR)/Build/VMWare/Workstation/* $(DESTDIR)/Build/VMware/Workstation/ @cp -r $(THISDIR)/Build/syslinux/* $(DESTDIR)/Build/ISO/ - @echo $(DESTDIR) > /etc/CosmosUserKit.cfg + @printf $(DESTDIR) > /etc/CosmosUserKit.cfg .PHONY: nuget-install nuget-install: - @echo "Installing Nuget packages" + @printf "Installing ${GREEN}Nuget packages${DEFAULT}\n" @rm -r -f ~/.nuget/packages/cosmos.*/ @rm -r -f ~/.nuget/packages/il2cpu.*/ From ec0644cca5b132192945855ad277bde7153dcb4f Mon Sep 17 00:00:00 2001 From: Kiirx Date: Wed, 20 Mar 2024 19:31:22 +0100 Subject: [PATCH 2/3] =?UTF-8?q?=E2=9E=95=20Compile=20time,=20Release=20mod?= =?UTF-8?q?e?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- Docs/articles/Installation/DevKit.md | 12 ++++----- Makefile | 37 +++++++++++++++++++--------- 2 files changed, 32 insertions(+), 17 deletions(-) diff --git a/Docs/articles/Installation/DevKit.md b/Docs/articles/Installation/DevKit.md index b90e00697d..a0fd084fda 100644 --- a/Docs/articles/Installation/DevKit.md +++ b/Docs/articles/Installation/DevKit.md @@ -1,4 +1,4 @@ -# Dev Kit Installation +# Dev Kit Installation ## Windows @@ -6,7 +6,7 @@ * (Free) source code of Development Kit from [Cosmos on GitHub](https://github.com/CosmosOS/Cosmos) * You must clone the repository using Git. For a detailed walkthrough, [see here](https://help.github.com/articles/fork-a-repo/). -* (Free) [Visual Studio 2022 Community](https://visualstudio.microsoft.com/vs/) +* (Free) [Visual Studio 2022 Community](https://visualstudio.microsoft.com/vs/) * (Free) [InnoSetup](http://www.jrsoftware.org/isdl.php#qsp) * This is required to build the setup kit which is used to build and install the Visual Studio integration libaries for Cosmos. * During install it will ask you about optional components to install. Be sure you check "Install Inno Setup Preprocessor". @@ -53,7 +53,7 @@ This will take a while. If there is no error, you successfully installed Cosmos if you are using custom cosmos repos you will need to clone them all manually as the installer script will pull from https://github.com/CosmosOS/ -A tree diagram of the source should look like the following: +A tree diagram of the source should look like the following: @@ -71,6 +71,6 @@ you may need to clear you nuget cache try ``dotnet clean`` to clear the project if you have more then 1 version of visual studio installed this can bug this follow "dotnet Project Templates" should fix it ### dotnet Project Templates -If you are using linux or prefer not using Visual Studio for your projects, you can install the dotnet project template using `dotnet new --install ./source/templates/csharp/` assuming you are currently in the Cosmos base directory. -After installing the template use `dotnet new cosmosCSKernel -n {name}` to create a new Cosmos Kernel project. -The dotnet template can be removed at a later time using `dotnet new --uninstall ./source/templates/csharp/`. +If you are using linux or prefer not using Visual Studio for your projects, you can install the dotnet project template using `dotnet new install ./source/templates/csharp/` assuming you are currently in the Cosmos base directory. +After installing the template use `dotnet new cosmosCSKernel -n {name}` to create a new Cosmos Kernel project. +The dotnet template can be removed at a later time using `dotnet new uninstall ./source/templates/csharp/`. \ No newline at end of file diff --git a/Makefile b/Makefile index 774a84273a..fa8e798716 100644 --- a/Makefile +++ b/Makefile @@ -16,21 +16,28 @@ COMMON_DIR = $(THISDIR)/../Common GIT = git DOTNET = dotnet +BUILDMODE=Release GITFLAGS = clone --depth=1 -DOTNETFLAGS = -nologo -v:q -c:Debug - +DOTNETFLAGS = -nologo -v:q -c:$(BUILDMODE) GREEN = \033[0;32m YELLOW = \033[1;33m DEFAULT = \033[0m +date = $(date +%F%T) + .PHONY: all all: $(IL2CPU_DIR) $(XSHARP_DIR) $(COMMON_DIR) + @printf "${YELLOW}Cosmos${DEFAULT} DevKit Installer\n" + @printf "${date}\n" @# Elapsed time is stored in a temporary file, deleted post-install. @date +%s > _time_$@.txt @$(MAKE) build @$(MAKE) publish @sudo $(MAKE) install @$(MAKE) nuget-install + @$(MAKE) template-install + @printf "To create a Cosmos kernel, run \'dotnet new cosmosCSKernel -n \{name\}\'' + @printf "Build log file saved to ${GREEN}$(THISDIR)/build${date}.log${DEFAULT}\n" @printf "============================================\n" @printf "| ${YELLOW}Cosmos${DEFAULT} has been installed successfully! |\n" @printf "============================================\n" @@ -118,19 +125,19 @@ install: @mkdir -p $(DESTDIR)/Build/VMware/Workstation @mkdir -p $(DESTDIR)/Packages @mkdir -p $(DESTDIR)/Kernel - @cp -r $(IL2CPU_DIR)/artifacts/Release/nupkg/*.nupkg $(DESTDIR)/Packages/ - @cp -r $(THISDIR)/artifacts/Release/nupkg/*.nupkg $(DESTDIR)/Packages/ - @cp -r $(XSHARP_DIR)/artifacts/Release/nupkg/*.nupkg $(DESTDIR)/Packages/ + @cp -r $(IL2CPU_DIR)/artifacts/$(BUILDMODE)/nupkg/*.nupkg $(DESTDIR)/Packages/ + @cp -r $(THISDIR)/artifacts/$(BUILDMODE)/nupkg/*.nupkg $(DESTDIR)/Packages/ + @cp -r $(XSHARP_DIR)/artifacts/$(BUILDMODE)/nupkg/*.nupkg $(DESTDIR)/Packages/ @cp -r $(IL2CPU_DIR)/source/Cosmos.Core.DebugStub/*.xs $(DESTDIR)/XSharp/DebugStub/ @cp -r $(THISDIR)/Artwork/XSharp/XSharp.ico $(DESTDIR)/XSharp/ @cp -r $(THISDIR)/Artwork/Cosmos.ico $(DESTDIR)/ - @cp -r $(IL2CPU_DIR)/source/IL2CPU/bin/Debug/*/linux-x64/publish/* $(DESTDIR)/Build/IL2CPU/ - @cp -r $(THISDIR)/source/Cosmos.Core_Plugs/bin/Debug/*/publish/*.dll $(DESTDIR)/Kernel/ - @cp -r $(THISDIR)/source/Cosmos.System2_Plugs/bin/Debug/*/publish/*.dll $(DESTDIR)/Kernel/ - @cp -r $(THISDIR)/source/Cosmos.HAL2/bin/Debug/*/publish/*.dll $(DESTDIR)/Kernel/ - @cp -r $(THISDIR)/source/Cosmos.Debug.Kernel.Plugs.Asm/bin/Debug/netstandard2.0/publish/*.dll $(DESTDIR)/Kernel/ + @cp -r $(IL2CPU_DIR)/source/IL2CPU/bin/$(BUILDMODE)/*/linux-x64/publish/* $(DESTDIR)/Build/IL2CPU/ + @cp -r $(THISDIR)/source/Cosmos.Core_Plugs/bin/$(BUILDMODE)/*/publish/*.dll $(DESTDIR)/Kernel/ + @cp -r $(THISDIR)/source/Cosmos.System2_Plugs/bin/$(BUILDMODE)/*/publish/*.dll $(DESTDIR)/Kernel/ + @cp -r $(THISDIR)/source/Cosmos.HAL2/bin/$(BUILDMODE)/*/publish/*.dll $(DESTDIR)/Kernel/ + @cp -r $(THISDIR)/source/Cosmos.Debug.Kernel.Plugs.Asm/bin/$(BUILDMODE)/netstandard2.0/publish/*.dll $(DESTDIR)/Kernel/ @cp -r $(THISDIR)/Build/HyperV/*.vhdx $(DESTDIR)/Build/HyperV/ @cp -r $(THISDIR)/Build/VMWare/Workstation/* $(DESTDIR)/Build/VMware/Workstation/ @@ -145,4 +152,12 @@ nuget-install: @rm -r -f ~/.nuget/packages/il2cpu.*/ @$(DOTNET) nuget remove source "Cosmos Local Package Feed" || true - @$(DOTNET) nuget add source $(DESTDIR)/Packages/ -n "Cosmos Local Package Feed" \ No newline at end of file + @$(DOTNET) nuget add source $(DESTDIR)/Packages/ -n "Cosmos Local Package Feed" + +.PHONY: template-install +template-install: + @printf "Installing ${GREEN}C# Template packages${DEFAULT}\n" + @-dotnet new uninstall $(THISDIR)/source/templates/csharp/ + @printf "If the template was not installed, you can ignore this" + @dotnet new install $(THISDIR)/source/templates/csharp/ +#TODO: Uninstall \ No newline at end of file From ac00a53412e6bdafc40962675236323743a1e5af Mon Sep 17 00:00:00 2001 From: Kiirx Date: Wed, 20 Mar 2024 19:46:42 +0100 Subject: [PATCH 3/3] Remove useless date variable --- Makefile | 3 --- 1 file changed, 3 deletions(-) diff --git a/Makefile b/Makefile index fa8e798716..e03919f148 100644 --- a/Makefile +++ b/Makefile @@ -23,12 +23,9 @@ GREEN = \033[0;32m YELLOW = \033[1;33m DEFAULT = \033[0m -date = $(date +%F%T) - .PHONY: all all: $(IL2CPU_DIR) $(XSHARP_DIR) $(COMMON_DIR) @printf "${YELLOW}Cosmos${DEFAULT} DevKit Installer\n" - @printf "${date}\n" @# Elapsed time is stored in a temporary file, deleted post-install. @date +%s > _time_$@.txt @$(MAKE) build