-
Notifications
You must be signed in to change notification settings - Fork 0
/
0002-Added-makefiles-for-building-PowerNex-target.patch
287 lines (283 loc) · 8.71 KB
/
0002-Added-makefiles-for-building-PowerNex-target.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
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
From 9a2733b41c222547c2cf24a65ba61382f575435a Mon Sep 17 00:00:00 2001
From: Dan Printzell <[email protected]>
Date: Fri, 17 Jan 2020 01:47:59 +0100
Subject: [PATCH 2/4] Added makefiles for building PowerNex target
Signed-off-by: Dan Printzell <[email protected]>
---
powernex.mak | 13 +++
src/build.d | 4 +-
src/powernex.mak | 223 +++++++++++++++++++++++++++++++++++++++++++++++
3 files changed, 239 insertions(+), 1 deletion(-)
create mode 100644 powernex.mak
create mode 100644 src/powernex.mak
diff --git a/powernex.mak b/powernex.mak
new file mode 100644
index 000000000..55517111d
--- /dev/null
+++ b/powernex.mak
@@ -0,0 +1,13 @@
+INSTALL_DIR=$(PWD)/../install
+.PHONY: all clean install
+
+all:
+ $(QUIET)$(MAKE) -C src -f powernex.mak all
+
+clean:
+ $(QUIET)$(MAKE) -C src -f powernex.mak clean
+
+install: all
+ $(MAKE) INSTALL_DIR=$(INSTALL_DIR) -C src -f powernex.mak install
+
+.DELETE_ON_ERROR: # GNU Make directive (delete output files on error)
diff --git a/src/build.d b/src/build.d
index dc1272be0..f6b1899b9 100755
--- a/src/build.d
+++ b/src/build.d
@@ -1426,7 +1426,7 @@ bool download(string to, string from, uint tries = 3)
/**
Detects the host OS.
-Returns: a string from `{windows, osx,linux,freebsd,openbsd,netbsd,dragonflybsd,solaris}`
+Returns: a string from `{windows, osx,linux,freebsd,openbsd,netbsd,dragonflybsd,solaris,powernex}`
*/
string detectOS()
{
@@ -1446,6 +1446,8 @@ string detectOS()
return "dragonflybsd";
else version(Solaris)
return "solaris";
+ else version(PowerNex)
+ return "powernex";
else
static assert(0, "Unrecognized or unsupported OS.");
}
diff --git a/src/powernex.mak b/src/powernex.mak
new file mode 100644
index 000000000..50df6fdaf
--- /dev/null
+++ b/src/powernex.mak
@@ -0,0 +1,223 @@
+################################################################################
+# Important variables:
+# --------------------
+#
+# HOST_CXX: Host C++ compiler to use (g++,clang++)
+# HOST_DMD: Host D compiler to use for bootstrapping
+# AUTO_BOOTSTRAP: Enable auto-boostrapping by downloading a stable DMD binary
+# INSTALL_DIR: Installation folder to use
+# MODEL: Target architecture to build for (32,64) - defaults to the host architecture
+#
+################################################################################
+# Build modes:
+# ------------
+# BUILD: release (default) | debug (enabled a build with debug instructions)
+#
+# Opt-in build features:
+#
+# ENABLE_RELEASE: Optimized release built
+# ENABLE_DEBUG: Add debug instructions and symbols (set if ENABLE_RELEASE isn't set)
+# ENABLE_LTO: Enable link-time optimizations
+# ENABLE_UNITTEST: Build dmd with unittests (sets ENABLE_COVERAGE=1)
+# ENABLE_PROFILE: Build dmd with a profiling recorder (D)
+# ENABLE_COVERAGE Build dmd with coverage counting
+# ENABLE_SANITIZERS Build dmd with sanitizer (e.g. ENABLE_SANITIZERS=address,undefined)
+#
+# Targets
+# -------
+#
+# all Build dmd
+# unittest Run all unittest blocks
+# cxx-unittest Check conformance of the C++ headers
+# build-examples Build DMD as library examples
+# clean Remove all generated files
+# man Generate the man pages
+# checkwhitespace Checks for trailing whitespace and tabs
+# zip Packs all sources into a ZIP archive
+# gitzip Packs all sources into a ZIP archive
+# install Installs dmd into $(INSTALL_DIR)
+################################################################################
+
+# get OS and MODEL
+OS:=powernex
+include osmodel.mak
+
+# Default to a release built, override with BUILD=debug
+ifeq (,$(BUILD))
+BUILD=release
+endif
+
+ifneq ($(BUILD),release)
+ ifneq ($(BUILD),debug)
+ $(error Unrecognized BUILD=$(BUILD), must be 'debug' or 'release')
+ endif
+endif
+
+INSTALL_DIR=../../install
+D = dmd
+
+GENERATED = ../generated
+G = $(GENERATED)/$(OS)/$(BUILD)/$(MODEL)
+$(shell mkdir -p $G)
+
+ifeq (osx,$(OS))
+ export MACOSX_DEPLOYMENT_TARGET=10.9
+endif
+
+HOST_CXX?=c++
+# compatibility with old behavior
+ifneq ($(HOST_CC),)
+ $(warning ===== WARNING: Please use HOST_CXX=$(HOST_CC) instead of HOST_CC=$(HOST_CC). =====)
+ HOST_CXX=$(HOST_CC)
+endif
+
+HOST_DC?=
+ifneq (,$(HOST_DC))
+ $(warning ========== Use HOST_DMD instead of HOST_DC ========== )
+ HOST_DMD=$(HOST_DC)
+endif
+
+# Host D compiler for bootstrapping
+ifeq (,$(AUTO_BOOTSTRAP))
+ # No bootstrap, a $(HOST_DC) installation must be available
+ HOST_DMD?=dmd
+ HOST_DMD_PATH=$(abspath $(shell which $(HOST_DMD)))
+ ifeq (,$(HOST_DMD_PATH))
+ $(error '$(HOST_DMD)' not found, get a D compiler or make AUTO_BOOTSTRAP=1)
+ endif
+ HOST_DMD_RUN:=$(HOST_DMD)
+else
+ # Auto-bootstrapping, will download dmd automatically
+ # Keep var below in sync with other occurrences of that variable, e.g. in circleci.sh
+ HOST_DMD_VER=2.088.0
+ HOST_DMD_ROOT=$(GENERATED)/host_dmd-$(HOST_DMD_VER)
+ # dmd.2.088.0.osx.zip or dmd.2.088.0.linux.tar.xz
+ HOST_DMD_BASENAME=dmd.$(HOST_DMD_VER).$(OS)$(if $(filter $(OS),freebsd),-$(MODEL),)
+ # http://downloads.dlang.org/releases/2.x/2.088.0/dmd.2.088.0.linux.tar.xz
+ HOST_DMD_URL=http://downloads.dlang.org/releases/2.x/$(HOST_DMD_VER)/$(HOST_DMD_BASENAME)
+ HOST_DMD=$(HOST_DMD_ROOT)/dmd2/$(OS)/$(if $(filter $(OS),osx),bin,bin$(MODEL))/dmd
+ HOST_DMD_PATH=$(HOST_DMD)
+ HOST_DMD_RUN=$(HOST_DMD) -conf=$(dir $(HOST_DMD))dmd.conf
+endif
+
+RUN_BUILD = $(GENERATED)/build HOST_DMD="$(HOST_DMD)" CXX="$(HOST_CXX)" OS=$(OS) BUILD=$(BUILD) MODEL=$(MODEL) AUTO_BOOTSTRAP="$(AUTO_BOOTSTRAP)" DOCDIR="$(DOCDIR)" STDDOC="$(STDDOC)" DOC_OUTPUT_DIR="$(DOC_OUTPUT_DIR)" MAKE="$(MAKE)" --called-from-make
+
+######## Begin build targets
+
+all: dmd
+.PHONY: all
+
+dmd: $(GENERATED)/build
+ $(RUN_BUILD) $@
+.PHONY: dmd
+
+$(GENERATED)/build: build.d $(HOST_DMD_PATH)
+ $(HOST_DMD_RUN) -of$@ -g build.d
+
+auto-tester-build: $(GENERATED)/build
+ $(RUN_BUILD) $@
+
+.PHONY: auto-tester-build
+
+toolchain-info: $(GENERATED)/build
+ $(RUN_BUILD) $@
+
+unittest: $G/dmd-unittest
+ $<
+
+######## Manual cleanup
+
+clean:
+ rm -Rf $(GENERATED)
+
+######## Download and install the last dmd buildable without dmd
+
+ifneq (,$(AUTO_BOOTSTRAP))
+CURL_FLAGS:=-fsSL --retry 5 --retry-max-time 120 --connect-timeout 5 --speed-time 30 --speed-limit 1024
+$(HOST_DMD_PATH):
+ mkdir -p ${HOST_DMD_ROOT}
+ifneq (,$(shell which xz 2>/dev/null))
+ curl ${CURL_FLAGS} ${HOST_DMD_URL}.tar.xz | tar -C ${HOST_DMD_ROOT} -Jxf - || rm -rf ${HOST_DMD_ROOT}
+else
+ TMPFILE=$$(mktemp deleteme.XXXXXXXX) && curl ${CURL_FLAGS} ${HOST_DMD_URL}.zip > $${TMPFILE}.zip && \
+ unzip -qd ${HOST_DMD_ROOT} $${TMPFILE}.zip && rm $${TMPFILE}.zip;
+endif
+endif
+
+FORCE: ;
+
+################################################################################
+# Generate the man pages
+################################################################################
+
+DMD_MAN_PAGE = $(GENERATED)/docs/man/man1/dmd.1
+
+$(GENERATED)/docs/%: $(GENERATED)/build
+ $(RUN_BUILD) $@
+
+man: $(GENERATED)/build
+ $(RUN_BUILD) $@
+
+######################################################
+
+install: $(GENERATED)/build $(DMD_MAN_PAGE)
+ $(RUN_BUILD) $@
+
+######################################################
+
+checkwhitespace: $(GENERATED)/build
+ $(RUN_BUILD) $@
+
+######################################################
+# DScanner
+######################################################
+
+# runs static code analysis with Dscanner
+style: $(GENERATED)/build
+ $(RUN_BUILD) $@
+
+######################################################
+
+cxx-unittest: $(GENERATED)/build
+ $(RUN_BUILD) $@
+
+######################################################
+
+zip: $(GENERATED)/build
+ $(RUN_BUILD) $@
+
+######################################################
+
+gitzip:
+ git archive --format=zip HEAD > $(ZIPFILE)
+
+######################################################
+# Default rule to forward targets to build.d
+
+$G/%: $(GENERATED)/build FORCE
+ $(RUN_BUILD) $@
+
+################################################################################
+# DDoc documentation generation
+################################################################################
+
+# BEGIN fallbacks for old variable names
+# should be removed after https://github.com/dlang/dlang.org/pull/1581
+# has been pulled
+DOCSRC=../dlang.org
+STDDOC=$(DOCFMT)
+DOC_OUTPUT_DIR=$(DOCDIR)
+# END fallbacks
+
+# DDoc html generation - this is very similar to the way the documentation for
+# Phobos is built
+ifneq ($(DOCSRC),)
+
+html: $(GENERATED)/build FORCE
+ $(RUN_BUILD) $@
+
+endif
+
+######################################################
+
+.DELETE_ON_ERROR: # GNU Make directive (delete output files on error)
--
2.32.0