/
StackRaspbianConfig.class.st
216 lines (171 loc) · 5.22 KB
/
StackRaspbianConfig.class.st
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
"
This is a concrete class which generates a StackVM for Raspbian (debian on RaspberryPi).
Usage:
StackRaspbianConfig generateWithSources
Fore more information, check the class comments of all the superclasses.
"
Class {
#name : #StackRaspbianConfig,
#superclass : #StackUnixConfig,
#category : #'CMakeVMMaker-Unix'
}
{ #category : #'as yet unclassified' }
StackRaspbianConfig >> addDriver: name sources: aSources generator: cmakeGen externalLibs: extLibs [
| cfg srcs |
srcs := aSources inject: '' into: [:res :each | res , ' "', each, '"' ].
cfg := cmakeGen
captureOutputDuring: [
cmakeGen printHeader;
project: name;
include: '../directories.cmake';
message: 'Adding module: ', name;
addDefinitions: self compilerFlags;
addDefinitions: '-fPIC -DPIC';
set: #sources to: srcs;
cmd: 'add_library' params: name, ' SHARED ${sources}';
includeDirectories: '${crossDir}/plugins/FilePlugin';
includeDirectories: '${targetPlatform}/plugins/B3DAcceleratorPlugin';
includeDirectories: '${crossDir}/plugins/B3DAcceleratorPlugin';
set: 'LIBRARY_OUTPUT_PATH' toString: self outputDir fullName;
addExternalLibraries: extLibs;
cmd: 'target_link_libraries' params: name , ' ${LINKLIBS}';
cmd: 'set_target_properties' params: name , ' PROPERTIES PREFIX "" SUFFIX "" '
].
(self buildDir / name) ensureDirectory.
self write: cfg toFile: name , '/', cmakeGen outputFileName.
cmakeGen addSubdirectory: name.
]
{ #category : #'as yet unclassified' }
StackRaspbianConfig >> commonCompilerFlags [
"Common compiler flags
LSB_FIRST=1 means that target platform is little endian.
set it to 0 for big-endian platforms
"
^ {
'-DLSB_FIRST=1'.
'-DUSE_GLOBAL_STRUCT=0'.
'-DCOGMTVM=0' }
]
{ #category : #'as yet unclassified' }
StackRaspbianConfig >> compilerFlagsDebug [
^ {
'-g3'.
'-O0'.
'-D_GNU_SOURCE'.
'-DITIMER_HEARTBEAT=1'.
'-DNO_VM_PROFILE=1'.
'-DDEBUGVM=1' }
]
{ #category : #'as yet unclassified' }
StackRaspbianConfig >> compilerFlagsRelease [
"
THIS FLAGS ARE CRASHING COMPILER
-fschedule-insns2
-fschedule-insns
THIS FLAGS ARE CRASHING VM
-ftree-pre
-fcaller-saves
THIS FLAGS ARE WORKING
-O1 -fthread-jumps -falign-functions -falign-jumps -falign-loops -falign-labels -fcrossjumping -fcse-follow-jumps -fcse-skip-blocks -fdelete-null-pointer-checks -fdevirtualize -fexpensive-optimizations -fgcse -fgcse-lm -finline-small-functions -findirect-inlining -fipa-sra -foptimize-sibling-calls -fpeephole2 -fregmove -freorder-blocks -frerun-cse-after-loop -freorder-functions -fsched-interblock -fsched-spec -fstrict-aliasing -fstrict-overflow -ftree-switch-conversion -ftree-vrp
THIS IS LIKE: -O2 -fno-tree-pre -fno-caller-saves
"
^ {
'-g0'.
'-O2'.
'-fno-tree-pre'.
'-fno-caller-saves'.
'-D_GNU_SOURCE'.
'-DNDEBUG'.
'-DITIMER_HEARTBEAT=1'.
'-DNO_VM_PROFILE=1'.
'-DDEBUGVM=0' }
]
{ #category : #'as yet unclassified' }
StackRaspbianConfig >> configureBitBltSimulation: maker [
"extra rules for BitBltSimulation"
maker includeDirectories: '${pluginCross}'.
maker addCrossSources: #(
'BitBltGeneric.c'
'BitBltDispatch.c'
).
]
{ #category : #'as yet unclassified' }
StackRaspbianConfig >> defaultExternalPlugins [
^ #(
B3DAcceleratorPlugin
JPEGReaderPlugin
JPEGReadWriter2Plugin
RePlugin
InternetConfigPlugin
)
]
{ #category : #'as yet unclassified' }
StackRaspbianConfig >> defaultInternalPlugins [
" took from unixbuild/bld/plugins.int"
^ #(
ADPCMCodecPlugin
AsynchFilePlugin
BalloonEnginePlugin "B2DPlugin"
BitBltSimulation "BitBltPlugin"
BMPReadWriterPlugin
CroquetPlugin
DeflatePlugin "ZipPlugin"
DropPlugin
DSAPlugin "DSAPrims"
FFTPlugin
FileCopyPlugin
FilePlugin
FloatArrayPlugin
FloatMathPlugin
JoystickTabletPlugin
KlattSynthesizerPlugin "Klatt"
LargeIntegersPlugin "LargeIntegers"
Matrix2x3Plugin
MIDIPlugin
MiscPrimitivePlugin
Mpeg3Plugin
SecurityPlugin
SerialPlugin
SocketPlugin
SoundCodecPlugin "SoundCodecPrims"
SoundGenerationPlugin
SoundPlugin
StarSqueakPlugin
SurfacePlugin
LocalePlugin
)
]
{ #category : #'as yet unclassified' }
StackRaspbianConfig >> executableName [
^ 'PharoS'
]
{ #category : #'as yet unclassified' }
StackRaspbianConfig >> extraPluginSettings: maker [
maker isExternal ifTrue: [
"copy lib to results dir "
maker set: 'LIBRARY_OUTPUT_PATH' to: '${outputDir}'
].
maker set: #linkFlags toString: '${linkFlags}'
]
{ #category : #'as yet unclassified' }
StackRaspbianConfig >> linkFlags [
^ '-lSM -lICE -ldl -lGL -lpthread -lm -lnsl -lX11'
]
{ #category : #'as yet unclassified' }
StackRaspbianConfig >> setExtraTargetProperties: maker [
"maker setTargetProperties: 'LINK_FLAGS ""'."
maker puts: 'set_source_files_properties( ${srcVMDir}/cogit.c PROPERTIES
COMPILE_FLAGS "-O1 -fno-omit-frame-pointer -momit-leaf-frame-pointer")'.
maker
cmd: 'set_source_files_properties'
params: ' ${targetPlatform}/vm/sqUnixHeartbeat.c PROPERTIES
COMPILE_FLAGS "-O1 -fno-omit-frame-pointer"'.
maker addExternalLibraries:
#(
'm' "math lib"
'dl' "dynamic loader"
'pthread' "posix threads"
).
maker set: 'EXECUTABLE_OUTPUT_PATH' toString: self outputDir fullName.
self addVMDrivers: maker.
]