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

Add support for D package #19

Open
evangreen opened this issue Nov 1, 2016 · 1 comment
Open

Add support for D package #19

evangreen opened this issue Nov 1, 2016 · 1 comment

Comments

@evangreen
Copy link
Collaborator

Vegax 87 requested support for the D programming be added to the repositories in third-party. He writes:

Hi, I discovered Minoca today and I wanna ask you: what do you think about adding D language on Minoca? IMHO D language with Gdc or Ldc2 compiler has achieved excellent results and also is one of the most scalable languages out there and it has a very low memory usage which is perfect for Minoca, I think it deserves a chance to be included on Minoca 3rd-party repos, unfortunately I don't have enough knowledge to port it on Minoca...

P.S: You can see some reliable benchmarks here: https://github.com/kostya/benchmarks

@drawkula
Copy link

drawkula commented Nov 17, 2016

@vegax87 ... I get GDC built but not it's libs.

Read this as cheatsheet, don't run it as script... some paths need to be changed for your system. CHEATSHEET-4.9:

##
## GDC/Installation/Generic
##
## https://wiki.dlang.org/GDC/Installation/Generic
##

opkg install gcc libmpc libmpfr libgmp autoconf automake flex bison patch git

mkdir -p /opt/gdc/src
cd /opt/gdc/src

tar zxf /src/third-party/src/gcc-4.9.2.tar.gz 
cd gcc-4.9.2
patch -p1 < /src/third-party/build/gcc-4.9.2/gcc-4.9.2.diff 
cd ..

git clone -b gdc-4.9 --single-branch https://github.com/D-Programming-GDC/GDC.git gdc-4.9

cd gdc-4.9
patch -p1 < ../gdc-4.9.diff
./setup-gcc.sh ../gcc-4.9.2
cd ..
mkdir gdc-4.9-build

cd gdc-4.9-build

##
## Building GDC without building Druntime/Phobos
##
## https://wiki.dlang.org/GDC/Installation/Generic#Building_GDC_without_building_Druntime.2FPhobos
##
../gcc-4.9.2/configure --enable-languages=d --disable-bootstrap --prefix=/opt/gdc --with-bugurl=http://bugzilla.gdcproject.org --enable-checking=yes --disable-libphobos

make | tee build.log
make install

gdc-4.9.diff:

diff --git a/gcc/d/dfrontend/object.h b/gcc/d/dfrontend/object.h
index 2474223..2e59c78 100644
--- a/gcc/d/dfrontend/object.h
+++ b/gcc/d/dfrontend/object.h
@@ -10,7 +10,7 @@
 #ifndef OBJECT_H
 #define OBJECT_H

-#define POSIX (__linux__ || __APPLE__ || __FreeBSD__ || __OpenBSD__ || __sun)
+#define POSIX (__linux__ || __APPLE__ || __FreeBSD__ || __OpenBSD__ || __sun || __MINOCA__ )

 #if __DMC__
 #pragma once
diff --git a/gcc/d/dfrontend/speller.c b/gcc/d/dfrontend/speller.c
index eba4e9b..e8d61db 100644
--- a/gcc/d/dfrontend/speller.c
+++ b/gcc/d/dfrontend/speller.c
@@ -13,7 +13,7 @@
 #include <assert.h>
 #include <limits.h>

-#if __sun || _MSC_VER
+#if __sun || _MSC_VER || __MINOCA__
 #include <alloca.h>
 #endif

diff --git a/setup-gcc.sh b/setup-gcc.sh
index fd90721..6e0f844 100755
--- a/setup-gcc.sh
+++ b/setup-gcc.sh
@@ -29,24 +29,28 @@ for arg in "$@"; do
 done


