Git Product home page Git Product logo

dotnet-haiku's Introduction

.NET 8.0 workload for Haiku

An attempt to create a .NET SDK workload that provides the net8.0-haiku TFM.

Installation

To install, run the install-manifest.sh script:

bash -c "$(curl -fsSL https://raw.githubusercontent.com/trungnt2910/dotnet-haiku/HEAD/install-manifest.sh)"

The script requires dotnet, curl, jq, and unzip to be installed and be available in $PATH. It installs the latest version of the advertising manifests for the Haiku workload.

After that, the haiku workload will be available for install like any other workload:

dotnet workload install haiku

Note that you have to subscribe to @trungnt2910's GitHub Packages feed. If .NET for Haiku from the dotnet-builds repository has already been installed, you have already subscribed to this feed. Otherwise, run:

dotnet nuget add source --username your_github_username --password your_github_token --store-password-in-clear-text --name dotnet_haiku_nuget "https://nuget.pkg.github.com/trungnt2910/index.json"

your_github_token should be a personal access token with at least the read:packages permission.

Building instructions

Clone this repository

Make sure to do a recursive clone as this repository uses git submodules.

git clone --recurse-submodules https://github.com/trungnt2910/dotnet-haiku

Prerequisites

  • A platform that uses a Haiku-compatible Itanium ABI (tested on Linux only).
  • Git, CMake, and Ninja (used to build CppSharp). On Ubuntu:
sudo apt install -y git cmake ninja-build
  • A dotnet installation.
  • On non-Haiku platforms, a Haiku cross-compilation rootfs:
git clone --depth=1 https://github.com/dotnet/arcade
export ROOTFS_DIR=/path/to/rootfs/dir
arcade/eng/common/cross/build-rootfs.sh x64 haiku

Build and install workload

From the repository root directory:

dotnet tool restore
dotnet cake build.cake --target=InstallWorkload --configuration=Release

This should install the haiku workload to the default .NET SDK installation.

The first build will take a long time as it builds a portion of the LLVM project.

Usage

See the sample projects in the sample folder for more examples.

net8.0-haiku TFM

To use the Haiku API bindings, the project must target net8.0-haiku (replace 8.0 with a later version when applicable). This is similar to the usage of net8.0-windows or any other OS-specific TFMs.

<Project Sdk="Microsoft.NET.Sdk">

  <PropertyGroup>
    <OutputType>Exe</OutputType>
    <TargetFramework>net8.0-haiku</TargetFramework>
    <ImplicitUsings>enable</ImplicitUsings>
    <Nullable>enable</Nullable>
  </PropertyGroup>

</Project>

Kits and symbols

Each kit is located in a separate namespace prefixed with Haiku..

Non-member constants/variables starting with B_ or be_ are located in a class called Symbols in their kits' namespaces. The name Symbols is not final and is subject to change.

Members of named enums have the B_ prefix removed. Their names are also converted to PascalCase to match C#'s convention.

For example, to create a custom BWindow:

using Haiku.App;
using Haiku.Interface;
using static Haiku.App.Symbols;
using static Haiku.Interface.Symbols;

namespace EmptyWindow;

public class MainWindow: BWindow
{
    public MainWindow()
        : base(new BRect(), "Main Window", WindowType.TitledWindow, B_QUIT_ON_WINDOW_CLOSE)
    {
        MoveTo(100, 100);
        ResizeTo(200, 200);
    }

    public override bool QuitRequested()
    {
        be_app.PostMessage(B_QUIT_REQUESTED);
        return true;
    }
}

Limitations

Compilation

Only building on Linux is supported. At the time of writing, the .NET SDK on Haiku has not been stable yet.

Packaging

Only x86_64 is supported. Throughout the various build scripts x64 and x86_64 are hard coded. Some other parts of the scripts might also assume x86_64.

Reference assemblies are currently the same as the x86_64 version.

It is still too early to add support for other platforms, since neither .NET on Haiku nor CppSharp is compatibile with anything other than x86_64.

Generation

  • Only a few basic kits are generated. Currently, Application, Interface, Kernel, Storage, and Support kits are included.
  • Macros are not generated.
  • Some classes, especially C++ template classes, might be missing.
  • Documentation is not included.
  • The generated API is considered experimental and may change any time as the generators improve.

Usage

The usage of this workload is only supported on custom .NET builds for Haiku.

Attempting to use this workload on mainstream .NET builds will result in an error:

/home/trung/sdk/.dotnet/sdk/8.0.100-preview.4.23260.5/Sdks/Microsoft.NET.Sdk/targets/Microsoft.NET.Sdk.FrameworkReferenceResolution.targets(90,5): error NETSDK1083: The specified RuntimeIdentifier 'haiku-x64' is not recognized. [/home/trung/DotnetHaiku/sample/EmptyWindow/EmptyWindow.csproj]

The haiku-x64 RID does not exist yet, at least before this pull request gets merged.

dotnet-haiku's People

Contributors

dependabot[bot] avatar trungnt2910 avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar

Forkers

cybersys

dotnet-haiku's Issues

Haiku application generated form the workload template fails on loading BApplication

dotnet build succeeds with no warnings or errors but running the application executable or via dotnet run, return the following error:

Unhandled exception. System.TypeLoadException: Could not load type 'Haiku.App.BApplication' from assembly 'haiku, Version=1.0.0.0, Culture=neutral, PublicKeyToken=null'.
Abort

haiku.zip

Please find attached the project generated out of the template.

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.