Skip to content

Commit f51e884

Browse files
committed
Merge remote-tracking branch 'upstream/main' into hwt-dev
Incorporate changes in PR#81 from @gluckez to fix conflicts
2 parents ffb2958 + 0bab871 commit f51e884

11 files changed

Lines changed: 1230 additions & 746 deletions

File tree

.github/workflows/monodevelop.yml

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -56,7 +56,8 @@ jobs:
5656
mono -V
5757
msbuild -version
5858
dotnet --info
59-
git config --global --add safe.directory "$GITHUB_WORKSPACE"
59+
git config --global --add safe.directory /__w/dotdevelop/dotdevelop
60+
6061
# Checkout, configure and build
6162
- uses: actions/checkout@v3
6263
with:

.gitignore

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -286,3 +286,8 @@ main/.idea/
286286

287287
.localcache
288288

289+
#dotnet Version
290+
global.json
291+
292+
#crash logs
293+
*mono_crash.*.json

Building.md

Lines changed: 103 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,103 @@
1+
# Building DotDevelop
2+
3+
To build DotDevelop from scratch you will need to following pre-requisites.
4+
5+
Please note, Ubuntu 20.04 LTS is the perferred environment for buiding from source as Ubuntu 22.04 LTS doesn’t support .NET Core 3.1 or 2.0 since the distro only supports openSSL 3.
6+
7+
## Build Environment Requirements
8+
9+
The following steps are for Ubuntu, other distros may require different URLs.
10+
11+
```bash
12+
sudo apt update
13+
sudo apt install wget
14+
sudo apt install intltool fsharp gtk-sharp2
15+
16+
# DotNet
17+
## Ubuntu 20.04
18+
wget https://packages.microsoft.com/config/ubuntu/20.04/packages-microsoft-prod.deb -O packages-microsoft-prod.deb
19+
sudo dpkg -i packages-microsoft-prod.deb
20+
rm packages-microsoft-prod.deb
21+
22+
## Ubuntu 22.04
23+
# wget https://packages.microsoft.com/config/ubuntu/22.04/packages-microsoft-prod.deb -O packages-microsoft-prod.deb
24+
# sudo dpkg -i packages-microsoft-prod.deb
25+
# rm packages-microsoft-prod.deb
26+
27+
sudo apt-get install -y apt-transport-https
28+
sudo apt-get update && sudo apt-get install -y dotnet-sdk-3.1
29+
sudo apt-get update && sudo apt-get install -y dotnet-sdk-5.0
30+
sudo apt-get update && sudo apt-get install -y dotnet-sdk-6.0
31+
32+
# Install Mono and MSBuild
33+
sudo apt-get install -y gnupg ca-certificates
34+
sudo apt-key adv --keyserver hkp://keyserver.ubuntu.com:80 --recv-keys 3FA7E0328081BFF6A14DA29AA6A19B38D3D831EF
35+
36+
# Reference mono and msbuild from stable repo for versions 6.12.0.122 (mono) and 16.6.0.15201 (msbuild)
37+
echo "deb https://download.mono-project.com/repo/ubuntu stable-focal main" | sudo tee /etc/apt/sources.list.d/mono-official-stable.list
38+
39+
# Reference mono and msbuild from preview repo for versions 6.12.0.147 (mono) and 16.10.1 (msbuild)
40+
# echo "deb https://download.mono-project.com/repo/ubuntu preview-focal main" | sudo tee /etc/apt/sources.list.d/mono-official-preview.list
41+
sudo apt-get update
42+
43+
# Install mono-complete and ca-certificates-mono
44+
sudo apt-get install -y mono-complete ca-certificates-mono
45+
46+
# Synchronise Mono SSL certs
47+
cert-sync /etc/ssl/certs/ca-certificates.crt
48+
49+
# Install extra packages required for dotdevelop build
50+
sudo apt-get install -y sed git build-essential intltool nuget fsharp gtk-sharp2
51+
sudo apt-get install -y software-properties-common
52+
sudo apt-get update
53+
54+
# NetCoreDbg Requirements
55+
sudo apt install curl
56+
sudo apt install -y cmake clang
57+
```
58+
59+
## Clone and Building
60+
61+
Build DotDevelop
62+
63+
```bash
64+
git clone -b main https://github.com/dotdevelop/dotdevelop.git
65+
cd dotdevelop/
66+
67+
./configure --profile=gnome
68+
make
69+
```
70+
71+
Build NetCoreDbg, starting from the root of the `dotdevelop` folder.
72+
73+
```bash
74+
# Build NetCoreDbg (starting from DotDevelop directory)
75+
cd main/external/Samsung.Netcoredbg
76+
bash build.sh
77+
cd ../../..
78+
```
79+
80+
## Launching the IDE
81+
82+
Launch DotDevelop, using one of the 2 options
83+
84+
```bash
85+
# Start detached from terminal window
86+
(mono main/build/bin/MonoDevelop.exe &)
87+
88+
# Start attached to terminal window
89+
mono main/build/bin/MonoDevelop.exe
90+
```
91+
92+
### Verify .NET Core Debugger is attached
93+
94+
1. Launch, MonoDevelop
95+
2. Edit > Preferences > Projects > .NET Core Debuggers
96+
3. Click `...` and navigate to, `main/build/AddIns/Samsung.Netcoredbg/netcoredbg`
97+
4. Click, OK and start debugging
98+
99+
## References
100+
101+
* [NetCoreDbg - Readme.md](https://github.com/dotdevelop/netcoredbg/tree/dotdevelop#readme)
102+
* [Samsung NetCoreDbg](https://github.com/Samsung/netcoredbg)
103+
* [Issue #19 - Samsung.NetCoreDbg External Package](https://github.com/dotdevelop/dotdevelop/issues/47)

main/src/core/MonoDevelop.Core/MonoDevelop.Core.csproj

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -749,6 +749,7 @@
749749
<Compile Include="MonoDevelop.Core.FeatureConfiguration\FeatureSwitch.cs" />
750750
<Compile Include="MonoDevelop.Core.AddIns\FeatureSwitchExtensionNode.cs" />
751751
<Compile Include="MonoDevelop.Core.FeatureConfiguration\IFeatureSwitchController.cs" />
752+
<Compile Include="MonoDevelop.Utilities\LibraryTools.cs" />
752753
</ItemGroup>
753754
<ItemGroup>
754755
<None Include="BuildVariables.cs.in" />
Lines changed: 101 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,101 @@
1+
using System;
2+
using System.Runtime.InteropServices;
3+
4+
namespace MonoDevelop.Utilities
5+
{
6+
public class LibraryTools
7+
{
8+
private class Windows
9+
{
10+
[DllImport ("kernel32", CharSet = CharSet.Ansi, ExactSpelling = true, SetLastError = true)]
11+
public static extern IntPtr GetProcAddress (IntPtr hModule, string procName);
12+
13+
[DllImport ("kernel32", SetLastError = true, CharSet = CharSet.Unicode)]
14+
public static extern IntPtr LoadLibraryW (string lpszLib);
15+
}
16+
17+
private class Linux
18+
{
19+
[DllImport ("libdl.so.2")]
20+
public static extern IntPtr dlopen (string path, int flags);
21+
22+
[DllImport ("libdl.so.2")]
23+
public static extern IntPtr dlsym (IntPtr handle, string symbol);
24+
}
25+
26+
private class OSX
27+
{
28+
[DllImport ("/usr/lib/libSystem.dylib")]
29+
public static extern IntPtr dlopen (string path, int flags);
30+
31+
[DllImport ("/usr/lib/libSystem.dylib")]
32+
public static extern IntPtr dlsym (IntPtr handle, string symbol);
33+
}
34+
35+
[DllImport ("libc")]
36+
private static extern int uname (IntPtr buf);
37+
38+
private const int RTLD_LAZY = 0x0001;
39+
private const int RTLD_GLOBAL = 0x0100;
40+
41+
public static bool IsWindows, IsOSX;
42+
43+
static LibraryTools ()
44+
{
45+
switch (Environment.OSVersion.Platform) {
46+
case PlatformID.Win32NT:
47+
case PlatformID.Win32S:
48+
case PlatformID.Win32Windows:
49+
case PlatformID.WinCE:
50+
IsWindows = true;
51+
break;
52+
case PlatformID.MacOSX:
53+
IsOSX = true;
54+
break;
55+
case PlatformID.Unix:
56+
try {
57+
var buf = Marshal.AllocHGlobal (8192);
58+
if (uname (buf) == 0 && Marshal.PtrToStringAnsi (buf) == "Darwin")
59+
IsOSX = true;
60+
61+
Marshal.FreeHGlobal (buf);
62+
} catch { }
63+
64+
break;
65+
}
66+
}
67+
68+
public static IntPtr LoadLibrary (string libname)
69+
{
70+
if (IsWindows)
71+
return Windows.LoadLibraryW (libname);
72+
73+
if (IsOSX)
74+
return OSX.dlopen (libname, RTLD_GLOBAL | RTLD_LAZY);
75+
76+
return Linux.dlopen (libname, RTLD_GLOBAL | RTLD_LAZY);
77+
}
78+
79+
public static IntPtr GetProcAddress (IntPtr library, string function)
80+
{
81+
var ret = IntPtr.Zero;
82+
83+
if (IsWindows)
84+
ret = Windows.GetProcAddress (library, function);
85+
else if (IsOSX)
86+
ret = OSX.dlsym (library, function);
87+
else
88+
ret = Linux.dlsym (library, function);
89+
90+
return ret;
91+
}
92+
93+
public static T LoadFunction<T> (IntPtr procaddress)
94+
{
95+
if (procaddress == IntPtr.Zero)
96+
return default (T);
97+
98+
return Marshal.GetDelegateForFunctionPointer<T> (procaddress);
99+
}
100+
}
101+
}

0 commit comments

Comments
 (0)