-# 0. Find out what GCC version this is
-if grep version_string $d_gccsrc/gcc/version.c | grep -q '"3.4'; then
-    gcc_ver=3.4
-elif grep version_string $d_gccsrc/gcc/version.c | grep -q '"4.0'; then
-    gcc_ver=4.0
-elif grep -q -E '^4\.[1-9]+([^0-9]|$)' $d_gccsrc/gcc/BASE-VER; then
-    gcc_ver=$(grep -oh -E '^4\.[0-9]+|$' $d_gccsrc/gcc/BASE-VER)
-elif grep -q -E '^5\.[0-9]+([^0-9]|$)' $d_gccsrc/gcc/BASE-VER; then
-    gcc_ver=5
-elif grep -q -E '^6\.[0-9]+([^0-9]|$)' $d_gccsrc/gcc/BASE-VER; then
-    gcc_ver=6
-elif grep -q -E '^7\.[0-9]+([^0-9]|$)' $d_gccsrc/gcc/BASE-VER; then
-    gcc_ver=7
-else echo "cannot get gcc version"
-    exit 1
-fi
-echo "found gcc version $gcc_ver"
-gcc_patch_key=${gcc_ver}.x
+## 0. Find out what GCC version this is
+#if grep version_string $d_gccsrc/gcc/version.c | grep -q '"3.4'; then
+#    gcc_ver=3.4
+#elif grep version_string $d_gccsrc/gcc/version.c | grep -q '"4.0'; then
+#    gcc_ver=4.0
+#elif grep -q -E '^4\.[1-9]+([^0-9]|$)' $d_gccsrc/gcc/BASE-VER; then
+#    gcc_ver=$(grep -oh -E '^4\.[0-9]+|$' $d_gccsrc/gcc/BASE-VER)
+#elif grep -q -E '^5\.[0-9]+([^0-9]|$)' $d_gccsrc/gcc/BASE-VER; then
+#    gcc_ver=5
+#elif grep -q -E '^6\.[0-9]+([^0-9]|$)' $d_gccsrc/gcc/BASE-VER; then
+#    gcc_ver=6
+#elif grep -q -E '^7\.[0-9]+([^0-9]|$)' $d_gccsrc/gcc/BASE-VER; then
+#    gcc_ver=7
+#else echo "cannot get gcc version"
+#    exit 1
+#fi
+#echo "found gcc version $gcc_ver"
+#gcc_patch_key=${gcc_ver}.x
+
+## the above failed due to no "-o" in minoca's grep.
+## for 1st tests hardcoding the version
+gcc_patch_key=4.9.x

 # 1. Determine if this version of GCC is supported
 if test ! -f "gcc/d/patches/patch-gcc-$gcc_patch_key"; then

Houston, we have some results:

(root@minoca:pty19)/opt/gdc/bin# ls -l
total 17312
-rwxr-xr-x  1 root root  2308138 Nov 17 12:23 cpp
-rwxr-xr-x  1 root root  2306134 Nov 17 12:23 gcc
-rwxr-xr-x  1 root root    97013 Nov 17 12:23 gcc-ar
-rwxr-xr-x  1 root root    96957 Nov 17 12:23 gcc-nm
-rwxr-xr-x  1 root root    96969 Nov 17 12:23 gcc-ranlib
-rwxr-xr-x  1 root root  1507565 Nov 17 12:23 gcov
-rwxr-xr-x  1 root root  2311749 Nov 17 12:23 gdc
lrwxr-xr-x  1 root root        3 Nov 17 12:23 i686-pc-minoca-gcc -> gcc
lrwxr-xr-x  1 root root        3 Nov 17 12:23 i686-pc-minoca-gcc-4.9.2 -> gcc
lrwxr-xr-x  1 root root        6 Nov 17 12:23 i686-pc-minoca-gcc-ar -> gcc-ar
lrwxr-xr-x  1 root root        6 Nov 17 12:23 i686-pc-minoca-gcc-nm -> gcc-nm
lrwxr-xr-x  1 root root       10 Nov 17 12:23 i686-pc-minoca-gcc-ranlib -> gcc-ranlib
lrwxr-xr-x  1 root root        3 Nov 17 12:23 i686-pc-minoca-gdc -> gdc

Someone knowing more about GDC should take over now removing --disable-libphobos and looking at the resulting errors.

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

No branches or pull requests

2 participants