Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Proposal: Change the way of building native binaries #47

Open
am11 opened this issue Jan 10, 2017 · 6 comments
Open

Proposal: Change the way of building native binaries #47

am11 opened this issue Jan 10, 2017 · 6 comments

Comments

@am11
Copy link
Contributor

am11 commented Jan 10, 2017

Currently we are compiling both x64 and x86 libsass binaries (solution) build.

This needs to change in such a way that we compile only one binary for the given set of configuration with constant name (libsass) and avoid copying binaries around.

This will help us when we build against other platform such as Linux and OSX.

node-sass has also this way of compiling one binary per build.


@darrenkopp,

This is the first step towards .NET Core support.

NuGet packaging would be also easier for multiple operating system, as it requires the same name but create the OS+Arch specific directory. Note that there is a platform inheritance involved in latest NuGet packaging when dealing with native binaries. For instance, Alpine Linux x64 inherits Linux x64, which has a sibling Linux x86 and parent Linux, which has Unix as parent and OSX and FreeBSD etc. at sibling nodes. NuGet handles all this at restore time, if we follow the right convention to package the bins.

I have few ideas about packaging that I would like to try once we get there. :)

Thoughts?

@nschonni
Copy link
Contributor

I was thinking about this yesterday when I was trying to build. What about just getting rid of the "AnyCPU" target and then just include the VC++ project directly? Still requires more than one build for full packaging, but builds quicker.

@darrenkopp
Copy link
Collaborator

@nschonni That's how it did it in the past, but it really makes the nuget packaging story pretty painful for downstream libraries that then had to split their packages into x86/x64 versions as well.

@nschonni
Copy link
Contributor

Fair enough, looking at https://www.nuget.org/packages/Microsoft.TeamFoundationServer.ExtendedClient looks like they still use a native folder under lib along with the target architectures.

@am11
Copy link
Contributor Author

am11 commented Jan 10, 2017

@nschonni, I guess TFS package might not be the good example as it is tied to Windows and only supports full .NET Framework. For example, compare the Dependencies section to a real cross platform, multi-framework package: https://www.nuget.org/packages/System.IO.Compression/.

Speaking of which if we search for S.IO.C: https://www.nuget.org/packages?q=System.IO.Compression we will find sea of packages starting with runtimes.. Few new concepts introduced in nuget lately, one of them is transitive dependency. In this case, S.IO.C will install S.IO.C package (with managed assemblies only), then runtime.<platform>.S.IO.C package which will include common assemblies for this platform (say win7), then runtime.<platform>-<architecture>.S.IO.C for x64 etc., then runtime.<platform>-<version>-<architecture>.S.IO.C for this version of platform and finally runtime.<platform>-<version>-<architecture>.<dotnetRuntime>.S.IO.C where dotnetRuntime could be aot (ahead of time), native (.Net Native) etc.

There is a well defined convention to get all this packaging done automatically by Nuget and then Nuget resolves the dependency from most specific to most general at restore time based on the target's RID (runtime ID). For example, like node-sass if we build Linux binary on CentOS, then we don't need to specialize RID for Fedora and MintOS etc. But in case of Alpine Linux, we would want to create a separate package as Alpine uses musl-libc instead of glibc etc.

A lot of stuff that we were doing by hand in node-sass is handled by the latest Nuget (v4 is in RC stage), just need to follow few conventions (basically by mimicking how they are handling stuff in CoreFX, SDK and Core-Setup repos of dotnet organization). :)

@nschonni
Copy link
Contributor

Makes sense, I'm looking at the base build right now since it's not compiling for me. I won't try anything to do with Core though 😉

@am11
Copy link
Contributor Author

am11 commented Jan 11, 2017

Lol, I just wanted to have general feeling whether building for current-platform-only based on solution configurations. will submit a PR today or by tomorrow. :)

am11 added a commit to am11/libsass-net that referenced this issue Jan 19, 2017
Added an inline MSBuild task, which make use of a new CoreFX API
`System.Runtime.InteropServices.RuntimeInformation` to obtain OS
description and architecture information, then translates into
`LibSassPlatform` (Win32 or Win64 etc.).

Also added ability to cross compile, e.g. Win32 on 64-bit system.

Additional OSes will be added with .NET Core support.

Fixes sass#47.
am11 added a commit to am11/libsass-net that referenced this issue Jan 19, 2017
Added an inline MSBuild task, which make use of a new CoreFX API
`System.Runtime.InteropServices.RuntimeInformation` to obtain OS
description and architecture information, then translates into
`LibSassPlatform` (Win32 or Win64 etc.).

Also added ability to cross compile, e.g. Win32 on 64-bit system.

Additional OSes will be added with .NET Core support.

Fixes sass#47.
am11 added a commit to am11/libsass-net that referenced this issue Jan 19, 2017
Added an inline MSBuild task, which make use of a new CoreFX API
`System.Runtime.InteropServices.RuntimeInformation` to obtain OS
description and architecture information, then translates into
`LibSassPlatform` (Win32 or Win64 etc.).

Also added ability to cross compile, e.g. Win32 on 64-bit system.

Additional OSes will be added with .NET Core support.

Fixes sass#47.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants