This repository has been archived by the owner on Aug 22, 2024. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 1
/
Copy pathapps_dlang_toolchain.patch
209 lines (195 loc) · 7.18 KB
/
apps_dlang_toolchain.patch
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
diff --git a/Application.mk b/Application.mk
index b482ea3..c12903d 100644
--- a/Application.mk
+++ b/Application.mk
@@ -76,25 +76,28 @@ COBJS = $(CSRCS:=$(SUFFIX)$(OBJEXT))
CXXOBJS = $(CXXSRCS:=$(SUFFIX)$(OBJEXT))
RUSTOBJS = $(RUSTSRCS:=$(SUFFIX)$(OBJEXT))
ZIGOBJS = $(ZIGSRCS:=$(SUFFIX)$(OBJEXT))
+DOBJS = $(DSRCS:=$(SUFFIX)$(OBJEXT))
MAINCXXSRCS = $(filter %$(CXXEXT),$(MAINSRC))
MAINCSRCS = $(filter %.c,$(MAINSRC))
MAINRUSTSRCS = $(filter %$(RUSTEXT),$(MAINSRC))
MAINZIGSRCS = $(filter %$(ZIGEXT),$(MAINSRC))
+MAINDSRCS = $(filter %$(DEXT),$(MAINSRC))
MAINCXXOBJ = $(MAINCXXSRCS:=$(SUFFIX)$(OBJEXT))
MAINCOBJ = $(MAINCSRCS:=$(SUFFIX)$(OBJEXT))
MAINRUSTOBJ = $(MAINRUSTSRCS:=$(SUFFIX)$(OBJEXT))
MAINZIGOBJ = $(MAINZIGSRCS:=$(SUFFIX)$(OBJEXT))
+MAINDOBJ = $(MAINDSRCS:=$(SUFFIX)$(OBJEXT))
SRCS = $(ASRCS) $(CSRCS) $(CXXSRCS) $(MAINSRC)
-OBJS = $(RAOBJS) $(CAOBJS) $(COBJS) $(CXXOBJS) $(RUSTOBJS) $(ZIGOBJS) $(EXTOBJS)
+OBJS = $(RAOBJS) $(CAOBJS) $(COBJS) $(CXXOBJS) $(RUSTOBJS) $(ZIGOBJS) $(DOBJS) $(EXTOBJS)
ifneq ($(BUILD_MODULE),y)
- OBJS += $(MAINCOBJ) $(MAINCXXOBJ) $(MAINRUSTOBJ) $(MAINZIGOBJ)
+ OBJS += $(MAINCOBJ) $(MAINCXXOBJ) $(MAINRUSTOBJ) $(MAINZIGOBJ) $(MAINDOBJ)
endif
ifneq ($(strip $(PROGNAME)),)
- PROGOBJ := $(MAINCOBJ) $(MAINCXXOBJ) $(MAINRUSTOBJ) $(MAINZIGOBJ)
+ PROGOBJ := $(MAINCOBJ) $(MAINCXXOBJ) $(MAINRUSTOBJ) $(MAINZIGOBJ) $(MAINDOBJ)
PROGLIST := $(addprefix $(BINDIR)$(DELIM),$(PROGNAME))
REGLIST := $(addprefix $(BUILTIN_REGISTRY)$(DELIM),$(addsuffix .bdat,$(PROGNAME)))
@@ -131,6 +134,7 @@ endif
ZIGELFFLAGS ?= $(ZIGFLAGS)
RUSTELFFLAGS ?= $(RUSTFLAGS)
+DELFFLAGS ?= $(DFLAGS)
DEPPATH += --dep-path .
DEPPATH += --obj-path .
@@ -175,6 +179,12 @@ define ELFCOMPILEZIG
$(ECHO_END)
endef
+define ELFCOMPILED
+ $(ECHO_BEGIN)"DC: $1 "
+ $(Q) $(DC) -c $(DELFFLAGS) $($(strip $1)_DELFFLAGS) $1 -of $2
+ $(ECHO_END)
+endef
+
define ELFLD
$(ECHO_BEGIN)"LD: $2 "
$(Q) $(LD) $(LDELFFLAGS) $(LDLIBPATH) $(ARCHCRT0OBJ) $1 $(LDSTARTGROUP) $(LDLIBS) $(LDENDGROUP) -o $2
@@ -212,6 +222,10 @@ $(ZIGOBJS): %$(ZIGEXT)$(SUFFIX)$(OBJEXT): %$(ZIGEXT)
$(if $(and $(CONFIG_BUILD_LOADABLE), $(CELFFLAGS)), \
$(call ELFCOMPILEZIG, $<, $@), $(call COMPILEZIG, $<, $@))
+$(DOBJS): %$(DEXT)$(SUFFIX)$(OBJEXT): %$(DEXT)
+ $(if $(and $(CONFIG_BUILD_LOADABLE), $(CELFFLAGS)), \
+ $(call ELFCOMPILED, $<, $@), $(call COMPILED, $<, $@))
+
AROBJS :=
ifneq ($(OBJS),)
SORTOBJS := $(sort $(OBJS))
@@ -246,7 +260,11 @@ $(MAINZIGOBJ): %$(ZIGEXT)$(SUFFIX)$(OBJEXT): %$(ZIGEXT)
$(if $(and $(CONFIG_BUILD_LOADABLE),$(CELFFLAGS)), \
$(call ELFCOMPILEZIG, $<, $@), $(call COMPILEZIG, $<, $@))
-$(PROGLIST): $(MAINCOBJ) $(MAINCXXOBJ) $(MAINRUSTOBJ) $(MAINZIGOBJ)
+$(MAINDOBJ): %$(DEXT)$(SUFFIX)$(OBJEXT): %$(DEXT)
+ $(if $(and $(CONFIG_BUILD_LOADABLE),$(CELFFLAGS)), \
+ $(call ELFCOMPILED, $<, $@), $(call COMPILED, $<, $@))
+
+$(PROGLIST): $(MAINCOBJ) $(MAINCXXOBJ) $(MAINRUSTOBJ) $(MAINZIGOBJ) $(MAINDOBJ)
$(Q) mkdir -p $(BINDIR)
$(call ELFLD, $(PROGOBJ_$@), $(call CONVERT_PATH,$@))
$(Q) chmod +x $@
@@ -281,6 +299,10 @@ $(MAINZIGOBJ): %$(ZIGEXT)$(SUFFIX)$(OBJEXT): %$(ZIGEXT)
$(call ELFCOMPILEZIG, $(basename $<)_tmp.zig, $@), $(call COMPILEZIG, $(basename $<)_tmp.zig, $@))
$(Q) rm -f $(basename $<)_tmp.zig
+$(MAINDOBJ): %$(DEXT)$(SUFFIX)$(OBJEXT): %$(DEXT)
+ $(if $(and $(CONFIG_BUILD_LOADABLE),$(CELFFLAGS)), \
+ $(call ELFCOMPILED, $<, $@), $(call COMPILED, $<, $@))
+
install::
@:
diff --git a/Make.defs b/Make.defs
index d13634f..13f3e79 100644
--- a/Make.defs
+++ b/Make.defs
@@ -54,6 +54,7 @@ $(foreach BDIR, $(BUILDIRS), $(eval $(call Add_Application,$(BDIR))))
CXXEXT ?= .cxx
RUSTEXT ?= .rs
ZIGEXT ?= .zig
+DEXT ?= .d
# Library path
diff --git a/examples/hello_d/Kconfig b/examples/hello_d/Kconfig
new file mode 100644
index 0000000..2c033ac
--- /dev/null
+++ b/examples/hello_d/Kconfig
@@ -0,0 +1,29 @@
+#
+# For a description of the syntax of this configuration file,
+# see the file kconfig-language.txt in the NuttX tools repository.
+#
+
+config EXAMPLES_HELLO_D
+ tristate "\"Hello, D!\" D example"
+ default y
+ ---help---
+ Enable the \"Hello, D!\" D example
+
+if EXAMPLES_HELLO_D
+
+config EXAMPLES_HELLO_D_PROGNAME
+ string "Program name"
+ default "hello_d"
+ ---help---
+ This is the name of the program that will be used when the
+ program is installed.
+
+config EXAMPLES_HELLO_D_PRIORITY
+ int "Hello D task priority"
+ default 100
+
+config EXAMPLES_HELLO_D_STACKSIZE
+ int "Hello D stack size"
+ default DEFAULT_TASK_STACKSIZE
+
+endif
diff --git a/examples/hello_d/Make.defs b/examples/hello_d/Make.defs
new file mode 100644
index 0000000..b267da1
--- /dev/null
+++ b/examples/hello_d/Make.defs
@@ -0,0 +1,23 @@
+############################################################################
+# apps/examples/hello_d/Make.defs
+#
+# Licensed to the Apache Software Foundation (ASF) under one or more
+# contributor license agreements. See the NOTICE file distributed with
+# this work for additional information regarding copyright ownership. The
+# ASF licenses this file to you under the Apache License, Version 2.0 (the
+# "License"); you may not use this file except in compliance with the
+# License. You may obtain a copy of the License at
+#
+# http://www.apache.org/licenses/LICENSE-2.0
+#
+# Unless required by applicable law or agreed to in writing, software
+# distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
+# WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the
+# License for the specific language governing permissions and limitations
+# under the License.
+#
+############################################################################
+
+ifneq ($(CONFIG_EXAMPLES_HELLO_D),)
+CONFIGURED_APPS += $(APPDIR)/examples/hello_d
+endif
diff --git a/examples/hello_d/Makefile b/examples/hello_d/Makefile
new file mode 100644
index 0000000..27c72b7
--- /dev/null
+++ b/examples/hello_d/Makefile
@@ -0,0 +1,35 @@
+############################################################################
+# apps/examples/hello_d/Makefile
+#
+# Licensed to the Apache Software Foundation (ASF) under one or more
+# contributor license agreements. See the NOTICE file distributed with
+# this work for additional information regarding copyright ownership. The
+# ASF licenses this file to you under the Apache License, Version 2.0 (the
+# "License"); you may not use this file except in compliance with the
+# License. You may obtain a copy of the License at
+#
+# http://www.apache.org/licenses/LICENSE-2.0
+#
+# Unless required by applicable law or agreed to in writing, software
+# distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
+# WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the
+# License for the specific language governing permissions and limitations
+# under the License.
+#
+############################################################################
+
+include $(APPDIR)/Make.defs
+
+# Hello, World! D Example
+
+MAINSRC = hello_d_main.d
+
+# hello_d built-in application info
+
+DFLAGS += -oq
+PROGNAME = $(CONFIG_EXAMPLES_HELLO_D_PROGNAME)
+PRIORITY = $(CONFIG_EXAMPLES_HELLO_D_PRIORITY)
+STACKSIZE = $(CONFIG_EXAMPLES_HELLO_D_STACKSIZE)
+MODULE = $(CONFIG_EXAMPLES_HELLO_D)
+
+include $(APPDIR)/Application.mk