mirror of
https://github.com/gbdev/rgbds.git
synced 2026-08-25 08:14:31 +00:00
Compare commits
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
307846b03e | ||
|
|
e7e671b249 | ||
|
|
0c772ea049 | ||
|
|
6f64fd00f6 | ||
|
|
4384223951 | ||
|
|
4e87f61656 | ||
|
|
9d854114ea | ||
|
|
70d8d67ffc | ||
|
|
ca2b8e4cde | ||
|
|
80c8e77b19 | ||
|
|
604c69e048 | ||
|
|
ec5e6cbabb | ||
|
|
50678d0942 | ||
|
|
c691ec6607 | ||
|
|
c3073f4318 | ||
|
|
e5b03e3cb1 | ||
|
|
0d379e9016 | ||
|
|
9cbfec30c7 | ||
|
|
9def9c9aa8 | ||
|
|
b5681c0d34 | ||
|
|
ec43f06bd9 | ||
|
|
106ec399d5 | ||
|
|
d9c0d37fd5 | ||
|
|
3b1606c63c | ||
|
|
fa49e238a9 | ||
|
|
3426f685a0 | ||
|
|
c0e2f8340b | ||
|
|
8883251bf9 | ||
|
|
f27a8132d9 | ||
|
|
0af28de791 | ||
|
|
8d2275dc48 | ||
|
|
7e11ab4d8f | ||
|
|
e84bcf83b4 | ||
|
|
57c9bab3a5 | ||
|
|
4ada3e85d8 | ||
|
|
ba4a7f2e6a | ||
|
|
b0948566bb | ||
|
|
5aa7067876 | ||
|
|
dff176791c | ||
|
|
07f5969005 | ||
|
|
d61c0561c1 | ||
|
|
b13b0c8eb8 | ||
|
|
ca2de0f429 | ||
|
|
a821badc3e | ||
|
|
cb34fe18f7 | ||
|
|
1ed22cc518 | ||
|
|
9a15b723f2 | ||
|
|
7e2a3491a5 | ||
|
|
e7855ea1b8 | ||
|
|
19e60d9864 | ||
|
|
c0ff3d92ad | ||
|
|
e4583e7ac2 | ||
|
|
5869e0dc60 | ||
|
|
196d50c1d7 | ||
|
|
8b951bc047 | ||
|
|
59b6b15106 | ||
|
|
304cbb464f | ||
|
|
ea3a8ee171 | ||
|
|
f0419eb183 | ||
|
|
4a6ea35299 | ||
|
|
08354cf573 | ||
|
|
417b5212d4 | ||
|
|
66312f55dd | ||
|
|
21eaa2d2cc | ||
|
|
e9fa1e4e94 | ||
|
|
8ab6190f96 | ||
|
|
22bd8a9bd5 | ||
|
|
96bc58b7f7 | ||
|
|
4857ad1e00 | ||
|
|
3b33c942ae | ||
|
|
5525dd902b | ||
|
|
4350a3252d | ||
|
|
a8442bccc7 | ||
|
|
00006a9d00 | ||
|
|
a383bec96e | ||
|
|
226031c18b | ||
|
|
24a896f60a | ||
|
|
a6f5e3efd1 | ||
|
|
c02b234bb1 | ||
|
|
be4c1161bd | ||
|
|
0e1e5e80f6 | ||
|
|
118f1f7543 | ||
|
|
eaa35ed26d | ||
|
|
7b39bcd412 | ||
|
|
255cd7f7f6 | ||
|
|
b8011947a8 | ||
|
|
39e7e064c9 | ||
|
|
7b97d7ce15 | ||
|
|
c667bac93a | ||
|
|
db96144d49 | ||
|
|
276a1a7952 | ||
|
|
b219e03b38 | ||
|
|
824ebd80f9 | ||
|
|
5aedf31b46 | ||
|
|
d94d0bcc2f | ||
|
|
ed8e3e4d02 | ||
|
|
30fd4514dc | ||
|
|
08e83601f5 | ||
|
|
e606f4e997 | ||
|
|
9008d8391c | ||
|
|
21682e8814 | ||
|
|
f82b0838a1 | ||
|
|
dabd0a08d2 | ||
|
|
c3e10dbb03 | ||
|
|
3883c2a2b8 | ||
|
|
cd0caaaceb | ||
|
|
1e4a060d9e | ||
|
|
fe3b238dea | ||
|
|
46a6966b70 | ||
|
|
be3fc61859 | ||
|
|
0adbb92e50 | ||
|
|
09da4e001a | ||
|
|
3eb8c7e8f2 | ||
|
|
189c679e13 | ||
|
|
5d5000011a | ||
|
|
f81f5fe63c | ||
|
|
6e643406a2 | ||
|
|
de36a11be7 | ||
|
|
799c55b4dd | ||
|
|
ddd8f37508 | ||
|
|
c55dec254d | ||
|
|
0996a2f5ed | ||
|
|
e3c594c250 | ||
|
|
daba94b495 | ||
|
|
2f604bfa9a | ||
|
|
9bbb2247a7 | ||
|
|
9b4df11473 | ||
|
|
4a77c42ed7 | ||
|
|
b12eac356e | ||
|
|
82702d8149 | ||
|
|
1f9cc9651a | ||
|
|
04b9c7fa3d | ||
|
|
5e8a6cde20 | ||
|
|
d59081a918 | ||
|
|
250a94c588 | ||
|
|
37818a1847 | ||
|
|
0e3d1df129 | ||
|
|
586c3073f9 | ||
|
|
e3fc46f933 | ||
|
|
3941a28661 | ||
|
|
a829e6c067 | ||
|
|
b252877b05 | ||
|
|
22a3625144 | ||
|
|
6cba5518e9 | ||
|
|
caf561457d | ||
|
|
fc7d9ad573 | ||
|
|
0b91bf654b | ||
|
|
6b2b6e6000 | ||
|
|
f72a4d53e2 | ||
|
|
998f636495 | ||
|
|
075f132d77 | ||
|
|
31e1d2ec87 | ||
|
|
673c62414f | ||
|
|
007672f080 | ||
|
|
7eaca1577d | ||
|
|
996469ee28 | ||
|
|
55db252a8f | ||
|
|
cfa0adf295 | ||
|
|
ed19806434 | ||
|
|
a0d96a0856 | ||
|
|
4b992bfea5 | ||
|
|
141a7fe22b | ||
|
|
43ffc89bb4 | ||
|
|
72a410c007 | ||
|
|
090768e2c9 | ||
|
|
5f2ee530b8 | ||
|
|
4a173130b9 | ||
|
|
ef2f021892 | ||
|
|
dce14fd4b8 | ||
|
|
728bed39d5 | ||
|
|
48fcd9a0ca | ||
|
|
1871b0a0b8 | ||
|
|
d56dbbb4bf | ||
|
|
728d14879b | ||
|
|
0ed8c2f8ee | ||
|
|
d5186b088b | ||
|
|
fee177d0b9 | ||
|
|
42e3da837c | ||
|
|
358e8fe636 | ||
|
|
c50a849757 | ||
|
|
57111b219a | ||
|
|
be2d028ae6 | ||
|
|
1af8bdda16 | ||
|
|
fa22b78e7d | ||
|
|
f0161b41c8 | ||
|
|
ca23210f18 | ||
|
|
85e044f5be | ||
|
|
60e76b2da4 | ||
|
|
3c7488c131 | ||
|
|
9fd0c0297f | ||
|
|
c1c7e64249 | ||
|
|
a18b2f1049 | ||
|
|
3f144b7713 | ||
|
|
eeb3a73210 | ||
|
|
37d39f91f6 | ||
|
|
d5ce5329ea | ||
|
|
6bcd79b997 | ||
|
|
decc5f7153 | ||
|
|
a3c953ea46 | ||
|
|
d43049c84d | ||
|
|
b6ff54acc3 | ||
|
|
71fc449452 | ||
|
|
59dd1fbbf8 | ||
|
|
2502d130eb | ||
|
|
a78a268cb4 | ||
|
|
0553491107 | ||
|
|
6edac50cc4 | ||
|
|
77dceaf43a | ||
|
|
cfec017fed | ||
|
|
12186fdccc | ||
|
|
71dfab3365 | ||
|
|
20b11039c9 | ||
|
|
eb9e9c0f33 | ||
|
|
ac2a022124 | ||
|
|
1249c4ef58 | ||
|
|
aeedfb35a6 | ||
|
|
63609871f4 | ||
|
|
393eaa9dc1 | ||
|
|
b3c3981a90 | ||
|
|
185a5c5369 | ||
|
|
4ea15ed85a | ||
|
|
b218fd65a0 | ||
|
|
81edc27b6e | ||
|
|
dc52487d31 | ||
|
|
6b994b1737 | ||
|
|
0849eb801e | ||
|
|
e6916360f4 | ||
|
|
a802bcb320 | ||
|
|
846aa975f1 | ||
|
|
b65649ca73 | ||
|
|
62ddabb570 | ||
|
|
d48d6fe5d9 | ||
|
|
ac0f93ffda | ||
|
|
a1712cb6d9 | ||
|
|
2968bee86f | ||
|
|
dec7a74166 | ||
|
|
9c4e53d1c4 | ||
|
|
463edc3c01 | ||
|
|
73941c3249 | ||
|
|
7596ae67b5 | ||
|
|
fc08ab6aee | ||
|
|
c7663423d6 | ||
|
|
1ff73cd5e0 | ||
|
|
65ec1af1e8 | ||
|
|
bc3572ec37 | ||
|
|
78281a4aaa | ||
|
|
6e51ab6f55 | ||
|
|
52aaf7e3b3 | ||
|
|
09db4f25dd | ||
|
|
fed5db7743 | ||
|
|
c6dbec7830 | ||
|
|
017b0119e6 | ||
|
|
0e6e91d048 | ||
|
|
df0b557638 | ||
|
|
123201ecc6 | ||
|
|
422e8eec20 | ||
|
|
49a4da2235 | ||
|
|
4577ff16bc | ||
|
|
b430d5a8b8 | ||
|
|
a5be1d886e | ||
|
|
c3b47abcc8 | ||
|
|
2cfb2b2533 | ||
|
|
187e1a55b8 | ||
|
|
143d503c6c | ||
|
|
6e13779b8b | ||
|
|
ace2f3e613 | ||
|
|
8d1a60d6b5 | ||
|
|
11ac22d8f5 | ||
|
|
812e1f6d4b | ||
|
|
8dc052475b | ||
|
|
133eaa4e92 | ||
|
|
57f1894fbd | ||
|
|
021fe01eb0 | ||
|
|
9b4b4a581b | ||
|
|
bcff14b596 | ||
|
|
11f6278d95 | ||
|
|
ede9405daf | ||
|
|
25bf0e9e2c | ||
|
|
167a7ee80c | ||
|
|
4ce4162da4 | ||
|
|
18b074711e | ||
|
|
44b6a2c453 | ||
|
|
3fc3130364 | ||
|
|
5090395ca7 | ||
|
|
efd4373a56 | ||
|
|
92a31ff7df | ||
|
|
8025c2ae66 | ||
|
|
f7831ce8da | ||
|
|
b736fa22ff | ||
|
|
0692d1d28c | ||
|
|
4b69d5cc8a | ||
|
|
52aa518e20 | ||
|
|
919a5dba89 | ||
|
|
d9932b9031 | ||
|
|
66e521e9e5 | ||
|
|
b8e425b41d | ||
|
|
6b0658fb59 | ||
|
|
91fdfcd179 | ||
|
|
5abebcf61f | ||
|
|
145473d9bd | ||
|
|
2fb64816a9 | ||
|
|
7cf330e3f9 | ||
|
|
2e66515096 | ||
|
|
c93f377bfb | ||
|
|
d6d1844d60 | ||
|
|
fd38a3dbc4 | ||
|
|
60d58723aa | ||
|
|
a9b6cda77b | ||
|
|
091452d591 | ||
|
|
df1d909853 | ||
|
|
fb4e08ce71 | ||
|
|
7244b9d17e | ||
|
|
5c4ca36c5a | ||
|
|
292c297518 | ||
|
|
a5bb431d47 | ||
|
|
10e1c9d187 | ||
|
|
d8722b6705 | ||
|
|
2d0ac7eeb0 | ||
|
|
d5033a2bd9 | ||
|
|
45fff0fd58 | ||
|
|
c963c7b1c7 | ||
|
|
63c7835e71 | ||
|
|
35af3185eb | ||
|
|
db9d9c7653 | ||
|
|
9e5a9107f2 | ||
|
|
275fcf8fcf | ||
|
|
bc37b0ece6 | ||
|
|
e63ce24e48 | ||
|
|
d524884799 | ||
|
|
34e1f8dcc5 | ||
|
|
cd64de9323 | ||
|
|
a01b805e4b | ||
|
|
a139cbc744 | ||
|
|
06e5386d93 | ||
|
|
37f57a752f | ||
|
|
670bdf2095 | ||
|
|
6270f654a1 | ||
|
|
676db46c01 | ||
|
|
8979b54281 | ||
|
|
a6f03530ed | ||
|
|
b56b56a695 | ||
|
|
dc5fc9f327 | ||
|
|
3d35457eeb | ||
|
|
aea39ec8c8 | ||
|
|
9293068370 | ||
|
|
d054f07703 | ||
|
|
65b0b49720 | ||
|
|
48d58ba095 | ||
|
|
af0505b4cd | ||
|
|
7c1e1fe515 | ||
|
|
d053025070 | ||
|
|
ade898d815 | ||
|
|
e738b90c69 | ||
|
|
a91d26192d | ||
|
|
92bfe5d930 | ||
|
|
41fe1d8f25 | ||
|
|
63a911e657 | ||
|
|
a9ab248fed | ||
|
|
9b22ff3491 | ||
|
|
a4af81f250 | ||
|
|
e08de399db | ||
|
|
d4e0ca5f90 | ||
|
|
2666dcbc26 | ||
|
|
27dca5680c | ||
|
|
b0e0dfc56e | ||
|
|
33475e2c36 | ||
|
|
c8161be23a | ||
|
|
2c5c453ab8 | ||
|
|
c3e245c13e | ||
|
|
3631fab63c | ||
|
|
1c00123b33 | ||
|
|
131bb97ebc | ||
|
|
8d6c617875 | ||
|
|
752e2b3620 | ||
|
|
ad3188f038 | ||
|
|
a6eb6457d8 | ||
|
|
0d3276975e | ||
|
|
d961c697d7 | ||
|
|
1eb4eb3339 | ||
|
|
a3d3e1525a | ||
|
|
3553c9c4da | ||
|
|
5c2c893ced | ||
|
|
0f266d1c66 | ||
|
|
8ab4602ae5 | ||
|
|
04e3a904c2 | ||
|
|
395b03e88e | ||
|
|
fb9fa6038c | ||
|
|
35e5808423 | ||
|
|
558d3ca0fc | ||
|
|
df5162edca | ||
|
|
2519d1e698 | ||
|
|
ca383c91ca | ||
|
|
8bedd710d7 | ||
|
|
efb5a88edb | ||
|
|
f065243cd2 | ||
|
|
a0bb830679 | ||
|
|
7654c6e27a | ||
|
|
400375b2e5 | ||
|
|
7462bccb72 | ||
|
|
2873e0b8c8 | ||
|
|
1badba03d8 | ||
|
|
64bcef99bd | ||
|
|
aa672bbec9 | ||
|
|
651877e094 | ||
|
|
26c48cc409 | ||
|
|
23b9039716 | ||
|
|
711fba5e35 | ||
|
|
089fc11e31 | ||
|
|
837f552987 | ||
|
|
cb8c973453 | ||
|
|
cca3794dd0 | ||
|
|
02c2408f58 | ||
|
|
fba0562650 | ||
|
|
0c9920d4a6 | ||
|
|
7733ccdeb6 | ||
|
|
13e85b5151 | ||
|
|
268b586c9d | ||
|
|
85d3b5df58 | ||
|
|
eea277ae9c | ||
|
|
538395b92c | ||
|
|
3108fb5297 | ||
|
|
f99591bf6f | ||
|
|
0297da4d4c | ||
|
|
96b953fe51 | ||
|
|
0670c03bc2 | ||
|
|
09ef5b7e06 | ||
|
|
d5bb462f25 | ||
|
|
b0727e9779 | ||
|
|
ca4b890273 | ||
|
|
96a75500d3 | ||
|
|
634fd853d1 | ||
|
|
c8d22d8744 | ||
|
|
3ece61b103 | ||
|
|
a82fd17529 | ||
|
|
e7f5ab3f55 | ||
|
|
595c87b2f8 | ||
|
|
c49a7d1e2f | ||
|
|
d8aff148bb | ||
|
|
e31bcabbaa | ||
|
|
67741ab428 | ||
|
|
e0a6199f83 | ||
|
|
6cffd991f7 | ||
|
|
1fdeb34e50 | ||
|
|
9f16881d64 | ||
|
|
223b3d1921 | ||
|
|
65d408eb5d | ||
|
|
3677ab2ebf | ||
|
|
d404621e0d | ||
|
|
c8a088f281 | ||
|
|
94ed28acf8 | ||
|
|
00b5077b2a | ||
|
|
024b33b63a | ||
|
|
dcc10cebc3 | ||
|
|
1fc9ba86c4 | ||
|
|
e569e0c200 | ||
|
|
f7fb3af615 | ||
|
|
1dfc1d3231 | ||
|
|
891e6f98df | ||
|
|
bdc885bd69 | ||
|
|
5b67dc94b6 | ||
|
|
4f702a4be8 | ||
|
|
c5d437ab3c | ||
|
|
c5c2800f17 | ||
|
|
c798500563 | ||
|
|
590d113e94 | ||
|
|
ee1db0a582 | ||
|
|
5701d747d4 | ||
|
|
2110aaca20 | ||
|
|
8df88f92ba | ||
|
|
534a4efee4 | ||
|
|
cc96b4d517 | ||
|
|
0ccdbf509a | ||
|
|
531278961f | ||
|
|
85176ef10a | ||
|
|
02b880e1b0 | ||
|
|
c6997fe73c | ||
|
|
c578a7b761 | ||
|
|
8564df51e5 | ||
|
|
62d3b44768 | ||
|
|
ead5337fe0 | ||
|
|
0d509aa65c | ||
|
|
fcfc931867 | ||
|
|
3d155d5695 | ||
|
|
92ed6ece53 | ||
|
|
e0e9ef190a | ||
|
|
386fb5f398 | ||
|
|
94e9ef5213 | ||
|
|
0c4c25b2d2 | ||
|
|
f7167d8115 | ||
|
|
b7e0783ae7 | ||
|
|
77a105e189 | ||
|
|
a16dcc0ea5 | ||
|
|
9f373d49ac | ||
|
|
272019beb0 | ||
|
|
db6793f444 | ||
|
|
ea1358bbe6 | ||
|
|
2bdf61da70 | ||
|
|
92826a726a | ||
|
|
9c3ce69180 | ||
|
|
50d0b101c3 | ||
|
|
1bf1219e07 | ||
|
|
7b405513d9 | ||
|
|
7df9c12a6c | ||
|
|
30a8503dcd | ||
|
|
02310489c6 | ||
|
|
5f8b7474b4 | ||
|
|
92a9c73ee7 | ||
|
|
7ade3e74b3 | ||
|
|
978e832914 | ||
|
|
2130a5ba1f | ||
|
|
9fc83efe06 | ||
|
|
e41ce49698 | ||
|
|
1574b5b1f7 | ||
|
|
3f6db080b4 | ||
|
|
f9a55bd5cd | ||
|
|
a4a830776b | ||
|
|
34d99b273c | ||
|
|
feb8365812 | ||
|
|
bf66e346f0 | ||
|
|
3a0a4b7f90 | ||
|
|
39f0f9edc0 | ||
|
|
a3983b7b0f | ||
|
|
504a45a4ed | ||
|
|
98c5c7f776 | ||
|
|
7020cf7188 | ||
|
|
70d129fcd7 | ||
|
|
2d5f4d8910 | ||
|
|
26c6911c8f | ||
|
|
f1fd3abcff | ||
|
|
2cae47a5a2 | ||
|
|
ac75a085fa | ||
|
|
0c1b422c36 | ||
|
|
23ce888d65 | ||
|
|
d992b21141 | ||
|
|
903492cce2 | ||
|
|
fc9b614225 | ||
|
|
543b7fa6c2 | ||
|
|
5a7ffd19b0 | ||
|
|
7be7483571 | ||
|
|
2eeb333be0 | ||
|
|
fe8baaec50 | ||
|
|
752b273aec | ||
|
|
b51056f743 | ||
|
|
ee1aed51d8 | ||
|
|
db2cda790c | ||
|
|
86b43ea14f | ||
|
|
d1829ed923 | ||
|
|
6d53bc4121 | ||
|
|
32b5ef5095 | ||
|
|
a36f2b3b7d | ||
|
|
cd4be6aa07 | ||
|
|
499edaecd0 | ||
|
|
225490163e | ||
|
|
d388a60daa | ||
|
|
6d05de9d4d | ||
|
|
5d6e571338 | ||
|
|
308d488833 | ||
|
|
cecbf0aa0e | ||
|
|
d21e6669ce | ||
|
|
2341d1ee50 | ||
|
|
53949761a7 | ||
|
|
f7eb986313 | ||
|
|
75aed1afd5 | ||
|
|
d16751f56a | ||
|
|
8b1a5244f7 | ||
|
|
b2747dfbd8 | ||
|
|
16e16cdf51 | ||
|
|
a353637a90 | ||
|
|
f3cbfcecf4 | ||
|
|
3bc8b1ff7c | ||
|
|
aa46c79db6 | ||
|
|
92acb6e547 | ||
|
|
ac632d9223 | ||
|
|
0df5b7b86d | ||
|
|
87c10988ed | ||
|
|
d6a28a6259 | ||
|
|
c6d0e8de63 | ||
|
|
ded4ef4072 | ||
|
|
1849a35e61 | ||
|
|
18e35053fa | ||
|
|
7e151f16c3 | ||
|
|
2ce4cdbff6 | ||
|
|
eea532ded1 | ||
|
|
c83b87e0a0 | ||
|
|
8d268e8a8a | ||
|
|
ee0f311c10 | ||
|
|
61730be6ce | ||
|
|
5f333d9753 | ||
|
|
d1493a9f96 | ||
|
|
d652212857 | ||
|
|
0cd60ea1e6 | ||
|
|
a0e23ee911 | ||
|
|
ad81c74cda | ||
|
|
9ef32e405c | ||
|
|
89ca6a325c | ||
|
|
9e0e7ef9a1 | ||
|
|
2dc948fefb | ||
|
|
e3a5290dad | ||
|
|
cfe1f60e47 | ||
|
|
0eed237517 | ||
|
|
68ffb01cac | ||
|
|
169ac61e14 | ||
|
|
0681110647 | ||
|
|
8d1b111692 | ||
|
|
2935942667 | ||
|
|
9a4593e823 | ||
|
|
250e08043b | ||
|
|
14f5e16ae8 | ||
|
|
bf69043a1d | ||
|
|
7086b8aeff | ||
|
|
53c39d01d4 | ||
|
|
4a2f9fc744 | ||
|
|
e7d63f5f6b | ||
|
|
b80b30fba1 | ||
|
|
8e84850679 | ||
|
|
e31256c0d4 | ||
|
|
9a9fd6603c | ||
|
|
e99ff5ac45 | ||
|
|
60cec85638 | ||
|
|
39f2ed1339 | ||
|
|
4c8724899b | ||
|
|
0c96234532 | ||
|
|
9dddd87893 | ||
|
|
5eb093f13e | ||
|
|
529989bde5 | ||
|
|
776e37980b | ||
|
|
7f24d46d44 | ||
|
|
cf6e5fec63 | ||
|
|
d8fc25ee43 | ||
|
|
a0eccceb01 | ||
|
|
2720224890 | ||
|
|
8bebab1db0 | ||
|
|
ee29579d3e | ||
|
|
5aec36350b | ||
|
|
1fecf80659 | ||
|
|
b6d77fbb9e | ||
|
|
8a19c5c30a | ||
|
|
0149122cd0 | ||
|
|
35335aadbe | ||
|
|
80df858ee3 | ||
|
|
eafc32fd68 | ||
|
|
2adeda0318 | ||
|
|
21a6d35b8b | ||
|
|
ce78280af3 | ||
|
|
041b86b8dd | ||
|
|
611b0041c4 | ||
|
|
ddb2acb652 | ||
|
|
da133baf17 | ||
|
|
d32b1912ed | ||
|
|
82513e5255 | ||
|
|
f2708ce967 | ||
|
|
01a5c94c7e | ||
|
|
e7a05b1db8 | ||
|
|
510a4aa99d | ||
|
|
3f4e8396aa | ||
|
|
276a200590 | ||
|
|
a40109e4e4 | ||
|
|
34cf959c9d | ||
|
|
bf6875f160 | ||
|
|
44f5b47bf0 | ||
|
|
41ab5dff5a | ||
|
|
5e43ece578 | ||
|
|
9acba4b412 | ||
|
|
8c50839109 | ||
|
|
6736d2ec66 | ||
|
|
6869e4807c | ||
|
|
5de05e2e4b | ||
|
|
fda54fd0c3 | ||
|
|
35962dedc4 | ||
|
|
991b74dd0d | ||
|
|
1a77667409 | ||
|
|
c9765ec158 | ||
|
|
202c91471c | ||
|
|
e14f68d1d7 | ||
|
|
185a3b29e6 | ||
|
|
d7b1569ee6 | ||
|
|
468f1cd912 | ||
|
|
965288de38 | ||
|
|
008920f533 | ||
|
|
20ed6a52ee | ||
|
|
8b85875b67 | ||
|
|
7054d81650 | ||
|
|
5942117ac3 | ||
|
|
e7a3b9d90e | ||
|
|
b13d623ad4 | ||
|
|
37bf9fae01 | ||
|
|
612cf3b7dd | ||
|
|
089e366ddc | ||
|
|
fa9e29e4ce | ||
|
|
fa3d83a3d1 | ||
|
|
804db4e073 | ||
|
|
5d998ef483 | ||
|
|
126b1e5726 | ||
|
|
4f2400c15b | ||
|
|
063d284cbf | ||
|
|
205bf5a11d | ||
|
|
41c94aa448 | ||
|
|
d413870e6d | ||
|
|
e95ac6fb06 | ||
|
|
e1ae92709c | ||
|
|
1715f85d50 | ||
|
|
c2de0a991a | ||
|
|
2e6e1ccf06 | ||
|
|
081f48404c | ||
|
|
bdac0ce053 | ||
|
|
122d91509f | ||
|
|
7c6f778ae7 | ||
|
|
8cf6c5423a | ||
|
|
56f7222230 | ||
|
|
e45b9625ca | ||
|
|
e0a8eb8aff | ||
|
|
2a5b9b5f98 | ||
|
|
a72843748f | ||
|
|
762e2311d2 | ||
|
|
0b7cda9e0c | ||
|
|
df83bc31d2 | ||
|
|
bc8d99d915 | ||
|
|
c841672059 | ||
|
|
75b605797d | ||
|
|
00d0ae840d | ||
|
|
2cdbb145da | ||
|
|
d8192560b0 | ||
|
|
9b395f3bf1 | ||
|
|
0150eb4bf3 | ||
|
|
632342b254 | ||
|
|
c9060c7f2d | ||
|
|
993879a2ed | ||
|
|
62309d5c87 | ||
|
|
b2e865ee2a | ||
|
|
3feb75f84f | ||
|
|
ad4d9da4cf | ||
|
|
1489854932 | ||
|
|
2aef09c8d9 | ||
|
|
48412e9c56 | ||
|
|
177a3abfac | ||
|
|
4c916b8da8 | ||
|
|
d9d381cb62 | ||
|
|
fbde24ee17 | ||
|
|
91310c9eb6 | ||
|
|
81ea4ee920 | ||
|
|
29ece2940d | ||
|
|
03452c6d4f | ||
|
|
b35e9d86fb | ||
|
|
e20347e38c | ||
|
|
f61019dd68 | ||
|
|
c19ddc80f0 | ||
|
|
a59867cd78 | ||
|
|
375adc6804 | ||
|
|
44caffe04a | ||
|
|
d54619a453 | ||
|
|
e49291b7cf | ||
|
|
34a9c8e083 | ||
|
|
c4b456b166 | ||
|
|
79401cce8b | ||
|
|
4e44958d26 | ||
|
|
cae31005f8 | ||
|
|
25c9f8f383 | ||
|
|
01c9106b59 | ||
|
|
192fc808c8 | ||
|
|
9c8e327ae2 | ||
|
|
9ebd2a7e8e | ||
|
|
b8b60207f5 | ||
|
|
c5e59f40fd | ||
|
|
a354af3d08 | ||
|
|
20c18256ed | ||
|
|
890528812e | ||
|
|
84f59e14ed | ||
|
|
91d7ce5e09 | ||
|
|
d9654b752f | ||
|
|
157826bf82 | ||
|
|
a5e36f924f | ||
|
|
82f7bdb480 | ||
|
|
056190413e | ||
|
|
c2db23aef0 | ||
|
|
2426068409 | ||
|
|
147a5c9bf3 | ||
|
|
6ae3f040b8 | ||
|
|
e561f63db3 | ||
|
|
af9de812ec | ||
|
|
edc9e07a2d | ||
|
|
382ad17969 | ||
|
|
fac5e35d24 | ||
|
|
a85d6b3b57 | ||
|
|
f23a14afc7 | ||
|
|
f63167dd0f | ||
|
|
0ee4ba95b3 | ||
|
|
727c1f5b50 | ||
|
|
d829fd2ffe | ||
|
|
b13c0f2f8e | ||
|
|
d9773424e4 | ||
|
|
4e2464a69d | ||
|
|
a5f12f66bb | ||
|
|
73ad431b8d | ||
|
|
d88feee1c0 | ||
|
|
5963dc9e0e | ||
|
|
8363f25d47 | ||
|
|
72b2a4d7c0 | ||
|
|
06daf2a9b5 | ||
|
|
ad95d2e06f | ||
|
|
5197e6b79f | ||
|
|
b99ce3845e | ||
|
|
d63955eccd | ||
|
|
2c4fc4cbe8 | ||
|
|
7d3c31b6d8 | ||
|
|
151f83db6d | ||
|
|
22838ce2d8 | ||
|
|
b058bb6e15 | ||
|
|
36b04b5dea | ||
|
|
a7296ecb31 | ||
|
|
92917ceb2f | ||
|
|
c1c5b10082 | ||
|
|
f44de0c7ae | ||
|
|
b18cfe6bdb | ||
|
|
a8ec9228d4 | ||
|
|
c1b85554a8 | ||
|
|
b877c81c32 | ||
|
|
e66da4c8c7 | ||
|
|
573e044b30 | ||
|
|
ceb43c7aa4 | ||
|
|
eae1ecb77e | ||
|
|
c4de6c402b | ||
|
|
0b147c9386 | ||
|
|
6982c8a116 | ||
|
|
d5f39c8dce | ||
|
|
a5d18d62df | ||
|
|
a27f704c25 | ||
|
|
9216485bca | ||
|
|
c33acb905b | ||
|
|
81c3521610 | ||
|
|
e0ee9dc3ad | ||
|
|
cb546f0cd8 | ||
|
|
a60186db2f | ||
|
|
d9f87a5721 | ||
|
|
a7fdb2c3d3 | ||
|
|
5efd303b7f | ||
|
|
0d3980d039 | ||
|
|
ab6244d81c | ||
|
|
7fcf4ba60f | ||
|
|
f048cbbb11 | ||
|
|
4c495c31d9 | ||
|
|
90286ccbbc | ||
|
|
b33aa31944 | ||
|
|
dd6c741143 | ||
|
|
3b3263273c | ||
|
|
bc5a71ff88 | ||
|
|
e623aeb85d | ||
|
|
a2ff653a83 | ||
|
|
a13723c523 | ||
|
|
cf85146353 | ||
|
|
a9e49a09fd | ||
|
|
cbe44fed9b | ||
|
|
c439b8e27f | ||
|
|
86bf289452 | ||
|
|
e1ac7f389d | ||
|
|
d5159f66be | ||
|
|
c7a029a051 | ||
|
|
d5ded84501 | ||
|
|
4cd0dd5314 | ||
|
|
9783671399 | ||
|
|
8037b9e10a | ||
|
|
7c74653aa1 | ||
|
|
22767e36e2 | ||
|
|
6b89938da7 | ||
|
|
15919e550f | ||
|
|
f93587c805 | ||
|
|
a870f7de10 | ||
|
|
6b72067387 | ||
|
|
84c01f064f | ||
|
|
5d3e96662e | ||
|
|
91580043e0 | ||
|
|
3e28e92622 | ||
|
|
d494f73825 | ||
|
|
b03a5b13b7 | ||
|
|
37b64ca51f | ||
|
|
deb3ac3452 | ||
|
|
dd20012e88 | ||
|
|
91fbece1ad | ||
|
|
0597ff82e3 | ||
|
|
9ef2e43bf7 | ||
|
|
197f6cb0ba | ||
|
|
9b3d19c3f2 | ||
|
|
02439b18c0 | ||
|
|
122ef95d9c | ||
|
|
bfb96b038d | ||
|
|
1adf68d018 | ||
|
|
750e69c5a6 | ||
|
|
6e83a14143 | ||
|
|
cff05435ad | ||
|
|
3b59e8963e | ||
|
|
56af572bfd | ||
|
|
6bc2446966 | ||
|
|
155e7287db | ||
|
|
1dcc000572 | ||
|
|
8cd0e66297 | ||
|
|
5f07095f6d | ||
|
|
11f0e88b30 | ||
|
|
d917df406d | ||
|
|
323028d9f2 | ||
|
|
7960a10228 | ||
|
|
068ad93427 | ||
|
|
610f04beeb | ||
|
|
e289387b09 | ||
|
|
80d37f9988 | ||
|
|
1283b0b6a6 | ||
|
|
a098213053 | ||
|
|
6b8d33529e | ||
|
|
2fb76ce584 | ||
|
|
7330c2c606 | ||
|
|
c07371c9fc | ||
|
|
15f0871683 | ||
|
|
26fcff831d | ||
|
|
3a5ff35928 | ||
|
|
38a90890fb | ||
|
|
de84e3ea8b | ||
|
|
b77ba1d87d | ||
|
|
4ce6c9f4a5 | ||
|
|
8286d9c462 | ||
|
|
fbe28e0def | ||
|
|
23272f028f | ||
|
|
77129b9e80 | ||
|
|
44332ff4be | ||
|
|
81ab133566 | ||
|
|
0e8a17ce82 | ||
|
|
7bc9a24bf0 | ||
|
|
b438c83bda | ||
|
|
82e81ab1da | ||
|
|
57c3d74b9e | ||
|
|
7d98b9a900 | ||
|
|
8f47fb494b | ||
|
|
8c96293b11 | ||
|
|
57f122a04e | ||
|
|
356367bfd3 | ||
|
|
b7290366cb | ||
|
|
731715ff36 | ||
|
|
7cf4156003 | ||
|
|
ee3a93a442 | ||
|
|
96a0481cba | ||
|
|
86140b5b2f | ||
|
|
369296693c | ||
|
|
47b2e0e912 | ||
|
|
28733fe312 | ||
|
|
e45a422da3 | ||
|
|
9fd4ba90cc | ||
|
|
e548ecc6fa | ||
|
|
00b0914436 | ||
|
|
60c03ec1e3 | ||
|
|
379aa8c267 | ||
|
|
589cea47f6 | ||
|
|
68a6abd00e | ||
|
|
c42e856efb | ||
|
|
b987e5669f | ||
|
|
718066c2cf | ||
|
|
2d530dbcd6 | ||
|
|
a9140e6bb4 | ||
|
|
fb6f861a08 | ||
|
|
0adff57e2c | ||
|
|
784e828219 | ||
|
|
b20b2dd28c | ||
|
|
2a85009b6b | ||
|
|
809b364958 | ||
|
|
60f9e86361 | ||
|
|
817dcfdc70 | ||
|
|
a3f9952b9e | ||
|
|
0cd79c33ef | ||
|
|
747427e801 | ||
|
|
6b09838739 | ||
|
|
0f1137c6ec | ||
|
|
1ad9383042 | ||
|
|
5b486e1d87 | ||
|
|
e93190d491 | ||
|
|
7435630d6a | ||
|
|
fc8707886c | ||
|
|
bb480b761c | ||
|
|
2706f94788 | ||
|
|
2f8f99bd94 | ||
|
|
f304e1dd7f | ||
|
|
c5e6a815fa | ||
|
|
d4231f9efa | ||
|
|
e4ffcf7153 | ||
|
|
1d194b68ca | ||
|
|
9a5b3f0902 | ||
|
|
436580a649 | ||
|
|
8af9e9d465 | ||
|
|
98bca79df4 | ||
|
|
dae4219acd | ||
|
|
3d1f5386c2 | ||
|
|
1f8f28cac8 | ||
|
|
8e60d1f0b8 | ||
|
|
d8aceaea4a | ||
|
|
a23b4732e3 | ||
|
|
3bd35a8848 | ||
|
|
41046c287f | ||
|
|
f4d0f01f91 | ||
|
|
0ed846c773 | ||
|
|
4e0f794c23 | ||
|
|
6a65cbc9ed | ||
|
|
92abe24894 | ||
|
|
13a8895fca | ||
|
|
e179ba5fd3 | ||
|
|
1d89d75381 | ||
|
|
c0904228f2 | ||
|
|
556c8a968a | ||
|
|
ed5529d639 | ||
|
|
240ab8ed1c | ||
|
|
0433714d77 | ||
|
|
ee748cfe26 | ||
|
|
623c3f662c | ||
|
|
9cc595b2cc | ||
|
|
8c3ca462fe | ||
|
|
9e1898238d | ||
|
|
b3c94b5b87 | ||
|
|
82f60e26c4 | ||
|
|
dfec7111e2 | ||
|
|
c5c6cc9794 | ||
|
|
39e9315e8a | ||
|
|
352551d4f8 | ||
|
|
e2633d5b66 | ||
|
|
3e9d2cab12 | ||
|
|
7aecc00919 | ||
|
|
b8387427a6 | ||
|
|
a234da42a6 | ||
|
|
1d39e5ed56 | ||
|
|
9ab3446d1a | ||
|
|
6b5248f15b | ||
|
|
eb708ebee5 | ||
|
|
cf3e5e15f8 | ||
|
|
408a783fd8 | ||
|
|
17afe611fd | ||
|
|
996db14ffa | ||
|
|
7326cc6875 | ||
|
|
9dac583e45 | ||
|
|
ccfd3b6af8 | ||
|
|
4a4656af1b | ||
|
|
b021090e7f | ||
|
|
230b1db438 | ||
|
|
14b72222b1 | ||
|
|
106e516962 | ||
|
|
6f74e4fb9c | ||
|
|
83c0634f15 | ||
|
|
4172d330b9 | ||
|
|
cf7bdb19b6 | ||
|
|
20b7b591d4 | ||
|
|
d327138cd8 | ||
|
|
0c0923ac16 | ||
|
|
e5078aba3b | ||
|
|
cae7b5dcf6 | ||
|
|
506911d7d0 | ||
|
|
dcb4e40388 | ||
|
|
912a1504ec | ||
|
|
2ef5e807f8 | ||
|
|
b6039870e5 | ||
|
|
78801e324c | ||
|
|
bf0cabb3ea | ||
|
|
a68bebf4a2 | ||
|
|
32db0a0f18 | ||
|
|
a167d23d01 | ||
|
|
8b6ae994b1 | ||
|
|
2b44672873 | ||
|
|
3568418c5d | ||
|
|
cb59119881 | ||
|
|
d9e5e57e27 | ||
|
|
e9e8915725 | ||
|
|
c075ffb570 | ||
|
|
96c808810f | ||
|
|
6a5518e0c5 | ||
|
|
507439bc25 | ||
|
|
b85c5cde8f | ||
|
|
e255af9e10 | ||
|
|
9f239f6dcc | ||
|
|
412073774c | ||
|
|
52e8e1f9fc | ||
|
|
04405fb444 | ||
|
|
dd43723e20 | ||
|
|
de667c8afb | ||
|
|
f792580816 | ||
|
|
0f772932a5 | ||
|
|
0300971a17 | ||
|
|
32b4a6f284 | ||
|
|
6560b7819d | ||
|
|
0af1e512c2 | ||
|
|
035678d250 | ||
|
|
554778da5b | ||
|
|
fec2266dd8 | ||
|
|
33dd97b6a0 | ||
|
|
a862c7b17b | ||
|
|
40db9d5cef | ||
|
|
05d79d87f6 | ||
|
|
e96675be03 | ||
|
|
472d1bde06 | ||
|
|
6cabb8c9af | ||
|
|
7b11c528ef | ||
|
|
91164ac1b0 | ||
|
|
04899a21cd | ||
|
|
8f77518406 | ||
|
|
b76e196c89 | ||
|
|
d06376c170 | ||
|
|
cefc4f4aa3 | ||
|
|
a14de10e28 | ||
|
|
e4a3509845 | ||
|
|
eb99fc8681 | ||
|
|
8ec0d01fc4 | ||
|
|
658286c8e4 | ||
|
|
a1bbb3b3f7 | ||
|
|
67c707739d | ||
|
|
68f6ab5c32 | ||
|
|
188fcfdd64 | ||
|
|
4f15f07dd4 | ||
|
|
08066d4692 | ||
|
|
42d32c72a6 | ||
|
|
81ed5fe41e | ||
|
|
b9596890c9 | ||
|
|
846a9411b9 | ||
|
|
58fdaa8747 | ||
|
|
820f6b5b3c | ||
|
|
d982d47c56 | ||
|
|
569b940b82 | ||
|
|
ba104baf3e | ||
|
|
cce7f51235 | ||
|
|
17444e825a | ||
|
|
3323cb56fe | ||
|
|
5681be1fd8 | ||
|
|
4a7d333891 | ||
|
|
9890cf25b4 | ||
|
|
9f5bf5e285 | ||
|
|
0bfade4435 | ||
|
|
40704b5055 | ||
|
|
53537cf9af | ||
|
|
1b97297d63 | ||
|
|
75cc12bb3d | ||
|
|
563d699394 | ||
|
|
e701faa1bc | ||
|
|
aed172071b | ||
|
|
90356ee669 | ||
|
|
0a4a01c5e5 | ||
|
|
0f52cd0bab | ||
|
|
2fd95381a6 | ||
|
|
184957c0ed | ||
|
|
7663a777d5 | ||
|
|
097b7c3baf | ||
|
|
bf45ebb178 | ||
|
|
84bedc7bbe | ||
|
|
e5b7e65e91 | ||
|
|
104fd6c70d | ||
|
|
0ea174f0dd | ||
|
|
35ec190664 | ||
|
|
292adb27a3 | ||
|
|
8c173b4e95 | ||
|
|
94b724ae5f | ||
|
|
6d4a61f51d | ||
|
|
75105016f7 | ||
|
|
f419f206e5 | ||
|
|
82824a4bf2 | ||
|
|
d1652c0028 | ||
|
|
053aa80951 | ||
|
|
585c620945 | ||
|
|
bd88787cb3 | ||
|
|
74539f08ba | ||
|
|
e74073e480 | ||
|
|
b004648a13 | ||
|
|
f2c875e71e | ||
|
|
13904dc536 | ||
|
|
ba183e900b | ||
|
|
447c561aaa | ||
|
|
f8dab23e8f | ||
|
|
0da216897a | ||
|
|
8cf446b14c | ||
|
|
6b67c82b94 | ||
|
|
930a5c3e44 | ||
|
|
538b253dfb | ||
|
|
277ea9be28 | ||
|
|
d812acff24 | ||
|
|
2e1b0b6421 | ||
|
|
52f8ecc347 | ||
|
|
19bb12754b | ||
|
|
dbcb82799e | ||
|
|
a71e4086a2 | ||
|
|
2069a95e0f | ||
|
|
b130c2e27c | ||
|
|
ba00cf5684 | ||
|
|
b488d3a90f | ||
|
|
701b926288 | ||
|
|
446fb07fd5 | ||
|
|
1ac3c0262f | ||
|
|
e14ba664ea | ||
|
|
91d22f180e | ||
|
|
043db49676 | ||
|
|
eff8c324c8 | ||
|
|
1210a7441f | ||
|
|
cf08fed067 | ||
|
|
c44b336e1b | ||
|
|
e90084ad06 | ||
|
|
cdb9315366 | ||
|
|
2ff723f943 | ||
|
|
d1fa5ccd4d | ||
|
|
17df94c75b | ||
|
|
96f354026a | ||
|
|
8fe6be19f1 | ||
|
|
002eed405b | ||
|
|
ef1c1440a0 | ||
|
|
826512730c | ||
|
|
5a26a48d11 | ||
|
|
3c0af94c5c | ||
|
|
fc5ab8a14c | ||
|
|
ace45bfd90 | ||
|
|
d6681d3580 | ||
|
|
0cc49782ab | ||
|
|
e1ac51d7da | ||
|
|
c3eb532439 | ||
|
|
18d4a81954 | ||
|
|
7daa8759c9 | ||
|
|
beb1997378 | ||
|
|
962398969b | ||
|
|
0bed84174b | ||
|
|
48b2e94aa3 | ||
|
|
a24df27cd8 | ||
|
|
52ac98c294 | ||
|
|
4cd88ade54 | ||
|
|
dead69eb2c | ||
|
|
f47ce337bf | ||
|
|
9a51fbafb3 | ||
|
|
3d23f5bbb3 | ||
|
|
af055ecd27 | ||
|
|
31836967fa | ||
|
|
514044496f | ||
|
|
cf42d035f2 | ||
|
|
4b2294292a | ||
|
|
0e19f6c0ae | ||
|
|
5075ac8887 | ||
|
|
d792ee4b61 | ||
|
|
b207bff157 | ||
|
|
53343d2fa6 | ||
|
|
e98d1efee3 | ||
|
|
e4764e37b1 | ||
|
|
b8e267e387 | ||
|
|
17861a970f | ||
|
|
a5ea25cde5 | ||
|
|
843f3394c8 | ||
|
|
b1aa98b43d | ||
|
|
6a23c5fd48 | ||
|
|
6b2c6c20bc | ||
|
|
a4ed7e1d18 | ||
|
|
1b8e588961 | ||
|
|
dec1811d20 | ||
|
|
72e9f55368 | ||
|
|
9140180c85 | ||
|
|
e022adf4a0 | ||
|
|
6e03504802 | ||
|
|
003977a9fb | ||
|
|
1afc8554c0 | ||
|
|
26a93a530b | ||
|
|
2df4fff6c9 | ||
|
|
b74b40abd2 | ||
|
|
d53bba97e8 | ||
|
|
95e7dac9a6 | ||
|
|
83d3a39dcd | ||
|
|
f44701c02d | ||
|
|
d5de3fa111 | ||
|
|
bc8cb754c0 | ||
|
|
2ea6de7195 | ||
|
|
8083ef605f | ||
|
|
b87ee62e6c | ||
|
|
521ca1c34a | ||
|
|
a310b659cd | ||
|
|
feb342804b | ||
|
|
36cfce40ad | ||
|
|
52c80c2740 | ||
|
|
0e07408c63 | ||
|
|
3da201b26e | ||
|
|
b66212e6d6 | ||
|
|
d87b1ed22a | ||
|
|
595c066c2a | ||
|
|
54d6a22d19 | ||
|
|
c0d534f5ad | ||
|
|
6d29d2a67e | ||
|
|
c70cecc24a | ||
|
|
bba5b8a740 | ||
|
|
c0da9fa2bb | ||
|
|
ee59f17ea1 | ||
|
|
464000bca8 | ||
|
|
bc8fd8a6dc | ||
|
|
9cdd0b8a02 | ||
|
|
a02687a83e | ||
|
|
f00e57a0ed | ||
|
|
cd297e1f90 | ||
|
|
5e8c87cf82 | ||
|
|
a0ae37d580 | ||
|
|
18e83c17b4 | ||
|
|
3860ab11c7 | ||
|
|
1b08a12b26 | ||
|
|
36dad4380e | ||
|
|
b100c8ebee | ||
|
|
0769694839 | ||
|
|
4064e4a7a9 | ||
|
|
efaef7039e | ||
|
|
580b7ec5be | ||
|
|
bd56405aae | ||
|
|
2dee0fc536 | ||
|
|
26f150220b | ||
|
|
289910fe83 | ||
|
|
f1b6ef204d | ||
|
|
8a49a0b714 | ||
|
|
c07f3da9a1 | ||
|
|
d71a161bc9 | ||
|
|
ef0d973187 | ||
|
|
a5ceaa3664 | ||
|
|
a37285eae9 | ||
|
|
8d48cc79a2 | ||
|
|
3741510108 | ||
|
|
66fd5a7062 | ||
|
|
d179f3ed28 | ||
|
|
eaed9eee5b | ||
|
|
08f3e360c9 | ||
|
|
0524eeb61a | ||
|
|
b0f2f0ffd6 | ||
|
|
528a4c0b70 | ||
|
|
6b559e99b2 | ||
|
|
93d1d85f94 | ||
|
|
1f3985a164 | ||
|
|
dc5d3a7342 | ||
|
|
ccf9dcb851 | ||
|
|
7b199d7550 | ||
|
|
98cecaee9e | ||
|
|
d5cddb202c | ||
|
|
09dbc50447 | ||
|
|
fdd45ab1dc | ||
|
|
39018174c5 | ||
|
|
5a3a215b0e | ||
|
|
495d701022 | ||
|
|
b886b7e611 | ||
|
|
fd78a9ae83 | ||
|
|
ab30690854 | ||
|
|
34b2543c8b | ||
|
|
1fa289f2ee | ||
|
|
22ff7ff101 | ||
|
|
1402615bc0 | ||
|
|
6132b77c1e | ||
|
|
cee3d1c859 | ||
|
|
b46aa0f55b | ||
|
|
e1220d6fc6 | ||
|
|
2ebd7f2ea3 | ||
|
|
756f2866bb | ||
|
|
92836408cc | ||
|
|
c5721b749c | ||
|
|
6f0defbfe5 | ||
|
|
f4463b1708 | ||
|
|
39e85c6dec | ||
|
|
aa5b163944 | ||
|
|
eb237ea4e1 | ||
|
|
27c1237daa | ||
|
|
a218622d73 | ||
|
|
46e29de66f | ||
|
|
6f0ffcf3e1 | ||
|
|
c7b39f094c | ||
|
|
f5ae6a80f0 | ||
|
|
482160ea04 | ||
|
|
ad62421264 | ||
|
|
083a82f6d1 | ||
|
|
99671b8eb5 | ||
|
|
3c0879a3c6 | ||
|
|
232416b30d | ||
|
|
cf62ff772f | ||
|
|
e824e34526 | ||
|
|
d390db5c57 | ||
|
|
31529524c8 | ||
|
|
dde9f2bb79 | ||
|
|
5711c088e5 | ||
|
|
765ae3f484 | ||
|
|
f3dbf17b78 | ||
|
|
8eeb40cca8 | ||
|
|
9fc088dcb0 | ||
|
|
5379e51094 | ||
|
|
05a0905582 | ||
|
|
1e70e703a7 | ||
|
|
78d83be2b2 | ||
|
|
a28f32a8a0 | ||
|
|
7a1e052b58 | ||
|
|
02f9128d07 | ||
|
|
6ac1dd8966 | ||
|
|
968c6f7ab7 | ||
|
|
93285f8ea8 | ||
|
|
28358b55fe | ||
|
|
0afb6cd53c | ||
|
|
143e76b7e3 | ||
|
|
f8af569680 | ||
|
|
259ec58140 | ||
|
|
99727cbe99 | ||
|
|
46e67ee078 | ||
|
|
28d92b7be3 | ||
|
|
c869edd1d2 | ||
|
|
8f3369fe29 | ||
|
|
477e9812d4 | ||
|
|
9e4b9e75e3 | ||
|
|
55f946198b | ||
|
|
181512ad9d | ||
|
|
5a25c547ab | ||
|
|
0d72ba886b | ||
|
|
a64f28de5c | ||
|
|
b4dbb5093a | ||
|
|
e7d0428a2e | ||
|
|
bb7c34db65 | ||
|
|
02f06407b1 | ||
|
|
73e9aac135 | ||
|
|
32bc68d06d | ||
|
|
a5d51b4330 | ||
|
|
79948be3a0 | ||
|
|
ab42eb2c50 | ||
|
|
45c2a5e4ec | ||
|
|
ae38ebaf6f | ||
|
|
80bdc889f8 | ||
|
|
84f3cb4075 | ||
|
|
22def89760 | ||
|
|
a15f1a52c7 | ||
|
|
944c5f0cd0 | ||
|
|
7a39e9e569 | ||
|
|
cfe432ea65 | ||
|
|
36bfeea8dc | ||
|
|
7b3a05eea8 | ||
|
|
e1f0a13e5a | ||
|
|
e634888a50 | ||
|
|
168950855d | ||
|
|
a2e0ac2872 | ||
|
|
6d806238fb | ||
|
|
a0dfa916e6 | ||
|
|
9748524ef6 | ||
|
|
718cfa133f | ||
|
|
4cadc6f0fe | ||
|
|
2023d9ed99 | ||
|
|
6828f7bf49 | ||
|
|
33a0857b8d | ||
|
|
4e712807d7 | ||
|
|
2d15e40539 | ||
|
|
50aaa6524d | ||
|
|
01f1703dfb | ||
|
|
69a573923f | ||
|
|
7eb4ecea8b | ||
|
|
599ce757a1 | ||
|
|
75a07a90f8 | ||
|
|
ec2d1312ef | ||
|
|
03b6dd9321 | ||
|
|
a16d3d6405 | ||
|
|
3e5cd8ce1a | ||
|
|
6902387991 | ||
|
|
62b4f2b264 | ||
|
|
79748afdc4 | ||
|
|
32cb0558e4 | ||
|
|
92b2ac3c8c | ||
|
|
0e67298dff | ||
|
|
f6d218ed36 | ||
|
|
1a9fc964df | ||
|
|
48248faab0 | ||
|
|
58181c2d73 | ||
|
|
0f86084e08 | ||
|
|
c8e602dec1 | ||
|
|
b168717e91 | ||
|
|
930c2ac328 | ||
|
|
28737d5778 | ||
|
|
12ba057b4f | ||
|
|
0e0876b17f | ||
|
|
b28eea24fc | ||
|
|
a1e59ddc3d | ||
|
|
3fbdba31bf | ||
|
|
d90a7e4302 | ||
|
|
7377a14245 | ||
|
|
e2136d60b2 | ||
|
|
74e40654e6 |
@@ -1,88 +0,0 @@
|
|||||||
# Configuration for checkpatch.pl
|
|
||||||
# ===============================
|
|
||||||
|
|
||||||
# Enable more tests
|
|
||||||
--strict
|
|
||||||
|
|
||||||
# Quiet
|
|
||||||
--quiet
|
|
||||||
|
|
||||||
# No per-file summary
|
|
||||||
--no-summary
|
|
||||||
|
|
||||||
# Don't expect the Linux kernel tree
|
|
||||||
--no-tree
|
|
||||||
|
|
||||||
# Show file line, not input line
|
|
||||||
--showfile
|
|
||||||
|
|
||||||
# Don't expect SPDX tag in the first line of a file
|
|
||||||
--ignore SPDX_LICENSE_TAG
|
|
||||||
|
|
||||||
# Don't expect Signed-off-by lines in commit messages
|
|
||||||
--no-signoff
|
|
||||||
|
|
||||||
# List of ignored rules
|
|
||||||
# ---------------------
|
|
||||||
|
|
||||||
# There's no BIT macro
|
|
||||||
--ignore BIT_MACRO
|
|
||||||
|
|
||||||
# Don't complain when bools are used in structs
|
|
||||||
--ignore BOOL_MEMBER
|
|
||||||
|
|
||||||
# Allow CamelCase
|
|
||||||
--ignore CAMELCASE
|
|
||||||
|
|
||||||
# Comparing to NULL explicitly isn't a bad thing
|
|
||||||
--ignore COMPARISON_TO_NULL
|
|
||||||
|
|
||||||
# Causes false positives
|
|
||||||
--ignore COMPLEX_MACRO
|
|
||||||
|
|
||||||
# Don't complain about structs not being const
|
|
||||||
--ignore CONST_STRUCT
|
|
||||||
|
|
||||||
# Don't complain about printing "warning:" without the function name, as warning
|
|
||||||
# printing is relevant to the code being parsed, not RGBDS' code
|
|
||||||
--ignore EMBEDDED_FUNCTION_NAME
|
|
||||||
|
|
||||||
# Do not check the format of commit messages
|
|
||||||
--ignore GIT_COMMIT_ID
|
|
||||||
|
|
||||||
# Do not check for global initializers (this is specific to the kernel)
|
|
||||||
--ignore GLOBAL_INITIALISERS
|
|
||||||
|
|
||||||
# Don't complain about initializing statics (this is specific to the kernel)
|
|
||||||
--ignore INITIALISED_STATIC
|
|
||||||
|
|
||||||
# We don't have a MAINTAINERS file, don't complain about it.
|
|
||||||
--ignore FILE_PATH_CHANGES
|
|
||||||
|
|
||||||
# Writing the continuation on the start of the line can make it clearer
|
|
||||||
--ignore LOGICAL_CONTINUATIONS
|
|
||||||
|
|
||||||
# Don't complain if a line that contains a string is too long. It's better to
|
|
||||||
# have a really long line that can be found with grep.
|
|
||||||
--ignore LONG_LINE_STRING
|
|
||||||
|
|
||||||
# Don't complain when files are modified in 'include/asm'
|
|
||||||
--ignore MODIFIED_INCLUDE_ASM
|
|
||||||
|
|
||||||
# Allow new typedefs
|
|
||||||
--ignore NEW_TYPEDEFS
|
|
||||||
|
|
||||||
# We allow lines ending with parentheses for the usage prints
|
|
||||||
--ignore OPEN_ENDED_LINE
|
|
||||||
|
|
||||||
# Prefer stdint.h types over kernel types
|
|
||||||
--ignore PREFER_KERNEL_TYPES
|
|
||||||
|
|
||||||
# Don't ask to replace sscanf by kstrto
|
|
||||||
--ignore SSCANF_TO_KSTRTO
|
|
||||||
|
|
||||||
# Parentheses can make the code clearer
|
|
||||||
--ignore UNNECESSARY_PARENTHESES
|
|
||||||
|
|
||||||
# We don't have `fallthrough;` */
|
|
||||||
--ignore PREFER_FALLTHROUGH
|
|
||||||
+16
-9
@@ -1,13 +1,13 @@
|
|||||||
AccessModifierOffset: -4
|
AccessModifierOffset: -4
|
||||||
AlignAfterOpenBracket: Align
|
AlignAfterOpenBracket: BlockIndent
|
||||||
AlignArrayOfStructures: Left
|
AlignArrayOfStructures: Left
|
||||||
AlignConsecutiveAssignments: None
|
AlignConsecutiveAssignments: None
|
||||||
AlignConsecutiveBitFields: Consecutive
|
AlignConsecutiveBitFields: Consecutive
|
||||||
AlignConsecutiveDeclarations: None
|
AlignConsecutiveDeclarations: None
|
||||||
AlignConsecutiveMacros: Consecutive
|
AlignConsecutiveMacros: Consecutive
|
||||||
AlignEscapedNewlines: Left
|
AlignEscapedNewlines: DontAlign
|
||||||
AlignOperands: Align
|
AlignOperands: Align
|
||||||
AlignTrailingComments: false
|
AlignTrailingComments: true
|
||||||
AllowShortBlocksOnASingleLine: Empty
|
AllowShortBlocksOnASingleLine: Empty
|
||||||
AllowShortCaseLabelsOnASingleLine: false
|
AllowShortCaseLabelsOnASingleLine: false
|
||||||
AllowShortEnumsOnASingleLine: true
|
AllowShortEnumsOnASingleLine: true
|
||||||
@@ -21,9 +21,10 @@ AlwaysBreakTemplateDeclarations: Yes
|
|||||||
AttributeMacros:
|
AttributeMacros:
|
||||||
- format_
|
- format_
|
||||||
- attr_
|
- attr_
|
||||||
BinPackArguments: true
|
BinPackArguments: false
|
||||||
BinPackParameters: true
|
BinPackParameters: false
|
||||||
BitFieldColonSpacing: Both
|
BitFieldColonSpacing: Both
|
||||||
|
BreakAfterAttributes: Always
|
||||||
BreakBeforeBinaryOperators: NonAssignment
|
BreakBeforeBinaryOperators: NonAssignment
|
||||||
BreakBeforeBraces: Attach
|
BreakBeforeBraces: Attach
|
||||||
BreakBeforeConceptDeclarations: true
|
BreakBeforeConceptDeclarations: true
|
||||||
@@ -54,22 +55,28 @@ IncludeCategories:
|
|||||||
IndentAccessModifiers: false
|
IndentAccessModifiers: false
|
||||||
IndentCaseBlocks: false
|
IndentCaseBlocks: false
|
||||||
IndentCaseLabels: false
|
IndentCaseLabels: false
|
||||||
IndentExternBlock: NoIndent
|
IndentExternBlock: Indent
|
||||||
IndentGotoLabels: false
|
IndentGotoLabels: false
|
||||||
IndentPPDirectives: BeforeHash
|
IndentPPDirectives: BeforeHash
|
||||||
IndentRequires: true
|
IndentRequires: true
|
||||||
IndentWidth: 4
|
IndentWidth: 4
|
||||||
IndentWrappedFunctionNames: true
|
IndentWrappedFunctionNames: true
|
||||||
# Only support for Javascript as of clang-format 13...
|
InsertBraces: true
|
||||||
# InsertTrailingCommas: true
|
InsertNewlineAtEOF: true
|
||||||
|
# Only support for Javascript as of clang-format 14...
|
||||||
|
# InsertTrailingCommas: Wrapped
|
||||||
KeepEmptyLinesAtTheStartOfBlocks: false
|
KeepEmptyLinesAtTheStartOfBlocks: false
|
||||||
LambdaBodyIndentation: Signature
|
LambdaBodyIndentation: Signature
|
||||||
Language: Cpp
|
Language: Cpp
|
||||||
MaxEmptyLinesToKeep: 1
|
MaxEmptyLinesToKeep: 1
|
||||||
NamespaceIndentation: None
|
NamespaceIndentation: None
|
||||||
PPIndentWidth: -1
|
PPIndentWidth: -1
|
||||||
|
PenaltyBreakScopeResolution: 1000
|
||||||
PointerAlignment: Right
|
PointerAlignment: Right
|
||||||
|
QualifierAlignment: Right
|
||||||
ReflowComments: true
|
ReflowComments: true
|
||||||
|
RemoveParentheses: ReturnStatement
|
||||||
|
RemoveSemicolon: true
|
||||||
SortIncludes: CaseSensitive
|
SortIncludes: CaseSensitive
|
||||||
SortUsingDeclarations: true
|
SortUsingDeclarations: true
|
||||||
SpaceAfterCStyleCast: false
|
SpaceAfterCStyleCast: false
|
||||||
@@ -93,7 +100,7 @@ SpacesInConditionalStatement: false
|
|||||||
SpacesInContainerLiterals: false
|
SpacesInContainerLiterals: false
|
||||||
SpacesInParentheses: false
|
SpacesInParentheses: false
|
||||||
SpacesInSquareBrackets: false
|
SpacesInSquareBrackets: false
|
||||||
Standard: c++17
|
Standard: c++20
|
||||||
TabWidth: 4
|
TabWidth: 4
|
||||||
UseCRLF: false
|
UseCRLF: false
|
||||||
UseTab: ForIndentation
|
UseTab: ForIndentation
|
||||||
|
|||||||
@@ -0,0 +1,6 @@
|
|||||||
|
---
|
||||||
|
Checks: ''
|
||||||
|
WarningsAsErrors: ''
|
||||||
|
HeaderFilterRegex: ''
|
||||||
|
FormatStyle: none
|
||||||
|
SystemHeaders: false
|
||||||
@@ -1,7 +1,2 @@
|
|||||||
# This file is part of RGBDS.
|
|
||||||
#
|
|
||||||
# Copyright (c) 2018-2019, Phil Smith and RGBDS contributors.
|
|
||||||
#
|
|
||||||
# SPDX-License-Identifier: MIT
|
|
||||||
.git
|
.git
|
||||||
docs
|
docs
|
||||||
|
|||||||
+11
-2
@@ -1,9 +1,18 @@
|
|||||||
[*]
|
|
||||||
root = true
|
root = true
|
||||||
|
|
||||||
|
[*]
|
||||||
indent_style = tab
|
indent_style = tab
|
||||||
indent_size = tab
|
indent_size = tab
|
||||||
tab_width = 8
|
tab_width = 4
|
||||||
charset = utf-8
|
charset = utf-8
|
||||||
insert_final_newline = true
|
insert_final_newline = true
|
||||||
trim_trailing_whitespace = true
|
trim_trailing_whitespace = true
|
||||||
end_of_line = lf
|
end_of_line = lf
|
||||||
|
|
||||||
|
[{CMakeLists.txt,*.cmake}]
|
||||||
|
indent_style = space
|
||||||
|
indent_size = 2
|
||||||
|
|
||||||
|
[*.yml]
|
||||||
|
indent_style = space
|
||||||
|
indent_size = 2
|
||||||
|
|||||||
@@ -0,0 +1,19 @@
|
|||||||
|
# This file contains a list of commits that are probably not what you
|
||||||
|
# are looking for in a `git blame`, such as mass reformatting or renaming.
|
||||||
|
#
|
||||||
|
# You can set this file as a default ignore file for `git blame` by running
|
||||||
|
# the following command:
|
||||||
|
#
|
||||||
|
# $ git config blame.ignoreRevsFile .git-blame-ignore-revs
|
||||||
|
|
||||||
|
# 2024-03-04: Run `clang-format` on everything
|
||||||
|
e74073e4805fa3cce90a99946fc9994ae2970f9b
|
||||||
|
|
||||||
|
# 2009-06-11: Run `indent' on the whole tree
|
||||||
|
b6c749ffbd30138de7beef13fb9265372a461a96
|
||||||
|
|
||||||
|
# 2009-06-11: Switch line terminators from CRLF to LF
|
||||||
|
94fad97aedcd8bd85c53a505db28390e3f82577b
|
||||||
|
|
||||||
|
# 2009-06-11: Use spaces instead of tabs after CPP directives
|
||||||
|
0d9739535e313b0a2ad19c89b9c85fc7b75237a3
|
||||||
@@ -1,6 +1,19 @@
|
|||||||
# Shell scripts need Unix line endings (see https://github.com/gbdev/rgbds/issues/841)
|
# Shell scripts need Unix line endings (see https://github.com/gbdev/rgbds/issues/841)
|
||||||
*.sh text eol=lf
|
*.sh text eol=lf
|
||||||
*.bash text eol=lf
|
*.bash text eol=lf
|
||||||
|
*.cfg text eol=lf
|
||||||
|
|
||||||
# Flags also need Unix line endings (see https://github.com/gbdev/rgbds/issues/955)
|
# Flags also need Unix line endings (see https://github.com/gbdev/rgbds/issues/955)
|
||||||
*.flags text eol=lf
|
*.flags text eol=lf
|
||||||
|
|
||||||
|
# Binary files need exact bytes
|
||||||
|
*.bin binary
|
||||||
|
*.gb binary
|
||||||
|
*.1bpp binary
|
||||||
|
*.2bpp binary
|
||||||
|
*.pal binary
|
||||||
|
*.attrmap binary
|
||||||
|
*.tilemap binary
|
||||||
|
*.palmap binary
|
||||||
|
*.patch binary
|
||||||
|
*.png binary
|
||||||
|
|||||||
@@ -1 +1,2 @@
|
|||||||
open_collective: gbdev
|
open_collective: gbdev
|
||||||
|
github: gbdev
|
||||||
|
|||||||
@@ -0,0 +1,4 @@
|
|||||||
|
---
|
||||||
|
name: Update to RGBDS
|
||||||
|
about: Suggest a feature or report a bug in RGBDS.
|
||||||
|
---
|
||||||
@@ -0,0 +1,5 @@
|
|||||||
|
blank_issues_enabled: false
|
||||||
|
contact_links:
|
||||||
|
- name: GBDev Discord
|
||||||
|
url: https://discord.gg/RjJKA8wrD4
|
||||||
|
about: If you have questions about the RGBDS code or its organization, join our Discord server!
|
||||||
@@ -1,21 +0,0 @@
|
|||||||
#!/bin/bash
|
|
||||||
set -e
|
|
||||||
|
|
||||||
case "${1%-*}" in
|
|
||||||
ubuntu)
|
|
||||||
sudo apt-get -qq update
|
|
||||||
sudo apt-get install -yq bison libpng-dev pkg-config
|
|
||||||
;;
|
|
||||||
macos)
|
|
||||||
brew install bison libpng pkg-config md5sha1sum
|
|
||||||
# For the version check below exclusively, re-do this before building
|
|
||||||
export PATH="/usr/local/opt/bison/bin:$PATH"
|
|
||||||
;;
|
|
||||||
*)
|
|
||||||
echo "WARNING: Cannot install deps for OS '$1'"
|
|
||||||
;;
|
|
||||||
esac
|
|
||||||
|
|
||||||
bison --version
|
|
||||||
make --version
|
|
||||||
cmake --version
|
|
||||||
@@ -1,34 +0,0 @@
|
|||||||
#!/bin/sh
|
|
||||||
|
|
||||||
set -e
|
|
||||||
|
|
||||||
pngver=1.6.37
|
|
||||||
arch="$1"
|
|
||||||
|
|
||||||
## Grab sources and check them
|
|
||||||
|
|
||||||
wget http://downloads.sourceforge.net/project/libpng/libpng16/$pngver/libpng-$pngver.tar.xz
|
|
||||||
wget http://downloads.sourceforge.net/project/apng/libpng/libpng16/libpng-$pngver-apng.patch.gz
|
|
||||||
sha256sum -c .github/actions/mingw-w64-libpng-dev.sha256sums
|
|
||||||
|
|
||||||
## Extract sources and patch them
|
|
||||||
|
|
||||||
tar -xf libpng-$pngver.tar.xz
|
|
||||||
gunzip libpng-$pngver-apng.patch.gz
|
|
||||||
|
|
||||||
# Patch in apng support
|
|
||||||
env -C libpng-$pngver patch -p0 ../libpng-$pngver-apng.patch
|
|
||||||
|
|
||||||
## Start building!
|
|
||||||
|
|
||||||
mkdir -p build
|
|
||||||
cd build
|
|
||||||
../libpng-$pngver/configure \
|
|
||||||
--host="$arch" --target="$arch" \
|
|
||||||
--prefix="/usr/$arch" \
|
|
||||||
--enable-shared --disable-static \
|
|
||||||
CPPFLAGS="-D_FORTIFY_SOURCE=2" \
|
|
||||||
CFLAGS="-O2 -pipe -fno-plt -fexceptions --param=ssp-buffer-size=4" \
|
|
||||||
LDFLAGS="-Wl,-O1,--sort-common,--as-needed -fstack-protector"
|
|
||||||
make -kj
|
|
||||||
make install
|
|
||||||
@@ -1,2 +0,0 @@
|
|||||||
10d9e0cb60e2b387a79b355eb7527c0bee2ed8cbd12cf04417cabc4d6976683c libpng-1.6.37-apng.patch.gz
|
|
||||||
505e70834d35383537b6491e7ae8641f1a4bed1876dbfe361201fc80868d88ca libpng-1.6.37.tar.xz
|
|
||||||
@@ -0,0 +1,19 @@
|
|||||||
|
# https://docs.github.com/code-security/dependabot/dependabot-version-updates/configuration-options-for-the-dependabot.yml-file
|
||||||
|
version: 2
|
||||||
|
updates:
|
||||||
|
- package-ecosystem: "github-actions"
|
||||||
|
directory: "/"
|
||||||
|
schedule:
|
||||||
|
interval: "quarterly" # We do not need *immediate* bumps, only frequent enough to avoid falling out of support range.
|
||||||
|
cooldown: # Avoid bumping deps immediately, to give time for security audits to be conducted
|
||||||
|
default-days: 15
|
||||||
|
include: [ "*" ]
|
||||||
|
groups:
|
||||||
|
actions:
|
||||||
|
patterns: [ "*" ]
|
||||||
|
ignore:
|
||||||
|
- dependency-name: "*"
|
||||||
|
update-types:
|
||||||
|
- "version-update:semver-minor"
|
||||||
|
- "version-update:semver-patch"
|
||||||
|
labels: [ builds ] # Since those are CI-related updates...
|
||||||
Executable
+8
@@ -0,0 +1,8 @@
|
|||||||
|
#!/usr/bin/env sh
|
||||||
|
set -eu
|
||||||
|
|
||||||
|
bash --version
|
||||||
|
zsh --version
|
||||||
|
|
||||||
|
find contrib -type f \( -name '*.sh' -o -name '*.bash' \) -exec bash --norc -n {} \;
|
||||||
|
find contrib/zsh_compl -type f -name '_rgb*' -exec zsh -n {} \;
|
||||||
Executable
+93
@@ -0,0 +1,93 @@
|
|||||||
|
#!/usr/bin/env bash
|
||||||
|
|
||||||
|
# SPDX-License-Identifier: MIT
|
||||||
|
|
||||||
|
declare -A FILES
|
||||||
|
while IFS= read -r -d '' file; do
|
||||||
|
FILES["$file"]=true
|
||||||
|
done < <(git diff --name-only -z "$1" HEAD)
|
||||||
|
|
||||||
|
edited () {
|
||||||
|
${FILES["$1"]:-false}
|
||||||
|
}
|
||||||
|
|
||||||
|
dependency () {
|
||||||
|
if edited "$1" && ! edited "$2"; then
|
||||||
|
echo "'$1' was modified, but not '$2'! $3"
|
||||||
|
fi
|
||||||
|
}
|
||||||
|
|
||||||
|
# Pull requests that edit the first file without the second may be correct,
|
||||||
|
# but are suspicious enough to require review.
|
||||||
|
|
||||||
|
dependency include/linkdefs.hpp man/rgbds.5 \
|
||||||
|
"Was the object file format changed?"
|
||||||
|
|
||||||
|
dependency src/asm/parser.y man/rgbasm.5 \
|
||||||
|
"Was the rgbasm grammar changed?"
|
||||||
|
|
||||||
|
dependency src/asm/actions.cpp man/rgbasm.5 \
|
||||||
|
"Was the rgbasm grammar changed?"
|
||||||
|
|
||||||
|
dependency src/link/script.y man/rgblink.5 \
|
||||||
|
"Was the linker script grammar changed?"
|
||||||
|
|
||||||
|
dependency src/link/layout.cpp man/rgblink.5 \
|
||||||
|
"Was the linker script grammar changed?"
|
||||||
|
|
||||||
|
dependency include/asm/warning.hpp man/rgbasm.1 \
|
||||||
|
"Were the rgbasm warnings changed?"
|
||||||
|
dependency include/link/warning.hpp man/rgblink.1 \
|
||||||
|
"Were the rgblink warnings changed?"
|
||||||
|
dependency include/fix/warning.hpp man/rgbfix.1 \
|
||||||
|
"Were the rgbfix warnings changed?"
|
||||||
|
dependency include/gfx/warning.hpp man/rgbgfx.1 \
|
||||||
|
"Were the rgbgfx warnings changed?"
|
||||||
|
|
||||||
|
dependency src/asm/object.cpp include/linkdefs.hpp \
|
||||||
|
"Should the object file revision be bumped?"
|
||||||
|
dependency src/link/object.cpp include/linkdefs.hpp \
|
||||||
|
"Should the object file revision be bumped?"
|
||||||
|
|
||||||
|
dependency Makefile CMakeLists.txt \
|
||||||
|
"Did the build process change?"
|
||||||
|
dependency Makefile src/CMakeLists.txt \
|
||||||
|
"Did the build process change?"
|
||||||
|
|
||||||
|
dependency src/asm/main.cpp man/rgbasm.1 \
|
||||||
|
"Did the rgbasm CLI change?"
|
||||||
|
dependency src/asm/main.cpp contrib/zsh_compl/_rgbasm \
|
||||||
|
"Did the rgbasm CLI change?"
|
||||||
|
dependency src/asm/main.cpp contrib/bash_compl/_rgbasm.bash \
|
||||||
|
"Did the rgbasm CLI change?"
|
||||||
|
dependency src/link/main.cpp man/rgblink.1 \
|
||||||
|
"Did the rgblink CLI change?"
|
||||||
|
dependency src/link/main.cpp contrib/zsh_compl/_rgblink \
|
||||||
|
"Did the rgblink CLI change?"
|
||||||
|
dependency src/link/main.cpp contrib/bash_compl/_rgblink.bash \
|
||||||
|
"Did the rgblink CLI change?"
|
||||||
|
dependency src/fix/main.cpp man/rgbfix.1 \
|
||||||
|
"Did the rgbfix CLI change?"
|
||||||
|
dependency src/fix/main.cpp contrib/zsh_compl/_rgbfix \
|
||||||
|
"Did the rgbfix CLI change?"
|
||||||
|
dependency src/fix/main.cpp contrib/bash_compl/_rgbfix.bash \
|
||||||
|
"Did the rgbfix CLI change?"
|
||||||
|
dependency src/gfx/main.cpp man/rgbgfx.1 \
|
||||||
|
"Did the rgbgfx CLI change?"
|
||||||
|
dependency src/gfx/main.cpp contrib/zsh_compl/_rgbgfx \
|
||||||
|
"Did the rgbgfx CLI change?"
|
||||||
|
dependency src/gfx/main.cpp contrib/bash_compl/_rgbgfx.bash \
|
||||||
|
"Did the rgbgfx CLI change?"
|
||||||
|
|
||||||
|
dependency test/external/fetch-repos.sh docs/CONTRIBUTING.md \
|
||||||
|
"Did the test protocol change?"
|
||||||
|
dependency test/run-tests.sh docs/CONTRIBUTING.md \
|
||||||
|
"Did the test protocol change?"
|
||||||
|
dependency test/asm/test.sh docs/CONTRIBUTING.md \
|
||||||
|
"Did the RGBASM test protocol change?"
|
||||||
|
dependency test/link/test.sh docs/CONTRIBUTING.md \
|
||||||
|
"Did the RGBLINK test protocol change?"
|
||||||
|
dependency test/fix/test.sh docs/CONTRIBUTING.md \
|
||||||
|
"Did the RGBFIX test protocol change?"
|
||||||
|
dependency test/gfx/test.sh docs/CONTRIBUTING.md \
|
||||||
|
"Did the RGBGFX test protocol change?"
|
||||||
Executable
+15
@@ -0,0 +1,15 @@
|
|||||||
|
#!/usr/bin/env sh
|
||||||
|
|
||||||
|
# SPDX-License-Identifier: MIT
|
||||||
|
|
||||||
|
clang-format --version
|
||||||
|
|
||||||
|
find . -type f -iname '*.[ch]pp' -exec clang-format -i {} +
|
||||||
|
|
||||||
|
if ! git diff-index --quiet HEAD --; then
|
||||||
|
echo 'Unformatted files:'
|
||||||
|
git diff-index --name-only HEAD --
|
||||||
|
echo
|
||||||
|
git diff HEAD --
|
||||||
|
exit 1
|
||||||
|
fi
|
||||||
Executable
+25
@@ -0,0 +1,25 @@
|
|||||||
|
#!/usr/bin/env bash
|
||||||
|
set -euo pipefail
|
||||||
|
|
||||||
|
tag=$1
|
||||||
|
[ $# -eq 1 ]
|
||||||
|
|
||||||
|
flags=(--draft --fail-on-no-commits --verify-tag)
|
||||||
|
if [[ "$tag" = v*-rc* ]]; then
|
||||||
|
flags+=(--prerelease)
|
||||||
|
fi
|
||||||
|
|
||||||
|
files=(
|
||||||
|
win64/rgbds-win64.zip
|
||||||
|
win32/rgbds-win32.zip
|
||||||
|
macos/rgbds-macos.zip
|
||||||
|
linux/rgbds-linux-x86_64.tar.xz
|
||||||
|
rgbds-source.tar.gz
|
||||||
|
)
|
||||||
|
|
||||||
|
set -x
|
||||||
|
gh release create "${flags[@]}" --notes-file - "$tag" "${files[@]}" <<"EOF"
|
||||||
|
Please ensure that the packages below work properly.
|
||||||
|
Once that's done, replace this text with the changelog, un-draft the release, and update the `release` branch.
|
||||||
|
By the way, if you forgot to update `include/version.hpp`, RGBASM's version test is going to fail in the tag's regression testing! (Use `git push --delete origin <tag>` to delete it)
|
||||||
|
EOF
|
||||||
Executable
+11
@@ -0,0 +1,11 @@
|
|||||||
|
#!/usr/bin/env sh
|
||||||
|
|
||||||
|
local_bin_dir="$PWD/.local/bin"
|
||||||
|
|
||||||
|
mkdir -p "$local_bin_dir"
|
||||||
|
|
||||||
|
# Alias `make` to `gmake` and `python` to `python3` for use by external tests.
|
||||||
|
ln -s "$(which gmake)" "$local_bin_dir/make"
|
||||||
|
ln -s "$(which python3)" "$local_bin_dir/python"
|
||||||
|
|
||||||
|
export PATH="$local_bin_dir:$PATH"
|
||||||
Executable
+102
@@ -0,0 +1,102 @@
|
|||||||
|
#!/bin/sh
|
||||||
|
# This script requires `sh` instead of `bash` because the latter is not always installed on FreeBSD.
|
||||||
|
set -eu
|
||||||
|
|
||||||
|
# Python and the Pillow library are dependencies for libbet, a repo built by our external tests.
|
||||||
|
# Other dependencies are for building rgbds itself.
|
||||||
|
|
||||||
|
case $# in
|
||||||
|
1) OS="$1"; TOOLSET= ;;
|
||||||
|
2) OS="$1"; TOOLSET="$2" ;;
|
||||||
|
*) echo >&2 "Usage: $0 <os> [<toolset>]" && exit 1 ;;
|
||||||
|
esac
|
||||||
|
|
||||||
|
case "${OS%%-*}" in
|
||||||
|
ubuntu|debian)
|
||||||
|
pkgs=bison
|
||||||
|
case "$TOOLSET" in
|
||||||
|
mingw32)
|
||||||
|
pkgs="$pkgs libz-mingw-w64-dev g++-mingw-w64-i686-win32"
|
||||||
|
TOOLSET=
|
||||||
|
;;
|
||||||
|
mingw64)
|
||||||
|
pkgs="$pkgs libz-mingw-w64-dev g++-mingw-w64-x86-64-win32"
|
||||||
|
TOOLSET=
|
||||||
|
;;
|
||||||
|
g++-10 | lcov)
|
||||||
|
pkgs="$pkgs libpng-dev pkgconf python3-pil $TOOLSET"
|
||||||
|
TOOLSET=
|
||||||
|
;;
|
||||||
|
'' | g++ | clang++)
|
||||||
|
pkgs="$pkgs libpng-dev pkgconf python3-pil"
|
||||||
|
TOOLSET=
|
||||||
|
;;
|
||||||
|
esac
|
||||||
|
sudo apt-get update -qq
|
||||||
|
# shellcheck disable=SC2086 # (This word splitting is intentional.)
|
||||||
|
sudo apt-get install -yq $pkgs
|
||||||
|
;;
|
||||||
|
macos)
|
||||||
|
pkgs="bison make pillow"
|
||||||
|
case "$TOOLSET" in
|
||||||
|
lld)
|
||||||
|
pkgs="$pkgs $TOOLSET"
|
||||||
|
TOOLSET=
|
||||||
|
;;
|
||||||
|
clang++)
|
||||||
|
TOOLSET=
|
||||||
|
;;
|
||||||
|
esac
|
||||||
|
# macOS bundles GNU Make 3.81, which doesn't support synced output.
|
||||||
|
# We leave it as the default in `PATH`, to test that our Makefile works with it.
|
||||||
|
# However, CMake automatically uses Homebrew's `gmake`, so our CI has synced output.
|
||||||
|
# shellcheck disable=SC2086 # (This word splitting is intentional.)
|
||||||
|
brew install $pkgs
|
||||||
|
# Export `bison` to allow using the version we install from Homebrew,
|
||||||
|
# instead of the outdated one preinstalled on macOS (which doesn't even support `-Wall`...).
|
||||||
|
export PATH="$(brew --prefix)/opt/bison/bin:$PATH"
|
||||||
|
printf 'PATH=%s\n' "$PATH" >>"$GITHUB_ENV" # Make it available to later CI steps too.
|
||||||
|
;;
|
||||||
|
freebsd)
|
||||||
|
# GNU `gmake` and `gcc` are dependencies for most repos built by our external tests.
|
||||||
|
pkg install -y bash bison cmake ninja git png gmake lang/gcc python3 py312-pillow
|
||||||
|
;;
|
||||||
|
windows)
|
||||||
|
# GitHub Actions' hosted runners ship CMake 3.x, but versions prior to 4.0.0 ignore `CPACK_PACKAGE_FILE_NAME`.
|
||||||
|
choco install -y winflexbison3 cmake
|
||||||
|
# The version-printing code below will invoke `bison`, not the Windows-specific name `win_bison`.
|
||||||
|
bison() { win_bison "$@"; } # An alias doesn't work, so we use a function instead.
|
||||||
|
py -3 -m pip install pillow
|
||||||
|
;;
|
||||||
|
windowsmingw)
|
||||||
|
py -3 -m pip install pillow
|
||||||
|
;;
|
||||||
|
*)
|
||||||
|
echo "Cannot install deps for OS '$1'"
|
||||||
|
exit 1
|
||||||
|
;;
|
||||||
|
esac
|
||||||
|
|
||||||
|
if [ -n "$TOOLSET" ]; then
|
||||||
|
printf >&2 'Unknown toolset `%s` for OS `%s`\n' "$TOOLSET" "$OS"
|
||||||
|
exit 1
|
||||||
|
fi
|
||||||
|
|
||||||
|
# We do not build RGBDS *in* MinGW on Windows, so skip printing build tool info.
|
||||||
|
if [ "$OS" = "windowsmingw" ]; then
|
||||||
|
exit 0
|
||||||
|
fi
|
||||||
|
|
||||||
|
# Print some system info, for easier debugging.
|
||||||
|
# https://docs.github.com/en/actions/reference/workflows-and-actions/workflow-commands#grouping-log-lines
|
||||||
|
|
||||||
|
echo ::group::PATH
|
||||||
|
echo "PATH=($PATH)" | sed 's/:/\n /g'
|
||||||
|
echo ::endgroup::
|
||||||
|
|
||||||
|
for prog in bison make cmake; do
|
||||||
|
printf '::group::' # No line terminator, the next command's first line becomes the group's title.
|
||||||
|
$prog --version
|
||||||
|
type $prog
|
||||||
|
echo ::endgroup::
|
||||||
|
done
|
||||||
@@ -0,0 +1,4 @@
|
|||||||
|
@rem From https://github.com/microsoft/vswhere/wiki/Start-Developer-Command-Prompt#using-batch
|
||||||
|
for /f "delims=" %%p in ('vswhere.exe -prerelease -latest -property installationPath') do set vspath=%%p
|
||||||
|
@rem From https://learn.microsoft.com/en-us/cpp/build/building-on-the-command-line?view=msvc-170#developer_command_file_locations
|
||||||
|
call "%vspath%\VC\Auxiliary\Build\vcvars%1.bat"
|
||||||
@@ -0,0 +1,59 @@
|
|||||||
|
name: Build container image
|
||||||
|
on:
|
||||||
|
push:
|
||||||
|
branches:
|
||||||
|
- master
|
||||||
|
tags:
|
||||||
|
- '*'
|
||||||
|
|
||||||
|
env:
|
||||||
|
# Force colored output (see https://bixense.com/clicolors/ and https://force-color.org/)
|
||||||
|
TERM: xterm-256color
|
||||||
|
CLICOLOR: 1
|
||||||
|
CLICOLOR_FORCE: 1
|
||||||
|
|
||||||
|
jobs:
|
||||||
|
publish-docker-image:
|
||||||
|
if: github.repository_owner == 'gbdev'
|
||||||
|
runs-on: ubuntu-latest
|
||||||
|
permissions:
|
||||||
|
packages: write
|
||||||
|
steps:
|
||||||
|
- name: Checkout repo
|
||||||
|
uses: actions/checkout@v7
|
||||||
|
|
||||||
|
- name: Login to GitHub Container Registry
|
||||||
|
uses: docker/login-action@v4
|
||||||
|
with:
|
||||||
|
registry: ghcr.io
|
||||||
|
username: ${{ github.actor }}
|
||||||
|
password: ${{ secrets.GITHUB_TOKEN }}
|
||||||
|
|
||||||
|
- name: Build and push the master container image
|
||||||
|
if: github.ref == 'refs/heads/master'
|
||||||
|
run: |
|
||||||
|
COMMIT_HASH=$(git rev-parse --short HEAD)
|
||||||
|
sed -i "2i LABEL org.opencontainers.image.description=\"RGBDS container image, containing the git version master:$COMMIT_HASH\"" Dockerfile
|
||||||
|
docker build . --tag ghcr.io/gbdev/rgbds:master
|
||||||
|
docker push ghcr.io/gbdev/rgbds:master
|
||||||
|
|
||||||
|
- name: Build and push the version-tagged container image
|
||||||
|
if: startsWith(github.ref, 'refs/tags/')
|
||||||
|
run: |
|
||||||
|
TAG_NAME=${GITHUB_REF#refs/tags/}
|
||||||
|
sed -i "2i LABEL org.opencontainers.image.description=\"RGBDS container image for the release version $TAG_NAME\"" Dockerfile
|
||||||
|
docker build . --tag ghcr.io/gbdev/rgbds:$TAG_NAME
|
||||||
|
docker tag ghcr.io/gbdev/rgbds:$TAG_NAME ghcr.io/gbdev/rgbds:latest
|
||||||
|
docker push ghcr.io/gbdev/rgbds:$TAG_NAME
|
||||||
|
docker push ghcr.io/gbdev/rgbds:latest
|
||||||
|
|
||||||
|
- name: Delete untagged container images
|
||||||
|
if: github.repository_owner == 'gbdev'
|
||||||
|
uses: Chizkiyahu/delete-untagged-ghcr-action@v6
|
||||||
|
with:
|
||||||
|
# Requires a personal access token with delete:packages permissions
|
||||||
|
token: ${{ secrets.PAT_TOKEN }}
|
||||||
|
package_name: 'rgbds'
|
||||||
|
untagged_only: true
|
||||||
|
except_untagged_multiplatform: true
|
||||||
|
owner_type: 'org'
|
||||||
@@ -0,0 +1,23 @@
|
|||||||
|
name: Contrib script syntax checking
|
||||||
|
on:
|
||||||
|
- push
|
||||||
|
- pull_request
|
||||||
|
|
||||||
|
env:
|
||||||
|
# Force colored output (see https://bixense.com/clicolors/ and https://force-color.org/)
|
||||||
|
TERM: xterm-256color
|
||||||
|
CLICOLOR: 1
|
||||||
|
CLICOLOR_FORCE: 1
|
||||||
|
|
||||||
|
jobs:
|
||||||
|
check-contrib:
|
||||||
|
runs-on: ubuntu-slim
|
||||||
|
steps:
|
||||||
|
- name: Checkout repo
|
||||||
|
uses: actions/checkout@v7
|
||||||
|
- name: Install zsh
|
||||||
|
run: |
|
||||||
|
sudo apt install -Uyq zsh
|
||||||
|
- name: Check contrib scripts
|
||||||
|
run: |
|
||||||
|
.github/scripts/check-contrib.sh
|
||||||
@@ -0,0 +1,27 @@
|
|||||||
|
name: Diff completeness check
|
||||||
|
on: pull_request
|
||||||
|
|
||||||
|
env:
|
||||||
|
# Force colored output (see https://bixense.com/clicolors/ and https://force-color.org/)
|
||||||
|
TERM: xterm-256color
|
||||||
|
CLICOLOR: 1
|
||||||
|
CLICOLOR_FORCE: 1
|
||||||
|
|
||||||
|
jobs:
|
||||||
|
check-diff:
|
||||||
|
runs-on: ubuntu-slim
|
||||||
|
steps:
|
||||||
|
- name: Clone repo
|
||||||
|
uses: actions/checkout@v7
|
||||||
|
with:
|
||||||
|
ref: ${{ github.event.pull_request.head.sha }}
|
||||||
|
- name: Check diff
|
||||||
|
shell: bash # Bash is the default, but specifying it explicitly enables `-o pipefail`.
|
||||||
|
run: |
|
||||||
|
MERGE_BASE=$(gh api "/repos/{owner}/{repo}/compare/$BASE_SHA...$HEAD_SHA" --jq '.merge_base_commit.sha')
|
||||||
|
git fetch origin "$MERGE_BASE"
|
||||||
|
.github/scripts/check-diff.bash "$MERGE_BASE" | sed -E 's/^/::warning::/'
|
||||||
|
env:
|
||||||
|
BASE_SHA: ${{ github.event.pull_request.base.sha }}
|
||||||
|
HEAD_SHA: ${{ github.event.pull_request.head.sha }}
|
||||||
|
GH_TOKEN: ${{ github.token }}
|
||||||
@@ -0,0 +1,21 @@
|
|||||||
|
name: Code format checking
|
||||||
|
on: pull_request
|
||||||
|
|
||||||
|
env:
|
||||||
|
# Force colored output (see https://bixense.com/clicolors/ and https://force-color.org/)
|
||||||
|
TERM: xterm-256color
|
||||||
|
CLICOLOR: 1
|
||||||
|
CLICOLOR_FORCE: 1
|
||||||
|
|
||||||
|
jobs:
|
||||||
|
check-format:
|
||||||
|
runs-on: ubuntu-slim
|
||||||
|
steps:
|
||||||
|
- name: Checkout repo
|
||||||
|
uses: actions/checkout@v7
|
||||||
|
- name: Install clang-format
|
||||||
|
run: |
|
||||||
|
sudo apt install -Uyq clang-format
|
||||||
|
- name: Check format
|
||||||
|
run: |
|
||||||
|
.github/scripts/check-format.sh
|
||||||
@@ -1,17 +0,0 @@
|
|||||||
name: "Code coverage checking"
|
|
||||||
on: pull_request
|
|
||||||
|
|
||||||
jobs:
|
|
||||||
checkdiff:
|
|
||||||
runs-on: ubuntu-latest
|
|
||||||
steps:
|
|
||||||
- name: Set up repo
|
|
||||||
run: |
|
|
||||||
git clone -b "${{ github.event.pull_request.head.ref }}" "${{ github.event.pull_request.head.repo.clone_url }}" rgbds
|
|
||||||
cd rgbds
|
|
||||||
git remote add upstream "${{ github.event.pull_request.base.repo.clone_url }}"
|
|
||||||
git fetch upstream
|
|
||||||
- name: Checkdiff
|
|
||||||
working-directory: rgbds
|
|
||||||
run: |
|
|
||||||
make checkdiff "BASE_REF=${{ github.event.pull_request.base.sha }}" Q= | tee log
|
|
||||||
@@ -1,25 +0,0 @@
|
|||||||
name: "Code style checking"
|
|
||||||
on: pull_request
|
|
||||||
|
|
||||||
jobs:
|
|
||||||
checkpatch:
|
|
||||||
runs-on: ubuntu-latest
|
|
||||||
steps:
|
|
||||||
- name: Set up repo
|
|
||||||
run: |
|
|
||||||
git clone -b "${{ github.event.pull_request.head.ref }}" "${{ github.event.pull_request.head.repo.clone_url }}" rgbds
|
|
||||||
cd rgbds
|
|
||||||
git remote add upstream "${{ github.event.pull_request.base.repo.clone_url }}"
|
|
||||||
git fetch upstream
|
|
||||||
- name: Set up checkpatch
|
|
||||||
working-directory: rgbds
|
|
||||||
run: |
|
|
||||||
wget 'https://raw.githubusercontent.com/torvalds/linux/master/scripts/checkpatch.pl'
|
|
||||||
chmod +x checkpatch.pl
|
|
||||||
wget 'https://raw.githubusercontent.com/torvalds/linux/master/scripts/const_structs.checkpatch'
|
|
||||||
wget 'https://raw.githubusercontent.com/torvalds/linux/master/scripts/spelling.txt'
|
|
||||||
- name: Checkpatch
|
|
||||||
working-directory: rgbds
|
|
||||||
run: |
|
|
||||||
make checkpatch CHECKPATCH=./checkpatch.pl "BASE_REF=${{ github.event.pull_request.base.sha }}" Q= | tee log
|
|
||||||
if grep -q ERROR: log; then exit 1; else exit 0; fi
|
|
||||||
@@ -0,0 +1,33 @@
|
|||||||
|
name: Code coverage report
|
||||||
|
on:
|
||||||
|
- push
|
||||||
|
- pull_request
|
||||||
|
|
||||||
|
env:
|
||||||
|
# Force colored output (see https://bixense.com/clicolors/ and https://force-color.org/)
|
||||||
|
TERM: xterm-256color
|
||||||
|
CLICOLOR: 1
|
||||||
|
CLICOLOR_FORCE: 1
|
||||||
|
|
||||||
|
jobs:
|
||||||
|
coverage:
|
||||||
|
runs-on: ubuntu-latest
|
||||||
|
steps:
|
||||||
|
- name: Checkout repo
|
||||||
|
uses: actions/checkout@v7
|
||||||
|
- name: Install deps
|
||||||
|
run: |
|
||||||
|
.github/scripts/install-deps.sh ubuntu-latest lcov
|
||||||
|
- name: Generate coverage report
|
||||||
|
run: |
|
||||||
|
contrib/coverage.bash --os ubuntu-latest --jobs "$(getconf _NPROCESSORS_ONLN)"
|
||||||
|
- name: Upload coverage report
|
||||||
|
uses: actions/upload-artifact@v7
|
||||||
|
with:
|
||||||
|
name: coverage-report
|
||||||
|
# Workaround for keeping the top-level coverage/ directory
|
||||||
|
# https://github.com/actions/upload-artifact/issues/174
|
||||||
|
path: |
|
||||||
|
coverage
|
||||||
|
dummy-file-to-keep-directory-structure.txt
|
||||||
|
if-no-files-found: error
|
||||||
@@ -1,96 +0,0 @@
|
|||||||
name: "Create release artifacts"
|
|
||||||
on:
|
|
||||||
push:
|
|
||||||
tags:
|
|
||||||
- v[0-9]*
|
|
||||||
|
|
||||||
jobs:
|
|
||||||
windows:
|
|
||||||
runs-on: windows-2022
|
|
||||||
steps:
|
|
||||||
- uses: actions/checkout@v2
|
|
||||||
- name: Get version from tag
|
|
||||||
shell: bash
|
|
||||||
run: | # Turn "refs/tags/vX.Y.Z" into "X.Y.Z"
|
|
||||||
VERSION="${{ github.ref }}"
|
|
||||||
echo "version=${VERSION##*/v}" >> $GITHUB_ENV
|
|
||||||
- name: Get zlib, libpng and bison
|
|
||||||
run: | # TODO: use an array
|
|
||||||
$wc = New-Object System.Net.WebClient
|
|
||||||
$wc.DownloadFile('https://www.zlib.net/zlib1212.zip', 'zlib.zip')
|
|
||||||
$hash = (Get-FileHash "zlib.zip" -Algorithm SHA256).Hash
|
|
||||||
if ($hash -ne '173e89893dcb8b4a150d7731cd72f0602f1d6b45e60e2a54efdf7f3fc3325fd7') {
|
|
||||||
Write-Host "zlib SHA256 mismatch! ($hash)"
|
|
||||||
exit 1
|
|
||||||
}
|
|
||||||
$wc.DownloadFile('https://download.sourceforge.net/libpng/lpng1637.zip', 'libpng.zip')
|
|
||||||
$hash = (Get-FileHash "libpng.zip" -Algorithm SHA256).Hash
|
|
||||||
if ($hash -ne '3b4b1cbd0bae6822f749d39b1ccadd6297f05e2b85a83dd2ce6ecd7d09eabdf2') {
|
|
||||||
Write-Host "libpng SHA256 mismatch! ($hash)"
|
|
||||||
exit 1
|
|
||||||
}
|
|
||||||
$wc.DownloadFile('https://github.com/lexxmark/winflexbison/releases/download/v2.5.24/win_flex_bison-2.5.24.zip', 'winflexbison.zip')
|
|
||||||
$hash = (Get-FileHash "winflexbison.zip" -Algorithm SHA256).Hash
|
|
||||||
if ($hash -ne '39c6086ce211d5415500acc5ed2d8939861ca1696aee48909c7f6daf5122b505') {
|
|
||||||
Write-Host "bison SHA256 mismatch! ($hash)"
|
|
||||||
}
|
|
||||||
Expand-Archive -DestinationPath . "zlib.zip"
|
|
||||||
Expand-Archive -DestinationPath . "libpng.zip"
|
|
||||||
Expand-Archive -DestinationPath install_dir "winflexbison.zip"
|
|
||||||
Move-Item zlib-1.2.12 zlib
|
|
||||||
Move-Item lpng1637 libpng
|
|
||||||
- name: Build 32-bit zlib
|
|
||||||
run: | # BUILD_SHARED_LIBS causes the output DLL to be correctly called `zlib1.dll`
|
|
||||||
cmake -S zlib -B zbuild32 -A Win32 -DCMAKE_INSTALL_PREFIX=install_dir -DBUILD_SHARED_LIBS=ON
|
|
||||||
cmake --build zbuild32 --config Release
|
|
||||||
cmake --install zbuild32
|
|
||||||
- name: Build 32-bit libpng
|
|
||||||
run: |
|
|
||||||
cmake -S libpng -B pngbuild32 -A Win32 -DCMAKE_INSTALL_PREFIX=install_dir -DPNG_SHARED=ON -DPNG_STATIC=ON -DPNG_TESTS=OFF
|
|
||||||
cmake --build pngbuild32 --config Release
|
|
||||||
cmake --install pngbuild32
|
|
||||||
- name: Build 32-bit Windows binaries
|
|
||||||
run: |
|
|
||||||
cmake -S . -B build32 -A Win32 -DCMAKE_INSTALL_PREFIX=install_dir -DCMAKE_BUILD_TYPE=Release
|
|
||||||
cmake --build build32 --config Release
|
|
||||||
cmake --install build32
|
|
||||||
- name: Package 32-bit binaries
|
|
||||||
run: |
|
|
||||||
Compress-Archive -LiteralPath @("install_dir/bin/rgbasm.exe", "install_dir/bin/rgblink.exe", "install_dir/bin/rgbfix.exe", "install_dir/bin/rgbgfx.exe", "install_dir/bin/zlib1.dll", "install_dir/bin/libpng16.dll") "rgbds-${{ env.version }}-win32.zip"
|
|
||||||
- name: Build 64-bit zlib
|
|
||||||
run: | # BUILD_SHARED_LIBS causes the output DLL to be correctly called `zlib1.dll`
|
|
||||||
cmake -S zlib -B zbuild64 -A x64 -DCMAKE_INSTALL_PREFIX=install_dir -DBUILD_SHARED_LIBS=ON
|
|
||||||
cmake --build zbuild64 --config Release
|
|
||||||
cmake --install zbuild64
|
|
||||||
- name: Build 64-bit libpng
|
|
||||||
run: |
|
|
||||||
cmake -S libpng -B pngbuild64 -A x64 -DCMAKE_INSTALL_PREFIX=install_dir -DPNG_SHARED=ON -DPNG_STATIC=ON -DPNG_TESTS=OFF
|
|
||||||
cmake --build pngbuild64 --config Release
|
|
||||||
cmake --install pngbuild64
|
|
||||||
- name: Build 64-bit Windows binaries
|
|
||||||
run: |
|
|
||||||
cmake -S . -B build64 -A x64 -DCMAKE_INSTALL_PREFIX=install_dir -DCMAKE_BUILD_TYPE=Release
|
|
||||||
cmake --build build64 --config Release
|
|
||||||
cmake --install build64
|
|
||||||
- name: Package 64-bit binaries
|
|
||||||
run: |
|
|
||||||
Compress-Archive -LiteralPath @("install_dir/bin/rgbasm.exe", "install_dir/bin/rgblink.exe", "install_dir/bin/rgbfix.exe", "install_dir/bin/rgbgfx.exe", "install_dir/bin/zlib1.dll", "install_dir/bin/libpng16.dll") "rgbds-${{ env.version }}-win64.zip"
|
|
||||||
- name: Package sources
|
|
||||||
run: |
|
|
||||||
make dist
|
|
||||||
- name: Release
|
|
||||||
uses: softprops/action-gh-release@v1
|
|
||||||
with:
|
|
||||||
body: |
|
|
||||||
Please ensure that the three assets below work properly.
|
|
||||||
Once that's done, replace this text with the changelog, un-draft the release, and update the `release` branch.
|
|
||||||
By the way, if you forgot to update `include/version.h`, RGBASM's version test is gonna fail in the tag's regression testing! (Use `git push --delete origin <tag>` to delete it)
|
|
||||||
draft: true # Don't publish the release quite yet...
|
|
||||||
prerelease: ${{ contains(github.ref, '-rc') }}
|
|
||||||
files: |
|
|
||||||
rgbds-${{ env.version }}-win32.zip
|
|
||||||
rgbds-${{ env.version }}-win64.zip
|
|
||||||
rgbds-${{ env.version }}.tar.gz
|
|
||||||
fail_on_unmatched_files: true
|
|
||||||
env:
|
|
||||||
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
|
|
||||||
@@ -0,0 +1,125 @@
|
|||||||
|
name: Create release artifacts
|
||||||
|
on:
|
||||||
|
push:
|
||||||
|
tags:
|
||||||
|
- v[0-9]*
|
||||||
|
|
||||||
|
env:
|
||||||
|
# Force colored output (see https://bixense.com/clicolors/ and https://force-color.org/)
|
||||||
|
TERM: xterm-256color
|
||||||
|
CLICOLOR: 1
|
||||||
|
CLICOLOR_FORCE: 1
|
||||||
|
|
||||||
|
CMAKE_COLOR_DIAGNOSTICS: ON # Tells CMake-generated build systems to have colored output.
|
||||||
|
CMAKE_BUILD_TYPE: Release # `cmake -S` now implies `-DCMAKE_BUILD_TYPE=Release`.
|
||||||
|
CMAKE_CONFIG_TYPE: Release # `cmake --build` now implies `--config Release`.
|
||||||
|
|
||||||
|
# We instruct CMake to download and build third-party projects in the same place as in `testing.yml`
|
||||||
|
# to prevent divergence between testing and release workflows.
|
||||||
|
DEPS_ROOT_DIR: ~/_deps
|
||||||
|
|
||||||
|
# We use Ninja as the generator for CMake below because it provides synchronous output by default,
|
||||||
|
# and only shows full command lines when they fail.
|
||||||
|
|
||||||
|
jobs:
|
||||||
|
windows:
|
||||||
|
runs-on: windows-2022
|
||||||
|
strategy:
|
||||||
|
matrix:
|
||||||
|
bits: [32, 64]
|
||||||
|
fail-fast: false
|
||||||
|
steps:
|
||||||
|
- name: Checkout repo
|
||||||
|
uses: actions/checkout@v7
|
||||||
|
- name: Install deps
|
||||||
|
run: |
|
||||||
|
bash .github/scripts/install-deps.sh windows
|
||||||
|
- name: Build Windows binaries
|
||||||
|
shell: cmd
|
||||||
|
run: |
|
||||||
|
call .github\scripts\msvc-env.bat ${{ matrix.bits }}
|
||||||
|
cmake -B build -G Ninja -DFETCHCONTENT_BASE_DIR="${{ env.DEPS_ROOT_DIR }}" -DCMAKE_C_FLAGS="/nologo"
|
||||||
|
cmake --build build -- -k 0
|
||||||
|
- name: Package binaries
|
||||||
|
working-directory: build
|
||||||
|
run: |
|
||||||
|
cpack -DCPACK_PACKAGE_FILE_NAME=rgbds-win${{ matrix.bits }} -G ZIP --verbose
|
||||||
|
- name: Upload Windows binaries
|
||||||
|
uses: actions/upload-artifact@v7
|
||||||
|
with:
|
||||||
|
name: win${{ matrix.bits }}
|
||||||
|
path: build/rgbds-win${{ matrix.bits }}.zip
|
||||||
|
if-no-files-found: error
|
||||||
|
|
||||||
|
macos:
|
||||||
|
runs-on: macos-26
|
||||||
|
steps:
|
||||||
|
- name: Checkout repo
|
||||||
|
uses: actions/checkout@v7
|
||||||
|
- name: Install deps
|
||||||
|
run: |
|
||||||
|
./.github/scripts/install-deps.sh macos lld
|
||||||
|
- name: Build binaries
|
||||||
|
run: |
|
||||||
|
cmake -B build -G Ninja --preset macos-static -DFETCHCONTENT_BASE_DIR="${{ env.DEPS_ROOT_DIR }}"
|
||||||
|
cmake --build build -- -k 0
|
||||||
|
strip rgb{asm,link,fix,gfx}
|
||||||
|
env:
|
||||||
|
LDFLAGS: -fuse-ld=lld # cmake/macos-static.cmake comments explain why we use lld.
|
||||||
|
- name: Create install script
|
||||||
|
run: |
|
||||||
|
make install.sh
|
||||||
|
- name: Package binaries
|
||||||
|
run: |
|
||||||
|
zip --junk-paths rgbds-macos.zip rgb{asm,link,fix,gfx} man/* install.sh
|
||||||
|
- name: Upload macOS binaries
|
||||||
|
uses: actions/upload-artifact@v7
|
||||||
|
with:
|
||||||
|
name: macos
|
||||||
|
path: rgbds-macos.zip
|
||||||
|
if-no-files-found: error
|
||||||
|
|
||||||
|
linux:
|
||||||
|
runs-on: ubuntu-22.04 # Oldest supported, for best glibc compatibility.
|
||||||
|
steps:
|
||||||
|
- name: Checkout repo
|
||||||
|
uses: actions/checkout@v7
|
||||||
|
- name: Install deps
|
||||||
|
run: |
|
||||||
|
./.github/scripts/install-deps.sh ubuntu-22.04
|
||||||
|
- name: Build binaries
|
||||||
|
run: |
|
||||||
|
make -k -j "$(getconf _NPROCESSORS_ONLN)" WARNFLAGS="-Wall -Wextra -pedantic -static" PKG_CONFIG="pkg-config --static" Q=
|
||||||
|
strip rgb{asm,link,fix,gfx}
|
||||||
|
- name: Create install script
|
||||||
|
run: |
|
||||||
|
make install.sh Q=
|
||||||
|
- name: Package binaries
|
||||||
|
run: |
|
||||||
|
tar caf rgbds-linux-x86_64.tar.xz --transform='s#.*/##' rgb{asm,link,fix,gfx} man/* install.sh
|
||||||
|
- name: Upload Linux binaries
|
||||||
|
uses: actions/upload-artifact@v7
|
||||||
|
with:
|
||||||
|
name: linux
|
||||||
|
path: rgbds-linux-x86_64.tar.xz
|
||||||
|
if-no-files-found: error
|
||||||
|
|
||||||
|
release:
|
||||||
|
runs-on: ubuntu-slim
|
||||||
|
needs: [windows, macos, linux]
|
||||||
|
permissions:
|
||||||
|
contents: write
|
||||||
|
steps:
|
||||||
|
- name: Checkout repo
|
||||||
|
uses: actions/checkout@v7
|
||||||
|
- name: Package sources
|
||||||
|
run: |
|
||||||
|
make dist Q=
|
||||||
|
- name: Download all binary packages
|
||||||
|
uses: actions/download-artifact@v8
|
||||||
|
- name: Draft the release
|
||||||
|
run: |
|
||||||
|
.github/scripts/draft-release.sh "${ref#refs/tags/}"
|
||||||
|
env:
|
||||||
|
ref: ${{ github.ref_name }}
|
||||||
|
GH_TOKEN: ${{ github.token }} # Required by the `gh` command.
|
||||||
@@ -1,46 +1,48 @@
|
|||||||
name: "Create release docs"
|
name: Create release docs
|
||||||
on:
|
on:
|
||||||
release:
|
release:
|
||||||
types:
|
types:
|
||||||
- released # This avoids triggering on pre-releases
|
- released # This avoids triggering on pre-releases
|
||||||
|
|
||||||
|
env:
|
||||||
|
# Force colored output (see https://bixense.com/clicolors/ and https://force-color.org/)
|
||||||
|
TERM: xterm-256color
|
||||||
|
CLICOLOR: 1
|
||||||
|
CLICOLOR_FORCE: 1
|
||||||
|
|
||||||
jobs:
|
jobs:
|
||||||
build:
|
build:
|
||||||
if: github.repository_owner == 'gbdev'
|
if: github.repository_owner == 'gbdev'
|
||||||
runs-on: ubuntu-22.04
|
runs-on: ubuntu-slim
|
||||||
steps:
|
steps:
|
||||||
- name: Checkout rgbds@release
|
- name: Checkout rgbds@release
|
||||||
uses: actions/checkout@v2
|
uses: actions/checkout@v7
|
||||||
with:
|
with:
|
||||||
path: rgbds
|
path: rgbds
|
||||||
- name: Checkout rgbds-www@master
|
sparse-checkout: man # Avoid checking out other files, we don't use them here.
|
||||||
uses: actions/checkout@v2
|
- name: Checkout rgbds-www
|
||||||
|
uses: actions/checkout@v7
|
||||||
with:
|
with:
|
||||||
repository: ${{ github.repository_owner }}/rgbds-www
|
|
||||||
path: rgbds-www
|
path: rgbds-www
|
||||||
|
repository: ${{ github.repository_owner }}/rgbds-www
|
||||||
|
ref: master # Need to check out the branch to be able to commit on and push it.
|
||||||
|
ssh-key: !!str ${{ secrets.SSH_KEY_SECRET }}
|
||||||
- name: Install groff and mandoc
|
- name: Install groff and mandoc
|
||||||
run: |
|
run: |
|
||||||
sudo apt-get -qq update
|
sudo apt install -Uyq groff mandoc -o APT::Color=yes -o Acquire::Queue-Mode=access
|
||||||
sudo apt-get install -yq groff mandoc
|
|
||||||
- name: Update pages
|
- name: Update pages
|
||||||
working-directory: rgbds/man
|
working-directory: rgbds/man
|
||||||
run: | # The ref appears to be in the format "refs/tags/<version>", so strip that
|
run: | # The ref appears to be in the format "refs/tags/<version>", so strip that
|
||||||
../../rgbds-www/.github/actions/get-pages.sh ${GITHUB_REF##*/} *
|
../../rgbds-www/maintainer/man_to_html.sh ${GITHUB_REF##*/} *
|
||||||
|
../../rgbds-www/maintainer/new_release.sh ${GITHUB_REF##*/}
|
||||||
- name: Push new pages
|
- name: Push new pages
|
||||||
working-directory: rgbds-www
|
working-directory: rgbds-www
|
||||||
|
env:
|
||||||
|
GIT_AUTHOR_NAME: !!str ${{ github.actor }}
|
||||||
|
GIT_AUTHOR_EMAIL: !!str ${{ github.actor_id }}+${{ github.actor }}@users.noreply.github.com
|
||||||
|
GIT_COMMITTER_NAME: github-actions[bot]
|
||||||
|
GIT_COMMITTER_EMAIL: 41898282+github-actions[bot]@users.noreply.github.com
|
||||||
run: |
|
run: |
|
||||||
mkdir -p -m 700 ~/.ssh
|
|
||||||
cat > ~/.ssh/id_ed25519 <<<"${{ secrets.SSH_KEY_SECRET }}"
|
|
||||||
chmod 0600 ~/.ssh/id_ed25519
|
|
||||||
eval $(ssh-agent -s)
|
|
||||||
ssh-add ~/.ssh/id_ed25519
|
|
||||||
git config --global user.name "GitHub Action"
|
|
||||||
git config --global user.email "[email protected]"
|
|
||||||
git add -A
|
git add -A
|
||||||
git commit -m "Create RGBDS ${GITHUB_REF##*/} documentation"
|
git commit -m "Create RGBDS ${GITHUB_REF##*/} documentation"
|
||||||
if git remote | grep -q origin; then
|
git push
|
||||||
git remote set-url origin [email protected]:${{ github.repository_owner }}/rgbds-www.git
|
|
||||||
else
|
|
||||||
git remote add origin [email protected]:${{ github.repository_owner }}/rgbds-www.git
|
|
||||||
fi
|
|
||||||
git push origin master
|
|
||||||
|
|||||||
+372
-148
@@ -1,227 +1,451 @@
|
|||||||
name: "Regression testing"
|
name: Regression testing
|
||||||
on:
|
on:
|
||||||
- push
|
- push
|
||||||
- pull_request
|
- pull_request
|
||||||
|
|
||||||
|
env:
|
||||||
|
# Force colored output (see https://bixense.com/clicolors/ and https://force-color.org/)
|
||||||
|
TERM: xterm-256color
|
||||||
|
CLICOLOR: 1
|
||||||
|
CLICOLOR_FORCE: 1
|
||||||
|
|
||||||
|
CMAKE_COLOR_DIAGNOSTICS: ON # Tells CMake-generated build systems to have colored output.
|
||||||
|
CMAKE_CONFIG_TYPE: Debug # `cmake --build` now implies `--config Debug`.
|
||||||
|
|
||||||
|
CTEST_PARALLEL_LEVEL: "" # `ctest` now implies `--parallel` (default number of logical CPUs).
|
||||||
|
CTEST_NO_TESTS_ACTION: error # Make CTest fail if it cannot find any tests. (That should never happen.)
|
||||||
|
CTEST_OUTPUT_ON_FAILURE: ON # CTest reports test program output on failure.
|
||||||
|
|
||||||
|
GIT_CONFIG_COUNT: 1
|
||||||
|
GIT_CONFIG_KEY_0: color.ui
|
||||||
|
GIT_CONFIG_VALUE_0: always # Colorful output is helpful even though CI is not considered to be a terminal.
|
||||||
|
|
||||||
|
# We instruct CMake to download and build third-party projects outside of our source tree,
|
||||||
|
# otherwise they can trigger `-Werror=dev` (from the `develop` preset).
|
||||||
|
DEPS_ROOT_DIR: ~/_deps # Note that this needs to be used in a position where Bash will trigger tilde expansion!
|
||||||
|
|
||||||
|
# We use bash syntax across OSes for consistency unless otherwise specified
|
||||||
|
defaults:
|
||||||
|
run:
|
||||||
|
shell: bash
|
||||||
|
|
||||||
|
# We use Ninja as the generator for CMake below because it provides synchronous output by default,
|
||||||
|
# and only shows full command lines when they fail.
|
||||||
|
|
||||||
jobs:
|
jobs:
|
||||||
unix-testing:
|
unix:
|
||||||
strategy:
|
strategy:
|
||||||
matrix:
|
matrix:
|
||||||
os: [ubuntu-20.04, ubuntu-22.04, macos-11, macos-12]
|
os: [ubuntu-22.04, macos-15-intel, macos-26]
|
||||||
cc: [gcc, clang]
|
cxx: [g++, clang++]
|
||||||
buildsys: [make, cmake]
|
buildsys: [make, cmake]
|
||||||
exclude:
|
exclude: # Don't use `g++` on macOS; it's just an alias to `clang++`.
|
||||||
# `gcc` is just an alias to `clang` on macOS, don't bother
|
- { os: macos-15-intel, cxx: g++ }
|
||||||
- os: macos-11
|
- { os: macos-26, cxx: g++ }
|
||||||
cc: gcc
|
include: # Use `g++-10`, the earliest GCC version we support, on the earliest Ubuntu runner.
|
||||||
- os: macos-12
|
- { os: ubuntu-22.04, cxx: g++-10, buildsys: make }
|
||||||
cc: gcc
|
- { os: ubuntu-22.04, cxx: g++-10, buildsys: cmake }
|
||||||
include:
|
|
||||||
- cc: gcc
|
|
||||||
cxx: g++
|
|
||||||
- cc: clang
|
|
||||||
cxx: clang++
|
|
||||||
fail-fast: false
|
fail-fast: false
|
||||||
runs-on: ${{ matrix.os }}
|
runs-on: ${{ matrix.os }}
|
||||||
steps:
|
steps:
|
||||||
- uses: actions/checkout@v2
|
- name: Checkout repo
|
||||||
|
uses: actions/checkout@v7
|
||||||
- name: Install deps
|
- name: Install deps
|
||||||
shell: bash
|
|
||||||
run: |
|
run: |
|
||||||
./.github/actions/install_deps.sh ${{ matrix.os }}
|
.github/scripts/install-deps.sh ${{ matrix.os }} ${{ matrix.cxx }}
|
||||||
# The `export` lines are to allow working on macOS...
|
- name: Build using Make
|
||||||
# Apple's base version is severely outdated, not even supporting -Wall,
|
|
||||||
# but it overrides Homebrew's version nonetheless...
|
|
||||||
- name: Build & install using Make
|
|
||||||
if: matrix.buildsys == 'make'
|
if: matrix.buildsys == 'make'
|
||||||
run: |
|
run: |
|
||||||
export PATH="/usr/local/opt/bison/bin:$PATH"
|
make develop -k -j "$(getconf _NPROCESSORS_ONLN)" Q= CXX=${{ matrix.cxx }}
|
||||||
make develop -j Q= CC=${{ matrix.cc }} CXX=${{ matrix.cxx }}
|
- name: Install using Make
|
||||||
sudo make install -j Q=
|
if: matrix.buildsys == 'make'
|
||||||
- name: Build & install using CMake
|
run: |
|
||||||
|
sudo make install Q=
|
||||||
|
type rgbasm rgblink rgbfix rgbgfx
|
||||||
|
man -w 1 rgbasm rgblink rgbfix rgbgfx
|
||||||
|
- name: Build using CMake
|
||||||
|
if: matrix.buildsys == 'cmake'
|
||||||
|
# Since GitHub's runners are basically kitchen sinks,
|
||||||
|
# the Mono framework exposes a libpng 1.4.x header, breaking everything.
|
||||||
|
# Searching frameworks last makes Homebrew's libpng be discovered first, which works.
|
||||||
|
# Note that since this is specific to our CI environment, the workaround is
|
||||||
|
# better applied here than in our CMakeLists, where it could affect and break someone else.
|
||||||
|
run: |
|
||||||
|
CXX=${{ matrix.cxx }} cmake -B build -G Ninja --preset develop -DCMAKE_FIND_FRAMEWORK=LAST
|
||||||
|
cmake --build build -- -k 0
|
||||||
|
- name: Install using CMake
|
||||||
if: matrix.buildsys == 'cmake'
|
if: matrix.buildsys == 'cmake'
|
||||||
run: |
|
run: |
|
||||||
export PATH="/usr/local/opt/bison/bin:$PATH"
|
|
||||||
cmake -S . -B build -DCMAKE_BUILD_TYPE=Debug -DCMAKE_C_COMPILER=${{ matrix.cc }} -DCMAKE_CXX_COMPILER=${{ matrix.cxx }} -DSANITIZERS=ON -DMORE_WARNINGS=ON
|
|
||||||
cmake --build build -j --verbose
|
|
||||||
cp build/src/rgb{asm,link,fix,gfx} .
|
|
||||||
sudo cmake --install build --verbose
|
sudo cmake --install build --verbose
|
||||||
|
type rgbasm rgblink rgbfix rgbgfx
|
||||||
|
man -w 1 rgbasm rgblink rgbfix rgbgfx
|
||||||
- name: Package binaries
|
- name: Package binaries
|
||||||
run: |
|
run: |
|
||||||
mkdir bins
|
mkdir bins
|
||||||
cp rgb{asm,link,fix,gfx} bins
|
cp rgb{asm,link,fix,gfx} bins
|
||||||
- name: Upload binaries
|
- name: Upload binaries
|
||||||
uses: actions/upload-artifact@v3
|
uses: actions/upload-artifact@v7
|
||||||
with:
|
with:
|
||||||
name: rgbds-canary-${{ matrix.os }}-${{ matrix.cc }}-${{ matrix.buildsys }}
|
name: rgbds-canary-${{ matrix.os }}-${{ matrix.cxx }}-${{ matrix.buildsys }}
|
||||||
path: bins
|
path: bins
|
||||||
- name: Test
|
if-no-files-found: error
|
||||||
shell: bash
|
- name: Compute test dependency cache params
|
||||||
|
id: test-deps-cache-params
|
||||||
run: |
|
run: |
|
||||||
test/run-tests.sh
|
paths=$(test/external/fetch-repos.sh --get-paths)
|
||||||
|
hash=$(test/external/fetch-repos.sh --get-hash)
|
||||||
|
tee -a <<<"paths=\"${paths//,/\\n}\"" $GITHUB_OUTPUT
|
||||||
|
tee -a <<<"hash=${hash%-}" $GITHUB_OUTPUT
|
||||||
|
- name: Check test dependency repositories cache
|
||||||
|
id: test-deps-cache
|
||||||
|
uses: actions/cache@v5
|
||||||
|
with:
|
||||||
|
path: ${{ fromJSON(steps.test-deps-cache-params.outputs.paths) }}
|
||||||
|
key: ${{ matrix.os }}-${{ steps.test-deps-cache-params.outputs.hash }}
|
||||||
|
- name: Fetch test dependency repositories
|
||||||
|
if: steps.test-deps-cache.outputs.cache-hit != 'true'
|
||||||
|
continue-on-error: true
|
||||||
|
run: |
|
||||||
|
test/external/fetch-repos.sh
|
||||||
|
- name: Run tests using our script
|
||||||
|
if: matrix.buildsys == 'make'
|
||||||
|
run: |
|
||||||
|
CXX=${{ matrix.cxx }} test/run-tests.sh --os ${{ matrix.os }} --jobs "$(getconf _NPROCESSORS_ONLN)"
|
||||||
|
- name: Run tests using CTest
|
||||||
|
if: matrix.buildsys == 'cmake'
|
||||||
|
run: |
|
||||||
|
ctest --test-dir build --schedule-random
|
||||||
|
|
||||||
windows-testing:
|
macos-static:
|
||||||
|
runs-on: macos-26
|
||||||
|
steps:
|
||||||
|
- name: Checkout repo
|
||||||
|
uses: actions/checkout@v7
|
||||||
|
- name: Install deps
|
||||||
|
run: |
|
||||||
|
.github/scripts/install-deps.sh macos lld
|
||||||
|
- name: Cache library deps
|
||||||
|
uses: actions/cache@v5
|
||||||
|
with:
|
||||||
|
path: ${{ env.DEPS_ROOT_DIR }}/*-tmp/
|
||||||
|
key: dep-srcs-${{ hashFiles('cmake/deps.cmake') }}
|
||||||
|
enableCrossOsArchive: true
|
||||||
|
- name: Build
|
||||||
|
run: |
|
||||||
|
cmake -B build -G Ninja --preset macos-static -DFETCHCONTENT_BASE_DIR="${{ env.DEPS_ROOT_DIR }}"
|
||||||
|
cmake --build build -- -k 0
|
||||||
|
env:
|
||||||
|
LDFLAGS: -fuse-ld=lld # cmake/macos-static.cmake comments explain why we use lld.
|
||||||
|
- name: Install
|
||||||
|
run: |
|
||||||
|
sudo cmake --install build --verbose
|
||||||
|
type rgbasm rgblink rgbfix rgbgfx
|
||||||
|
man -w 1 rgbasm rgblink rgbfix rgbgfx
|
||||||
|
- name: Package binaries
|
||||||
|
run: |
|
||||||
|
mkdir bins
|
||||||
|
cp rgb{asm,link,fix,gfx} bins
|
||||||
|
- name: Upload binaries
|
||||||
|
uses: actions/upload-artifact@v7
|
||||||
|
with:
|
||||||
|
name: rgbds-canary-macos-static
|
||||||
|
path: bins
|
||||||
|
if-no-files-found: error
|
||||||
|
- name: Compute test dependency cache params
|
||||||
|
id: test-deps-cache-params
|
||||||
|
run: |
|
||||||
|
paths=$(test/external/fetch-repos.sh --get-paths)
|
||||||
|
hash=$(test/external/fetch-repos.sh --get-hash)
|
||||||
|
tee -a <<<"paths=\"${paths//,/\\n}\"" $GITHUB_OUTPUT
|
||||||
|
tee -a <<<"hash=${hash%-}" $GITHUB_OUTPUT
|
||||||
|
- name: Check test dependency repositories cache
|
||||||
|
id: test-deps-cache
|
||||||
|
uses: actions/cache@v5
|
||||||
|
with:
|
||||||
|
path: ${{ fromJSON(steps.test-deps-cache-params.outputs.paths) }}
|
||||||
|
key: macos-26-${{ steps.test-deps-cache-params.outputs.hash }}
|
||||||
|
- name: Fetch test dependency repositories
|
||||||
|
if: steps.test-deps-cache.outputs.cache-hit != 'true'
|
||||||
|
continue-on-error: true
|
||||||
|
run: |
|
||||||
|
test/external/fetch-repos.sh
|
||||||
|
- name: Run tests
|
||||||
|
run: |
|
||||||
|
ctest --test-dir build --schedule-random
|
||||||
|
|
||||||
|
windows:
|
||||||
strategy:
|
strategy:
|
||||||
matrix:
|
matrix:
|
||||||
bits: [32, 64]
|
bits: [32, 64]
|
||||||
os: [windows-2019, windows-2022]
|
os: [windows-2022, windows-2025]
|
||||||
include:
|
|
||||||
- bits: 32
|
|
||||||
arch: x86
|
|
||||||
platform: Win32
|
|
||||||
- bits: 64
|
|
||||||
arch: x86_x64
|
|
||||||
platform: x64
|
|
||||||
fail-fast: false
|
fail-fast: false
|
||||||
runs-on: ${{ matrix.os }}
|
runs-on: ${{ matrix.os }}
|
||||||
steps:
|
steps:
|
||||||
- uses: actions/checkout@v2
|
- name: Checkout repo
|
||||||
- name: Get zlib, libpng and bison
|
uses: actions/checkout@v7
|
||||||
run: | # TODO: use an array; remember to update the versions being downloaded, *and* the paths being extracted! (`Move-Item`)
|
- name: Install deps
|
||||||
$wc = New-Object System.Net.WebClient
|
run: |
|
||||||
$wc.DownloadFile('https://www.zlib.net/zlib1212.zip', 'zlib.zip')
|
bash .github/scripts/install-deps.sh ${{ matrix.os }}
|
||||||
$hash = (Get-FileHash "zlib.zip" -Algorithm SHA256).Hash
|
- name: Cache library deps
|
||||||
if ($hash -ne '173e89893dcb8b4a150d7731cd72f0602f1d6b45e60e2a54efdf7f3fc3325fd7') {
|
uses: actions/cache@v5
|
||||||
Write-Host "zlib SHA256 mismatch! ($hash)"
|
|
||||||
exit 1
|
|
||||||
}
|
|
||||||
$wc.DownloadFile('https://download.sourceforge.net/libpng/lpng1637.zip', 'libpng.zip')
|
|
||||||
$hash = (Get-FileHash "libpng.zip" -Algorithm SHA256).Hash
|
|
||||||
if ($hash -ne '3b4b1cbd0bae6822f749d39b1ccadd6297f05e2b85a83dd2ce6ecd7d09eabdf2') {
|
|
||||||
Write-Host "libpng SHA256 mismatch! ($hash)"
|
|
||||||
exit 1
|
|
||||||
}
|
|
||||||
$wc.DownloadFile('https://github.com/lexxmark/winflexbison/releases/download/v2.5.24/win_flex_bison-2.5.24.zip', 'winflexbison.zip')
|
|
||||||
$hash = (Get-FileHash "winflexbison.zip" -Algorithm SHA256).Hash
|
|
||||||
if ($hash -ne '39c6086ce211d5415500acc5ed2d8939861ca1696aee48909c7f6daf5122b505') {
|
|
||||||
Write-Host "bison SHA256 mismatch! ($hash)"
|
|
||||||
}
|
|
||||||
Expand-Archive -DestinationPath . "zlib.zip"
|
|
||||||
Expand-Archive -DestinationPath . "libpng.zip"
|
|
||||||
Expand-Archive -DestinationPath install_dir "winflexbison.zip"
|
|
||||||
Move-Item zlib-1.2.12 zlib
|
|
||||||
Move-Item lpng1637 libpng
|
|
||||||
- uses: actions/cache@v3
|
|
||||||
id: cache
|
|
||||||
with:
|
with:
|
||||||
path: |
|
path: ${{ env.DEPS_ROOT_DIR }}/*-tmp/
|
||||||
zbuild
|
key: dep-srcs-${{ hashFiles('cmake/deps.cmake') }}
|
||||||
pngbuild
|
enableCrossOsArchive: true
|
||||||
key: ${{ matrix.arch }}-${{ hashFiles('zlib/**', 'libpng/**') }}
|
- name: Build
|
||||||
- name: Build zlib
|
shell: cmd
|
||||||
run: | # BUILD_SHARED_LIBS causes the output DLL to be correctly called `zlib1.dll`
|
run: | # ASan seems to be broken on Windows, so we disable it.
|
||||||
cmake -S zlib -B zbuild -A ${{ matrix.platform }} -DCMAKE_INSTALL_PREFIX=install_dir -DBUILD_SHARED_LIBS=ON
|
call .github\scripts\msvc-env.bat ${{ matrix.bits }}
|
||||||
cmake --build zbuild --config Release -j
|
cmake -B build -G Ninja --preset develop -DFETCHCONTENT_BASE_DIR="${{ env.DEPS_ROOT_DIR }}" ^
|
||||||
if: steps.cache.outputs.cache-hit != 'true'
|
-DSANITIZERS=OFF -DCMAKE_C_FLAGS="/nologo"
|
||||||
- name: Install zlib
|
cmake --build build -- -k 0
|
||||||
|
- name: Install
|
||||||
|
shell: cmd
|
||||||
run: |
|
run: |
|
||||||
cmake --install zbuild
|
cmake --install build --verbose
|
||||||
- name: Build libpng
|
where rgbasm rgblink rgbfix rgbgfx
|
||||||
run: |
|
|
||||||
cmake -S libpng -B pngbuild -A ${{ matrix.platform }} -DCMAKE_INSTALL_PREFIX=install_dir -DPNG_SHARED=ON -DPNG_STATIC=ON -DPNG_TESTS=OFF
|
|
||||||
cmake --build pngbuild --config Release -j
|
|
||||||
if: steps.cache.outputs.cache-hit != 'true'
|
|
||||||
- name: Install libpng
|
|
||||||
run: |
|
|
||||||
cmake --install pngbuild
|
|
||||||
- name: Build Windows binaries
|
|
||||||
run: |
|
|
||||||
cmake -S . -B build -A ${{ matrix.platform }} -DCMAKE_INSTALL_PREFIX=install_dir -DCMAKE_BUILD_TYPE=Release
|
|
||||||
cmake --build build --config Release -j --verbose
|
|
||||||
cmake --install build --verbose --prefix install_dir
|
|
||||||
- name: Package binaries
|
- name: Package binaries
|
||||||
shell: bash
|
working-directory: build
|
||||||
run: |
|
run: |
|
||||||
mkdir bins
|
cpack -DCPACK_PACKAGE_FILE_NAME=rgbds-win${{ matrix.bits }} -G ZIP --verbose
|
||||||
cp install_dir/bin/{rgbasm.exe,rgblink.exe,rgbfix.exe,rgbgfx.exe,zlib1.dll,libpng16.dll} bins
|
|
||||||
- name: Upload Windows binaries
|
- name: Upload Windows binaries
|
||||||
uses: actions/upload-artifact@v3
|
uses: actions/upload-artifact@v7
|
||||||
with:
|
with:
|
||||||
name: rgbds-canary-win${{ matrix.bits }}
|
name: rgbds-canary-w${{ matrix.bits }}-${{ matrix.os }}
|
||||||
path: bins
|
path: build/rgbds-win${{ matrix.bits }}.zip
|
||||||
- name: Test
|
if-no-files-found: error
|
||||||
shell: bash
|
- name: Compute test dependency cache params
|
||||||
|
id: test-deps-cache-params
|
||||||
run: |
|
run: |
|
||||||
cp bins/* .
|
paths=$(test/external/fetch-repos.sh --get-paths)
|
||||||
cp bins/*.dll test/gfx
|
hash=$(test/external/fetch-repos.sh --get-hash)
|
||||||
test/run-tests.sh
|
tee -a <<<"paths=\"${paths//,/\\n}\"" $GITHUB_OUTPUT
|
||||||
|
tee -a <<<"hash=${hash%-}" $GITHUB_OUTPUT
|
||||||
|
- name: Check test dependency repositories cache
|
||||||
|
id: test-deps-cache
|
||||||
|
uses: actions/cache@v5
|
||||||
|
with:
|
||||||
|
path: ${{ fromJSON(steps.test-deps-cache-params.outputs.paths) }}
|
||||||
|
key: ${{ matrix.os }}-${{ matrix.bits }}-${{ steps.test-deps-cache-params.outputs.hash }}
|
||||||
|
- name: Fetch test dependency repositories
|
||||||
|
if: steps.test-deps-cache.outputs.cache-hit != 'true'
|
||||||
|
continue-on-error: true
|
||||||
|
run: |
|
||||||
|
test/external/fetch-repos.sh
|
||||||
|
- name: Run tests using CTest
|
||||||
|
run: |
|
||||||
|
ctest --test-dir build --schedule-random
|
||||||
|
|
||||||
windows-xbuild:
|
windows-mingw-build:
|
||||||
strategy:
|
strategy:
|
||||||
matrix:
|
matrix:
|
||||||
bits: [32, 64]
|
bits: [32, 64]
|
||||||
include:
|
|
||||||
- bits: 32
|
|
||||||
arch: i686
|
|
||||||
triplet: i686-w64-mingw32
|
|
||||||
- bits: 64
|
|
||||||
arch: x86-64
|
|
||||||
triplet: x86_64-w64-mingw32
|
|
||||||
fail-fast: false
|
fail-fast: false
|
||||||
runs-on: ubuntu-22.04
|
runs-on: ubuntu-latest
|
||||||
env:
|
|
||||||
DIST_DIR: win${{ matrix.bits }}
|
|
||||||
steps:
|
steps:
|
||||||
- uses: actions/checkout@v2
|
- name: Checkout repo
|
||||||
|
uses: actions/checkout@v7
|
||||||
- name: Install deps
|
- name: Install deps
|
||||||
shell: bash
|
|
||||||
run: |
|
run: |
|
||||||
./.github/actions/install_deps.sh ${{ matrix.os }}
|
.github/scripts/install-deps.sh ubuntu mingw${{ matrix.bits }}
|
||||||
- name: Install MinGW
|
- name: Cache library deps
|
||||||
run: | # dpkg-dev is apparently required for pkg-config for cross-building
|
uses: actions/cache@v5
|
||||||
sudo apt-get install {gcc,g++}-mingw-w64-${{ matrix.arch }}-win32 mingw-w64-tools libz-mingw-w64-dev dpkg-dev
|
with:
|
||||||
- name: Install libpng dev headers for MinGW
|
path: ${{ env.DEPS_ROOT_DIR }}/*-tmp/
|
||||||
run: |
|
key: dep-srcs-${{ hashFiles('cmake/deps.cmake') }}
|
||||||
sudo ./.github/actions/mingw-w64-libpng-dev.sh ${{ matrix.triplet }}
|
enableCrossOsArchive: true
|
||||||
- name: Cross-build Windows binaries
|
- name: Cross-build Windows binaries
|
||||||
|
run: | # MinGW doesn't support `--preset develop` sanitizers ASan or UBSan, so we disable them.
|
||||||
|
dll_search_dir=$(printf '%s\n' /usr/lib/gcc/*-w64-mingw32/*-win32 | tee -a /dev/stderr)
|
||||||
|
cmake -B build -G Ninja --preset develop -DFETCHCONTENT_BASE_DIR="${{ env.DEPS_ROOT_DIR }}" \
|
||||||
|
-DSANITIZERS=OFF -DDLL_SEARCH_DIRS="$dll_search_dir" \
|
||||||
|
--toolchain cmake/toolchain-mingw${{ matrix.bits }}.cmake
|
||||||
|
cmake --build build -- -k 0
|
||||||
|
- name: Package Windows binaries
|
||||||
run: |
|
run: |
|
||||||
make mingw${{ matrix.bits }} -j Q=
|
cmake --install build --prefix . --verbose --component binaries
|
||||||
- name: Package binaries
|
cmake --install build --prefix . --verbose --component shared-libs
|
||||||
run: | # DLL dependencies can be figured out using e.g. Dependency Walker
|
|
||||||
mkdir bins
|
|
||||||
mv -v rgb{asm,link,fix,gfx}.exe bins/
|
|
||||||
cp -v /usr/${{ matrix.triplet }}/lib/zlib1.dll bins
|
|
||||||
cp -v /usr/${{ matrix.triplet }}/bin/libpng16-16.dll bins
|
|
||||||
[ "${{ matrix.bits }}" -ne 32 ] || cp -v /usr/lib/gcc/${{ matrix.triplet }}/10-win32/lib{gcc_s_dw2-1,ssp-0,stdc++-6}.dll bins
|
|
||||||
- name: Upload Windows binaries
|
- name: Upload Windows binaries
|
||||||
uses: actions/upload-artifact@v3
|
uses: actions/upload-artifact@v7
|
||||||
with:
|
with:
|
||||||
name: rgbds-canary-mingw-win${{ matrix.bits }}
|
name: rgbds-canary-mingw-win${{ matrix.bits }}
|
||||||
path: bins
|
path: bin
|
||||||
|
if-no-files-found: error
|
||||||
- name: Upload Windows test binaries
|
- name: Upload Windows test binaries
|
||||||
uses: actions/upload-artifact@v3
|
uses: actions/upload-artifact@v7
|
||||||
with:
|
with:
|
||||||
name: testing-programs-mingw-win${{ matrix.bits }}
|
name: testing-programs-mingw-win${{ matrix.bits }}
|
||||||
path: |
|
path: |
|
||||||
test/gfx/randtilegen.exe
|
test/gfx/randtilegen.exe
|
||||||
test/gfx/rgbgfx_test.exe
|
test/gfx/rgbgfx_test.exe
|
||||||
|
if-no-files-found: error
|
||||||
|
|
||||||
windows-xtesting:
|
windows-mingw-testing:
|
||||||
needs: windows-xbuild
|
needs: windows-mingw-build
|
||||||
strategy:
|
strategy:
|
||||||
matrix:
|
matrix:
|
||||||
os: [windows-2019, windows-2022]
|
os: [windows-2022, windows-2025]
|
||||||
bits: [32, 64]
|
bits: [32, 64]
|
||||||
fail-fast: false
|
fail-fast: false
|
||||||
runs-on: ${{ matrix.os }}
|
runs-on: ${{ matrix.os }}
|
||||||
steps:
|
steps:
|
||||||
- uses: actions/checkout@v2
|
- name: Checkout repo
|
||||||
|
uses: actions/checkout@v7
|
||||||
|
- name: Install test deps
|
||||||
|
run: |
|
||||||
|
.github/scripts/install-deps.sh windowsmingw
|
||||||
- name: Retrieve binaries
|
- name: Retrieve binaries
|
||||||
uses: actions/download-artifact@v3
|
uses: actions/download-artifact@v8
|
||||||
with:
|
with:
|
||||||
name: rgbds-canary-mingw-win${{ matrix.bits }}
|
name: rgbds-canary-mingw-win${{ matrix.bits }}
|
||||||
path: bins
|
path: bins
|
||||||
- name: Retrieve test binaries
|
- name: Retrieve test binaries
|
||||||
uses: actions/download-artifact@v3
|
uses: actions/download-artifact@v8
|
||||||
with:
|
with:
|
||||||
name: testing-programs-mingw-win${{ matrix.bits }}
|
name: testing-programs-mingw-win${{ matrix.bits }}
|
||||||
path: test/gfx
|
path: test/gfx
|
||||||
- name: Extract binaries
|
- name: Extract binaries
|
||||||
shell: bash
|
|
||||||
run: |
|
run: |
|
||||||
cp bins/* .
|
cp bins/* .
|
||||||
cp bins/*.dll test/gfx
|
cp bins/*.dll test/gfx
|
||||||
- name: Run tests
|
- name: Compute test dependency cache params
|
||||||
shell: bash
|
id: test-deps-cache-params
|
||||||
run: |
|
run: |
|
||||||
test/run-tests.sh
|
paths=$(test/external/fetch-repos.sh --get-paths)
|
||||||
|
hash=$(test/external/fetch-repos.sh --get-hash)
|
||||||
|
tee -a <<<"paths=\"${paths//,/\\n}\"" $GITHUB_OUTPUT
|
||||||
|
tee -a <<<"hash=${hash%-}" $GITHUB_OUTPUT
|
||||||
|
- name: Check test dependency repositories cache
|
||||||
|
id: test-deps-cache
|
||||||
|
uses: actions/cache@v5
|
||||||
|
with:
|
||||||
|
path: ${{ fromJSON(steps.test-deps-cache-params.outputs.paths) }}
|
||||||
|
key: mingw-${{ matrix.bits }}-${{ steps.test-deps-cache-params.outputs.hash }}
|
||||||
|
- name: Fetch test dependency repositories
|
||||||
|
if: steps.test-deps-cache.outputs.cache-hit != 'true'
|
||||||
|
continue-on-error: true
|
||||||
|
run: |
|
||||||
|
test/external/fetch-repos.sh
|
||||||
|
- name: Run tests
|
||||||
|
run: |
|
||||||
|
test/run-tests.sh --os ${{ matrix.os }} --jobs "$(getconf _NPROCESSORS_ONLN)"
|
||||||
|
|
||||||
|
cygwin:
|
||||||
|
strategy:
|
||||||
|
matrix:
|
||||||
|
arch: [x86, x86_64]
|
||||||
|
fail-fast: false
|
||||||
|
runs-on: windows-2022
|
||||||
|
timeout-minutes: 30
|
||||||
|
env:
|
||||||
|
CYGWIN_NOWINPATH: 1
|
||||||
|
CHERE_INVOKING: 1
|
||||||
|
defaults:
|
||||||
|
run:
|
||||||
|
shell: C:\cygwin\bin\bash.exe -leo igncr '{0}'
|
||||||
|
steps:
|
||||||
|
- name: Save Windows git location for the PATH
|
||||||
|
shell: pwsh
|
||||||
|
run: | # The `cygwin/cygwin-install-action` step will override the PATH with Cygwin's binaries
|
||||||
|
"ORIGINAL_GIT_DIR=$(Split-Path (Get-Command git).Source)" >> $env:GITHUB_ENV
|
||||||
|
- name: Checkout repo
|
||||||
|
uses: actions/checkout@v7
|
||||||
|
- name: Setup Cygwin
|
||||||
|
uses: cygwin/cygwin-install-action@v6
|
||||||
|
with:
|
||||||
|
platform: ${{ matrix.arch }}
|
||||||
|
packages: >-
|
||||||
|
bison
|
||||||
|
cmake
|
||||||
|
gcc-g++
|
||||||
|
git
|
||||||
|
libpng-devel
|
||||||
|
make
|
||||||
|
ninja
|
||||||
|
pkg-config
|
||||||
|
python3
|
||||||
|
python-imaging
|
||||||
|
- name: Build using Make
|
||||||
|
if: matrix.arch == 'x86'
|
||||||
|
run: | # Cygwin doesn't support `make develop` sanitizers ASan or UBSan, so we don't use it.
|
||||||
|
make -k -j "$(getconf _NPROCESSORS_ONLN)" Q=
|
||||||
|
- name: Install using Make
|
||||||
|
if: matrix.arch == 'x86'
|
||||||
|
run: |
|
||||||
|
make install Q=
|
||||||
|
type rgbasm rgblink rgbfix rgbgfx
|
||||||
|
man -w 1 rgbasm rgblink rgbfix rgbgfx
|
||||||
|
- name: Build using CMake
|
||||||
|
if: matrix.arch == 'x86_64'
|
||||||
|
run: | # Cygwin doesn't support `--preset develop` sanitizers ASan or UBSan, so we disable them.
|
||||||
|
cmake -B build -G Ninja --preset develop -DSANITIZERS=OFF
|
||||||
|
cmake --build build -- -k 0
|
||||||
|
- name: Install using CMake
|
||||||
|
if: matrix.arch == 'x86_64'
|
||||||
|
run: |
|
||||||
|
cmake --install build --verbose
|
||||||
|
type rgbasm rgblink rgbfix rgbgfx
|
||||||
|
man -w 1 rgbasm rgblink rgbfix rgbgfx
|
||||||
|
- name: Compute test dependency cache params
|
||||||
|
id: test-deps-cache-params
|
||||||
|
run: |
|
||||||
|
paths=$(test/external/fetch-repos.sh --get-paths)
|
||||||
|
hash=$(test/external/fetch-repos.sh --get-hash)
|
||||||
|
tee -a <<<"paths=\"${paths//,/\\n}\"" $GITHUB_OUTPUT
|
||||||
|
tee -a <<<"hash=${hash%-}" $GITHUB_OUTPUT
|
||||||
|
- name: Check test dependency repositories cache
|
||||||
|
id: test-deps-cache
|
||||||
|
uses: actions/cache@v5
|
||||||
|
with:
|
||||||
|
path: ${{ fromJSON(steps.test-deps-cache-params.outputs.paths) }}
|
||||||
|
key: cygwin-${{ matrix.bits }}-${{ steps.test-deps-cache-params.outputs.hash }}
|
||||||
|
- name: Fetch test dependency repositories
|
||||||
|
if: steps.test-deps-cache.outputs.cache-hit != 'true'
|
||||||
|
continue-on-error: true
|
||||||
|
run: |
|
||||||
|
test/external/fetch-repos.sh
|
||||||
|
- name: Run tests using our script
|
||||||
|
if: matrix.arch == 'x86'
|
||||||
|
run: | # 32-bit Cygwin's `git` 2.38 doesn't support `git clone --revision`, so we don't fetch/run external tests.
|
||||||
|
test/run-tests.sh --os cygwin --only-internal --jobs "$(getconf _NPROCESSORS_ONLN)"
|
||||||
|
- name: Run tests using CTest
|
||||||
|
if: matrix.arch == 'x86_64'
|
||||||
|
run: |
|
||||||
|
ctest --test-dir build --schedule-random
|
||||||
|
- name: Use Windows git location in the PATH
|
||||||
|
shell: pwsh
|
||||||
|
run: | # Prevents the `actions/checkout` post-job cleanup from using Cygwin's git binary
|
||||||
|
"$env:ORIGINAL_GIT_DIR" >> $env:GITHUB_PATH
|
||||||
|
|
||||||
|
freebsd:
|
||||||
|
runs-on: ubuntu-latest
|
||||||
|
timeout-minutes: 30
|
||||||
|
steps:
|
||||||
|
- name: Checkout repo
|
||||||
|
uses: actions/checkout@v7
|
||||||
|
- name: Build & test using CMake on FreeBSD
|
||||||
|
uses: vmactions/freebsd-vm@v1
|
||||||
|
with:
|
||||||
|
envs: >-
|
||||||
|
TERM CLICOLOR CLICOLOR_FORCE
|
||||||
|
CMAKE_COLOR_DIAGNOSTICS CMAKE_CONFIG_TYPE
|
||||||
|
CTEST_PARALLEL_LEVEL
|
||||||
|
CTEST_NO_TESTS_ACTION CTEST_OUTPUT_ON_FAILURE
|
||||||
|
GIT_CONFIG_COUNT GIT_CONFIG_KEY_0 GIT_CONFIG_VALUE_0
|
||||||
|
release: "15.1"
|
||||||
|
usesh: true
|
||||||
|
copyback: false
|
||||||
|
prepare: |
|
||||||
|
.github/scripts/install-deps.sh freebsd
|
||||||
|
run: |
|
||||||
|
: # Build
|
||||||
|
cmake -B build -G Ninja --preset develop
|
||||||
|
cmake --build build -- -k 0
|
||||||
|
: # Install
|
||||||
|
cmake --install build --verbose
|
||||||
|
type rgbasm rgblink rgbfix rgbgfx
|
||||||
|
man -w 1 rgbasm rgblink rgbfix rgbgfx
|
||||||
|
: # Run tests
|
||||||
|
: # Leak detection is not supported on FreeBSD, so we disable it.
|
||||||
|
. .github/scripts/freebsd-env.sh
|
||||||
|
ASAN_OPTIONS=detect_leaks=0 ctest --test-dir build --schedule-random
|
||||||
|
|||||||
@@ -1,59 +1,50 @@
|
|||||||
name: "Update master docs"
|
name: Update master docs
|
||||||
on:
|
on:
|
||||||
push:
|
push:
|
||||||
branches:
|
branches:
|
||||||
- master
|
- master
|
||||||
paths:
|
paths:
|
||||||
- man/gbz80.7
|
- man/*
|
||||||
- man/rgbds.5
|
workflow_dispatch:
|
||||||
- man/rgbds.7
|
|
||||||
- man/rgbasm.1
|
env:
|
||||||
- man/rgbasm.5
|
# Force colored output (see https://bixense.com/clicolors/ and https://force-color.org/)
|
||||||
- man/rgblink.1
|
TERM: xterm-256color
|
||||||
- man/rgblink.5
|
CLICOLOR: 1
|
||||||
- man/rgbfix.1
|
CLICOLOR_FORCE: 1
|
||||||
- man/rgbgfx.1
|
|
||||||
|
|
||||||
jobs:
|
jobs:
|
||||||
build:
|
build:
|
||||||
if: github.repository_owner == 'gbdev'
|
if: github.repository_owner == 'gbdev'
|
||||||
runs-on: ubuntu-22.04
|
runs-on: ubuntu-slim
|
||||||
steps:
|
steps:
|
||||||
- name: Checkout rgbds@master
|
- name: Checkout rgbds
|
||||||
uses: actions/checkout@v2
|
uses: actions/checkout@v7
|
||||||
with:
|
with:
|
||||||
repository: gbdev/rgbds
|
|
||||||
ref: master
|
|
||||||
path: rgbds
|
path: rgbds
|
||||||
- name: Checkout rgbds-www@master
|
sparse-checkout: man # Avoid checking out other files, we don't use them here.
|
||||||
uses: actions/checkout@v2
|
- name: Checkout rgbds-www
|
||||||
|
uses: actions/checkout@v7
|
||||||
with:
|
with:
|
||||||
repository: gbdev/rgbds-www
|
|
||||||
ref: master
|
|
||||||
path: rgbds-www
|
path: rgbds-www
|
||||||
|
repository: ${{ github.repository_owner }}/rgbds-www
|
||||||
|
ref: master # Need to check out the branch to be able to commit on and push it.
|
||||||
|
ssh-key: !!str ${{ secrets.SSH_KEY_SECRET }}
|
||||||
- name: Install groff and mandoc
|
- name: Install groff and mandoc
|
||||||
run: |
|
run: |
|
||||||
sudo apt-get -qq update
|
sudo apt install -Uyq groff mandoc -o APT::Color=yes -o Acquire::Queue-Mode=access
|
||||||
sudo apt-get install -yq groff mandoc
|
|
||||||
- name: Update pages
|
- name: Update pages
|
||||||
working-directory: rgbds/man
|
working-directory: rgbds/man
|
||||||
run: |
|
run: |
|
||||||
../../rgbds-www/maintainer/man_to_html.sh master *
|
../../rgbds-www/maintainer/man_to_html.sh master *
|
||||||
- name: Push new pages
|
- name: Push new pages
|
||||||
working-directory: rgbds-www
|
working-directory: rgbds-www
|
||||||
|
env:
|
||||||
|
GIT_AUTHOR_NAME: !!str ${{ github.actor }}
|
||||||
|
GIT_AUTHOR_EMAIL: !!str ${{ github.actor_id }}+${{ github.actor }}@users.noreply.github.com
|
||||||
|
GIT_COMMITTER_NAME: github-actions[bot]
|
||||||
|
GIT_COMMITTER_EMAIL: 41898282+github-actions[bot]@users.noreply.github.com
|
||||||
run: |
|
run: |
|
||||||
mkdir -p -m 700 ~/.ssh
|
|
||||||
echo "${{ secrets.SSH_KEY_SECRET }}" > ~/.ssh/id_ed25519
|
|
||||||
chmod 0600 ~/.ssh/id_ed25519
|
|
||||||
eval $(ssh-agent -s)
|
|
||||||
ssh-add ~/.ssh/id_ed25519
|
|
||||||
git config --global user.name "GitHub Action"
|
|
||||||
git config --global user.email "[email protected]"
|
|
||||||
git add -A
|
git add -A
|
||||||
git commit -m "Update RGBDS master documentation"
|
git commit -m "Update RGBDS master documentation"
|
||||||
if git remote | grep -q origin; then
|
git push
|
||||||
git remote set-url origin [email protected]:gbdev/rgbds-www.git
|
|
||||||
else
|
|
||||||
git remote add origin [email protected]:gbdev/rgbds-www.git
|
|
||||||
fi
|
|
||||||
git push origin master
|
|
||||||
|
|||||||
+10
-1
@@ -2,11 +2,20 @@
|
|||||||
/rgblink
|
/rgblink
|
||||||
/rgbfix
|
/rgbfix
|
||||||
/rgbgfx
|
/rgbgfx
|
||||||
|
/install.sh
|
||||||
/rgbshim.sh
|
/rgbshim.sh
|
||||||
|
/coverage/
|
||||||
*.o
|
*.o
|
||||||
*.exe
|
*.exe
|
||||||
*.dll
|
*.dll
|
||||||
.checkpatch-camelcase.*
|
*.gcno
|
||||||
|
*.gcda
|
||||||
|
*.gcov
|
||||||
|
/compile_flags.txt
|
||||||
CMakeCache.txt
|
CMakeCache.txt
|
||||||
CMakeFiles/
|
CMakeFiles/
|
||||||
cmake_install.cmake
|
cmake_install.cmake
|
||||||
|
CMakeUserPresets.json
|
||||||
|
build*/
|
||||||
|
*.dSYM/
|
||||||
|
callgrind.out.*
|
||||||
|
|||||||
+190
-95
@@ -1,136 +1,231 @@
|
|||||||
#
|
|
||||||
# This file is part of RGBDS.
|
|
||||||
#
|
|
||||||
# Copyright (c) 2020 RGBDS contributors.
|
|
||||||
#
|
|
||||||
# SPDX-License-Identifier: MIT
|
# SPDX-License-Identifier: MIT
|
||||||
#
|
|
||||||
|
|
||||||
# 3.9 required for LTO checks
|
# - 3.24 is required for `FetchContent`'s `find_package` integration.
|
||||||
cmake_minimum_required(VERSION 3.9 FATAL_ERROR)
|
# Older versions *may* work, but we can't test them; compat patches are welcome.
|
||||||
|
# - 3.17 is required for `CHECK_*` messages to display properly, but is not essential.
|
||||||
|
# - 3.9 is required for LTO checks.
|
||||||
|
cmake_minimum_required(VERSION 3.24...4.3 FATAL_ERROR)
|
||||||
|
|
||||||
|
# Read the project version from the header (the canonical source of truth).
|
||||||
|
file(STRINGS "include/version.hpp" version_defines REGEX "^[ \t]*#define[ \t]+PACKAGE_VERSION_")
|
||||||
|
foreach(line IN LISTS version_defines)
|
||||||
|
# We want the `CMAKE_MATCH_n` variables, so we just need to run *some* regex op.
|
||||||
|
string(REGEX MATCH "PACKAGE_(VERSION_[^ \t]+)[ \t]+([0-9]+)" dummy "${line}")
|
||||||
|
set("${CMAKE_MATCH_1}" "${CMAKE_MATCH_2}")
|
||||||
|
endforeach()
|
||||||
|
|
||||||
project(rgbds
|
project(rgbds
|
||||||
LANGUAGES C CXX)
|
VERSION "${VERSION_MAJOR}.${VERSION_MINOR}.${VERSION_PATCH}"
|
||||||
|
LANGUAGES CXX
|
||||||
|
DESCRIPTION "Game Boy assembly toolchain"
|
||||||
|
HOMEPAGE_URL "https://rgbds.gbdev.io")
|
||||||
|
if(DEFINED VERSION_RC)
|
||||||
|
string(APPEND CMAKE_PROJECT_VERSION "-rc${VERSION_RC}")
|
||||||
|
endif()
|
||||||
|
|
||||||
# get real path of source and binary directories
|
# Reject in-source builds, as they may conflict with the Makefile.
|
||||||
get_filename_component(srcdir "${CMAKE_SOURCE_DIR}" REALPATH)
|
get_filename_component(srcdir "${CMAKE_SOURCE_DIR}" REALPATH)
|
||||||
get_filename_component(bindir "${CMAKE_BINARY_DIR}" REALPATH)
|
get_filename_component(bindir "${CMAKE_BINARY_DIR}" REALPATH)
|
||||||
|
|
||||||
# reject in-source builds, may conflict with Makefile
|
|
||||||
if(srcdir STREQUAL bindir)
|
if(srcdir STREQUAL bindir)
|
||||||
message("RGBDS should not be built in the source directory.")
|
message(FATAL_ERROR "RGBDS should not be built in the source directory.
|
||||||
message("Instead, create a separate build directory and specify to CMake the path to the source directory.")
|
Instead, create a separate build directory and specify to CMake the path to the source directory.")
|
||||||
message(FATAL_ERROR "Terminating configuration")
|
|
||||||
endif()
|
endif()
|
||||||
|
|
||||||
option(SANITIZERS "Build with sanitizers enabled" OFF) # Ignored on MSVC
|
include(CTest) # Note: CTest only functions properly if included from the top-level CMakeLists.
|
||||||
option(MORE_WARNINGS "Turn on more warnings" OFF) # Ignored on MSVC
|
include(GNUInstallDirs)
|
||||||
|
include(CMakeDependentOption)
|
||||||
|
|
||||||
if(MSVC)
|
## Compiler switches that should apply to our deps too.
|
||||||
# MSVC's standard library triggers warning C5105,
|
|
||||||
# "macro expansion producing 'defined' has undefined behavior"
|
|
||||||
add_compile_options(/MP /wd5105)
|
|
||||||
add_definitions(/D_CRT_SECURE_NO_WARNINGS)
|
|
||||||
# Also, CMake appears not to pass the C11-enabling flag, so we must add it manually... but only for C!
|
|
||||||
if(NOT CMAKE_C_FLAGS MATCHES "std:c11") # The flag may already have been injected by an earlier CMake invocation, so don't add it twice
|
|
||||||
set(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} -std:c11" CACHE STRING "Flags used by the C compiler during all build types." FORCE)
|
|
||||||
endif()
|
|
||||||
|
|
||||||
if(SANITIZERS)
|
option(SANITIZERS "Build with sanitizers enabled" OFF)
|
||||||
set(SAN_FLAGS /fsanitize=address)
|
cmake_dependent_option(MORE_WARNINGS "Turn on more warnings" OFF "NOT MSVC" OFF)
|
||||||
|
|
||||||
|
if(NOT DEFINED CMAKE_MSVC_RUNTIME_LIBRARY) # Allow this to be overridden from the CLI easily.
|
||||||
|
# We link against the Microsoft C++ runtime libs statically, except the debug-mode one.
|
||||||
|
# This is because Microsoft's license terms (through some indirection) allow us to redistribute
|
||||||
|
# the runtime lib code *except* the debug-mode libs'.
|
||||||
|
# Since we want to remain able to not think too hard about debug executables, we link against
|
||||||
|
# the debug libs dynamically, shifting the burden of obtaining them onto the recipient.
|
||||||
|
set(CMAKE_MSVC_RUNTIME_LIBRARY "MultiThreaded$<$<CONFIG:Debug>:DebugDLL>")
|
||||||
|
endif()
|
||||||
|
|
||||||
|
if(SANITIZERS)
|
||||||
|
if(MSVC)
|
||||||
|
message(STATUS "ASan enabled")
|
||||||
|
add_compile_options(/fsanitize=address) # Note that this shouldn't be passed to the linker.
|
||||||
|
else() # We assume a GNU-like compiler.
|
||||||
|
message(STATUS "ASan and UBSan enabled")
|
||||||
|
set(SAN_FLAGS -fsanitize=address -fsanitize=undefined
|
||||||
|
-fsanitize=float-divide-by-zero)
|
||||||
add_compile_options(${SAN_FLAGS})
|
add_compile_options(${SAN_FLAGS})
|
||||||
add_link_options(${SAN_FLAGS})
|
add_link_options(${SAN_FLAGS})
|
||||||
|
add_definitions(-D_GLIBCXX_ASSERTIONS -D_LIBCPP_HARDENING_MODE=_LIBCPP_HARDENING_MODE_DEBUG)
|
||||||
|
# A non-zero optimization level is desired even in debug mode (especially for Clang),
|
||||||
|
# and the two codegen flags improve the sanitizers' backtraces, but we want the user to
|
||||||
|
# be able to override these easily so we put them first.
|
||||||
|
string(PREPEND CMAKE_CXX_FLAGS_DEBUG "-Og -fno-omit-frame-pointer -fno-optimize-sibling-calls ")
|
||||||
endif()
|
endif()
|
||||||
|
endif()
|
||||||
|
|
||||||
|
message(CHECK_START "Checking if LTO is supported")
|
||||||
|
include(CheckIPOSupported)
|
||||||
|
check_ipo_supported(RESULT enable_lto)
|
||||||
|
if(enable_lto)
|
||||||
|
message(CHECK_PASS "yes (enabled only in release modes)")
|
||||||
|
set(CMAKE_INTERPROCEDURAL_OPTIMIZATION_RELEASE ON)
|
||||||
|
set(CMAKE_INTERPROCEDURAL_OPTIMIZATION_RELWITHDEBINFO ON)
|
||||||
|
set(CMAKE_INTERPROCEDURAL_OPTIMIZATION_MINSIZEREL ON)
|
||||||
else()
|
else()
|
||||||
add_compile_options(-Wall -pedantic)
|
message(CHECK_FAIL "no")
|
||||||
add_definitions(-D_POSIX_C_SOURCE=200809L -D_ISOC11_SOURCE)
|
|
||||||
if(SANITIZERS)
|
|
||||||
set(SAN_FLAGS -fsanitize=shift -fsanitize=integer-divide-by-zero
|
|
||||||
-fsanitize=unreachable -fsanitize=vla-bound
|
|
||||||
-fsanitize=signed-integer-overflow -fsanitize=bounds
|
|
||||||
-fsanitize=object-size -fsanitize=bool -fsanitize=enum
|
|
||||||
-fsanitize=alignment -fsanitize=null -fsanitize=address)
|
|
||||||
add_compile_options(${SAN_FLAGS})
|
|
||||||
add_link_options(${SAN_FLAGS})
|
|
||||||
# A non-zero optimization level is desired in debug mode, but allow overriding it nonetheless
|
|
||||||
# TODO: this overrides anything previously set... that's a bit sloppy!
|
|
||||||
set(CMAKE_C_FLAGS_DEBUG "-g -Og -fno-omit-frame-pointer -fno-optimize-sibling-calls" CACHE STRING "" FORCE)
|
|
||||||
set(CMAKE_CXX_FLAGS_DEBUG "-g -Og -fno-omit-frame-pointer -fno-optimize-sibling-calls" CACHE STRING "" FORCE)
|
|
||||||
endif()
|
|
||||||
|
|
||||||
if(MORE_WARNINGS)
|
|
||||||
add_compile_options(-Werror -Wextra
|
|
||||||
-Walloc-zero -Wcast-align -Wcast-qual -Wduplicated-branches -Wduplicated-cond
|
|
||||||
-Wfloat-equal -Wlogical-op -Wnull-dereference -Wshift-overflow=2
|
|
||||||
-Wstringop-overflow=4 -Wstrict-overflow=5 -Wundef -Wuninitialized -Wunused
|
|
||||||
-Wshadow # TODO: -Wshadow=compatible-local ?
|
|
||||||
-Wformat=2 -Wformat-overflow=2 -Wformat-truncation=1
|
|
||||||
-Wno-format-nonliteral # We have a couple of "dynamic" prints
|
|
||||||
# We do some range checks that are always false on some platforms (GCC, Clang)
|
|
||||||
-Wno-type-limits -Wno-tautological-constant-out-of-range-compare
|
|
||||||
-Wvla # MSVC does not support VLAs
|
|
||||||
-Wno-unknown-warning-option) # Clang shouldn't diagnose unknown warnings
|
|
||||||
endif()
|
|
||||||
endif()
|
endif()
|
||||||
|
|
||||||
# Use versioning consistent with Makefile
|
# Use versioning consistent with Makefile:
|
||||||
# the git revision is used but uses the fallback in an archive
|
# the git revision is used but uses the fallback in an archive.
|
||||||
|
|
||||||
find_program(GIT git)
|
message(CHECK_START "Determining RGBDS version from Git history")
|
||||||
if(GIT)
|
list(APPEND CMAKE_MESSAGE_INDENT " ")
|
||||||
execute_process(COMMAND ${GIT} describe --tags --dirty --always
|
set(GIT_REV "") # This fallback is important!
|
||||||
WORKING_DIRECTORY ${CMAKE_SOURCE_DIR}
|
find_package(Git)
|
||||||
|
list(POP_BACK CMAKE_MESSAGE_INDENT)
|
||||||
|
if(NOT Git_FOUND)
|
||||||
|
message(CHECK_FAIL "Git not found")
|
||||||
|
else()
|
||||||
|
execute_process(COMMAND "${GIT_EXECUTABLE}" --git-dir=.git -c safe.directory='*'
|
||||||
|
describe --tags --dirty --always --match "v[0-9]*"
|
||||||
|
WORKING_DIRECTORY "${CMAKE_SOURCE_DIR}"
|
||||||
OUTPUT_VARIABLE GIT_REV OUTPUT_STRIP_TRAILING_WHITESPACE
|
OUTPUT_VARIABLE GIT_REV OUTPUT_STRIP_TRAILING_WHITESPACE
|
||||||
ERROR_QUIET)
|
ERROR_VARIABLE git_err ERROR_STRIP_TRAILING_WHITESPACE
|
||||||
message(STATUS "RGBDS version: ${GIT_REV}")
|
RESULT_VARIABLE result)
|
||||||
else(GIT)
|
if(NOT result EQUAL 0)
|
||||||
message(STATUS "Cannot determine RGBDS version (Git not installed), falling back")
|
# Note that this happens e.g. when building from a tarball, so it shouldn't fail the build!
|
||||||
endif(GIT)
|
message(CHECK_FAIL "error ${result} from Git:")
|
||||||
|
list(APPEND CMAKE_MESSAGE_INDENT " ")
|
||||||
find_package(PkgConfig)
|
message("${git_err}")
|
||||||
if(MSVC OR NOT PKG_CONFIG_FOUND)
|
list(POP_BACK CMAKE_MESSAGE_INDENT)
|
||||||
# fallback to find_package
|
else()
|
||||||
find_package(PNG REQUIRED)
|
message(CHECK_PASS "${GIT_REV}")
|
||||||
else()
|
if(NOT "${GIT_REV}" MATCHES "^v[0-9]+\\.[0-9]+\\.[0-9]+(-rc[0-9]+)?")
|
||||||
pkg_check_modules(LIBPNG REQUIRED libpng)
|
# Can't find an ancestor tag! (That passes `--match`, anyway.)
|
||||||
|
message(WARNING "No `v*` Git tag reachable; falling back")
|
||||||
|
elseif(NOT CMAKE_MATCH_0 STREQUAL "v${CMAKE_PROJECT_VERSION}")
|
||||||
|
message(SEND_ERROR "\
|
||||||
|
Version mismatch! Git says ${CMAKE_MATCH_0},
|
||||||
|
version.hpp says v${CMAKE_PROJECT_VERSION}!")
|
||||||
|
endif()
|
||||||
|
endif()
|
||||||
endif()
|
endif()
|
||||||
|
|
||||||
include_directories("${PROJECT_SOURCE_DIR}/include")
|
## Dependencies.
|
||||||
|
|
||||||
set(CMAKE_C_STANDARD 11)
|
include(FetchContent)
|
||||||
set(CMAKE_C_STANDARD_REQUIRED True)
|
include(cmake/deps.cmake)
|
||||||
set(CMAKE_CXX_STANDARD 17)
|
|
||||||
|
# Be sure to make zlib available before libpng, otherwise libpng
|
||||||
|
# will attempt to `find_package(ZLIB)` without going through `FetchContent`.
|
||||||
|
if(NOT DEFINED ZLIB_BUILD_TESTING) # Unless overridden (e.g. in the cache), we don't care about zlib's tests.
|
||||||
|
set(ZLIB_BUILD_TESTING OFF)
|
||||||
|
endif()
|
||||||
|
FetchContent_MakeAvailable(ZLIB)
|
||||||
|
if(NOT DEFINED ZLIB_INCLUDE_DIRS)
|
||||||
|
set(ZLIB_INCLUDE_DIRS "${zlib_BINARY_DIR};${zlib_SOURCE_DIR}") # libpng's `genout` script relies on this variable to be set.
|
||||||
|
endif()
|
||||||
|
# Statically building zlib (from source) generates a target named differently.
|
||||||
|
if(NOT TARGET ZLIB::ZLIB AND TARGET zlibstatic)
|
||||||
|
add_library(ZLIB::ZLIB ALIAS zlibstatic)
|
||||||
|
endif()
|
||||||
|
|
||||||
|
if(NOT DEFINED PNG_TESTS) # Unless overridden (e.g. in the cache), we don't care about libpng's tests.
|
||||||
|
set(PNG_TESTS OFF)
|
||||||
|
endif()
|
||||||
|
FetchContent_MakeAvailable(PNG)
|
||||||
|
if(NOT TARGET PNG::PNG)
|
||||||
|
if(PNG_SHARED)
|
||||||
|
add_library(PNG::PNG ALIAS png_shared)
|
||||||
|
else()
|
||||||
|
add_library(PNG::PNG ALIAS png_static)
|
||||||
|
endif()
|
||||||
|
endif()
|
||||||
|
|
||||||
|
## The actual stuff.
|
||||||
|
# Any compiler options that shouldn't apply to our dependencies go here.
|
||||||
|
|
||||||
|
include_directories("include")
|
||||||
|
|
||||||
|
set(CMAKE_CXX_STANDARD 20)
|
||||||
set(CMAKE_CXX_STANDARD_REQUIRED True)
|
set(CMAKE_CXX_STANDARD_REQUIRED True)
|
||||||
|
|
||||||
add_subdirectory(src)
|
if(MSVC)
|
||||||
add_subdirectory(test)
|
add_compile_options(
|
||||||
|
/wd5030 # Warning C5030 is about unknown attributes (`[[gnu::ATTR]]`), none of ours being load-bearing.
|
||||||
|
/wd4996 # Warning C4996 is about using POSIX names, which we want to do for portability.
|
||||||
|
/Zc:preprocessor # Opt into the C++20-conformant preprocessor.
|
||||||
|
)
|
||||||
|
add_definitions(/D_CRT_SECURE_NO_WARNINGS)
|
||||||
|
else()
|
||||||
|
add_compile_options(-Wall -pedantic -Wno-unknown-warning-option -fno-exceptions -fno-rtti)
|
||||||
|
|
||||||
# By default, build in Release mode; Debug mode must be explicitly requested
|
if(MORE_WARNINGS)
|
||||||
# (You may want to augment it with the options above)
|
add_compile_options(-Wextra
|
||||||
if(CMAKE_BUILD_TYPE STREQUAL "Release")
|
-Walloc-zero -Wcast-align -Wcast-qual -Wduplicated-branches -Wduplicated-cond
|
||||||
message(CHECK_START "Checking if LTO is supported")
|
-Wfloat-equal -Wlogical-op -Wnull-dereference -Wold-style-cast -Wshift-overflow=2
|
||||||
include(CheckIPOSupported)
|
-Wstringop-overflow=4 -Wtrampolines -Wundef -Wuninitialized -Wunused -Wshadow
|
||||||
check_ipo_supported(RESULT enable_lto)
|
-Wformat=2 -Wformat-overflow=2 -Wformat-truncation=1
|
||||||
if(enable_lto)
|
-Wno-format-nonliteral -Wno-strict-overflow
|
||||||
message(CHECK_PASS "yes")
|
-Wno-type-limits -Wno-tautological-constant-out-of-range-compare
|
||||||
set_property(TARGET rgbasm rgblink rgbfix rgbgfx PROPERTY INTERPROCEDURAL_OPTIMIZATION ON)
|
-Wvla) # MSVC does not support VLAs
|
||||||
else()
|
endif()
|
||||||
message(CHECK_FAIL "no")
|
|
||||||
|
add_compile_options(-Wno-unused-but-set-variable # bison's `yynerrs_` is incremented but unused
|
||||||
|
# C++20 allows macros to take zero variadic arguments.
|
||||||
|
# Some versions of Clang don't recognize this, and treat them as a GNU extension.
|
||||||
|
-Wno-gnu-zero-variadic-macro-arguments)
|
||||||
|
|
||||||
|
if(MINGW)
|
||||||
|
# MinGW warns about format specifiers like `%z` and `%j`, which are missing on Windows XP and earlier.
|
||||||
|
# We rely on runtimes more modern than that, so we can ignore those warnings.
|
||||||
|
# If this is a problem for you: use Microsoft's equivalents, or define `__USE_MINGW_ANSI_STDIO=1`.
|
||||||
|
# https://sourceforge.net/p/mingw-w64/wiki2/gnu%20printf/
|
||||||
|
add_compile_options(-Wno-error=format -Wno-error=format-extra-args)
|
||||||
endif()
|
endif()
|
||||||
endif()
|
endif()
|
||||||
|
|
||||||
set(MANDIR "share/man")
|
add_subdirectory(src)
|
||||||
|
if(BUILD_TESTING) # This option is defined implicitly by `include(CTest)`.
|
||||||
|
add_subdirectory(test)
|
||||||
|
endif()
|
||||||
|
|
||||||
set(man1 "man/rgbasm.1"
|
set(man1 "man/rgbasm.1"
|
||||||
"man/rgbfix.1"
|
"man/rgbfix.1"
|
||||||
"man/rgbgfx.1"
|
"man/rgbgfx.1"
|
||||||
"man/rgblink.1")
|
"man/rgblink.1")
|
||||||
set(man5 "man/rgbasm.5"
|
set(man5 "man/rgbasm.5"
|
||||||
|
"man/rgbasm-old.5"
|
||||||
"man/rgblink.5"
|
"man/rgblink.5"
|
||||||
"man/rgbds.5")
|
"man/rgbds.5")
|
||||||
set(man7 "man/gbz80.7"
|
set(man7 "man/gbz80.7"
|
||||||
"man/rgbds.7")
|
"man/rgbds.7")
|
||||||
|
|
||||||
foreach(SECTION "man1" "man5" "man7")
|
foreach(SECTION "man1" "man5" "man7")
|
||||||
set(DEST "${MANDIR}/${SECTION}")
|
install(FILES ${${SECTION}} DESTINATION "${CMAKE_INSTALL_MANDIR}/${SECTION}" COMPONENT man)
|
||||||
install(FILES ${${SECTION}} DESTINATION ${DEST})
|
|
||||||
endforeach()
|
endforeach()
|
||||||
|
|
||||||
|
## Packaging.
|
||||||
|
|
||||||
|
# We only specify here the package-agnostic options;
|
||||||
|
# the rest is rather convention from our side, and thus more appropriate for presets or CLI flags.
|
||||||
|
## CPACK_PACKAGE_NAME: copied from `project()`
|
||||||
|
set(CPACK_PACKAGE_VENDOR "GBDev")
|
||||||
|
set(CPACK_PACKAGE_VERSION "${CMAKE_PROJECT_VERSION}") # The individual components are defined implicitly.
|
||||||
|
set(CPACK_PACKAGE_DESCRIPTION "An assembly toolchain for the Nintendo Game Boy and Game Boy Color") # Same as our repo's description.
|
||||||
|
## CPACK_PACKAGE_DESCRIPTION_SUMMARY: copied from `project()`
|
||||||
|
set(CPACK_PACKAGE_HOMEPAGE_URL "https://rgbds.gbdev.io")
|
||||||
|
## CPACK_PACKAGE_FILE_NAME: should be provided at runtime (`cpack -P`)
|
||||||
|
set(CPACK_PACKAGE_CHECKSUM SHA256)
|
||||||
|
set(CPACK_RESOURCE_FILE_LICENSE "${CMAKE_SOURCE_DIR}/LICENSE")
|
||||||
|
set(CPACK_RESOURCE_FILE_README "${CMAKE_SOURCE_DIR}/README.md")
|
||||||
|
set(CPACK_STRIP_FILES ON) # Only applies to binary packages, not sources.
|
||||||
|
set(CPACK_VERBATIM_VARIABLES ON)
|
||||||
|
set(CPACK_THREADS 0) # Use all available CPU cores.
|
||||||
|
set(CPACK_INCLUDE_TOPLEVEL_DIRECTORY OFF)
|
||||||
|
|
||||||
|
include(CPack)
|
||||||
|
|||||||
@@ -0,0 +1,46 @@
|
|||||||
|
{
|
||||||
|
"version": 3,
|
||||||
|
"configurePresets": [
|
||||||
|
{
|
||||||
|
"name": "develop",
|
||||||
|
"description": "Debugging config for maintainers",
|
||||||
|
"cacheVariables": {
|
||||||
|
"CMAKE_BUILD_TYPE": "Debug",
|
||||||
|
"CMAKE_EXPORT_COMPILE_COMMANDS": true,
|
||||||
|
"CMAKE_COMPILE_WARNING_AS_ERROR": true,
|
||||||
|
"CMAKE_LINK_WARNING_AS_ERROR": true,
|
||||||
|
"MORE_WARNINGS": true,
|
||||||
|
"SANITIZERS": true
|
||||||
|
},
|
||||||
|
"warnings": { "uninitialized": true },
|
||||||
|
"errors": { "dev": true }
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"name": "develop-msbuild32",
|
||||||
|
"inherits": ["develop", "msbuild32"]
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"name": "develop-msbuild64",
|
||||||
|
"inherits": ["develop", "msbuild64"]
|
||||||
|
},
|
||||||
|
|
||||||
|
{
|
||||||
|
"name": "msbuild32",
|
||||||
|
"description": "Flags for building 32-bit executables with MSBuild",
|
||||||
|
"architecture": "Win32"
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"name": "msbuild64",
|
||||||
|
"description": "Flags for building 64-bit executables with MSBuild",
|
||||||
|
"architecture": "x64"
|
||||||
|
},
|
||||||
|
|
||||||
|
{
|
||||||
|
"name": "macos-static",
|
||||||
|
"description": "Flags for building an executable compatible with old macOS",
|
||||||
|
"cacheVariables": {
|
||||||
|
"CMAKE_PROJECT_TOP_LEVEL_INCLUDES": "cmake/macos-static.cmake"
|
||||||
|
}
|
||||||
|
}
|
||||||
|
]
|
||||||
|
}
|
||||||
@@ -1,95 +0,0 @@
|
|||||||
Contributing
|
|
||||||
============
|
|
||||||
|
|
||||||
RGBDS was created in the late '90s and has received contributions from several
|
|
||||||
developers since then. It wouldn't have been possible to get to this point
|
|
||||||
without their work, and it is always open to the contributions of other people.
|
|
||||||
|
|
||||||
Reporting Bugs
|
|
||||||
--------------
|
|
||||||
|
|
||||||
Bug reports are essential to improve RGBDS and they are always welcome. If you
|
|
||||||
want to report a bug:
|
|
||||||
|
|
||||||
1. Make sure that there isn't a similar issue already reported
|
|
||||||
`here <https://github.com/rednex/rgbds/issues>`__.
|
|
||||||
|
|
||||||
2. Figure out a way of reproducing it reliably.
|
|
||||||
|
|
||||||
3. If there is a piece of code that triggers the bug, try to reduce it to the
|
|
||||||
smallest file you can.
|
|
||||||
|
|
||||||
4. Create a new `issue <https://github.com/rednex/rgbds/issues>`__.
|
|
||||||
|
|
||||||
Of course, it may not always be possible to give an accurate bug report, but it
|
|
||||||
always helps to fix it.
|
|
||||||
|
|
||||||
Requesting new features
|
|
||||||
-----------------------
|
|
||||||
|
|
||||||
If you come up with a good idea that could be implemented, you can propose it to
|
|
||||||
be done.
|
|
||||||
|
|
||||||
1. Create a new `issue <https://github.com/rednex/rgbds/issues>`__.
|
|
||||||
|
|
||||||
2. Try to be as accurate as possible. Describe what you need and why you need
|
|
||||||
it, maybe with examples.
|
|
||||||
|
|
||||||
Please understand that the contributors are doing it in their free time, so
|
|
||||||
simple requests are more likely to catch the interest of a contributor than
|
|
||||||
complicated ones. If you really need something to be done, and you think you can
|
|
||||||
implement it yourself, you can always contribute to RGBDS with your own code.
|
|
||||||
|
|
||||||
Contributing code
|
|
||||||
-----------------
|
|
||||||
|
|
||||||
If you want to contribute with your own code, whether it is to fix a current
|
|
||||||
issue or to add something that nobody had requested, you should first consider
|
|
||||||
if your change is going to be small (and likely to be accepted as-is) or big
|
|
||||||
(and will have to go through some rework).
|
|
||||||
|
|
||||||
Big changes will most likely require some discussion, so open an
|
|
||||||
`issue <https://github.com/rednex/rgbds/issues>`__ and explain what you want to
|
|
||||||
do and how you intend to do it. If you already have a prototype, it's always a
|
|
||||||
good idea to show it. Tests help, too.
|
|
||||||
|
|
||||||
If you are going to work on a specific issue that involves a lot of work, it is
|
|
||||||
always a good idea to leave a message, just in case someone else is interested
|
|
||||||
but doesn't know that there's someone working on it.
|
|
||||||
|
|
||||||
Note that you must contribute all your changes under the MIT License. If you are
|
|
||||||
just modifying a file, you don't need to do anything (maybe update the copyright
|
|
||||||
years). If you are adding new files, you need to use the correct header with the
|
|
||||||
copyright and the reference to the MIT License.
|
|
||||||
|
|
||||||
1. Fork this repository.
|
|
||||||
|
|
||||||
2. Checkout the ``master`` branch.
|
|
||||||
|
|
||||||
3. Create a new branch to work on. You could still work on ``master``, but it's
|
|
||||||
easier that way.
|
|
||||||
|
|
||||||
4. Compile your changes with ``make develop`` instead of just ``make``. This
|
|
||||||
target checks for additional warnings. Your patches shouldn't introduce any
|
|
||||||
new warning (but it may be possible to remove some warning checks if it makes
|
|
||||||
the code much easier).
|
|
||||||
|
|
||||||
5. Follow the Linux kernel coding style, which can be found in the file
|
|
||||||
``Documentation/process/coding-style.rst`` in the Linux kernel repository.
|
|
||||||
Note that the coding style isn't written in stone, if there is a good reason
|
|
||||||
to deviate from it, it should be fine.
|
|
||||||
|
|
||||||
6. Download the files ``checkpatch.pl``, ``const_structs.checkpatch`` and
|
|
||||||
``spelling.txt`` from the folder ``scripts`` in the Linux kernel repository.
|
|
||||||
|
|
||||||
7. To use ``checkpatch.pl`` you can use ``make checkpatch``, which will check
|
|
||||||
the coding style of all patches between the current one and the upstream
|
|
||||||
code. By default, the Makefile expects the script (and associate files) to be
|
|
||||||
located in ``../linux/scripts/``, but you can place them anywhere you like as
|
|
||||||
long as you specify it when executing the command:
|
|
||||||
``make checkpatch CHECKPATCH=../path/to/folder``.
|
|
||||||
|
|
||||||
8. Create a pull request against the branch ``master``.
|
|
||||||
|
|
||||||
9. Be prepared to get some comments about your code and to modify it. Tip: Use
|
|
||||||
``git rebase -i origin/master`` to modify chains of commits.
|
|
||||||
@@ -1,57 +0,0 @@
|
|||||||
Contributors to RGBDS
|
|
||||||
=====================
|
|
||||||
|
|
||||||
Original author
|
|
||||||
---------------
|
|
||||||
|
|
||||||
- Carsten Elton Sørensen <[email protected]>
|
|
||||||
|
|
||||||
Main contributors
|
|
||||||
-----------------
|
|
||||||
|
|
||||||
- Justin Lloyd <[email protected]>
|
|
||||||
|
|
||||||
- Vegard Nossum <[email protected]>
|
|
||||||
|
|
||||||
- Anthony J. Bentley <[email protected]>
|
|
||||||
|
|
||||||
- stag019 <[email protected]>
|
|
||||||
|
|
||||||
- Antonio Niño Díaz <[email protected]>
|
|
||||||
|
|
||||||
- Eldred "ISSOtm" Habert <[email protected]>
|
|
||||||
|
|
||||||
- Rangi <http://github.com/Rangi42>
|
|
||||||
|
|
||||||
Other contributors
|
|
||||||
------------------
|
|
||||||
|
|
||||||
- Ben Hetherington <[email protected]>
|
|
||||||
|
|
||||||
- Björn Höhrmann <[email protected]>
|
|
||||||
|
|
||||||
- Christophe Staïesse <[email protected]>
|
|
||||||
|
|
||||||
- David Brotz <[email protected]>
|
|
||||||
|
|
||||||
- Jakub Kądziołka <[email protected]>
|
|
||||||
|
|
||||||
- James "JL2210" Larrowe <https://github.com/JL2210>
|
|
||||||
|
|
||||||
- The Musl C library <http://www.musl-libc.org>
|
|
||||||
|
|
||||||
- obskyr <[email protected]>
|
|
||||||
|
|
||||||
- The OpenBSD Project <http://www.openbsd.org>
|
|
||||||
|
|
||||||
- Quint Guvernator <[email protected]>
|
|
||||||
|
|
||||||
- Sanqui <[email protected]>
|
|
||||||
|
|
||||||
- YamaArashi <[email protected]>
|
|
||||||
|
|
||||||
- yenatch <[email protected]>
|
|
||||||
|
|
||||||
- phs <[email protected]>
|
|
||||||
|
|
||||||
- jidoc01 <[email protected]>
|
|
||||||
+23
-22
@@ -1,24 +1,25 @@
|
|||||||
# This file is part of RGBDS.
|
FROM debian:13-slim
|
||||||
#
|
LABEL org.opencontainers.image.source=https://github.com/gbdev/rgbds
|
||||||
# Copyright (c) 2018-2019, Phil Smith and RGBDS contributors.
|
ARG version=1.0.3
|
||||||
#
|
|
||||||
# SPDX-License-Identifier: MIT
|
|
||||||
# docker build -t rgbds:vX.X.X-alpine
|
|
||||||
FROM alpine:latest
|
|
||||||
RUN apk add --update \
|
|
||||||
build-base \
|
|
||||||
bison \
|
|
||||||
libpng-dev
|
|
||||||
COPY . /rgbds
|
|
||||||
WORKDIR /rgbds
|
WORKDIR /rgbds
|
||||||
RUN make Q='' all
|
|
||||||
|
|
||||||
FROM alpine:latest
|
COPY . .
|
||||||
RUN apk add --update \
|
|
||||||
libpng
|
# Install dependencies
|
||||||
COPY --from=0 \
|
RUN apt-get update && \
|
||||||
/rgbds/rgbasm \
|
apt-get install sudo make cmake gcc build-essential -y
|
||||||
/rgbds/rgbfix \
|
RUN ./.github/scripts/install-deps.sh debian
|
||||||
/rgbds/rgblink \
|
|
||||||
/rgbds/rgbgfx \
|
# Build RGBDS
|
||||||
/bin/
|
RUN make -j "$(getconf _NPROCESSORS_ONLN)" CXXFLAGS="-O3 -flto -DNDEBUG -static" PKG_CONFIG="pkg-config --static" Q=
|
||||||
|
|
||||||
|
# Create the install script
|
||||||
|
RUN make install.sh Q=
|
||||||
|
|
||||||
|
# Create an archive with the compiled executables, man pages, and install script,
|
||||||
|
# so it can be copied outside of the container and installed/used in another system
|
||||||
|
RUN tar caf rgbds-linux-x86_64.tar.xz --transform='s#.*/##' rgbasm rgblink rgbfix rgbgfx man/* install.sh
|
||||||
|
|
||||||
|
# Install RGBDS on the container so all the executables will be available in the PATH
|
||||||
|
RUN cp man/* .
|
||||||
|
RUN make install Q=
|
||||||
|
|||||||
@@ -1,6 +1,6 @@
|
|||||||
The MIT License
|
The MIT License
|
||||||
|
|
||||||
Copyright (c) 1997-2020, Carsten Sorensen and RGBDS contributors.
|
Copyright (c) 1996-2025, Carsten Sørensen and RGBDS contributors.
|
||||||
|
|
||||||
Permission is hereby granted, free of charge, to any person obtaining a copy
|
Permission is hereby granted, free of charge, to any person obtaining a copy
|
||||||
of this software and associated documentation files (the "Software"), to
|
of this software and associated documentation files (the "Software"), to
|
||||||
|
|||||||
@@ -1,15 +1,9 @@
|
|||||||
#
|
|
||||||
# This file is part of RGBDS.
|
|
||||||
#
|
|
||||||
# Copyright (c) 1997-2018, Carsten Sorensen and RGBDS contributors.
|
|
||||||
#
|
|
||||||
# SPDX-License-Identifier: MIT
|
# SPDX-License-Identifier: MIT
|
||||||
#
|
|
||||||
|
|
||||||
.SUFFIXES:
|
.SUFFIXES:
|
||||||
.SUFFIXES: .h .y .c .cpp .o
|
.SUFFIXES: .cpp .y .o
|
||||||
|
|
||||||
.PHONY: all clean install checkcodebase checkpatch checkdiff develop debug mingw32 mingw64 wine-shim dist
|
.PHONY: all clean install develop debug profile coverage format tidy iwyu wine-shim dist
|
||||||
|
|
||||||
# User-defined variables
|
# User-defined variables
|
||||||
|
|
||||||
@@ -17,10 +11,11 @@ Q := @
|
|||||||
PREFIX := /usr/local
|
PREFIX := /usr/local
|
||||||
bindir := ${PREFIX}/bin
|
bindir := ${PREFIX}/bin
|
||||||
mandir := ${PREFIX}/share/man
|
mandir := ${PREFIX}/share/man
|
||||||
|
SUFFIX :=
|
||||||
STRIP := -s
|
STRIP := -s
|
||||||
BINMODE := 755
|
BINMODE := 755
|
||||||
MANMODE := 644
|
MANMODE := 644
|
||||||
CHECKPATCH := ../linux/scripts/checkpatch.pl
|
MANSRC := man/
|
||||||
|
|
||||||
# Other variables
|
# Other variables
|
||||||
|
|
||||||
@@ -29,43 +24,48 @@ PNGCFLAGS := `${PKG_CONFIG} --cflags libpng`
|
|||||||
PNGLDFLAGS := `${PKG_CONFIG} --libs-only-L libpng`
|
PNGLDFLAGS := `${PKG_CONFIG} --libs-only-L libpng`
|
||||||
PNGLDLIBS := `${PKG_CONFIG} --libs-only-l libpng`
|
PNGLDLIBS := `${PKG_CONFIG} --libs-only-l libpng`
|
||||||
|
|
||||||
# Note: if this comes up empty, `version.c` will automatically fall back to last release number
|
# Note: if this comes up empty, `version.cpp` will automatically fall back to last release number
|
||||||
VERSION_STRING := `git describe --tags --dirty --always 2>/dev/null`
|
VERSION_STRING := `git --git-dir=.git -c safe.directory='*' describe --tags --dirty --always 2>/dev/null`
|
||||||
|
|
||||||
WARNFLAGS := -Wall -pedantic
|
WARNFLAGS := -Wall -pedantic -Wno-unknown-warning-option \
|
||||||
|
-Wno-gnu-zero-variadic-macro-arguments -Wno-unused-but-set-variable
|
||||||
|
|
||||||
# Overridable CFLAGS
|
# Overridable CXXFLAGS
|
||||||
CFLAGS ?= -O3 -flto=auto -DNDEBUG
|
CXXFLAGS ?= -O3 -flto -DNDEBUG
|
||||||
CXXFLAGS ?= -O3 -flto=auto -DNDEBUG
|
# Non-overridable CXXFLAGS
|
||||||
# Non-overridable CFLAGS
|
REQUIREDCXXFLAGS := -std=c++20 -I include -fno-exceptions -fno-rtti
|
||||||
# _ISOC11_SOURCE is required on certain platforms to get C11 on top of the C99-based POSIX 2008
|
REALCXXFLAGS := ${CXXFLAGS} ${WARNFLAGS} ${REQUIREDCXXFLAGS}
|
||||||
REALCFLAGS := ${CFLAGS} ${WARNFLAGS} -std=gnu11 -I include \
|
|
||||||
-D_POSIX_C_SOURCE=200809L -D_ISOC11_SOURCE
|
|
||||||
REALCXXFLAGS := ${CXXFLAGS} ${WARNFLAGS} -std=c++17 -I include \
|
|
||||||
-D_POSIX_C_SOURCE=200809L -fno-exceptions -fno-rtti
|
|
||||||
# Overridable LDFLAGS
|
# Overridable LDFLAGS
|
||||||
LDFLAGS ?=
|
LDFLAGS ?=
|
||||||
# Non-overridable LDFLAGS
|
# Non-overridable LDFLAGS
|
||||||
REALLDFLAGS := ${LDFLAGS} ${WARNFLAGS} \
|
REQUIREDLDFLAGS := -DBUILD_VERSION_STRING=\"${VERSION_STRING}\"
|
||||||
-DBUILD_VERSION_STRING=\"${VERSION_STRING}\"
|
REALLDFLAGS := ${LDFLAGS} ${WARNFLAGS} ${REQUIREDLDFLAGS}
|
||||||
|
|
||||||
YFLAGS ?= -Wall
|
# Wrapper around bison that passes flags depending on what the version supports
|
||||||
|
BISON := src/bison.sh
|
||||||
|
|
||||||
BISON := bison
|
|
||||||
RM := rm -rf
|
RM := rm -rf
|
||||||
|
|
||||||
# Used for checking pull requests
|
|
||||||
BASE_REF := origin/master
|
|
||||||
|
|
||||||
# Rules to build the RGBDS binaries
|
# Rules to build the RGBDS binaries
|
||||||
|
|
||||||
all: rgbasm rgblink rgbfix rgbgfx
|
all: rgbasm rgblink rgbfix rgbgfx
|
||||||
|
|
||||||
|
common_obj := \
|
||||||
|
src/extern/getopt.o \
|
||||||
|
src/cli.o \
|
||||||
|
src/diagnostics.o \
|
||||||
|
src/style.o \
|
||||||
|
src/usage.o \
|
||||||
|
src/util.o
|
||||||
|
|
||||||
rgbasm_obj := \
|
rgbasm_obj := \
|
||||||
|
${common_obj} \
|
||||||
|
src/asm/actions.o \
|
||||||
src/asm/charmap.o \
|
src/asm/charmap.o \
|
||||||
src/asm/fixpoint.o \
|
src/asm/fixpoint.o \
|
||||||
src/asm/format.o \
|
src/asm/format.o \
|
||||||
src/asm/fstack.o \
|
src/asm/fstack.o \
|
||||||
|
src/asm/intern.o \
|
||||||
src/asm/lexer.o \
|
src/asm/lexer.o \
|
||||||
src/asm/macro.o \
|
src/asm/macro.o \
|
||||||
src/asm/main.o \
|
src/asm/main.o \
|
||||||
@@ -75,19 +75,21 @@ rgbasm_obj := \
|
|||||||
src/asm/rpn.o \
|
src/asm/rpn.o \
|
||||||
src/asm/section.o \
|
src/asm/section.o \
|
||||||
src/asm/symbol.o \
|
src/asm/symbol.o \
|
||||||
src/asm/util.o \
|
|
||||||
src/asm/warning.o \
|
src/asm/warning.o \
|
||||||
src/extern/getopt.o \
|
|
||||||
src/extern/utf8decoder.o \
|
src/extern/utf8decoder.o \
|
||||||
src/error.o \
|
src/backtrace.o \
|
||||||
src/hashmap.o \
|
|
||||||
src/linkdefs.o \
|
src/linkdefs.o \
|
||||||
src/opmath.o
|
src/opmath.o \
|
||||||
|
src/verbosity.o
|
||||||
|
|
||||||
src/asm/lexer.o src/asm/main.o: src/asm/parser.h
|
src/asm/lexer.o src/asm/main.o: src/asm/parser.hpp
|
||||||
|
|
||||||
rgblink_obj := \
|
rgblink_obj := \
|
||||||
|
${common_obj} \
|
||||||
src/link/assign.o \
|
src/link/assign.o \
|
||||||
|
src/link/fstack.o \
|
||||||
|
src/link/lexer.o \
|
||||||
|
src/link/layout.o \
|
||||||
src/link/main.o \
|
src/link/main.o \
|
||||||
src/link/object.o \
|
src/link/object.o \
|
||||||
src/link/output.o \
|
src/link/output.o \
|
||||||
@@ -96,186 +98,174 @@ rgblink_obj := \
|
|||||||
src/link/sdas_obj.o \
|
src/link/sdas_obj.o \
|
||||||
src/link/section.o \
|
src/link/section.o \
|
||||||
src/link/symbol.o \
|
src/link/symbol.o \
|
||||||
src/extern/getopt.o \
|
src/link/warning.o \
|
||||||
src/extern/utf8decoder.o \
|
src/extern/utf8decoder.o \
|
||||||
src/error.o \
|
src/backtrace.o \
|
||||||
src/hashmap.o \
|
|
||||||
src/linkdefs.o \
|
src/linkdefs.o \
|
||||||
src/opmath.o
|
src/opmath.o \
|
||||||
|
src/verbosity.o
|
||||||
|
|
||||||
|
src/link/lexer.o src/link/main.o: src/link/script.hpp
|
||||||
|
|
||||||
rgbfix_obj := \
|
rgbfix_obj := \
|
||||||
|
${common_obj} \
|
||||||
|
src/fix/fix.o \
|
||||||
src/fix/main.o \
|
src/fix/main.o \
|
||||||
src/extern/getopt.o \
|
src/fix/mbc.o \
|
||||||
src/error.o
|
src/fix/warning.o
|
||||||
|
|
||||||
rgbgfx_obj := \
|
rgbgfx_obj := \
|
||||||
|
${common_obj} \
|
||||||
|
src/gfx/color_set.o \
|
||||||
src/gfx/main.o \
|
src/gfx/main.o \
|
||||||
src/gfx/pal_packing.o \
|
src/gfx/pal_packing.o \
|
||||||
src/gfx/pal_sorting.o \
|
src/gfx/pal_sorting.o \
|
||||||
src/gfx/pal_spec.o \
|
src/gfx/pal_spec.o \
|
||||||
|
src/gfx/palette.o \
|
||||||
|
src/gfx/png.o \
|
||||||
src/gfx/process.o \
|
src/gfx/process.o \
|
||||||
src/gfx/proto_palette.o \
|
|
||||||
src/gfx/reverse.o \
|
src/gfx/reverse.o \
|
||||||
src/gfx/rgba.o \
|
src/gfx/rgba.o \
|
||||||
src/extern/getopt.o \
|
src/gfx/warning.o \
|
||||||
src/error.o
|
src/verbosity.o
|
||||||
|
|
||||||
rgbasm: ${rgbasm_obj}
|
rgbasm: ${rgbasm_obj}
|
||||||
$Q${CC} ${REALLDFLAGS} -o $@ ${rgbasm_obj} ${REALCFLAGS} src/version.c -lm
|
$Q${CXX} ${REALLDFLAGS} -o $@ ${rgbasm_obj} ${REALCXXFLAGS} src/version.cpp
|
||||||
|
|
||||||
rgblink: ${rgblink_obj}
|
rgblink: ${rgblink_obj}
|
||||||
$Q${CC} ${REALLDFLAGS} -o $@ ${rgblink_obj} ${REALCFLAGS} src/version.c
|
$Q${CXX} ${REALLDFLAGS} -o $@ ${rgblink_obj} ${REALCXXFLAGS} src/version.cpp
|
||||||
|
|
||||||
rgbfix: ${rgbfix_obj}
|
rgbfix: ${rgbfix_obj}
|
||||||
$Q${CC} ${REALLDFLAGS} -o $@ ${rgbfix_obj} ${REALCFLAGS} src/version.c
|
$Q${CXX} ${REALLDFLAGS} -o $@ ${rgbfix_obj} ${REALCXXFLAGS} src/version.cpp
|
||||||
|
|
||||||
rgbgfx: ${rgbgfx_obj}
|
rgbgfx: ${rgbgfx_obj}
|
||||||
$Q${CXX} ${REALLDFLAGS} ${PNGLDFLAGS} -o $@ ${rgbgfx_obj} ${REALCXXFLAGS} -x c++ src/version.c ${PNGLDLIBS}
|
$Q${CXX} ${REALLDFLAGS} ${PNGLDFLAGS} -o $@ ${rgbgfx_obj} ${REALCXXFLAGS} ${PNGLDLIBS} src/version.cpp
|
||||||
|
|
||||||
test/gfx/randtilegen: test/gfx/randtilegen.c
|
test/gfx/randtilegen: test/gfx/randtilegen.cpp
|
||||||
$Q${CC} ${REALLDFLAGS} ${PNGLDFLAGS} -o $@ $^ ${REALCFLAGS} ${PNGCFLAGS} ${PNGLDLIBS}
|
$Q${CXX} ${REALLDFLAGS} ${PNGLDFLAGS} -o $@ $^ ${REALCXXFLAGS} ${PNGCFLAGS} ${PNGLDLIBS}
|
||||||
|
|
||||||
test/gfx/rgbgfx_test: test/gfx/rgbgfx_test.cpp
|
test/gfx/rgbgfx_test: test/gfx/rgbgfx_test.cpp
|
||||||
$Q${CXX} ${REALLDFLAGS} ${PNGLDFLAGS} -o $@ $^ ${REALCXXFLAGS} ${PNGLDLIBS}
|
$Q${CXX} ${REALLDFLAGS} ${PNGLDFLAGS} -o $@ $^ ${REALCXXFLAGS} ${PNGCFLAGS} ${PNGLDLIBS}
|
||||||
|
|
||||||
# Rules to process files
|
# Rules to process files
|
||||||
|
|
||||||
# We want the Bison invocation to pass through our rules, not default ones
|
# We want the Bison invocation to pass through our rules, not default ones
|
||||||
.y.o:
|
.y.o:
|
||||||
|
|
||||||
# Bison-generated C files have an accompanying header
|
.y.cpp:
|
||||||
src/asm/parser.h: src/asm/parser.c
|
$Q${BISON} $@ $<
|
||||||
|
|
||||||
|
# Bison-generated C++ files have an accompanying header
|
||||||
|
src/asm/parser.hpp: src/asm/parser.cpp
|
||||||
|
$Qtouch $@
|
||||||
|
src/link/script.hpp: src/link/script.cpp
|
||||||
$Qtouch $@
|
$Qtouch $@
|
||||||
|
|
||||||
src/asm/parser.c: src/asm/parser.y
|
# Only RGBGFX uses libpng (POSIX make doesn't support pattern rules to cover all these)
|
||||||
$QDEFS=; \
|
src/gfx/color_set.o: src/gfx/color_set.cpp
|
||||||
add_flag(){ \
|
$Q${CXX} ${REALCXXFLAGS} ${PNGCFLAGS} -c -o $@ $<
|
||||||
if src/check_bison_ver.sh $$1 $$2; then \
|
src/gfx/main.o: src/gfx/main.cpp
|
||||||
DEFS="-D$$3 $$DEFS"; \
|
$Q${CXX} ${REALCXXFLAGS} ${PNGCFLAGS} -c -o $@ $<
|
||||||
fi \
|
src/gfx/pal_packing.o: src/gfx/pal_packing.cpp
|
||||||
}; \
|
$Q${CXX} ${REALCXXFLAGS} ${PNGCFLAGS} -c -o $@ $<
|
||||||
add_flag 3 5 api.token.raw=true; \
|
src/gfx/pal_sorting.o: src/gfx/pal_sorting.cpp
|
||||||
add_flag 3 6 parse.error=detailed; \
|
$Q${CXX} ${REALCXXFLAGS} ${PNGCFLAGS} -c -o $@ $<
|
||||||
add_flag 3 0 parse.error=verbose; \
|
src/gfx/pal_spec.o: src/gfx/pal_spec.cpp
|
||||||
add_flag 3 0 parse.lac=full; \
|
$Q${CXX} ${REALCXXFLAGS} ${PNGCFLAGS} -c -o $@ $<
|
||||||
add_flag 3 0 lr.type=ielr; \
|
src/gfx/png.o: src/gfx/png.cpp
|
||||||
echo "DEFS=$$DEFS"; \
|
$Q${CXX} ${REALCXXFLAGS} ${PNGCFLAGS} -c -o $@ $<
|
||||||
${BISON} $$DEFS -d ${YFLAGS} -o $@ $<
|
src/gfx/process.o: src/gfx/process.cpp
|
||||||
|
$Q${CXX} ${REALCXXFLAGS} ${PNGCFLAGS} -c -o $@ $<
|
||||||
.c.o:
|
src/gfx/reverse.o: src/gfx/reverse.cpp
|
||||||
$Q${CC} ${REALCFLAGS} -c -o $@ $<
|
$Q${CXX} ${REALCXXFLAGS} ${PNGCFLAGS} -c -o $@ $<
|
||||||
|
src/gfx/rgba.o: src/gfx/rgba.cpp
|
||||||
.cpp.o:
|
|
||||||
$Q${CXX} ${REALCXXFLAGS} ${PNGCFLAGS} -c -o $@ $<
|
$Q${CXX} ${REALCXXFLAGS} ${PNGCFLAGS} -c -o $@ $<
|
||||||
|
|
||||||
# Target used to remove all files generated by other Makefile targets
|
.cpp.o:
|
||||||
|
$Q${CXX} ${REALCXXFLAGS} -c -o $@ $<
|
||||||
|
|
||||||
|
install.sh:
|
||||||
|
$Qecho '#!/usr/bin/env bash' > $@
|
||||||
|
$Q${MAKE} -s -n install MANSRC= >> $@
|
||||||
|
$Qchmod +x $@
|
||||||
|
|
||||||
|
# Target used to remove all files generated by other Makefile targets
|
||||||
clean:
|
clean:
|
||||||
$Q${RM} rgbasm rgbasm.exe
|
$Q${RM} rgbasm rgbasm.exe
|
||||||
$Q${RM} rgblink rgblink.exe
|
$Q${RM} rgblink rgblink.exe
|
||||||
$Q${RM} rgbfix rgbfix.exe
|
$Q${RM} rgbfix rgbfix.exe
|
||||||
$Q${RM} rgbgfx rgbgfx.exe
|
$Q${RM} rgbgfx rgbgfx.exe
|
||||||
$Qfind src/ -name "*.o" -exec rm {} \;
|
$Qfind src/ -name "*.o" -exec rm {} \;
|
||||||
$Q${RM} rgbshim.sh
|
$Qfind . -type f \( -name "*.gcno" -o -name "*.gcda" -o -name "*.gcov" \) -exec rm {} \;
|
||||||
$Q${RM} src/asm/parser.c src/asm/parser.h
|
$Q${RM} install.sh rgbshim.sh
|
||||||
|
$Q${RM} src/asm/parser.cpp src/asm/parser.hpp src/asm/stack.hh
|
||||||
|
$Q${RM} src/link/script.cpp src/link/script.hpp src/link/stack.hh
|
||||||
$Q${RM} test/gfx/randtilegen test/gfx/rgbgfx_test
|
$Q${RM} test/gfx/randtilegen test/gfx/rgbgfx_test
|
||||||
|
|
||||||
# Target used to install the binaries and man pages.
|
# Target used to install the binaries and man pages.
|
||||||
|
|
||||||
install: all
|
install: all
|
||||||
$Qmkdir -p ${DESTDIR}${bindir}
|
$Qinstall -d ${DESTDIR}${bindir}/ ${DESTDIR}${mandir}/man1/ ${DESTDIR}${mandir}/man5/ ${DESTDIR}${mandir}/man7/
|
||||||
$Qinstall ${STRIP} -m ${BINMODE} rgbasm ${DESTDIR}${bindir}/rgbasm
|
$Qinstall ${STRIP} -m ${BINMODE} rgbasm ${DESTDIR}${bindir}/rgbasm${SUFFIX}
|
||||||
$Qinstall ${STRIP} -m ${BINMODE} rgbfix ${DESTDIR}${bindir}/rgbfix
|
$Qinstall ${STRIP} -m ${BINMODE} rgblink ${DESTDIR}${bindir}/rgblink${SUFFIX}
|
||||||
$Qinstall ${STRIP} -m ${BINMODE} rgblink ${DESTDIR}${bindir}/rgblink
|
$Qinstall ${STRIP} -m ${BINMODE} rgbfix ${DESTDIR}${bindir}/rgbfix${SUFFIX}
|
||||||
$Qinstall ${STRIP} -m ${BINMODE} rgbgfx ${DESTDIR}${bindir}/rgbgfx
|
$Qinstall ${STRIP} -m ${BINMODE} rgbgfx ${DESTDIR}${bindir}/rgbgfx${SUFFIX}
|
||||||
$Qmkdir -p ${DESTDIR}${mandir}/man1 ${DESTDIR}${mandir}/man5 ${DESTDIR}${mandir}/man7
|
$Qinstall -m ${MANMODE} ${MANSRC}rgbasm.1 ${MANSRC}rgblink.1 ${MANSRC}rgbfix.1 ${MANSRC}rgbgfx.1 ${DESTDIR}${mandir}/man1/
|
||||||
$Qinstall -m ${MANMODE} man/rgbds.7 ${DESTDIR}${mandir}/man7/rgbds.7
|
$Qinstall -m ${MANMODE} ${MANSRC}rgbds.5 ${MANSRC}rgbasm.5 ${MANSRC}rgbasm-old.5 ${MANSRC}rgblink.5 ${DESTDIR}${mandir}/man5/
|
||||||
$Qinstall -m ${MANMODE} man/gbz80.7 ${DESTDIR}${mandir}/man7/gbz80.7
|
$Qinstall -m ${MANMODE} ${MANSRC}rgbds.7 ${MANSRC}gbz80.7 ${DESTDIR}${mandir}/man7/
|
||||||
$Qinstall -m ${MANMODE} man/rgbds.5 ${DESTDIR}${mandir}/man5/rgbds.5
|
|
||||||
$Qinstall -m ${MANMODE} man/rgbasm.1 ${DESTDIR}${mandir}/man1/rgbasm.1
|
|
||||||
$Qinstall -m ${MANMODE} man/rgbasm.5 ${DESTDIR}${mandir}/man5/rgbasm.5
|
|
||||||
$Qinstall -m ${MANMODE} man/rgbfix.1 ${DESTDIR}${mandir}/man1/rgbfix.1
|
|
||||||
$Qinstall -m ${MANMODE} man/rgblink.1 ${DESTDIR}${mandir}/man1/rgblink.1
|
|
||||||
$Qinstall -m ${MANMODE} man/rgblink.5 ${DESTDIR}${mandir}/man5/rgblink.5
|
|
||||||
$Qinstall -m ${MANMODE} man/rgbgfx.1 ${DESTDIR}${mandir}/man1/rgbgfx.1
|
|
||||||
|
|
||||||
# Target used to check the coding style of the whole codebase.
|
# Target used in development to prevent adding new issues to the source code.
|
||||||
# `extern/` is excluded, as it contains external code that should not be patched
|
# All warnings are treated as errors to block the compilation and make the
|
||||||
# to meet our coding style, so applying upstream patches is easier.
|
# continous integration infrastructure return failure.
|
||||||
# `.y` files aren't checked, unfortunately...
|
|
||||||
|
|
||||||
checkcodebase:
|
|
||||||
$Qfor file in `git ls-files | grep -E '(\.c|\.h)$$' | grep -Ev '(src|include)/extern/'`; do \
|
|
||||||
${CHECKPATCH} -f "$$file"; \
|
|
||||||
done
|
|
||||||
|
|
||||||
# Target used to check the coding style of the patches from the upstream branch
|
|
||||||
# to the HEAD. Runs checkpatch once for each commit between the current HEAD and
|
|
||||||
# the first common commit between the HEAD and origin/master.
|
|
||||||
# `.y` files aren't checked, unfortunately...
|
|
||||||
|
|
||||||
checkpatch:
|
|
||||||
$QCOMMON_COMMIT=`git merge-base HEAD ${BASE_REF}`; \
|
|
||||||
for commit in `git rev-list $$COMMON_COMMIT..HEAD`; do \
|
|
||||||
echo "[*] Analyzing commit '$$commit'"; \
|
|
||||||
git format-patch --stdout "$$commit~..$$commit" \
|
|
||||||
-- src include '!src/extern' '!include/extern' \
|
|
||||||
| ${CHECKPATCH} - || true; \
|
|
||||||
done
|
|
||||||
|
|
||||||
# Target used to check for suspiciously missing changed files.
|
|
||||||
|
|
||||||
checkdiff:
|
|
||||||
$Qcontrib/checkdiff.bash `git merge-base HEAD ${BASE_REF}`
|
|
||||||
|
|
||||||
# This target is used during development in order to prevent adding new issues
|
|
||||||
# to the source code. All warnings are treated as errors in order to block the
|
|
||||||
# compilation and make the continous integration infrastructure return failure.
|
|
||||||
# The rationale for some of the flags is documented in the CMakeLists.
|
# The rationale for some of the flags is documented in the CMakeLists.
|
||||||
|
|
||||||
develop:
|
develop:
|
||||||
$Qenv ${MAKE} WARNFLAGS="-Werror -Wextra \
|
$Q${MAKE} WARNFLAGS="${WARNFLAGS} -Werror -Wextra \
|
||||||
-Walloc-zero -Wcast-align -Wcast-qual -Wduplicated-branches -Wduplicated-cond \
|
-Walloc-zero -Wcast-align -Wcast-qual -Wduplicated-branches -Wduplicated-cond \
|
||||||
-Wfloat-equal -Wlogical-op -Wnull-dereference -Wshift-overflow=2 \
|
-Wfloat-equal -Wlogical-op -Wnull-dereference -Wold-style-cast -Wshift-overflow=2 \
|
||||||
-Wstringop-overflow=4 -Wstrict-overflow=5 -Wundef -Wuninitialized -Wunused \
|
-Wstringop-overflow=4 -Wtrampolines -Wundef -Wuninitialized -Wunused -Wshadow \
|
||||||
-Wshadow \
|
|
||||||
-Wformat=2 -Wformat-overflow=2 -Wformat-truncation=1 \
|
-Wformat=2 -Wformat-overflow=2 -Wformat-truncation=1 \
|
||||||
-Wno-format-nonliteral \
|
-Wno-format-nonliteral -Wno-strict-overflow -Wno-unused-but-set-variable \
|
||||||
-Wno-type-limits -Wno-tautological-constant-out-of-range-compare \
|
-Wno-type-limits -Wno-tautological-constant-out-of-range-compare -Wvla \
|
||||||
-Wvla \
|
-D_GLIBCXX_ASSERTIONS -D_LIBCPP_HARDENING_MODE=_LIBCPP_HARDENING_MODE_DEBUG \
|
||||||
-Wno-unknown-warning-option \
|
-fsanitize=address -fsanitize=undefined -fsanitize=float-divide-by-zero" \
|
||||||
-fsanitize=shift -fsanitize=integer-divide-by-zero \
|
|
||||||
-fsanitize=unreachable -fsanitize=vla-bound \
|
|
||||||
-fsanitize=signed-integer-overflow -fsanitize=bounds \
|
|
||||||
-fsanitize=object-size -fsanitize=bool -fsanitize=enum \
|
|
||||||
-fsanitize=alignment -fsanitize=null -fsanitize=address" \
|
|
||||||
CFLAGS="-ggdb3 -Og -fno-omit-frame-pointer -fno-optimize-sibling-calls" \
|
|
||||||
CXXFLAGS="-ggdb3 -Og -fno-omit-frame-pointer -fno-optimize-sibling-calls"
|
CXXFLAGS="-ggdb3 -Og -fno-omit-frame-pointer -fno-optimize-sibling-calls"
|
||||||
|
|
||||||
# This target is used during development in order to more easily debug with gdb.
|
# Target used in development to debug with gdb.
|
||||||
|
|
||||||
debug:
|
debug:
|
||||||
$Qenv ${MAKE} \
|
$Qenv ${MAKE} \
|
||||||
CFLAGS="-ggdb3 -Og -fno-omit-frame-pointer -fno-optimize-sibling-calls" \
|
CXXFLAGS="-ggdb3 -O0 -fno-omit-frame-pointer -fno-optimize-sibling-calls"
|
||||||
CXXFLAGS="-ggdb3 -Og -fno-omit-frame-pointer -fno-optimize-sibling-calls"
|
|
||||||
|
|
||||||
# Targets for the project maintainer to easily create Windows exes.
|
# Target used in development to profile with callgrind.
|
||||||
# This is not for Windows users!
|
# Use `valgrind --tool=callgrind --dump-instr=yes --simulate-cache=yes --collect-jumps=yes ./rgbasm ...`.
|
||||||
# If you're building on Windows with Cygwin or Mingw, just follow the Unix
|
profile:
|
||||||
# install instructions instead.
|
$Qenv ${MAKE} \
|
||||||
|
CXXFLAGS="-ggdb3 -O3 -fno-omit-frame-pointer -fno-optimize-sibling-calls"
|
||||||
|
|
||||||
mingw32:
|
# Target used in development to inspect code coverage with gcov.
|
||||||
$Q${MAKE} all test/gfx/randtilegen test/gfx/rgbgfx_test \
|
# Use `./contrib/coverage.bash`.
|
||||||
CC=i686-w64-mingw32-gcc CXX=i686-w64-mingw32-g++ \
|
coverage:
|
||||||
BISON=bison PKG_CONFIG="PKG_CONFIG_SYSROOT_DIR=/usr/i686-w64-mingw32 pkg-config"
|
$Qenv ${MAKE} \
|
||||||
|
CXXFLAGS="-ggdb3 -Og --coverage -fno-omit-frame-pointer -fno-optimize-sibling-calls"
|
||||||
|
|
||||||
mingw64:
|
# Target used in development to format source code with clang-format.
|
||||||
$Q${MAKE} all test/gfx/randtilegen test/gfx/rgbgfx_test \
|
format:
|
||||||
CC=x86_64-w64-mingw32-gcc CXX=x86_64-w64-mingw32-g++ \
|
$Qclang-format -i $$(git ls-files '*.[hc]pp')
|
||||||
BISON=bison PKG_CONFIG="PKG_CONFIG_SYSROOT_DIR=/usr/x86_64-w64-mingw32 pkg-config"
|
|
||||||
|
|
||||||
|
# Target used in development to check code with clang-tidy.
|
||||||
|
# Requires Bison-generated header files to exist.
|
||||||
|
tidy: src/asm/parser.hpp src/link/script.hpp compile_flags.txt
|
||||||
|
$Qclang-tidy -p . $$(git ls-files '*.[hc]pp')
|
||||||
|
compile_flags.txt:
|
||||||
|
$Qprintf '%s\n' ${REQUIREDCXXFLAGS} ${REQUIREDLDFLAGS} >$@
|
||||||
|
|
||||||
|
# Target used in development to remove unused `#include` headers.
|
||||||
|
iwyu:
|
||||||
|
$Qenv ${MAKE} \
|
||||||
|
CXX="include-what-you-use" \
|
||||||
|
REALCXXFLAGS="-std=c++20 -I include"
|
||||||
|
|
||||||
|
# Target used in development to conveniently invoke RGBDS binaries with Wine.
|
||||||
wine-shim:
|
wine-shim:
|
||||||
$Qecho '#!/bin/bash' > rgbshim.sh
|
$Qecho '#!/usr/bin/env bash' > rgbshim.sh
|
||||||
$Qecho 'WINEDEBUG=-all wine $$0.exe "$${@:1}"' >> rgbshim.sh
|
$Qecho 'WINEDEBUG=-all wine $$0.exe "$${@:1}"' >> rgbshim.sh
|
||||||
$Qchmod +x rgbshim.sh
|
$Qchmod +x rgbshim.sh
|
||||||
$Qln -s rgbshim.sh rgbasm
|
$Qln -s rgbshim.sh rgbasm
|
||||||
@@ -285,7 +275,6 @@ wine-shim:
|
|||||||
|
|
||||||
# Target for the project maintainer to produce distributable release tarballs
|
# Target for the project maintainer to produce distributable release tarballs
|
||||||
# of the source code.
|
# of the source code.
|
||||||
|
|
||||||
dist:
|
dist:
|
||||||
$Qgit ls-files | sed s~^~$${PWD##*/}/~ \
|
$Qgit ls-files | sed s~^~$${PWD##*/}/~ \
|
||||||
| tar -czf rgbds-`git describe --tags | cut -c 2-`.tar.gz -C .. -T -
|
| tar -czf rgbds-source.tar.gz -C .. -T -
|
||||||
|
|||||||
@@ -0,0 +1,63 @@
|
|||||||
|
# RGBDS
|
||||||
|
|
||||||
|
[RGBDS](https://github.com/gbdev/rgbds) (Rednex Game Boy Development System) is
|
||||||
|
a free assembler/linker package for the Game Boy and Game Boy Color.
|
||||||
|
|
||||||
|
It consists of four tools:
|
||||||
|
|
||||||
|
- **RGBASM:** assembler
|
||||||
|
- **RGBLINK:** linker
|
||||||
|
- **RGBFIX:** ROM checksum/header fixer
|
||||||
|
- **RGBGFX:** PNG-to-Game Boy graphics converter
|
||||||
|
|
||||||
|
## Documentation
|
||||||
|
|
||||||
|
The [full documentation](https://rgbds.gbdev.io/docs/) is available online,
|
||||||
|
including the [development history](https://rgbds.gbdev.io/docs/rgbds.7) and
|
||||||
|
[version history](https://rgbds.gbdev.io/versions), generated from the man pages
|
||||||
|
in this repository.
|
||||||
|
|
||||||
|
The documentation website's own source code is available in the
|
||||||
|
[rgbds-www](https://github.com/gbdev/rgbds-www) repository.
|
||||||
|
|
||||||
|
## Community
|
||||||
|
|
||||||
|
If you have questions about the RGBDS code or its organization, you can contact
|
||||||
|
the maintainers on the [GBDev Discord server](https://discord.gg/RjJKA8wrD4) or
|
||||||
|
[other community channels](https://gbdev.io/chat), or via email at
|
||||||
|
`rgbds at gbdev dot io`.
|
||||||
|
|
||||||
|
If you want to help maintain RGBDS, please read [the contribution guide](/docs/CONTRIBUTING.md).
|
||||||
|
|
||||||
|
## Installing
|
||||||
|
|
||||||
|
The [platform-specific installation instructions](https://rgbds.gbdev.io/install/)
|
||||||
|
are available online. To [build from source](https://rgbds.gbdev.io/install/source)
|
||||||
|
using `make` or `cmake`, briefly:
|
||||||
|
|
||||||
|
```sh
|
||||||
|
make
|
||||||
|
sudo make install
|
||||||
|
```
|
||||||
|
|
||||||
|
```sh
|
||||||
|
cmake -S . -B build -DCMAKE_BUILD_TYPE=Release
|
||||||
|
cmake --build build
|
||||||
|
cmake --install build
|
||||||
|
```
|
||||||
|
|
||||||
|
Both build systems support a prefix (e.g. to install into a specific directory)
|
||||||
|
and a suffix (e.g. to append the version number or commit ID):
|
||||||
|
|
||||||
|
```sh
|
||||||
|
make
|
||||||
|
sudo make install PREFIX=install_dir/ SUFFIX=-$(git rev-parse --short HEAD)
|
||||||
|
```
|
||||||
|
|
||||||
|
```sh
|
||||||
|
cmake -S . -B build -DCMAKE_BUILD_TYPE=Release -DSUFFIX=-$(git rev-parse --short HEAD)
|
||||||
|
cmake --build build
|
||||||
|
cmake --install build --prefix install_dir
|
||||||
|
```
|
||||||
|
|
||||||
|
On Windows, any `SUFFIX` should include the `.exe` extension.
|
||||||
-139
@@ -1,139 +0,0 @@
|
|||||||
RGBDS
|
|
||||||
=====
|
|
||||||
|
|
||||||
RGBDS (Rednex Game Boy Development System) is a free assembler/linker package
|
|
||||||
for the Game Boy and Game Boy Color. It consists of:
|
|
||||||
|
|
||||||
- rgbasm (assembler)
|
|
||||||
- rgblink (linker)
|
|
||||||
- rgbfix (checksum/header fixer)
|
|
||||||
- rgbgfx (PNG‐to‐Game Boy graphics converter)
|
|
||||||
|
|
||||||
This is a fork of the original RGBDS which aims to make the programs more like
|
|
||||||
other UNIX tools.
|
|
||||||
|
|
||||||
This toolchain is maintained `on GitHub <https://github.com/gbdev/rgbds>`__.
|
|
||||||
|
|
||||||
The documentation of this toolchain can be viewed online `here <https://rgbds.gbdev.io/docs/>`__, it is generated from the man pages found in this repository.
|
|
||||||
The source code of the website itself is on GitHub as well under the repo `rgbds-www <https://github.com/gbdev/rgbds-www>`__.
|
|
||||||
|
|
||||||
If you want to contribute or maintain RGBDS, and have questions regarding the code, its organisation, etc. you can find me `on GBDev <https://gbdev.io/chat>`__ or via mail at ``rgbds at eldred dot fr``.
|
|
||||||
|
|
||||||
1. Installing RGBDS
|
|
||||||
-------------------
|
|
||||||
|
|
||||||
The `installation procedure <https://rgbds.gbdev.io/install>`__ is available
|
|
||||||
online for various platforms. `Building from source <https://rgbds.gbdev.io/install/#building-from-source>`__
|
|
||||||
is possible using ``make`` or ``cmake``; follow the link for more detailed instructions.
|
|
||||||
|
|
||||||
.. code:: sh
|
|
||||||
|
|
||||||
make
|
|
||||||
sudo make install
|
|
||||||
|
|
||||||
.. code:: sh
|
|
||||||
|
|
||||||
cmake -S . -B build -DCMAKE_BUILD_TYPE=Release
|
|
||||||
cmake --build build
|
|
||||||
cmake --install build
|
|
||||||
|
|
||||||
2. RGBDS Folder Organization
|
|
||||||
----------------------------
|
|
||||||
|
|
||||||
The RGBDS source code file structure somewhat resembles the following:
|
|
||||||
|
|
||||||
::
|
|
||||||
|
|
||||||
.
|
|
||||||
├── .github/
|
|
||||||
│ ├── actions/
|
|
||||||
│ │ └── ...
|
|
||||||
│ └── workflows/
|
|
||||||
│ └── ...
|
|
||||||
├── contrib/
|
|
||||||
│ ├── zsh_compl/
|
|
||||||
│ │ └── ...
|
|
||||||
│ └── ...
|
|
||||||
├── include/
|
|
||||||
│ └── ...
|
|
||||||
├── man/
|
|
||||||
│ └── ...
|
|
||||||
├── src/
|
|
||||||
│ ├── asm/
|
|
||||||
│ │ └── ...
|
|
||||||
│ ├── extern/
|
|
||||||
│ │ └── ...
|
|
||||||
│ ├── fix/
|
|
||||||
│ │ └── ...
|
|
||||||
│ ├── gfx/
|
|
||||||
│ │ └── ...
|
|
||||||
│ ├── link/
|
|
||||||
│ │ └── ...
|
|
||||||
│ ├── CMakeLists.txt
|
|
||||||
│ └── ...
|
|
||||||
├── test/
|
|
||||||
│ ├── ...
|
|
||||||
│ └── run-tests.sh
|
|
||||||
├── .clang-format
|
|
||||||
├── CMakeLists.txt
|
|
||||||
├── Makefile
|
|
||||||
└── README.rst
|
|
||||||
|
|
||||||
.. |clang-format| replace:: ``clang-format``
|
|
||||||
.. _clang-format: https://clang.llvm.org/docs/ClangFormat.html
|
|
||||||
|
|
||||||
- ``.github/`` - files and scripts related to the integration of the RGBDS codebase with
|
|
||||||
GitHub.
|
|
||||||
|
|
||||||
* ``actions/`` - scripts used by workflow files.
|
|
||||||
* ``workflows/`` - CI workflow description files.
|
|
||||||
|
|
||||||
- ``contrib/`` - scripts and other resources which may be useful to users and developers of
|
|
||||||
RGBDS.
|
|
||||||
|
|
||||||
* ``zsh_compl`` contains tab completion scripts for use with zsh. Put them somewhere in your ``fpath``, and they should auto-load.
|
|
||||||
|
|
||||||
* ``bash_compl`` contains tab completion scripts for use with bash. Run them with ``source`` somewhere in your ``.bashrc``, and they should load every time you open a shell.
|
|
||||||
|
|
||||||
- ``include/`` - header files for each respective C files in `src`.
|
|
||||||
|
|
||||||
- ``man/`` - manual pages.
|
|
||||||
|
|
||||||
- ``src/`` - source code of RGBDS.
|
|
||||||
|
|
||||||
* Note that the code unique to each RGBDS tool is stored in its respective subdirectory
|
|
||||||
(rgbasm -> ``src/asm/``, for example). ``src/extern/`` contains code imported from external sources.
|
|
||||||
|
|
||||||
- ``test/`` - testing framework used to verify that changes to the code don't break or modify the behavior of RGBDS.
|
|
||||||
|
|
||||||
- ``.clang-format`` - code style for automated formatting with |clang-format|_. The C code does not currently follow this style, but all C++ code should.
|
|
||||||
|
|
||||||
3. History
|
|
||||||
----------
|
|
||||||
|
|
||||||
- Around 1997, Carsten Sørensen (AKA SurfSmurf) writes ASMotor as a
|
|
||||||
general-purpose assembler/linker system for DOS/Win32
|
|
||||||
|
|
||||||
- Around 1999, Justin Lloyd (AKA Otaku no Zoku) adapts ASMotor to read and
|
|
||||||
produce GBZ80 assembly/machine code, and releases this version as RGBDS.
|
|
||||||
|
|
||||||
- 2009, Vegard Nossum adapts the code to be more UNIX-like and releases
|
|
||||||
this version as rgbds-linux on
|
|
||||||
`GitHub <https://github.com/vegard/rgbds-linux>`__.
|
|
||||||
|
|
||||||
- 2010, Anthony J. Bentley forks that repository. The fork becomes the reference
|
|
||||||
implementation of rgbds.
|
|
||||||
|
|
||||||
- 2017, Bentley's repository is moved to a neutral name.
|
|
||||||
|
|
||||||
- 2018, codebase relicensed under the MIT license.
|
|
||||||
|
|
||||||
- 2020, repository is moved to the `gbdev <https://github.com/gbdev>`__ organisation. The `rgbds.gbdev.io <https://rgbds.gbdev.io>`__ website serving documentation and downloads is created.
|
|
||||||
|
|
||||||
4. Acknowledgements
|
|
||||||
-------------------
|
|
||||||
|
|
||||||
RGBGFX generates palettes using algorithms found in the paper
|
|
||||||
`"Algorithms for the Pagination Problem, a Bin Packing with Overlapping Items" <http://arxiv.org/abs/1605.00558>`__
|
|
||||||
(`GitHub <https://github.com/pagination-problem/pagination>`__, MIT license),
|
|
||||||
by Aristide Grange, Imed Kacem, and Sébastien Martin.
|
|
||||||
-67
@@ -1,67 +0,0 @@
|
|||||||
Releasing
|
|
||||||
=========
|
|
||||||
|
|
||||||
This describes for the maintainers of RGBDS how to publish a new release on
|
|
||||||
GitHub.
|
|
||||||
|
|
||||||
1. Update, commit, and push `include/version.h <include/version.h>`__ with
|
|
||||||
values for ``PACKAGE_VERSION_MAJOR``, ``PACKAGE_VERSION_MINOR``,
|
|
||||||
``PACKAGE_VERSION_PATCH``, and ``PACKAGE_VERSION_RC``. Only define
|
|
||||||
``PACKAGE_VERSION_RC`` if you are publishing a release candidate! You can
|
|
||||||
use ``git commit -m "Release <version>"`` and ``git push origin master``.
|
|
||||||
|
|
||||||
2. Create a Git tag formatted as ``v<MAJOR>.<MINOR>.<PATCH>``, or
|
|
||||||
``v<MAJOR>.<MINOR>.<PATCH>-rc<RC>`` for a release candidate. ``MAJOR``,
|
|
||||||
``MINOR``, ``PATCH``, and ``RC`` should match their values from
|
|
||||||
`include/version.h <include/version.h>`__. You can use ``git tag <tag>``.
|
|
||||||
|
|
||||||
3. Push the tag to GitHub. You can use ``git push origin <tag>``.
|
|
||||||
|
|
||||||
GitHub Actions will run the `create-release-artifacts.yaml
|
|
||||||
<.github/workflows/create-release-artifacts.yaml>`__ workflow to detect the
|
|
||||||
tag starting with "``v[0-9]``" and automatically do the following:
|
|
||||||
|
|
||||||
1. Build 32-bit and 64-bit RGBDS binaries for Windows with ``cmake``.
|
|
||||||
|
|
||||||
2. Package the binaries into zip files.
|
|
||||||
|
|
||||||
3. Package the source code into a tar.gz file with ``make dist``.
|
|
||||||
|
|
||||||
4. Create a draft GitHub release for the tag, attaching the three
|
|
||||||
packaged files. It will be a prerelease if the tag contains "``-rc``".
|
|
||||||
|
|
||||||
If an error occurred in the above steps, delete the tag and restart the
|
|
||||||
procedure. You can use ``git push --delete origin <tag>`` and
|
|
||||||
``git tag --delete <tag>``.
|
|
||||||
|
|
||||||
4. GitHub Actions will run the `create-release-docs.yml
|
|
||||||
<.github/workflows/create-release-docs.yml>`__ workflow to add the release
|
|
||||||
documentation to `rgbds-www <https://github.com/gbdev/rgbds-www>`__.
|
|
||||||
|
|
||||||
For a release candidate, which creates a prerelease, you will have to
|
|
||||||
take these steps yourself.
|
|
||||||
|
|
||||||
1. Clone `rgbds-www <https://github.com/gbdev/rgbds-www>`__. You can use
|
|
||||||
``git clone https://github.com/gbdev/rgbds-www.git``.
|
|
||||||
|
|
||||||
2. Make sure that you have installed ``groff`` and ``mandoc``. You will
|
|
||||||
need ``mandoc`` 1.14.5 or later to support ``-O toc``.
|
|
||||||
|
|
||||||
3. Run ``.github/actions/get-pages.sh -r <path/to/rgbds-www> <tag>``. This
|
|
||||||
will render the RGBDS documentation as HTML and PDF and copy it to
|
|
||||||
``rgbds-www``.
|
|
||||||
|
|
||||||
If you do not have ``groff`` installed, you can change
|
|
||||||
``groff -Tpdf -mdoc -wall`` to ``mandoc -Tpdf -I os=Linux`` in
|
|
||||||
`.github/actions/get-pages.sh <.github/actions/get-pages.sh>`__ and it
|
|
||||||
will suffice.
|
|
||||||
|
|
||||||
4. Commit and push the documentation. You can use ``git commit -m
|
|
||||||
"Create RGBDS <tag> documentation"`` and ``git push origin master``
|
|
||||||
(within the ``rgbds-www`` directory, not RGBDS).
|
|
||||||
|
|
||||||
5. Write a changelog in the GitHub draft release.
|
|
||||||
|
|
||||||
6. Click the "Publish release" button to publish it!
|
|
||||||
|
|
||||||
7. Update the `release` branch. You can use ``git push origin release``.
|
|
||||||
@@ -0,0 +1,25 @@
|
|||||||
|
# This file declares the dependencies we use, using `FetchContent`.
|
||||||
|
# https://cmake.org/cmake.help/latest/guide/using-dependencies/index.html#downloading-and-building-from-source-with-fetchcontent
|
||||||
|
# These are kept in a separate file so that it can be hashed as a key for our CI's `actions/cache`.
|
||||||
|
|
||||||
|
FetchContent_Declare(PNG
|
||||||
|
URL https://download.sourceforge.net/libpng/libpng-1.6.58.tar.xz
|
||||||
|
URL_HASH SHA256=28eb403f51f0f7405249132cecfe82ea5c0ef97f1b32c5a65828814ae0d34775
|
||||||
|
EXCLUDE_FROM_ALL # We only install the runtime dependencies, and do so separately.
|
||||||
|
FIND_PACKAGE_ARGS 1.5.4)
|
||||||
|
|
||||||
|
set(PNG_TESTS OFF CACHE INTERNAL "") # We do not need libpng's tests or tools
|
||||||
|
set(PNG_TOOLS OFF CACHE INTERNAL "") # (and they can even cause compile errors!)
|
||||||
|
set(PNG_SHARED OFF CACHE INTERNAL "")
|
||||||
|
set(PNG_STATIC ON CACHE INTERNAL "")
|
||||||
|
|
||||||
|
FetchContent_Declare(ZLIB
|
||||||
|
URL https://www.zlib.net/zlib-1.3.2.tar.xz
|
||||||
|
URL_HASH SHA256=d7a0654783a4da529d1bb793b7ad9c3318020af77667bcae35f95d0e42a792f3
|
||||||
|
EXCLUDE_FROM_ALL # We only install the runtime dependencies, and do so separately.
|
||||||
|
# libpng documents requiring "zlib 1.0.4 or later (1.2.13 or later recommended for performance and security reasons)".
|
||||||
|
# We thus enforce 1.0.4, but note that the libpng source code mentions that "it may work with versions as old as zlib 0.95".
|
||||||
|
FIND_PACKAGE_ARGS 1.0.4)
|
||||||
|
|
||||||
|
set(ZLIB_BUILD_SHARED OFF CACHE INTERNAL "")
|
||||||
|
set(ZLIB_BUILD_STATIC ON CACHE INTERNAL "")
|
||||||
@@ -0,0 +1,33 @@
|
|||||||
|
# This file is meant to be included at the project level,
|
||||||
|
# in order to generate executables compatible with old macOS versions.
|
||||||
|
# See our `macos-static` CMake preset for how it's meant to be used.
|
||||||
|
|
||||||
|
# Note that targeting old enough versions of Mac OS X on recent enough versions of macOS
|
||||||
|
# triggers some poorly-tested code paths within Apple's linker, which then crashes.
|
||||||
|
# This can be worked around by using LLVM's LLD linker and passing `-fuse-ld=lld` when linking.
|
||||||
|
|
||||||
|
# The `-mmacosx-version-min=10.4` flag ensures that the binary only uses APIs available on Mac OS X 10.4 Tiger.
|
||||||
|
# The `-arch` flags build a "fat binary" that works on both Apple architectures:
|
||||||
|
# older Intel x64 Macs and newer ARM "Apple Silicon" ones.
|
||||||
|
set(secret_sauce -mmacosx-version-min=10.4 "SHELL:-arch x86_64" "SHELL:-arch arm64") # Avoid `-arch` being dedup'd.
|
||||||
|
add_compile_options(${secret_sauce})
|
||||||
|
add_link_options(${secret_sauce})
|
||||||
|
set(PNG_HARDWARE_OPTIMIZATIONS OFF) # These do not play well with a dual-arch build.
|
||||||
|
|
||||||
|
# Mac OS X has always provided zlib, so we can safely link dynamically against it.
|
||||||
|
# However, libpng is *not* provided by default, so we link it statically, which requires downloading and building it from source.
|
||||||
|
set(PNG_SHARED OFF)
|
||||||
|
set(PNG_STATIC ON)
|
||||||
|
# If libpng is already available (e.g. via Homebrew), we ignore that and still build our own.
|
||||||
|
set(FETCHCONTENT_TRY_FIND_PACKAGE_MODE NEVER)
|
||||||
|
# But we still want to attempt linking against the system's zlib.
|
||||||
|
function(rgbds_provide_dependency method dep_name)
|
||||||
|
if(dep_name STREQUAL "ZLIB")
|
||||||
|
find_package(ZLIB)
|
||||||
|
if(ZLIB_FOUND)
|
||||||
|
FetchContent_SetPopulated(ZLIB)
|
||||||
|
endif()
|
||||||
|
endif()
|
||||||
|
endfunction(rgbds_provide_dependency)
|
||||||
|
cmake_language(SET_DEPENDENCY_PROVIDER rgbds_provide_dependency
|
||||||
|
SUPPORTED_METHODS FETCHCONTENT_MAKEAVAILABLE_SERIAL)
|
||||||
@@ -0,0 +1,22 @@
|
|||||||
|
# From https://www.mingw-w64.org/build-systems/cmake/
|
||||||
|
|
||||||
|
set(CMAKE_SYSTEM_NAME Windows)
|
||||||
|
set(CMAKE_SYSTEM_PROCESSOR i686)
|
||||||
|
|
||||||
|
# Specify the cross-compiler.
|
||||||
|
set(CMAKE_C_COMPILER i686-w64-mingw32-gcc)
|
||||||
|
set(CMAKE_CXX_COMPILER i686-w64-mingw32-g++)
|
||||||
|
set(CMAKE_RC_COMPILER i686-w64-mingw32-windres)
|
||||||
|
|
||||||
|
# Specify the target environment.
|
||||||
|
set(CMAKE_FIND_ROOT_PATH /usr/i686-w64-mingw32)
|
||||||
|
|
||||||
|
# Search for programs in the build host directories.
|
||||||
|
set(CMAKE_FIND_ROOT_PATH_MODE_PROGRAM NEVER)
|
||||||
|
# Search for libraries and headers in the target directories.
|
||||||
|
set(CMAKE_FIND_ROOT_PATH_MODE_LIBRARY ONLY)
|
||||||
|
set(CMAKE_FIND_ROOT_PATH_MODE_INCLUDE ONLY)
|
||||||
|
|
||||||
|
# CMake determines how to examine dependencies based on the *host* system, leading to
|
||||||
|
# a "file unknown error" unless the target platform is explicitly specified.
|
||||||
|
set(CMAKE_GET_RUNTIME_DEPENDENCIES_PLATFORM "windows+pe")
|
||||||
@@ -0,0 +1,22 @@
|
|||||||
|
# From https://www.mingw-w64.org/build-systems/cmake/
|
||||||
|
|
||||||
|
set(CMAKE_SYSTEM_NAME Windows)
|
||||||
|
set(CMAKE_SYSTEM_PROCESSOR x86_64)
|
||||||
|
|
||||||
|
# Specify the cross-compiler.
|
||||||
|
set(CMAKE_C_COMPILER x86_64-w64-mingw32-gcc)
|
||||||
|
set(CMAKE_CXX_COMPILER x86_64-w64-mingw32-g++)
|
||||||
|
set(CMAKE_RC_COMPILER x86_64-w64-mingw32-windres)
|
||||||
|
|
||||||
|
# Specify the target environment.
|
||||||
|
set(CMAKE_FIND_ROOT_PATH /usr/x86_64-w64-mingw32)
|
||||||
|
|
||||||
|
# Search for programs in the build host directories.
|
||||||
|
set(CMAKE_FIND_ROOT_PATH_MODE_PROGRAM NEVER)
|
||||||
|
# Search for libraries and headers in the target directories.
|
||||||
|
set(CMAKE_FIND_ROOT_PATH_MODE_LIBRARY ONLY)
|
||||||
|
set(CMAKE_FIND_ROOT_PATH_MODE_INCLUDE ONLY)
|
||||||
|
|
||||||
|
# CMake determines how to examine dependencies based on the *host* system, leading to
|
||||||
|
# a "file unknown error" unless the target platform is explicitly specified.
|
||||||
|
set(CMAKE_GET_RUNTIME_DEPENDENCIES_PLATFORM "windows+pe")
|
||||||
@@ -24,16 +24,14 @@ _rgbasm_completions() {
|
|||||||
# Empty long opt = it doesn't exit
|
# Empty long opt = it doesn't exit
|
||||||
# See the `state` variable below for info about `state_after`
|
# See the `state` variable below for info about `state_after`
|
||||||
declare -A opts=(
|
declare -A opts=(
|
||||||
|
[h]="help:normal"
|
||||||
[V]="version:normal"
|
[V]="version:normal"
|
||||||
[E]="export-all:normal"
|
[W]="warning:warning"
|
||||||
[H]="nop-after-halt:normal"
|
|
||||||
[h]="halt-without-nop:normal"
|
|
||||||
[L]="preserve-ld:normal"
|
|
||||||
[l]="auto-ldh:normal"
|
|
||||||
[v]="verbose:normal"
|
|
||||||
[w]=":normal"
|
[w]=":normal"
|
||||||
|
[B]="backtrace:unk"
|
||||||
[b]="binary-digits:unk"
|
[b]="binary-digits:unk"
|
||||||
[D]="define:unk"
|
[D]="define:unk"
|
||||||
|
[E]="export-all:normal"
|
||||||
[g]="gfx-chars:unk"
|
[g]="gfx-chars:unk"
|
||||||
[I]="include:dir"
|
[I]="include:dir"
|
||||||
[M]="dependfile:glob-*.mk *.d"
|
[M]="dependfile:glob-*.mk *.d"
|
||||||
@@ -42,7 +40,9 @@ _rgbasm_completions() {
|
|||||||
[p]="pad-value:unk"
|
[p]="pad-value:unk"
|
||||||
[Q]="q-precision:unk"
|
[Q]="q-precision:unk"
|
||||||
[r]="recursion-depth:unk"
|
[r]="recursion-depth:unk"
|
||||||
[W]="warning:warning"
|
[s]="state:unk"
|
||||||
|
[v]="verbose:normal"
|
||||||
|
[X]="max-errors:unk"
|
||||||
)
|
)
|
||||||
# Parse command-line up to current word
|
# Parse command-line up to current word
|
||||||
local opt_ena=true
|
local opt_ena=true
|
||||||
@@ -62,7 +62,7 @@ _rgbasm_completions() {
|
|||||||
parse_short_opt() {
|
parse_short_opt() {
|
||||||
# These options act like a long option (= takes up the entire word), but only use a single dash
|
# These options act like a long option (= takes up the entire word), but only use a single dash
|
||||||
# So, they need some special handling
|
# So, they need some special handling
|
||||||
if [[ "$1" = "-M"[GP] ]]; then
|
if [[ "$1" = "-M"[CGP] ]]; then
|
||||||
state=normal
|
state=normal
|
||||||
optlen=${#1}
|
optlen=${#1}
|
||||||
return;
|
return;
|
||||||
@@ -147,7 +147,7 @@ _rgbasm_completions() {
|
|||||||
# It is, try to complete one
|
# It is, try to complete one
|
||||||
mapfile -t COMPREPLY < <(compgen -W "${opts[*]%%:*}" -P '--' -- "${cur_word#--}")
|
mapfile -t COMPREPLY < <(compgen -W "${opts[*]%%:*}" -P '--' -- "${cur_word#--}")
|
||||||
return 0
|
return 0
|
||||||
elif [[ "$cur_word" = '-M'[GPQT] ]]; then
|
elif [[ "$cur_word" = '-M'[CGPQT] ]]; then
|
||||||
# These options act like long opts with no arguments, so return them and exactly them
|
# These options act like long opts with no arguments, so return them and exactly them
|
||||||
COMPREPLY=( "$cur_word" )
|
COMPREPLY=( "$cur_word" )
|
||||||
return 0
|
return 0
|
||||||
@@ -156,7 +156,7 @@ _rgbasm_completions() {
|
|||||||
parse_short_opt "$cur_word"
|
parse_short_opt "$cur_word"
|
||||||
|
|
||||||
if [[ "$state" = 'normal' ]]; then
|
if [[ "$state" = 'normal' ]]; then
|
||||||
mapfile -t COMPREPLY < <(compgen -W "${!opts[*]}" -P "$cur_word" ''; compgen -W '-MG -MP -MQ -MT' "$cur_word")
|
mapfile -t COMPREPLY < <(compgen -W "${!opts[*]}" -P "$cur_word" ''; compgen -W '-MC -MG -MP -MQ -MT' "$cur_word")
|
||||||
return 0
|
return 0
|
||||||
elif [[ "$optlen" = "${#cur_word}" && "$state" != "warning" ]]; then
|
elif [[ "$optlen" = "${#cur_word}" && "$state" != "warning" ]]; then
|
||||||
# This short option group only awaits its argument!
|
# This short option group only awaits its argument!
|
||||||
@@ -184,16 +184,19 @@ _rgbasm_completions() {
|
|||||||
empty-data-directive
|
empty-data-directive
|
||||||
empty-macro-arg
|
empty-macro-arg
|
||||||
empty-strrpl
|
empty-strrpl
|
||||||
|
export-undefined
|
||||||
large-constant
|
large-constant
|
||||||
long-string
|
|
||||||
macro-shift
|
macro-shift
|
||||||
nested-comment
|
nested-comment
|
||||||
numeric-string
|
numeric-string
|
||||||
obsolete
|
obsolete
|
||||||
|
purge
|
||||||
shift
|
shift
|
||||||
shift-amount
|
shift-amount
|
||||||
truncation
|
truncation
|
||||||
unmapped-char
|
unmapped-char
|
||||||
|
unmatched-directive
|
||||||
|
unterminated-load
|
||||||
user
|
user
|
||||||
all
|
all
|
||||||
extra
|
extra
|
||||||
|
|||||||
@@ -7,21 +7,26 @@ _rgbfix_completions() {
|
|||||||
# Empty long opt = it doesn't exit
|
# Empty long opt = it doesn't exit
|
||||||
# See the `state` variable below for info about `state_after`
|
# See the `state` variable below for info about `state_after`
|
||||||
declare -A opts=(
|
declare -A opts=(
|
||||||
|
[h]="help:normal"
|
||||||
[V]="version:normal"
|
[V]="version:normal"
|
||||||
[j]="non-japanese:normal"
|
[W]="warning:warning"
|
||||||
[s]="sgb-compatible:normal"
|
[w]=":normal"
|
||||||
[v]="validate:normal"
|
|
||||||
[C]="color-only:normal"
|
[C]="color-only:normal"
|
||||||
[c]="color-compatible:normal"
|
[c]="color-compatible:normal"
|
||||||
[f]="fix-spec:fix-spec"
|
[f]="fix-spec:fix-spec"
|
||||||
[i]="game-id:unk"
|
[i]="game-id:unk"
|
||||||
|
[j]="non-japanese:normal"
|
||||||
[k]="new-licensee:unk"
|
[k]="new-licensee:unk"
|
||||||
|
[L]="custom-logo:glob-*.1bpp"
|
||||||
[l]="old-licensee:unk"
|
[l]="old-licensee:unk"
|
||||||
[m]="mbc-type:mbc"
|
[m]="mbc-type:mbc"
|
||||||
[n]="rom-version:unk"
|
[n]="rom-version:unk"
|
||||||
|
[o]="output:glob-*.gb *.gbc *.sgb"
|
||||||
[p]="pad-value:unk"
|
[p]="pad-value:unk"
|
||||||
[r]="ram-size:unk"
|
[r]="ram-size:unk"
|
||||||
|
[s]="sgb-compatible:normal"
|
||||||
[t]="title:unk"
|
[t]="title:unk"
|
||||||
|
[v]="validate:normal"
|
||||||
)
|
)
|
||||||
# Parse command-line up to current word
|
# Parse command-line up to current word
|
||||||
local opt_ena=true
|
local opt_ena=true
|
||||||
@@ -137,6 +142,17 @@ _rgbfix_completions() {
|
|||||||
case "$state" in
|
case "$state" in
|
||||||
unk) # Return with no replies: no idea what to complete!
|
unk) # Return with no replies: no idea what to complete!
|
||||||
;;
|
;;
|
||||||
|
warning)
|
||||||
|
mapfile -t COMPREPLY < <(compgen -W "
|
||||||
|
mbc
|
||||||
|
obsolete
|
||||||
|
overwrite
|
||||||
|
sgb
|
||||||
|
truncation
|
||||||
|
all
|
||||||
|
everything
|
||||||
|
error" -P "${cur_word:0:$optlen}" -- "${cur_word:$optlen}")
|
||||||
|
;;
|
||||||
fix-spec)
|
fix-spec)
|
||||||
COMPREPLY=( "${cur_word}"{l,h,g,L,H,G} )
|
COMPREPLY=( "${cur_word}"{l,h,g,L,H,G} )
|
||||||
;;
|
;;
|
||||||
|
|||||||
@@ -7,29 +7,38 @@ _rgbgfx_completions() {
|
|||||||
# Empty long opt = it doesn't exit
|
# Empty long opt = it doesn't exit
|
||||||
# See the `state` variable below for info about `state_after`
|
# See the `state` variable below for info about `state_after`
|
||||||
declare -A opts=(
|
declare -A opts=(
|
||||||
|
[h]="help:normal"
|
||||||
[V]="version:normal"
|
[V]="version:normal"
|
||||||
[C]="color-curve:normal"
|
[W]="warning:warning"
|
||||||
[m]="mirror-tiles:normal"
|
[w]=":normal"
|
||||||
[u]="unique-tiles:normal"
|
[A]="auto-attr-map:normal"
|
||||||
[v]="verbose:normal"
|
|
||||||
[Z]="columns:normal"
|
|
||||||
[a]="attr-map:glob-*.attrmap"
|
[a]="attr-map:glob-*.attrmap"
|
||||||
[A]="output-attr-map:normal"
|
[B]="background-color:unk"
|
||||||
[b]="base-tiles:unk"
|
[b]="base-tiles:unk"
|
||||||
|
[C]="color-curve:normal"
|
||||||
|
[c]="colors:unk"
|
||||||
[d]="depth:unk"
|
[d]="depth:unk"
|
||||||
|
[i]="input-tileset:glob-*.2bpp"
|
||||||
[L]="slice:unk"
|
[L]="slice:unk"
|
||||||
|
[m]="mirror-tiles:normal"
|
||||||
[N]="nb-tiles:unk"
|
[N]="nb-tiles:unk"
|
||||||
[n]="nb-palettes:unk"
|
[n]="nb-palettes:unk"
|
||||||
|
[O]="group-outputs:normal"
|
||||||
[o]="output:glob-*.2bpp"
|
[o]="output:glob-*.2bpp"
|
||||||
|
[P]="auto-palette:normal"
|
||||||
[p]="palette:glob-*.pal"
|
[p]="palette:glob-*.pal"
|
||||||
[P]="output-palette:normal"
|
[Q]="auto-palette-map:normal"
|
||||||
[q]="palette-map:glob-*.palmap"
|
[q]="palette-map:glob-*.palmap"
|
||||||
[Q]="output-palette-map:normal"
|
|
||||||
[r]="reverse:unk"
|
[r]="reverse:unk"
|
||||||
[s]="palette-size:unk"
|
[s]="palette-size:unk"
|
||||||
|
[T]="auto-tilemap:normal"
|
||||||
[t]="tilemap:glob-*.tilemap"
|
[t]="tilemap:glob-*.tilemap"
|
||||||
[T]="output-tilemap:normal"
|
[u]="unique-tiles:normal"
|
||||||
|
[v]="verbose:normal"
|
||||||
|
[X]="mirror-x:normal"
|
||||||
[x]="trim-end:unk"
|
[x]="trim-end:unk"
|
||||||
|
[Y]="mirror-y:normal"
|
||||||
|
[Z]="columns:normal"
|
||||||
)
|
)
|
||||||
# Parse command-line up to current word
|
# Parse command-line up to current word
|
||||||
local opt_ena=true
|
local opt_ena=true
|
||||||
@@ -145,6 +154,15 @@ _rgbgfx_completions() {
|
|||||||
case "$state" in
|
case "$state" in
|
||||||
unk) # Return with no replies: no idea what to complete!
|
unk) # Return with no replies: no idea what to complete!
|
||||||
;;
|
;;
|
||||||
|
warning)
|
||||||
|
mapfile -t COMPREPLY < <(compgen -W "
|
||||||
|
embedded
|
||||||
|
obsolete
|
||||||
|
trim-nonempty
|
||||||
|
all
|
||||||
|
everything
|
||||||
|
error" -P "${cur_word:0:$optlen}" -- "${cur_word:$optlen}")
|
||||||
|
;;
|
||||||
normal) # Acts like a glob...
|
normal) # Acts like a glob...
|
||||||
state="glob-*.png"
|
state="glob-*.png"
|
||||||
;&
|
;&
|
||||||
|
|||||||
@@ -7,20 +7,22 @@ _rgblink_completions() {
|
|||||||
# Empty long opt = it doesn't exit
|
# Empty long opt = it doesn't exit
|
||||||
# See the `state` variable below for info about `state_after`
|
# See the `state` variable below for info about `state_after`
|
||||||
declare -A opts=(
|
declare -A opts=(
|
||||||
|
[h]="help:normal"
|
||||||
[V]="version:normal"
|
[V]="version:normal"
|
||||||
[d]="dmg:normal"
|
[W]="warning:warning"
|
||||||
[t]="tiny:normal"
|
|
||||||
[v]="verbose:normal"
|
|
||||||
[w]="wramx:normal"
|
|
||||||
[x]="nopad:normal"
|
|
||||||
[l]="linkerscript:glob-*"
|
|
||||||
[M]="no-sym-in-map:normal"
|
[M]="no-sym-in-map:normal"
|
||||||
|
[d]="dmg:normal"
|
||||||
|
[B]="backtrace:unk"
|
||||||
|
[l]="linkerscript:glob-*"
|
||||||
[m]="map:glob-*.map"
|
[m]="map:glob-*.map"
|
||||||
[n]="sym:glob-*.sym"
|
[n]="sym:glob-*.sym"
|
||||||
[O]="overlay:glob-*.gb *.gbc *.sgb"
|
[O]="overlay:glob-*.gb *.gbc *.sgb"
|
||||||
[o]="output:glob-*.gb *.gbc *.sgb"
|
[o]="output:glob-*.gb *.gbc *.sgb"
|
||||||
[p]="pad:unk"
|
[p]="pad:unk"
|
||||||
[s]="smart:unk"
|
[t]="tiny:normal"
|
||||||
|
[v]="verbose:normal"
|
||||||
|
[w]="wramx:normal"
|
||||||
|
[x]="nopad:normal"
|
||||||
)
|
)
|
||||||
# Parse command-line up to current word
|
# Parse command-line up to current word
|
||||||
local opt_ena=true
|
local opt_ena=true
|
||||||
@@ -136,6 +138,19 @@ _rgblink_completions() {
|
|||||||
case "$state" in
|
case "$state" in
|
||||||
unk) # Return with no replies: no idea what to complete!
|
unk) # Return with no replies: no idea what to complete!
|
||||||
;;
|
;;
|
||||||
|
warning)
|
||||||
|
mapfile -t COMPREPLY < <(compgen -W "
|
||||||
|
assert
|
||||||
|
div
|
||||||
|
large-constant
|
||||||
|
obsolete
|
||||||
|
shift
|
||||||
|
shift-amount
|
||||||
|
truncation
|
||||||
|
all
|
||||||
|
everything
|
||||||
|
error" -P "${cur_word:0:$optlen}" -- "${cur_word:$optlen}")
|
||||||
|
;;
|
||||||
normal) # Acts like a glob...
|
normal) # Acts like a glob...
|
||||||
state="glob-*.o *.obj"
|
state="glob-*.o *.obj"
|
||||||
;&
|
;&
|
||||||
|
|||||||
@@ -1,85 +0,0 @@
|
|||||||
#!/bin/bash
|
|
||||||
|
|
||||||
# SPDX-License-Identifier: MIT
|
|
||||||
#
|
|
||||||
# Copyright (c) 2021 Rangi
|
|
||||||
#
|
|
||||||
# Permission is hereby granted, free of charge, to any person obtaining a copy
|
|
||||||
# of this software and associated documentation files (the "Software"), to deal
|
|
||||||
# in the Software without restriction, including without limitation the rights
|
|
||||||
# to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
|
||||||
# copies of the Software, and to permit persons to whom the Software is
|
|
||||||
# furnished to do so, subject to the following conditions:
|
|
||||||
#
|
|
||||||
# The above copyright notice and this permission notice shall be included in all
|
|
||||||
# copies or substantial portions of the Software.
|
|
||||||
#
|
|
||||||
# THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
|
||||||
# IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
|
||||||
# FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
|
||||||
# AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
|
||||||
# LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
|
||||||
# OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
|
||||||
# SOFTWARE.
|
|
||||||
|
|
||||||
declare -A FILES
|
|
||||||
while read -r -d '' file; do
|
|
||||||
FILES["$file"]="true"
|
|
||||||
done < <(git diff --name-only -z "$1" HEAD)
|
|
||||||
|
|
||||||
edited () {
|
|
||||||
${FILES["$1"]:-"false"}
|
|
||||||
}
|
|
||||||
|
|
||||||
dependency () {
|
|
||||||
if edited "$1" && ! edited "$2"; then
|
|
||||||
echo "'$1' was modified, but not '$2'! $3" | xargs
|
|
||||||
fi
|
|
||||||
}
|
|
||||||
|
|
||||||
# Pull requests that edit the first file without the second may be correct,
|
|
||||||
# but are suspicious enough to require review.
|
|
||||||
|
|
||||||
dependency include/linkdefs.h man/rgbds.5 \
|
|
||||||
"Was the object file format changed?"
|
|
||||||
|
|
||||||
dependency src/asm/parser.y man/rgbasm.5 \
|
|
||||||
"Was the rgbasm grammar changed?"
|
|
||||||
|
|
||||||
dependency include/asm/warning.h man/rgbasm.1 \
|
|
||||||
"Were the rgbasm warnings changed?"
|
|
||||||
|
|
||||||
dependency src/asm/object.c include/linkdefs.h \
|
|
||||||
"Should the object file revision be bumped?"
|
|
||||||
dependency src/link/object.c include/linkdefs.h \
|
|
||||||
"Should the object file revision be bumped?"
|
|
||||||
|
|
||||||
dependency Makefile CMakeLists.txt \
|
|
||||||
"Did the build process change?"
|
|
||||||
dependency Makefile src/CMakeLists.txt \
|
|
||||||
"Did the build process change?"
|
|
||||||
|
|
||||||
dependency src/asm/main.c man/rgbasm.1 \
|
|
||||||
"Did the rgbasm CLI change?"
|
|
||||||
dependency src/asm/main.c contrib/zsh_compl/_rgbasm \
|
|
||||||
"Did the rgbasm CLI change?"
|
|
||||||
dependency src/asm/main.c contrib/bash_compl/_rgbasm.bash \
|
|
||||||
"Did the rgbasm CLI change?"
|
|
||||||
dependency src/link/main.c man/rgblink.1 \
|
|
||||||
"Did the rgblink CLI change?"
|
|
||||||
dependency src/link/main.c contrib/zsh_compl/_rgblink \
|
|
||||||
"Did the rgblink CLI change?"
|
|
||||||
dependency src/link/main.c contrib/bash_compl/_rgblink.bash \
|
|
||||||
"Did the rgblink CLI change?"
|
|
||||||
dependency src/fix/main.c man/rgbfix.1 \
|
|
||||||
"Did the rgbfix CLI change?"
|
|
||||||
dependency src/fix/main.c contrib/zsh_compl/_rgbfix \
|
|
||||||
"Did the rgbfix CLI change?"
|
|
||||||
dependency src/fix/main.c contrib/bash_compl/_rgbfix.bash \
|
|
||||||
"Did the rgbfix CLI change?"
|
|
||||||
dependency src/gfx/main.cpp man/rgbgfx.1 \
|
|
||||||
"Did the rgbgfx CLI change?"
|
|
||||||
dependency src/gfx/main.cpp contrib/zsh_compl/_rgbgfx \
|
|
||||||
"Did the rgbgfx CLI change?"
|
|
||||||
dependency src/gfx/main.cpp contrib/bash_compl/_rgbgfx.bash \
|
|
||||||
"Did the rgbgfx CLI change?"
|
|
||||||
Executable
+75
@@ -0,0 +1,75 @@
|
|||||||
|
#!/usr/bin/env bash
|
||||||
|
set -eu
|
||||||
|
|
||||||
|
usage() {
|
||||||
|
cat <<"EOF"
|
||||||
|
Generates LCOV code coverage report for RGBDS.
|
||||||
|
Options:
|
||||||
|
-h, --help show this help message
|
||||||
|
-o, --open open the HTML report in the preferred application
|
||||||
|
--jobs <n> build RGBDS and external codebases with `make -j<n>`
|
||||||
|
--os <os> skip tests known to fail on <os> (e.g. `macos-14`)
|
||||||
|
EOF
|
||||||
|
}
|
||||||
|
|
||||||
|
# Parse options in pure Bash because macOS `getopt` is stuck
|
||||||
|
# in what util-linux `getopt` calls `GETOPT_COMPATIBLE` mode
|
||||||
|
make_args=()
|
||||||
|
runtests_args=()
|
||||||
|
open_report=false
|
||||||
|
while [[ $# -gt 0 ]]; do
|
||||||
|
case "$1" in
|
||||||
|
-h|--help)
|
||||||
|
usage
|
||||||
|
exit 0
|
||||||
|
;;
|
||||||
|
-o|--open)
|
||||||
|
open_report=true
|
||||||
|
;;
|
||||||
|
--jobs)
|
||||||
|
shift
|
||||||
|
make_args+=(-j "$1")
|
||||||
|
runtests_args+=(--jobs "$1")
|
||||||
|
;;
|
||||||
|
--os)
|
||||||
|
shift
|
||||||
|
runtests_args+=(--os "$1")
|
||||||
|
;;
|
||||||
|
*)
|
||||||
|
echo "$(basename "$0"): unknown option '$1'"
|
||||||
|
exit 1
|
||||||
|
;;
|
||||||
|
esac
|
||||||
|
shift
|
||||||
|
done
|
||||||
|
|
||||||
|
# Build RGBDS with gcov support
|
||||||
|
make coverage "${make_args[@]}"
|
||||||
|
|
||||||
|
# Run the tests
|
||||||
|
pushd test
|
||||||
|
external/fetch-repos.sh
|
||||||
|
./run-tests.sh "${runtests_args[@]}"
|
||||||
|
popd
|
||||||
|
|
||||||
|
# Generate coverage logs
|
||||||
|
gcov src/**/*.cpp
|
||||||
|
mkdir -p coverage
|
||||||
|
|
||||||
|
# Generate coverage report, excluding Bison-generated files
|
||||||
|
COVERAGE_INFO=coverage/coverage.info
|
||||||
|
lcov -c --no-external -d . -o "$COVERAGE_INFO"
|
||||||
|
lcov -r "$COVERAGE_INFO" src/asm/parser.{hpp,cpp} src/link/script.{hpp,cpp} -o "$COVERAGE_INFO"
|
||||||
|
genhtml --dark-mode --num-spaces 4 -f -s -o coverage/ "$COVERAGE_INFO"
|
||||||
|
|
||||||
|
if "$open_report"; then
|
||||||
|
# Open the report in the preferred web browser
|
||||||
|
if [ "$(uname)" == "Darwin" ]; then
|
||||||
|
open coverage/index.html
|
||||||
|
else
|
||||||
|
xdg-open coverage/index.html
|
||||||
|
fi
|
||||||
|
else
|
||||||
|
# Output the path to the report
|
||||||
|
echo "Generated LCOV report at $PWD/coverage/index.html"
|
||||||
|
fi
|
||||||
+5
-24
@@ -1,26 +1,6 @@
|
|||||||
#!/bin/bash
|
#!/usr/bin/env bash
|
||||||
|
|
||||||
# SPDX-License-Identifier: MIT
|
# SPDX-License-Identifier: MIT
|
||||||
#
|
|
||||||
# Copyright (c) 2020 Eldred Habert
|
|
||||||
#
|
|
||||||
# Permission is hereby granted, free of charge, to any person obtaining a copy
|
|
||||||
# of this software and associated documentation files (the "Software"), to deal
|
|
||||||
# in the Software without restriction, including without limitation the rights
|
|
||||||
# to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
|
||||||
# copies of the Software, and to permit persons to whom the Software is
|
|
||||||
# furnished to do so, subject to the following conditions:
|
|
||||||
#
|
|
||||||
# The above copyright notice and this permission notice shall be included in all
|
|
||||||
# copies or substantial portions of the Software.
|
|
||||||
#
|
|
||||||
# THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
|
||||||
# IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
|
||||||
# FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
|
||||||
# AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
|
||||||
# LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
|
||||||
# OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
|
||||||
# SOFTWARE.
|
|
||||||
|
|
||||||
STATE=0
|
STATE=0
|
||||||
diff <(xxd "$1") <(xxd "$2") | while read -r LINE; do
|
diff <(xxd "$1") <(xxd "$2") | while read -r LINE; do
|
||||||
@@ -52,14 +32,15 @@ diff <(xxd "$1") <(xxd "$2") | while read -r LINE; do
|
|||||||
# Ignore comment lines, only pick matching bank
|
# Ignore comment lines, only pick matching bank
|
||||||
# (The bank regex ignores comments already, make `cut` and `tr` process less lines)
|
# (The bank regex ignores comments already, make `cut` and `tr` process less lines)
|
||||||
grep -Ei "$(printf "^%02x:" $BANK)" "$SYMFILE" |
|
grep -Ei "$(printf "^%02x:" $BANK)" "$SYMFILE" |
|
||||||
|
sed "s/$(printf "^%02x:" $BANK)/0x/g" |
|
||||||
cut -d ';' -f 1 |
|
cut -d ';' -f 1 |
|
||||||
tr -d "\r" |
|
tr -d "\r" |
|
||||||
|
sort -g |
|
||||||
while read -r SYMADDR SYM; do
|
while read -r SYMADDR SYM; do
|
||||||
SYMADDR=$((0x${SYMADDR#*:}))
|
SYMADDR=$(($SYMADDR))
|
||||||
if [[ $SYMADDR -le $ADDR ]]; then
|
if [[ $SYMADDR -le $ADDR ]]; then
|
||||||
printf " (%s+%#x)\n" "$SYM" $((ADDR - SYMADDR))
|
printf " (%s+0x%x)\n" "$SYM" $((ADDR - SYMADDR))
|
||||||
fi
|
fi
|
||||||
# TODO: assumes sorted sym files
|
|
||||||
done | tail -n 1
|
done | tail -n 1
|
||||||
fi)
|
fi)
|
||||||
printf "%02x:%04x %s\n" $BANK $ADDR "$EXTRA"
|
printf "%02x:%04x %s\n" $BANK $ADDR "$EXTRA"
|
||||||
|
|||||||
Executable
+25
@@ -0,0 +1,25 @@
|
|||||||
|
#!/usr/bin/env bash
|
||||||
|
set -euo pipefail
|
||||||
|
|
||||||
|
if [[ $# -ne 2 ]]; then
|
||||||
|
cat <<EOF >&2
|
||||||
|
Usage: $0 <palettes.pal> <output.png>
|
||||||
|
EOF
|
||||||
|
exit 1
|
||||||
|
fi
|
||||||
|
|
||||||
|
TMP=$(mktemp -d)
|
||||||
|
readonly TMP
|
||||||
|
trap 'rm -rf "$TMP"' EXIT
|
||||||
|
|
||||||
|
tile() { for i in {0..7}; do printf "$1"; done }
|
||||||
|
{ tile '\x00\x00' && tile '\xFF\x00' && tile '\x00\xFF' && tile '\xFF\xFF'; } >"$TMP/tmp.2bpp"
|
||||||
|
|
||||||
|
NB_BYTES=$(wc -c <"$1")
|
||||||
|
(( NB_PALS = NB_BYTES / 8 ))
|
||||||
|
for (( i = 0; i < NB_PALS; i++ )); do
|
||||||
|
printf '\0\1\2\3' >>"$TMP/tmp.tilemap"
|
||||||
|
printf $(printf '\\x%x' $i{,,,}) >> "$TMP/tmp.palmap"
|
||||||
|
done
|
||||||
|
|
||||||
|
"${RGBGFX:-${RGBDS+$RGBDS/}rgbgfx}" -r 4 "$2" -o "$TMP/tmp.2bpp" -OTQ -p "$1" -n "$NB_PALS"
|
||||||
+17
-14
@@ -16,42 +16,43 @@ _rgbasm_warnings() {
|
|||||||
'empty-data-directive:Warn on arg-less d[bwl] in ROM'
|
'empty-data-directive:Warn on arg-less d[bwl] in ROM'
|
||||||
'empty-macro-arg:Warn on empty macro arg'
|
'empty-macro-arg:Warn on empty macro arg'
|
||||||
'empty-strrpl:Warn on calling STRRPL with empty pattern'
|
'empty-strrpl:Warn on calling STRRPL with empty pattern'
|
||||||
|
'export-undefined:Warn on EXPORT of an undefined symbol'
|
||||||
'large-constant:Warn on constants too large for a signed 32-bit int'
|
'large-constant:Warn on constants too large for a signed 32-bit int'
|
||||||
'long-string:Warn on strings too long'
|
|
||||||
'macro-shift:Warn when shifting macro args part their limits'
|
'macro-shift:Warn when shifting macro args part their limits'
|
||||||
'nested-comment:Warn on "/*" inside block comments'
|
'nested-comment:Warn on "/*" inside block comments'
|
||||||
'numeric-string:Warn when a multi-character string is treated as a number'
|
'numeric-string:Warn when a multi-character string is treated as a number'
|
||||||
'obsolete:Warn when using deprecated features'
|
'obsolete:Warn when using deprecated features'
|
||||||
|
'purge:Warn when purging exported symbols or labels'
|
||||||
'shift:Warn when shifting negative values'
|
'shift:Warn when shifting negative values'
|
||||||
'shift-amount:Warn when a shift'\''s operand it negative or \> 32'
|
'shift-amount:Warn when a shift'\''s operand is negative or \> 32'
|
||||||
'truncation:Warn when implicit truncation loses bits'
|
'truncation:Warn when implicit truncation loses bits'
|
||||||
'unmapped-char:Warn on unmapped character'
|
'unmapped-char:Warn on unmapped character'
|
||||||
|
'unmatched-directive:Warn on unmatched directive pair'
|
||||||
|
'unterminated-load:Warn on LOAD without ENDL'
|
||||||
'user:Warn when executing the WARN built-in'
|
'user:Warn when executing the WARN built-in'
|
||||||
)
|
)
|
||||||
# TODO: handle `no-` and `error=` somehow?
|
|
||||||
# TODO: handle `=0|1|2` levels for `numeric-string`, `truncation`, and `unmapped-char`?
|
|
||||||
_describe warning warnings
|
_describe warning warnings
|
||||||
}
|
}
|
||||||
|
|
||||||
local args=(
|
local args=(
|
||||||
# Arguments are listed here in the same order as in the manual, except for the version
|
# Arguments are listed here in the same order as in the manual, except for the version and help
|
||||||
'(- : * options)'{-V,--version}'[Print version number]'
|
'(- : * options)'{-V,--version}'[Print version number and exit]'
|
||||||
|
'(- : * options)'{-h,--help}'[Print help text and exit]'
|
||||||
|
|
||||||
'(-E --export-all)'{-E,--export-all}'[Export all symbols]'
|
'(-E --export-all)'{-E,--export-all}'[Export all symbols]'
|
||||||
'(-H --nop-after-halt)'{-H,--nop-after-halt}'[Output a `nop` after `halt`]'
|
'(-v --verbose)'{-v,--verbose}'[Enable verbose output]'
|
||||||
'(-h --halt-without-nop)'{-h,--halt-without-nop}'[Prevent outputting a `nop` after `halt`]'
|
|
||||||
'(-L --preserve-ld)'{-L,--preserve-ld}'[Prevent optimizing `ld` into `ldh`]'
|
|
||||||
'(-l --auto-ldh)'{-l,--auto-ldh}'[Optimize `ld` into `ldh`]'
|
|
||||||
'(-v --verbose)'{-v,--verbose}'[Print additional messages regarding progression]'
|
|
||||||
-w'[Disable all warnings]'
|
-w'[Disable all warnings]'
|
||||||
|
|
||||||
|
'(-B --backtrace)'{-B,--backtrace}'+[Set backtrace depth or style]:param:'
|
||||||
'(-b --binary-digits)'{-b,--binary-digits}'+[Change chars for binary constants]:digit spec:'
|
'(-b --binary-digits)'{-b,--binary-digits}'+[Change chars for binary constants]:digit spec:'
|
||||||
|
--color'[Whether to use color in output]:color:(auto always never)'
|
||||||
'*'{-D,--define}'+[Define a string symbol]:name + value (default 1):'
|
'*'{-D,--define}'+[Define a string symbol]:name + value (default 1):'
|
||||||
'(-g --gfx-chars)'{-g,--gfx-chars}'+[Change chars for gfx constants]:chars spec:'
|
'(-g --gfx-chars)'{-g,--gfx-chars}'+[Change chars for gfx constants]:chars spec:'
|
||||||
'(-I --include)'{-I,--include}'+[Add an include directory]:include path:_files -/'
|
'(-I --include)'{-I,--include}'+[Add an include directory]:include path:_files -/'
|
||||||
'(-M --dependfile)'{-M,--dependfile}"+[List deps in make format]:output file:_files -g '*.{d,mk}'"
|
'(-M --dependfile)'{-M,--dependfile}"+[Write dependencies in Makefile format]:output file:_files -g '*.{d,mk}'"
|
||||||
-MG'[Assume missing files should be generated]'
|
-MC'[Continue after missing dependencies]'
|
||||||
-MP'[Add phony targets to all deps]'
|
-MG'[Assume missing dependencies should be generated]'
|
||||||
|
-MP'[Add phony targets to all dependencies]'
|
||||||
'*'-MT"+[Add a target to the rules]:target:_files -g '*.{d,mk,o}'"
|
'*'-MT"+[Add a target to the rules]:target:_files -g '*.{d,mk,o}'"
|
||||||
'*'-MQ"+[Add a target to the rules]:target:_files -g '*.{d,mk,o}'"
|
'*'-MQ"+[Add a target to the rules]:target:_files -g '*.{d,mk,o}'"
|
||||||
'(-o --output)'{-o,--output}'+[Output file]:output file:_files'
|
'(-o --output)'{-o,--output}'+[Output file]:output file:_files'
|
||||||
@@ -59,7 +60,9 @@ local args=(
|
|||||||
'(-p --pad-value)'{-p,--pad-value}'+[Set padding byte]:padding byte:'
|
'(-p --pad-value)'{-p,--pad-value}'+[Set padding byte]:padding byte:'
|
||||||
'(-Q --q-precision)'{-Q,--q-precision}'+[Set fixed-point precision]:precision:'
|
'(-Q --q-precision)'{-Q,--q-precision}'+[Set fixed-point precision]:precision:'
|
||||||
'(-r --recursion-depth)'{-r,--recursion-depth}'+[Set maximum recursion depth]:depth:'
|
'(-r --recursion-depth)'{-r,--recursion-depth}'+[Set maximum recursion depth]:depth:'
|
||||||
|
'(-s --state)'{-s,--state}"+[Write features of final state]:state file:_files -g '*.dump.asm'"
|
||||||
'(-W --warning)'{-W,--warning}'+[Toggle warning flags]:warning flag:_rgbasm_warnings'
|
'(-W --warning)'{-W,--warning}'+[Toggle warning flags]:warning flag:_rgbasm_warnings'
|
||||||
|
'(-X --max-errors)'{-X,--max-errors}'+[Set maximum errors before aborting]:maximum errors:'
|
||||||
|
|
||||||
":assembly sources:_files -g '*.asm'"
|
":assembly sources:_files -g '*.asm'"
|
||||||
)
|
)
|
||||||
|
|||||||
@@ -34,9 +34,26 @@ _mbc_names() {
|
|||||||
_describe "MBC name" mbc_names
|
_describe "MBC name" mbc_names
|
||||||
}
|
}
|
||||||
|
|
||||||
|
_rgbfix_warnings() {
|
||||||
|
local warnings=(
|
||||||
|
'error:Turn all warnings into errors'
|
||||||
|
|
||||||
|
'all:Enable most warning messages'
|
||||||
|
'everything:Enable literally everything'
|
||||||
|
|
||||||
|
'mbc:Warn about issues with MBC specs'
|
||||||
|
'obsolete:Warn when using deprecated features'
|
||||||
|
'overwrite:Warn when overwriting non-zero bytes'
|
||||||
|
'sgb:Warn when SGB flag conflicts with old licensee code'
|
||||||
|
'truncation:Warn when values are truncated to fit'
|
||||||
|
)
|
||||||
|
_describe warning warnings
|
||||||
|
}
|
||||||
|
|
||||||
local args=(
|
local args=(
|
||||||
# Arguments are listed here in the same order as in the manual, except for the version
|
# Arguments are listed here in the same order as in the manual, except for the version and help
|
||||||
'(- : * options)'{-V,--version}'[Print version number]'
|
'(- : * options)'{-V,--version}'[Print version number and exit]'
|
||||||
|
'(- : * options)'{-h,--help}'[Print help text and exit]'
|
||||||
|
|
||||||
'(-C --color-only -c --color-compatible)'{-C,--color-only}'[Mark ROM as GBC-only]'
|
'(-C --color-only -c --color-compatible)'{-C,--color-only}'[Mark ROM as GBC-only]'
|
||||||
'(-C --color-only -c --color-compatible)'{-c,--color-compatible}'[Mark ROM as GBC-compatible]'
|
'(-C --color-only -c --color-compatible)'{-c,--color-compatible}'[Mark ROM as GBC-compatible]'
|
||||||
@@ -44,16 +61,21 @@ local args=(
|
|||||||
'(-O --overwrite)'{-O,--overwrite}'[Allow overwriting non-zero bytes]'
|
'(-O --overwrite)'{-O,--overwrite}'[Allow overwriting non-zero bytes]'
|
||||||
'(-s --sgb-compatible)'{-s,--sgb-compatible}'[Set the SGB flag]'
|
'(-s --sgb-compatible)'{-s,--sgb-compatible}'[Set the SGB flag]'
|
||||||
'(-f --fix-spec -v --validate)'{-v,--validate}'[Shorthand for -f lhg]'
|
'(-f --fix-spec -v --validate)'{-v,--validate}'[Shorthand for -f lhg]'
|
||||||
|
-w'[Disable all warnings]'
|
||||||
|
|
||||||
|
--color'[Whether to use color in output]:color:(auto always never)'
|
||||||
'(-f --fix-spec -v --validate)'{-f,--fix-spec}'+[Fix or trash some header values]:fix spec:'
|
'(-f --fix-spec -v --validate)'{-f,--fix-spec}'+[Fix or trash some header values]:fix spec:'
|
||||||
'(-i --game-id)'{-i,--game-id}'+[Set game ID string]:4-char game ID:'
|
'(-i --game-id)'{-i,--game-id}'+[Set game ID string]:4-char game ID:'
|
||||||
'(-k --new-licensee)'{-k,--new-licensee}'+[Set new licensee string]:2-char licensee ID:'
|
'(-k --new-licensee)'{-k,--new-licensee}'+[Set new licensee string]:2-char licensee ID:'
|
||||||
'(-l --old-licensee)'{-l,--old-licensee}'+[Set old licensee ID]:licensee number:'
|
'(-l --old-licensee)'{-l,--old-licensee}'+[Set old licensee ID]:licensee number:'
|
||||||
|
'(-L --logo)'{-L,--logo}'+[Set custom logo]:1bpp image:'
|
||||||
'(-m --mbc-type)'{-m,--mbc-type}"+[Set MBC flags]:mbc name:_mbc_names"
|
'(-m --mbc-type)'{-m,--mbc-type}"+[Set MBC flags]:mbc name:_mbc_names"
|
||||||
'(-n --rom-version)'{-n,--rom-version}'+[Set ROM version]:rom version byte:'
|
'(-n --rom-version)'{-n,--rom-version}'+[Set ROM version]:rom version byte:'
|
||||||
|
'(-o --output)'{-o,--output}"+[Output file]:output file:_files -g '*.{gb,sgb,gbc}'"
|
||||||
'(-p --pad-value)'{-p,--pad-value}'+[Pad to next valid size using this byte as padding]:padding byte:'
|
'(-p --pad-value)'{-p,--pad-value}'+[Pad to next valid size using this byte as padding]:padding byte:'
|
||||||
'(-r --ram-size)'{-r,--ram-size}'+[Set RAM size]:ram size byte:'
|
'(-r --ram-size)'{-r,--ram-size}'+[Set RAM size]:ram size byte:'
|
||||||
'(-t --title)'{-t,--title}'+[Set title string]:11-char title string:'
|
'(-t --title)'{-t,--title}'+[Set title string]:11-char title string:'
|
||||||
|
'(-W --warning)'{-W,--warning}'+[Toggle warning flags]:warning flag:_rgbfix_warnings'
|
||||||
|
|
||||||
'*'":ROM files:_files -g '*.{gb,sgb,gbc}'"
|
'*'":ROM files:_files -g '*.{gb,sgb,gbc}'"
|
||||||
)
|
)
|
||||||
|
|||||||
+38
-14
@@ -9,32 +9,56 @@ _depths() {
|
|||||||
_describe 'bit depth' depths
|
_describe 'bit depth' depths
|
||||||
}
|
}
|
||||||
|
|
||||||
local args=(
|
_rgbgfx_warnings() {
|
||||||
# Arguments are listed here in the same order as in the manual, except for the version
|
local warnings=(
|
||||||
'(- : * options)'{-V,--version}'[Print version number]'
|
'error:Turn all warnings into errors'
|
||||||
|
|
||||||
'(-a --attr-map -A --output-attr-map)'{-A,--output-attr-map}'[Shortcut for -a <file>.attrmap]'
|
'all:Enable most warning messages'
|
||||||
|
'everything:Enable literally everything'
|
||||||
|
|
||||||
|
'embedded:Warn when using embedded PLTE without "-c embedded"'
|
||||||
|
'obsolete:Warn when using deprecated features'
|
||||||
|
'trim-nonempty:Warn when "-x" trims nonempty tiles'
|
||||||
|
)
|
||||||
|
_describe warning warnings
|
||||||
|
}
|
||||||
|
|
||||||
|
local args=(
|
||||||
|
# Arguments are listed here in the same order as in the manual, except for the version and help
|
||||||
|
'(- : * options)'{-V,--version}'[Print version number and exit]'
|
||||||
|
'(- : * options)'{-h,--help}'[Print help text and exit]'
|
||||||
|
|
||||||
|
'(-a --attr-map -A --auto-attr-map)'{-A,--auto-attr-map}'[Shortcut for -a <file>.attrmap]'
|
||||||
'(-C --color-curve)'{-C,--color-curve}'[Generate palettes using GBC color curve]'
|
'(-C --color-curve)'{-C,--color-curve}'[Generate palettes using GBC color curve]'
|
||||||
'(-m --mirror-tiles)'{-m,--mirror-tiles}'[Eliminate mirrored tiles from output]'
|
'(-m --mirror-tiles)'{-m,--mirror-tiles}'[Eliminate mirrored tiles from output]'
|
||||||
'(-p --palette -P --output-palette)'{-P,--output-palette}'[Shortcut for -p <file>.pal]'
|
'(-O --group-outputs)'{-O,--group-outputs}'[Base "shortcut" options on the output path, not input]'
|
||||||
'(-q --palette-map -Q --output-palette-map)'{-Q,--output-palette-map}'[Shortcut for -p <file>.palmap]'
|
'(-p --palette -P --auto-palette)'{-P,--auto-palette}'[Shortcut for -p <file>.pal]'
|
||||||
'(-t --tilemap -T --output-tilemap)'{-T,--output-tilemap}'[Shortcut for -t <file>.tilemap]'
|
'(-q --palette-map -Q --auto-palette-map)'{-Q,--auto-palette-map}'[Shortcut for -p <file>.palmap]'
|
||||||
|
'(-t --tilemap -T --auto-tilemap)'{-T,--auto-tilemap}'[Shortcut for -t <file>.tilemap]'
|
||||||
'(-u --unique-tiles)'{-u,--unique-tiles}'[Eliminate redundant tiles]'
|
'(-u --unique-tiles)'{-u,--unique-tiles}'[Eliminate redundant tiles]'
|
||||||
{-v,--verbose}'[Enable verbose output]'
|
'(-v --verbose)'{-v,--verbose}'[Enable verbose output]'
|
||||||
'(-h --horizontal -Z --columns)'{-Z,--columns}'[Read the image in column-major order]'
|
-w'[Disable all warnings]'
|
||||||
|
'(-X --mirror-x)'{-X,--mirror-x}'[Eliminate horizontally mirrored tiles from output]'
|
||||||
|
'(-Y --mirror-y)'{-Y,--mirror-y}'[Eliminate vertically mirrored tiles from output]'
|
||||||
|
'(-Z --columns)'{-Z,--columns}'[Read the image in column-major order]'
|
||||||
|
|
||||||
'(-a --attr-map -A --output-attr-map)'{-a,--attr-map}'+[Generate a map of tile attributes (mirroring)]:attrmap file:_files'
|
'(-a --attr-map -A --auto-attr-map)'{-a,--attr-map}'+[Generate a map of tile attributes (mirroring)]:attrmap file:_files'
|
||||||
|
'(-B --background-color)'{-B,--background-color}'+[Ignore tiles containing only specified color]:color:'
|
||||||
'(-b --base-tiles)'{-b,--base-tiles}'+[Base tile IDs for tile map output]:base tile IDs:'
|
'(-b --base-tiles)'{-b,--base-tiles}'+[Base tile IDs for tile map output]:base tile IDs:'
|
||||||
|
--color'[Whether to use color in output]:color:(auto always never)'
|
||||||
|
'(-c --colors)'{-c,--colors}'+[Specify color palettes]:palette spec:'
|
||||||
'(-d --depth)'{-d,--depth}'+[Set bit depth]:bit depth:_depths'
|
'(-d --depth)'{-d,--depth}'+[Set bit depth]:bit depth:_depths'
|
||||||
|
'(-i --input-tileset)'{-i,--input-tileset}'+[Use specific tiles]:tileset file:_files -g "*.2bpp"'
|
||||||
'(-L --slice)'{-L,--slice}'+[Only process a portion of the image]:input slice:'
|
'(-L --slice)'{-L,--slice}'+[Only process a portion of the image]:input slice:'
|
||||||
'(-N --nb-tiles)'{-n,--nb-tiles}'+[Limit number of tiles]:tile count:'
|
'(-N --nb-tiles)'{-N,--nb-tiles}'+[Limit number of tiles]:tile count:'
|
||||||
'(-n --nb-palettes)'{-n,--nb-palettes}'+[Limit number of palettes]:palette count:'
|
'(-n --nb-palettes)'{-n,--nb-palettes}'+[Limit number of palettes]:palette count:'
|
||||||
'(-o --output)'{-o,--output}'+[Set output file]:output file:_files'
|
'(-o --output)'{-o,--output}'+[Set output file]:output file:_files'
|
||||||
'(-p --palette -P --output-palette)'{-p,--palette}"+[Output the image's palette in little-endian native RGB555 format]:palette file:_files"
|
'(-p --palette -P --auto-palette)'{-p,--palette}"+[Output the image's palette in little-endian native RGB555 format]:palette file:_files"
|
||||||
'(-q --palette-map -Q --output-palette-map)'{-p,--palette-map}"+[Output the image's palette map]:palette map file:_files"
|
'(-q --palette-map -Q --auto-palette-map)'{-q,--palette-map}"+[Output the image's palette map]:palette map file:_files"
|
||||||
'(-r --reverse)'{-r,--reverse}'+[Yield an image from binary data]:image width (in tiles):'
|
'(-r --reverse)'{-r,--reverse}'+[Yield an image from binary data]:image width (in tiles):'
|
||||||
'(-s --palette-size)'{-s,--palette-size}'+[Limit palette size]:palette size:'
|
'(-s --palette-size)'{-s,--palette-size}'+[Limit palette size]:palette size:'
|
||||||
'(-t --tilemap -T --output-tilemap)'{-t,--tilemap}'+[Generate a map of tile indices]:tilemap file:_files'
|
'(-t --tilemap -T --auto-tilemap)'{-t,--tilemap}'+[Generate a map of tile indices]:tilemap file:_files'
|
||||||
|
'(-W --warning)'{-W,--warning}'+[Toggle warning flags]:warning flag:_rgbgfx_warnings'
|
||||||
'(-x --trim-end)'{-x,--trim-end}'+[Trim end of output by this many tiles]:tile count:'
|
'(-x --trim-end)'{-x,--trim-end}'+[Trim end of output by this many tiles]:tile count:'
|
||||||
|
|
||||||
":input png file:_files -g '*.png'"
|
":input png file:_files -g '*.png'"
|
||||||
|
|||||||
@@ -1,8 +1,27 @@
|
|||||||
#compdef rgblink
|
#compdef rgblink
|
||||||
|
|
||||||
|
_rgblink_warnings() {
|
||||||
|
local warnings=(
|
||||||
|
'error:Turn all warnings into errors'
|
||||||
|
|
||||||
|
'all:Enable most warning messages'
|
||||||
|
'everything:Enable literally everything'
|
||||||
|
|
||||||
|
'assert:Warn when WARN-type asserts fail'
|
||||||
|
'div:Warn when dividing the smallest int by -1'
|
||||||
|
'large-constant:Warn on constants too large for a signed 32-bit int'
|
||||||
|
'obsolete:Warn when using deprecated features'
|
||||||
|
'shift:Warn when shifting negative values'
|
||||||
|
'shift-amount:Warn when a shift'\''s operand is negative or \> 32'
|
||||||
|
'truncation:Warn when implicit truncation loses bits'
|
||||||
|
)
|
||||||
|
_describe warning warnings
|
||||||
|
}
|
||||||
|
|
||||||
local args=(
|
local args=(
|
||||||
# Arguments are listed here in the same order as in the manual, except for the version
|
# Arguments are listed here in the same order as in the manual, except for the version and help
|
||||||
'(- : * options)'{-V,--version}'[Print version number]'
|
'(- : * options)'{-V,--version}'[Print version number and exit]'
|
||||||
|
'(- : * options)'{-h,--help}'[Print help text and exit]'
|
||||||
|
|
||||||
'(-d --dmg)'{-d,--dmg}'[Enable DMG mode (-w + no VRAM banking)]'
|
'(-d --dmg)'{-d,--dmg}'[Enable DMG mode (-w + no VRAM banking)]'
|
||||||
'(-t --tiny)'{-t,--tiny}'[Enable tiny mode, disabling ROM banking]'
|
'(-t --tiny)'{-t,--tiny}'[Enable tiny mode, disabling ROM banking]'
|
||||||
@@ -10,6 +29,8 @@ local args=(
|
|||||||
'(-w --wramx)'{-w,--wramx}'[Disable WRAM banking]'
|
'(-w --wramx)'{-w,--wramx}'[Disable WRAM banking]'
|
||||||
'(-x --nopad)'{-x,--nopad}'[Disable padding the end of the final file]'
|
'(-x --nopad)'{-x,--nopad}'[Disable padding the end of the final file]'
|
||||||
|
|
||||||
|
'(-B --backtrace)'{-B,--backtrace}'+[Set backtrace depth or style]:param:'
|
||||||
|
--color'[Whether to use color in output]:color:(auto always never)'
|
||||||
'(-l --linkerscript)'{-l,--linkerscript}"+[Use a linker script]:linker script:_files -g '*.link'"
|
'(-l --linkerscript)'{-l,--linkerscript}"+[Use a linker script]:linker script:_files -g '*.link'"
|
||||||
'(-M --no-sym-in-map)'{-M,--no-sym-in-map}'[Do not output symbol names in map file]'
|
'(-M --no-sym-in-map)'{-M,--no-sym-in-map}'[Do not output symbol names in map file]'
|
||||||
'(-m --map)'{-m,--map}"+[Produce a map file]:map file:_files -g '*.map'"
|
'(-m --map)'{-m,--map}"+[Produce a map file]:map file:_files -g '*.map'"
|
||||||
@@ -18,7 +39,7 @@ local args=(
|
|||||||
'(-o --output)'{-o,--output}"+[Write ROM image to this file]:rom file:_files -g '*.{gb,sgb,gbc}'"
|
'(-o --output)'{-o,--output}"+[Write ROM image to this file]:rom file:_files -g '*.{gb,sgb,gbc}'"
|
||||||
'(-p --pad-value)'{-p,--pad-value}'+[Set padding byte]:padding byte:'
|
'(-p --pad-value)'{-p,--pad-value}'+[Set padding byte]:padding byte:'
|
||||||
'(-S --scramble)'{-s,--scramble}'+[Activate scrambling]:scramble spec'
|
'(-S --scramble)'{-s,--scramble}'+[Activate scrambling]:scramble spec'
|
||||||
'(-s --smart)'{-s,--smart}'+[!BROKEN! Perform smart linking from this symbol]:symbol name:'
|
'(-W --warning)'{-W,--warning}'+[Toggle warning flags]:warning flag:_rgblink_warnings'
|
||||||
|
|
||||||
'*'":object files:_files -g '*.o'"
|
'*'":object files:_files -g '*.o'"
|
||||||
)
|
)
|
||||||
|
|||||||
@@ -0,0 +1,301 @@
|
|||||||
|
# RGBDS Architecture
|
||||||
|
|
||||||
|
The RGBDS package consists of four programs: RGBASM, RGBLINK, RGBFIX, and RGBGFX.
|
||||||
|
|
||||||
|
- RGBASM is the assembler. It takes assembly code as input, and produces an RGB object file as output (and optionally a state file, logging the final state of variables and constants).
|
||||||
|
- RGBLINK is the linker. It takes object files as input, and produces a ROM file as output (and optionally a symbol and/or map file, logging where the assembly declarations got placed in the ROM).
|
||||||
|
- RGBFIX is the checksum/header fixer. It takes a ROM file as input, and outputs the same ROM file (or modifies it in-place) with the cartridge header's checksum and other metadata fixed for consistency.
|
||||||
|
- RGBGFX is the graphics converter. It takes a PNG image file as input, and outputs the tile data, palettes, tilemap, attribute map, and/or palette map in formats that the Game Boy can use.
|
||||||
|
|
||||||
|
In the simplest case, a single pipeline can turn an assembly file into a ROM:
|
||||||
|
|
||||||
|
```console
|
||||||
|
(rgbasm -o - - | rgblink -o - - | rgbfix -v -p 0) < game.asm > game.gb
|
||||||
|
```
|
||||||
|
|
||||||
|
This document describes how these four programs are structured. It goes over each source code file, noting which data is *global* (and thus scoped in all files), *owned* by that file (i.e. that is where the data's memory is managed, via [RAII](https://en.wikipedia.org/wiki/Resource_acquisition_is_initialization)) or *referenced* by that file (i.e. there are non-owning pointers to some data, and care must be taken to not dereference those pointers after the data's owner has moved or deleted the data).
|
||||||
|
|
||||||
|
We assume that the programs are single-threaded; data structures and operations may not be thread-safe.
|
||||||
|
|
||||||
|
## Folder Organization
|
||||||
|
|
||||||
|
The RGBDS source code file structure is as follows:
|
||||||
|
|
||||||
|
```
|
||||||
|
rgbds/
|
||||||
|
├── .github/
|
||||||
|
│ ├── scripts/
|
||||||
|
│ │ └── ...
|
||||||
|
│ └── workflows/
|
||||||
|
│ └── ...
|
||||||
|
├── cmake/
|
||||||
|
│ └── ...
|
||||||
|
├── contrib/
|
||||||
|
│ ├── bash_compl/
|
||||||
|
│ ├── zsh_compl/
|
||||||
|
│ │ └── ...
|
||||||
|
│ └── ...
|
||||||
|
├── docs/
|
||||||
|
│ └── ...
|
||||||
|
├── include/
|
||||||
|
│ └── ...
|
||||||
|
├── man/
|
||||||
|
│ └── ...
|
||||||
|
├── src/
|
||||||
|
│ ├── asm/
|
||||||
|
│ │ └── ...
|
||||||
|
│ ├── extern/
|
||||||
|
│ │ └── ...
|
||||||
|
│ ├── fix/
|
||||||
|
│ │ └── ...
|
||||||
|
│ ├── gfx/
|
||||||
|
│ │ └── ...
|
||||||
|
│ ├── link/
|
||||||
|
│ │ └── ...
|
||||||
|
│ ├── CMakeLists.txt
|
||||||
|
│ ├── bison.sh
|
||||||
|
│ └── ...
|
||||||
|
├── test/
|
||||||
|
│ ├── run-tests.sh
|
||||||
|
│ ├── external/
|
||||||
|
│ │ ├── fetch-repos.sh
|
||||||
|
│ │ └── ...
|
||||||
|
│ └── ...
|
||||||
|
├── .clang-format
|
||||||
|
├── .clang-tidy
|
||||||
|
├── CMakeLists.txt
|
||||||
|
├── CMakePresets.json
|
||||||
|
├── Dockerfile
|
||||||
|
└── Makefile
|
||||||
|
```
|
||||||
|
|
||||||
|
- **`.github/`:**
|
||||||
|
Files related to the integration of the RGBDS codebase with GitHub features.
|
||||||
|
* **`scripts/`:**
|
||||||
|
Scripts used by GitHub Actions workflow files.
|
||||||
|
* **`workflows/`:**
|
||||||
|
GitHub Actions CI workflow description files. Used for automated testing, deployment, etc.
|
||||||
|
- **`cmake/`**:
|
||||||
|
Files relevant to our CMake build system that are not required to be somewhere else (e.g. `CMakePresets.json` *has* to be at the root).
|
||||||
|
- **`contrib/`:**
|
||||||
|
Scripts and other resources which may be useful to RGBDS users and developers.
|
||||||
|
* **`bash_compl/`:**
|
||||||
|
Tab completion scripts for use with `bash`. Run them with `source` somewhere in your `.bashrc`, and they should auto-load when you open a shell.
|
||||||
|
* **`zsh_compl/`:**
|
||||||
|
Tab completion scripts for use with `zsh`. Put them somewhere in your `fpath`, and they should auto-load when you open a shell.
|
||||||
|
- **`docs/`:**
|
||||||
|
Documentation related to the development and maintenance of RGBDS itself.
|
||||||
|
(The directory's name, as well as some of its file's names, are
|
||||||
|
[recognized by GitHub](https://docs.github.com/en/communities/setting-up-your-project-for-healthy-contributions/setting-guidelines-for-repository-contributors)
|
||||||
|
and linked to in parts of its UI.)
|
||||||
|
Documentation for RGBDS itself exists as manual pages in `man/`.
|
||||||
|
- **`include/`:**
|
||||||
|
Header files for the respective source files in `src`.
|
||||||
|
- **`man/`:**
|
||||||
|
Manual pages to be read with `man`, written in the [`mandoc`](https://mandoc.bsd.lv) dialect.
|
||||||
|
- **`src/`:**
|
||||||
|
Source code of RGBDS.
|
||||||
|
* **`asm/`:**
|
||||||
|
Source code of RGBASM.
|
||||||
|
* **`extern/`:**
|
||||||
|
Source code copied from external sources.
|
||||||
|
* **`fix/`:**
|
||||||
|
Source code of RGBFIX.
|
||||||
|
* **`gfx/`:**
|
||||||
|
Source code of RGBGFX.
|
||||||
|
* **`link/`:**
|
||||||
|
Source code of RGBLINK.
|
||||||
|
* **`CMakeLists.txt`:**
|
||||||
|
Defines how to build individual RGBDS programs with CMake, including the source files that each program depends on.
|
||||||
|
* **`bison.sh`:**
|
||||||
|
Script used to run the Bison parser generator with the latest flags that the user's version supports.
|
||||||
|
- **`test/`:**
|
||||||
|
Testing framework used to verify that changes to the code don't break or modify the behavior of RGBDS.
|
||||||
|
The `test.sh` scripts inside each of the subdirectories are the individual test drivers.
|
||||||
|
* **`run-tests.sh`:**
|
||||||
|
Script used to run tests, including internal test cases and external repositories. `run-tests.sh --help` describes its options.
|
||||||
|
* **`external/`:**
|
||||||
|
Directory for third-party repos making use of RGBDS, which get cloned here and built during testing.
|
||||||
|
- **`fetch-repos.sh`:**
|
||||||
|
Script used to clone the external repositories. `fetch-repos.sh --help` describes its options.
|
||||||
|
- **`*.cfg`:**
|
||||||
|
Each `.cfg` file defines the parameters to clone, build, and verify an external repository.
|
||||||
|
- **`.clang-format`:**
|
||||||
|
Code style for automated C++ formatting with [`clang-format`](https://clang.llvm.org/docs/ClangFormat.html) (for which we define the shortcut `make format`).
|
||||||
|
- **`.clang-tidy`:**
|
||||||
|
Configuration for C++ static analysis with [`clang-tidy`](https://clang.llvm.org/extra/clang-tidy/) (for which we define the shortcut `make tidy`).
|
||||||
|
- **`CMakeLists.txt`:**
|
||||||
|
Defines how to build RGBDS with CMake.
|
||||||
|
- **`CMakePresets.json`:**
|
||||||
|
Defines some [presets](https://cmake.org/cmake/help/latest/manual/cmake-presets.7.html) useful for working with our CMake.
|
||||||
|
- **`Dockerfile`:**
|
||||||
|
Defines how to build RGBDS with Docker (which we do in CI to provide a [container image](https://github.com/gbdev/rgbds/pkgs/container/rgbds)).
|
||||||
|
- **`Makefile`:**
|
||||||
|
Defines how to build RGBDS with `make`, including the source files that each program depends on.
|
||||||
|
|
||||||
|
## RGBDS
|
||||||
|
|
||||||
|
These files in the `src/` directory are shared across multiple programs: often all four (RGBASM, RGBLINK, RGBFIX, and RGBGFX), sometimes only RGBASM and RGBLINK.
|
||||||
|
|
||||||
|
- **`backtrace.cpp`:**
|
||||||
|
Generic printing of location backtraces for RGBASM and RGBLINK. Allows configuring backtrace styles with a command-line flag (conventionally `-B/--backtrace`). Renders warnings in yellow, errors in red, and locations in cyan.
|
||||||
|
- **`cli.cpp`:**
|
||||||
|
A function for parsing command-line options, including RGBDS-specific "at-files" (a filename containing more options, prepended with an "`@`").
|
||||||
|
This is the only file to use the extern/getopt.cpp variables and functions.
|
||||||
|
- **`diagnostics.cpp`:**
|
||||||
|
Generic warning/error diagnostic support for all programs. Allows command-line flags (conventionally `-W`) to have `no-`, `error=`, or `no-error=` prefixes, and `=` level suffixes; allows "meta" flags to affect groups of individual flags; and counts how many total errors there have been. Every program has its own `warning.cpp` file that uses this.
|
||||||
|
- **`linkdefs.cpp`:**
|
||||||
|
Constants, data, and functions related to RGBDS object files, which are used for RGBASM output and RGBLINK input.
|
||||||
|
This file defines two *global* variables, `sectionTypeInfo` (metadata about each section type) and `sectionModNames` (names of section modifiers, for error reporting). RGBLINK may change some values in `sectionTypeInfo` depending on its command-line options (this only affects RGBLINK; `sectionTypeInfo` is immutable in RGBASM).
|
||||||
|
- **`opmath.cpp`:**
|
||||||
|
Functions for mathematical operations in RGBASM and RGBLINK that aren't trivially equivalent to built-in C++ ones, such as division and modulo with well-defined results for negative values.
|
||||||
|
- **`style.cpp`:**
|
||||||
|
Generic printing of cross-platform colored or bold text. Obeys the [`FORCE_COLOR`](https://force-color.org/) and [`NO_COLOR`](https://no-color.org/) environment variables, and allows configuring with a command-line flag (conventionally `--color`).
|
||||||
|
- **`usage.cpp`:**
|
||||||
|
Generic printing of usage information. Renders headings in green, flags in cyan, and URLs in blue. Every program has its own `main.cpp` file that uses this.
|
||||||
|
- **`util.cpp`:**
|
||||||
|
Utility functions applicable to most programs, mostly dealing with text strings, such as locale-independent character checks.
|
||||||
|
- **`verbosity.cpp`:**
|
||||||
|
Generic printing of messages conditionally at different verbosity levels. Allows configuring with a command-line flag (conventionally `-v/--verbose`).
|
||||||
|
- **`version.cpp`:**
|
||||||
|
RGBDS version number and string for all the programs.
|
||||||
|
|
||||||
|
## External
|
||||||
|
|
||||||
|
These files have been copied ("vendored") from external authors and adapted for use with RGBDS. Both of our vendored dependencies use the same MIT license as RGBDS.
|
||||||
|
|
||||||
|
- **`getopt.cpp`:**
|
||||||
|
Functions for parsing command-line options, including conventional single-dash and double-dash options.
|
||||||
|
This file defines some *global* `musl_opt*` variables, including `musl_optarg` (the argument given after an option flag) and `musl_optind` (the index of the next option in `argv`). Copied from [musl libc](https://musl.libc.org/).
|
||||||
|
- **`utf8decoder.cpp`:**
|
||||||
|
Function for decoding UTF-8 bytes into Unicode code points. Copied from [Björn Höhrmann](https://bjoern.hoehrmann.de/utf-8/decoder/dfa/).
|
||||||
|
|
||||||
|
## RGBASM
|
||||||
|
|
||||||
|
- **`actions.cpp`:**
|
||||||
|
Actions taken by the assembly language parser, to avoid large amounts of code going in the parser.y file.
|
||||||
|
- **`charmap.cpp`:**
|
||||||
|
Functions and data related to charmaps.
|
||||||
|
This file *owns* the `Charmap`s in its `charmaps` collection. It also maintains a static `currentCharmap` pointer, and a `charmapStack` stack of pointers to `Charmap`s within `charmaps` (which is affected by `PUSHC` and `POPC` directives).
|
||||||
|
- **`fixpoint.cpp`:**
|
||||||
|
Functions for fixed-point math, with configurable [Q*m*.*n*](https://en.wikipedia.org/wiki/Q_(number_format)) precision.
|
||||||
|
- **`format.cpp`:**
|
||||||
|
`FormatSpec` methods for parsing and applying format specs, as used by `{interpolations}` and `STRFMT`.
|
||||||
|
- **`fstack.cpp`:**
|
||||||
|
Functions and data related to "fstack" nodes (the contents of top-level or `INCLUDE`d files, macro expansions, or `REPT`/`FOR` loop iterations) and their "contexts" (metadata that is only relevant while a node's content is being lexed and parsed).
|
||||||
|
This file *owns* the `Context`s in its `contextStack` collection. Each of those `Context`s *owns* its `LexerState`, and *refers* to its `FileStackNode`, `uniqueIDStr`, and `macroArgs`. Each `FileStackNode` also *references* its `parent`.
|
||||||
|
- **`intern.cpp`:**
|
||||||
|
[Interned strings](https://en.wikipedia.org/wiki/String_interning), which are used for the names of keywords, symbols (labels, constants, variables, string constants, macros, etc), and charmaps.
|
||||||
|
This file *owns* the strings in its `internedStrings` collection, which its `internedIndexes` collection *references* by view and index.
|
||||||
|
- **`lexer.cpp`:**
|
||||||
|
Functions and data related to [lexing](https://en.wikipedia.org/wiki/Lexical_analysis) assembly source code into tokens, which can then be parsed.
|
||||||
|
This file maintains static `lexerState` and `lexerStateEOL` pointers to `LexerState`s from the `Context`s in `fstack.cpp`.
|
||||||
|
Each `LexerState` *owns* its `content` and its `expansionStack`'s content. Each `Expansion` (the contents of an `{interpolation}` or macro argument) in turn *owns* its `contents`.
|
||||||
|
The lexer and parser are interdependent: when the parser reaches certain tokens, it changes the lexer's mode, which affects how characters get lexed into tokens. For example, when the parser reaches a macro name, it changes the lexer to "raw" mode, which lexes the rest of the line as a sequence of string arguments to the macro.
|
||||||
|
- **`macro.cpp`:**
|
||||||
|
`MacroArgs` methods related to macro arguments. Each `MacroArgs` *references* its arguments' contents.
|
||||||
|
- **`main.cpp`:**
|
||||||
|
The `main` function for running RGBASM, including the initial handling of command-line options.
|
||||||
|
This file defines a *global* `options` variable with the parsed CLI options.
|
||||||
|
- **`opt.cpp`:**
|
||||||
|
Functions for parsing options specified by `OPT` or by certain command-line options.
|
||||||
|
This file *owns* the `OptStackEntry`s in its `stack` collection (which is affected by `PUSHO` and `POPO` directives).
|
||||||
|
- **`output.cpp`:**
|
||||||
|
Functions and data related to outputting object files (with `-o/--output`) and state files (with `-s/--state`).
|
||||||
|
This file *owns* its `assertions` (created by `ASSERT` and `STATIC_ASSERT` directives). Every assertion gets output in the object file.
|
||||||
|
This file also *references* some `fileStackNodes`, and maintains static pointers to `Symbol`s in `objectSymbols`. Only the "registered" symbols and fstack nodes get output in the object file. The `fileStackNodes` and `objectSymbols` collections keep track of which nodes and symbols have been registered for output.
|
||||||
|
- **`parser.y`:**
|
||||||
|
Grammar for the RGBASM assembly language, which Bison preprocesses into a [LALR(1) parser](https://en.wikipedia.org/wiki/LALR_parser).
|
||||||
|
The Bison-generated parser calls `yylex` (defined in `lexer.cpp`) to get the next token, and calls `yywrap` (defined in `fstack.cpp`) when the current context is out of tokens and returns `EOF`.
|
||||||
|
- **`rpn.cpp`:**
|
||||||
|
`Expression` methods and data related to "[RPN](https://en.wikipedia.org/wiki/Reverse_Polish_notation)" expressions. When a numeric expression is parsed, if its value cannot be calculated at assembly time, it is built up into a buffer of RPN-encoded operations to do so at link time by RGBLINK. The valid RPN operations are defined in [man/rgbds.5](/man/rgbds.5).
|
||||||
|
- **`section.cpp`:**
|
||||||
|
Functions and data related to `SECTION`s.
|
||||||
|
This file *owns* the `Section`s in its `sections` collection. It also maintains various static pointers to those sections, including the `currentSection`, `currentLoadSection`, and `sectionStack` (which is affected by `PUSHS` and `POPS` directives). (Note that sections cannot be deleted.)
|
||||||
|
- **`symbol.cpp`:**
|
||||||
|
Functions and data related to symbols (labels, constants, variables, string constants, macros, etc).
|
||||||
|
This file *owns* the `Symbol`s in its `symbols` collection, and the various built-in ones outside that collection (`PCSymbol` for "`@`", `NARGSymbol` for "`_NARG`", etc). It also maintains a static `purgedSymbols` collection to remember which symbol names have been `PURGE`d from `symbols`, for error reporting purposes.
|
||||||
|
- **`warning.cpp`:**
|
||||||
|
Functions and data for warning and error output.
|
||||||
|
This file defines a *global* `warnings` variable using the `diagnostics.cpp` code for RGBASM-specific warning flags.
|
||||||
|
|
||||||
|
## RGBFIX
|
||||||
|
|
||||||
|
- **`fix.cpp`:**
|
||||||
|
Functions for fixing the ROM header.
|
||||||
|
- **`main.cpp`:**
|
||||||
|
The `main` function for running RGBFIX, including the initial handling of command-line options.
|
||||||
|
This file defines a *global* `options` variable with the parsed CLI options.
|
||||||
|
- **`mbc.cpp`:**
|
||||||
|
Functions and data related to [MBCs](https://gbdev.io/pandocs/MBCs.html), including the names of known MBC values.
|
||||||
|
- **`warning.cpp`:**
|
||||||
|
Functions and data for warning and error output.
|
||||||
|
This file defines a *global* `warnings` variable using the `diagnostics.cpp` code for RGBFIX-specific warning flags.
|
||||||
|
|
||||||
|
## RGBGFX
|
||||||
|
|
||||||
|
- **`color_set.cpp`:**
|
||||||
|
`ColorSet` methods for creating and comparing sets of colors. A color set includes the unique colors used by a single tile, and these sets are then packed into palettes.
|
||||||
|
- **`main.cpp`:**
|
||||||
|
The `main` function for running RGBGFX, including the initial handling of command-line options.
|
||||||
|
This file defines a *global* `options` variable with the parsed CLI options.
|
||||||
|
- **`pal_packing.cpp`:**
|
||||||
|
Functions for packing color sets into palettes. This is done with an ["overload-and-remove" heuristic](https://arxiv.org/abs/1605.00558) for a pagination algorithm.
|
||||||
|
- **`pal_sorting.cpp`:**
|
||||||
|
Functions for sorting colors within palettes, which works differently for grayscale, RGB, or indexed-color palettes.
|
||||||
|
- **`pal_spec.cpp`:**
|
||||||
|
Functions for parsing various formats of palette specifications (from `-c/--colors`).
|
||||||
|
- **`palette.cpp`:**
|
||||||
|
`Palette` methods for working with up to four GBC-native (RGB555) colors.
|
||||||
|
- **`png.cpp`:**
|
||||||
|
`Png` methods for reading PNG image files, standardizing them to 8-bit RGBA pixels while also reading their indexed palette if there is one.
|
||||||
|
- **`process.cpp`:**
|
||||||
|
Functions related to generating and outputting files (tile data, palettes, tilemap, attribute map, and/or palette map).
|
||||||
|
- **`reverse.cpp`:**
|
||||||
|
Functions related to reverse-generating RGBGFX outputs into a PNG file (for `-r/--reverse`).
|
||||||
|
- **`rgba.cpp`:**
|
||||||
|
`Rgba` methods related to RGBA colors and their 8-bit or 5-bit representations.
|
||||||
|
- **`warning.cpp`:**
|
||||||
|
Functions and data for warning and error output.
|
||||||
|
This file defines a *global* `warnings` variable using the `diagnostics.cpp` code for RGBGFX-specific warning flags.
|
||||||
|
|
||||||
|
## RGBLINK
|
||||||
|
|
||||||
|
- **`assign.cpp`:**
|
||||||
|
Functions and data for assigning `SECTION`s to specific banks and addresses.
|
||||||
|
This file *owns* the `memory` table of free space: each section type is associated with a list of each bank's free address ranges, which are allocated to sections using a [first-fit decreasing](https://en.wikipedia.org/wiki/Bin_packing_problem#First-fit_algorithm) bin-packing algorithm.
|
||||||
|
- **`fstack.cpp`:**
|
||||||
|
Functions related to "fstack" nodes (the contents of top-level or `INCLUDE`d files, macro expansions, or `REPT`/`FOR` loop iterations) read from the object files. At link time, these nodes are only needed for printing of location backtraces.
|
||||||
|
- **`layout.cpp`:**
|
||||||
|
Actions taken by the linker script parser, to avoid large amounts of code going in the script.y file.
|
||||||
|
This file maintains some static data about the current bank and address layout, which get checked and updated for consistency as the linker script is parsed.
|
||||||
|
- **`lexer.cpp`:**
|
||||||
|
Functions and data related to [lexing](https://en.wikipedia.org/wiki/Lexical_analysis) linker script files into tokens, which can then be parsed.
|
||||||
|
This file *owns* the `LexerStackEntry`s in its `lexerStack` collection. Each of those `LexerStackEntry`s *owns* its `file`. The stack is updated as linker scripts can `INCLUDE` other linker script pieces.
|
||||||
|
The linker script lexer is simpler than the RGBASM one, and does not have modes.
|
||||||
|
- **`main.cpp`:**
|
||||||
|
The `main` function for running RGBLINK, including the initial handling of command-line options.
|
||||||
|
This file defines a *global* `options` variable with the parsed CLI options.
|
||||||
|
- **`object.cpp`:**
|
||||||
|
Functions and data for reading object files generated by RGBASM.
|
||||||
|
This file *owns* the `Symbol`s in its `symbolLists` collection, and the `FileStackNode`s in its `nodes` collection.
|
||||||
|
- **`output.cpp`:**
|
||||||
|
Functions and data related to outputting ROM files (with `-o/--output`), symbol files (with `-n/--sym`), and map files (with `-m/--map`).
|
||||||
|
This file *references* some `Symbol`s and `Section`s, in collections that keep them sorted by address and name, which allows the symbol and map output to be in order.
|
||||||
|
- **`patch.cpp`:**
|
||||||
|
Functions and data related to "[RPN](https://en.wikipedia.org/wiki/Reverse_Polish_notation)" expression patches read from the object files, including the ones for `ASSERT` conditions. After sections have been assigned specific locations, the RPN patches can have their values calculated and applied to the ROM. The valid RPN operations are defined in [man/rgbds.5](/man/rgbds.5).
|
||||||
|
This file *owns* the `Assertion`s in its `assertions` collection, and the `RPNStackEntry`s in its `rpnStack` collection.
|
||||||
|
- **`script.y`:**
|
||||||
|
Grammar for the linker script language, which Bison preprocesses into a [LALR(1) parser](https://en.wikipedia.org/wiki/LALR_parser).
|
||||||
|
The Bison-generated parser calls `yylex` (defined in `lexer.cpp`) to get the next token, and calls `yywrap` (also defined in `lexer.cpp`) when the current context is out of tokens and returns `EOF`.
|
||||||
|
- **`sdas_obj.cpp`:**
|
||||||
|
Functions and data for reading object files generated by [GBDK with SDCC](https://gbdk.org/). RGBLINK support for these object files is incomplete.
|
||||||
|
- **`section.cpp`:**
|
||||||
|
Functions and data related to `SECTION`s read from the object files.
|
||||||
|
This file *owns* the `Section`s in its `sections` collection.
|
||||||
|
- **`symbol.cpp`:**
|
||||||
|
Functions and data related to symbols read from the object files.
|
||||||
|
This file *references* the `Symbol`s in its `symbols` and `localSymbols` collections, which allow accessing symbols by name.
|
||||||
|
- **`warning.cpp`:**
|
||||||
|
Functions and data for warning and error output.
|
||||||
|
This file defines a *global* `warnings` variable using the `diagnostics.cpp` code for RGBLINK-specific warning flags.
|
||||||
@@ -0,0 +1,271 @@
|
|||||||
|
# Contributing
|
||||||
|
|
||||||
|
RGBDS was created in the late '90s and has received contributions from several
|
||||||
|
developers since then. It wouldn't have been possible to get to this point
|
||||||
|
without their work, and it is always open to the contributions of other people.
|
||||||
|
|
||||||
|
## Reporting bugs
|
||||||
|
|
||||||
|
Bug reports are essential to improve RGBDS and they are always welcome. If you
|
||||||
|
want to report a bug:
|
||||||
|
|
||||||
|
1. Make sure that there isn't a similar issue
|
||||||
|
[already reported](https://github.com/gbdev/rgbds/issues).
|
||||||
|
2. Figure out a way of reproducing it reliably.
|
||||||
|
3. If there is a piece of code that triggers the bug, try to reduce it to the
|
||||||
|
smallest file you can.
|
||||||
|
4. Create a new [issue](https://github.com/gbdev/rgbds/issues).
|
||||||
|
|
||||||
|
Of course, it may not always be possible to give an accurate bug report, but it
|
||||||
|
always helps to fix it.
|
||||||
|
|
||||||
|
## Requesting new features
|
||||||
|
|
||||||
|
If you come up with a good idea that could be implemented, you can propose it to
|
||||||
|
be done.
|
||||||
|
|
||||||
|
1. Create a new [issue](https://github.com/gbdev/rgbds/issues).
|
||||||
|
2. Try to be as accurate as possible. Describe what you need and why you need
|
||||||
|
it, maybe with examples.
|
||||||
|
|
||||||
|
Please understand that the contributors are doing it in their free time, so
|
||||||
|
simple requests are more likely to catch the interest of a contributor than
|
||||||
|
complicated ones. If you really need something to be done, and you think you can
|
||||||
|
implement it yourself, you can always contribute to RGBDS with your own code.
|
||||||
|
|
||||||
|
## Contributing code
|
||||||
|
|
||||||
|
Thank you! Code contributions are the most appreciated.
|
||||||
|
You can find a description of the project's layout in [`ARCHITECTURE.md`](/ARCHITECTURE.md).
|
||||||
|
|
||||||
|
If you want to contribute with your own code, whether it is to fix a current
|
||||||
|
issue or to add something that nobody had requested, you should first consider
|
||||||
|
if your change is going to be small (and likely to be accepted as-is) or big
|
||||||
|
(and will have to go through some rework).
|
||||||
|
|
||||||
|
Big changes will most likely require some discussion, so open an
|
||||||
|
[issue](https://github.com/gbdev/rgbds/issues) and explain what you want to
|
||||||
|
do and how you intend to do it. If you already have a prototype, it's always a
|
||||||
|
good idea to show it. Tests help, too.
|
||||||
|
|
||||||
|
If you are going to work on a specific issue that involves a lot of work, it is
|
||||||
|
always a good idea to leave a message, just in case someone else is interested
|
||||||
|
but doesn't know that there's someone working on it.
|
||||||
|
|
||||||
|
Note that you must contribute all your changes under the MIT License. If you are
|
||||||
|
just modifying a file, you don't need to do anything (maybe update the copyright
|
||||||
|
years). If you are adding new files, you need to use the
|
||||||
|
`SPDX-License-Identifier: MIT` header.
|
||||||
|
|
||||||
|
1. Fork this repository.
|
||||||
|
2. Checkout the `master` branch.
|
||||||
|
3. Create a new branch to work on. You could still work on `master`, but it's
|
||||||
|
easier that way.
|
||||||
|
4. Compile your changes with `make develop` instead of just `make`. This
|
||||||
|
target checks for additional warnings. Your patches shouldn't introduce any
|
||||||
|
new warning (but it may be possible to remove some warning checks if it makes
|
||||||
|
the code much easier).
|
||||||
|
|
||||||
|
You can also use `cmake --preset develop` if you prefer.
|
||||||
|
5. Test your changes by running `./run-tests.sh` in the `test` directory.
|
||||||
|
`./run-tests.sh --help` will print its available options. (You must run
|
||||||
|
`external/fetch-repos.sh` first; if you forget to, the test suite will fail and
|
||||||
|
remind you mid-way.)
|
||||||
|
|
||||||
|
You can also use `ctest --test-dir build` if you prefer.
|
||||||
|
`ctest --test-dir build --print-labels` will print its available
|
||||||
|
[test labels](https://cmake.org/cmake/help/latest/manual/ctest.1.html#label-matching).
|
||||||
|
6. Format your changes according to `clang-format`, which will reformat the
|
||||||
|
coding style according to our standards defined in `.clang-format`. You can
|
||||||
|
use `make format` to format all the C++ files.
|
||||||
|
7. Create a pull request against the branch `master`.
|
||||||
|
8. Check the results of the GitHub Actions CI jobs for your pull request. The
|
||||||
|
"Code format checking" and "Regression testing" jobs should all succeed.
|
||||||
|
The "Diff completeness check" job should be manually checked, as it may
|
||||||
|
output warnings which do not count as failure errors. The "Code coverage
|
||||||
|
report" provides an [LCOV](https://github.com/linux-test-project/lcov)-generated
|
||||||
|
report which can be downloaded and checked to see if your new code has full
|
||||||
|
test coverage.
|
||||||
|
9. Be prepared to get some comments about your code and to modify it. Tip: Use
|
||||||
|
`git rebase -i origin/master` to modify chains of commits.
|
||||||
|
|
||||||
|
## Adding a test
|
||||||
|
|
||||||
|
The test suite is a little ad-hoc, so the way tests work is different for each
|
||||||
|
program being tested.
|
||||||
|
|
||||||
|
Feel free to modify how the test scripts work, if the thing you want to test
|
||||||
|
doesn't fit the existing scheme(s).
|
||||||
|
|
||||||
|
### RGBASM
|
||||||
|
|
||||||
|
There are two kinds of test.
|
||||||
|
|
||||||
|
#### Simple tests
|
||||||
|
|
||||||
|
Each `.asm` file corresponds to one test.
|
||||||
|
RGBASM will be invoked on the `.asm` file with all warnings enabled.
|
||||||
|
|
||||||
|
If a `.flags` file exists, its first line contains flags to pass to RGBASM.
|
||||||
|
(There may be more lines, which will be ignored; they can serve as comments to
|
||||||
|
explain what the test is about.)
|
||||||
|
|
||||||
|
If a `.out` file exists, RGBASM's output (`print`, `println`, etc.) must match
|
||||||
|
its contents.
|
||||||
|
If a `.err` file exists, RGBASM's error output (`warn`, errors, etc.) must match
|
||||||
|
its contents.
|
||||||
|
|
||||||
|
If a `.out.bin` file exists, the object file will be linked, and the generated
|
||||||
|
ROM truncated to the length of the `.out.bin` file.
|
||||||
|
After that, the ROM must match the `.out.bin` file.
|
||||||
|
|
||||||
|
#### CLI tests
|
||||||
|
|
||||||
|
Each `.flags` file in `cli/` corresponds to one test.
|
||||||
|
RGBASM will be invoked, passing it the first line of the `.flags` file.
|
||||||
|
(There may be more lines, which will be ignored; they can serve as comments to
|
||||||
|
explain what the test is about.)
|
||||||
|
|
||||||
|
If a `.out` file exists, RGBASM's output (`print`, `println`, etc.) must match
|
||||||
|
its contents.
|
||||||
|
If a `.err` file exists, RGBASM's error output (`warn`, errors, etc.) must match
|
||||||
|
its contents.
|
||||||
|
|
||||||
|
### RGBLINK
|
||||||
|
|
||||||
|
Each `.asm` file corresponds to one test, or one *set* of tests.
|
||||||
|
|
||||||
|
All tests begin by assembling the `.asm` file into an object file, which will be
|
||||||
|
linked in various ways depending on the test.
|
||||||
|
|
||||||
|
#### Simple tests
|
||||||
|
|
||||||
|
These simply check that RGBLINK's output matches some expected output.
|
||||||
|
|
||||||
|
If a `.flags` file exists, its first line contains flags to pass to RGBLINK.
|
||||||
|
(There may be more lines, which will be ignored; they can serve as comments to
|
||||||
|
explain what the test is about.)
|
||||||
|
|
||||||
|
A `.out` file **must** exist, and RGBLINK's total output must match that file's
|
||||||
|
contents.
|
||||||
|
|
||||||
|
Additionally, if a `.out.bin` file exists, the `.gb` file generated by RGBLINK
|
||||||
|
must match it.
|
||||||
|
|
||||||
|
#### Linker script tests
|
||||||
|
|
||||||
|
These allow applying various linker scripts to the same object file.
|
||||||
|
If one or more `.link` files exist, whose names start the same as the `.asm`
|
||||||
|
file, then each of those files correspond to one test.
|
||||||
|
|
||||||
|
Each `.link` linker script **must** be accompanied by a `.out` file, and
|
||||||
|
RGBLINK's total output must match that file's contents when passed the
|
||||||
|
corresponding linker script.
|
||||||
|
|
||||||
|
#### Variant tests
|
||||||
|
|
||||||
|
These allow testing RGBLINK's `-d`, `-t`, and `-w` flags.
|
||||||
|
If one or more
|
||||||
|
<code>-<var><flag></var>.out</code> or <code>-no-<var><flag></var>.out</code>
|
||||||
|
files exist, then each of them corresponds to one test.
|
||||||
|
|
||||||
|
The object file will be linked with and without said flag, respectively; and in
|
||||||
|
each case, RGBLINK's total output must match the `.out` file's contents.
|
||||||
|
|
||||||
|
### RGBFIX
|
||||||
|
|
||||||
|
Each `.flags` file corresponds to one test.
|
||||||
|
Each one is a text file whose first line contains flags to pass to RGBFIX.
|
||||||
|
(There may be more lines, which will be ignored; they can serve as comments to
|
||||||
|
explain what the test is about.)
|
||||||
|
|
||||||
|
RGBFIX will be invoked on the `.bin` file if it exists, or else on
|
||||||
|
default-input.bin.
|
||||||
|
|
||||||
|
If no `.out` file exist, RGBFIX is not expected to output anything.
|
||||||
|
If one *does* exist, RGBFIX's output **must** match the `.out` file's contents.
|
||||||
|
|
||||||
|
If no `.err` file exists, RGBFIX is simply expected to be able to process the
|
||||||
|
file normally.
|
||||||
|
If one *does* exist, RGBFIX's return status is ignored, but its error output
|
||||||
|
**must** match the `.err` file's contents.
|
||||||
|
|
||||||
|
Additionally, if a `.gb` file exists, the output of RGBFIX must match the `.gb`.
|
||||||
|
|
||||||
|
### RGBGFX
|
||||||
|
|
||||||
|
There are three kinds of test.
|
||||||
|
|
||||||
|
#### Simple tests
|
||||||
|
|
||||||
|
Each `.png` file corresponds to one test.
|
||||||
|
RGBGFX will be invoked on the file.
|
||||||
|
If a `.flags` file exists, it will be used as part of the RGBGFX invocation
|
||||||
|
(<code>@<var><file></var>.flags</code>).
|
||||||
|
|
||||||
|
If `.out.1bpp`, `.out.2bpp`, `.out.pal`, `.out.tilemap`, `.out.attrmap`, or
|
||||||
|
`.out.palmap` files exist, RGBGFX will create the corresponding kind of output,
|
||||||
|
which must match the file's contents.
|
||||||
|
Multiple kinds of output may be tested for the same input.
|
||||||
|
|
||||||
|
If no `.err` file exists, RGBGFX is simply expected to be able to process the
|
||||||
|
file normally.
|
||||||
|
If one *does* exist, RGBGFX's return status is ignored, but its output **must**
|
||||||
|
match the `.err` file's contents.
|
||||||
|
|
||||||
|
#### Reverse tests
|
||||||
|
|
||||||
|
Each `.1bpp` or `.2bpp` file corresponds to one test.
|
||||||
|
RGBGFX will be invoked on the file with `-r 1` for reverse mode, then invoked on
|
||||||
|
the output without `-r 1`.
|
||||||
|
The round-trip output must match the input file's contents.
|
||||||
|
If a `.flags` file exists, it will be used as part of the RGBGFX invocation
|
||||||
|
(<code>@<var><file></var>.flags</code>).
|
||||||
|
|
||||||
|
#### Random seed tests
|
||||||
|
|
||||||
|
Each `seed*.bin` file corresponds to one test.
|
||||||
|
Each one is a binary RNG file which is passed to the `rgbgfx_test` program.
|
||||||
|
|
||||||
|
### External projects
|
||||||
|
|
||||||
|
Each `.cfg` file corresponds to one test.
|
||||||
|
Each one defines the parameters for a real external project that builds using RGBDS.
|
||||||
|
|
||||||
|
1. Ensure that the downstream project supports a `RGBDS` variable to build with
|
||||||
|
a non-system copy of RGBDS in some directory, i.e.
|
||||||
|
<code>make <var><target></var> RGBDS=<var><path/to/rgbds/></var></code>.
|
||||||
|
Only [GNU Make](https://www.gnu.org/software/make/) is currently supported.
|
||||||
|
2. Create the new `.cfg` file, following the existing ones.
|
||||||
|
|
||||||
|
If an external project does not support `make RGBDS=`, or otherwise fails to
|
||||||
|
build with current RGBDS, then you can edit the project to build correctly, and
|
||||||
|
create a patch with `git diff` to be committed as
|
||||||
|
<code>test/external/patches/<var><project></var>.patch</code>.
|
||||||
|
|
||||||
|
## Container images
|
||||||
|
|
||||||
|
The CI will
|
||||||
|
[take care](https://github.com/gbdev/rgbds/blob/master/.github/workflows/build-container.yml)
|
||||||
|
of updating the
|
||||||
|
[rgbds container](https://github.com/gbdev/rgbds/pkgs/container/rgbds) image
|
||||||
|
tagged `master`.
|
||||||
|
|
||||||
|
When a git tag is pushed, the image is also tagged with that tag.
|
||||||
|
|
||||||
|
The image can be built locally and pushed to the GitHub container registry by
|
||||||
|
manually running:
|
||||||
|
|
||||||
|
```bash
|
||||||
|
# e.g. to build and tag as 'master'
|
||||||
|
docker build . --tag ghcr.io/gbdev/rgbds:master
|
||||||
|
docker push ghcr.io/gbdev/rgbds:master
|
||||||
|
```
|
||||||
|
|
||||||
|
## Publishing a new release
|
||||||
|
|
||||||
|
Please refer to [`RELEASE.md`](/RELEASE.md).
|
||||||
|
|
||||||
|
## Closing remarks
|
||||||
|
|
||||||
|
Feel free to add yourself to `CREDITS.md`!
|
||||||
@@ -0,0 +1,48 @@
|
|||||||
|
# Contributors to RGBDS
|
||||||
|
|
||||||
|
## Original author
|
||||||
|
|
||||||
|
- Carsten Elton Sørensen <csoren@gmail.com>
|
||||||
|
|
||||||
|
## Main contributors
|
||||||
|
|
||||||
|
- Justin Lloyd <jlloyd@imf.la>
|
||||||
|
- Vegard Nossum <vegard.nossum@gmail.com>
|
||||||
|
- Anthony J. Bentley <anthony@anjbe.name>
|
||||||
|
- stag019 <stag019@gmail.com>
|
||||||
|
- Antonio Niño Díaz <antonio_nd@outlook.com>
|
||||||
|
- Eldred "ISSOtm" Habert <me@eldred.fr>
|
||||||
|
- Sylvie "Rangi" Oukaour <https://github.com/Rangi42>
|
||||||
|
|
||||||
|
## Other contributors
|
||||||
|
|
||||||
|
- Ben Hetherington <dev@ben-h.uk>
|
||||||
|
- Björn Höhrmann <bjoern@hoehrmann.de>
|
||||||
|
- Christophe Staïesse <chastai@skynet.be>
|
||||||
|
- David Brotz <dbrotz007@gmail.com>
|
||||||
|
- Evie <https://evie.gbdev.io>
|
||||||
|
- James "JL2210" Larrowe <https://github.com/JL2210>
|
||||||
|
- Maja Kądziołka <github@compilercrim.es>
|
||||||
|
- The Musl C library <https://musl.libc.org/>
|
||||||
|
- obskyr <powpowd@gmail.com>
|
||||||
|
- The OpenBSD Project <http://www.openbsd.org>
|
||||||
|
- Quint Guvernator <quint@guvernator.net>
|
||||||
|
- Sanqui <gsanky@gmail.com>
|
||||||
|
- YamaArashi <shadow962@live.com>
|
||||||
|
- yenatch <yenatch@gmail.com>
|
||||||
|
- phs <phil@philhsmith.com>
|
||||||
|
- jidoc01 <jidoc01@naver.com>
|
||||||
|
|
||||||
|
[<img src="https://contrib.rocks/image?repo=gbdev/rgbds">](https://github.com/gbdev/rgbds/graphs/contributors)
|
||||||
|
|
||||||
|
Contributor image made with [contrib.rocks](https://contrib.rocks).
|
||||||
|
|
||||||
|
## Acknowledgements
|
||||||
|
|
||||||
|
RGBGFX generates palettes using algorithms found in the paper
|
||||||
|
["Algorithms for the Pagination Problem, a Bin Packing with Overlapping Items"](https://arxiv.org/abs/1605.00558)
|
||||||
|
([GitHub](https://github.com/pagination-problem/pagination), MIT license),
|
||||||
|
by Aristide Grange, Imed Kacem, and Sébastien Martin.
|
||||||
|
|
||||||
|
RGBGFX's color palette was taken from [SameBoy](https://sameboy.github.io), with
|
||||||
|
permission and help by [LIJI](https://github.com/LIJI32).
|
||||||
@@ -0,0 +1,84 @@
|
|||||||
|
# Releasing
|
||||||
|
|
||||||
|
This describes for the maintainers of RGBDS how to publish a new release on
|
||||||
|
GitHub.
|
||||||
|
|
||||||
|
1. Update the following files, then commit and push.
|
||||||
|
You can use <code>git commit -m "Release <i><version></i>"</code> and `git push origin master`.
|
||||||
|
|
||||||
|
- [include/version.hpp](/include/version.hpp): set appropriate values for `PACKAGE_VERSION_MAJOR`,
|
||||||
|
`PACKAGE_VERSION_MINOR`, `PACKAGE_VERSION_PATCH`, and `PACKAGE_VERSION_RC`.
|
||||||
|
**Only** define `PACKAGE_VERSION_RC` if you are publishing a release candidate!
|
||||||
|
- [Dockerfile](/Dockerfile): update `ARG version`.
|
||||||
|
- [test/external/\*.cfg](/test/external): update test dependency commits
|
||||||
|
(preferably, use the latest available).
|
||||||
|
- [man/\*](/man/): update dates and authors.
|
||||||
|
|
||||||
|
2. Create a Git tag formatted as <code>v<i><MAJOR></i>.<i><MINOR></i>.<i><PATCH></i></code>,
|
||||||
|
or <code>v<i><MAJOR></i>.<i><MINOR></i>.<i><PATCH></i>-rc<i><RC></i></code>
|
||||||
|
for a release candidate. <code><i>MAJOR</i></code>, <code><i>MINOR</i></code>,
|
||||||
|
<code><i>PATCH</i></code>, and <code><i>RC</i></code> should match their values from
|
||||||
|
[include/version.hpp](/include/version.hpp). You can use <code>git tag <i><tag></i></code>.
|
||||||
|
|
||||||
|
3. Push the tag to GitHub. You can use <code>git push origin <i><tag></i></code>.
|
||||||
|
|
||||||
|
GitHub Actions will run the
|
||||||
|
[create-release-artifacts.yml](/.github/workflows/create-release-artifacts.yml)
|
||||||
|
workflow to detect the tag starting with "`v[0-9]`" and automatically do the following:
|
||||||
|
|
||||||
|
1. Build 32-bit and 64-bit RGBDS binaries for Windows with `cmake`.
|
||||||
|
|
||||||
|
2. Package the binaries into zip files.
|
||||||
|
|
||||||
|
3. Package the source code into a tar.gz file with `make dist`.
|
||||||
|
|
||||||
|
4. Create a draft GitHub release for the tag, attaching the three
|
||||||
|
packaged files. It will be a prerelease if the tag contains "`-rc`".
|
||||||
|
|
||||||
|
If an error occurred in the above steps, delete the tag and restart the
|
||||||
|
procedure. You can use <code>git push --delete origin <i><tag></i></code> and
|
||||||
|
<code>git tag --delete <i><tag></i></code>.
|
||||||
|
|
||||||
|
4. GitHub Actions will run the [create-release-docs.yml](/.github/workflows/create-release-docs.yml)
|
||||||
|
workflow to add the release documentation to [rgbds-www](https://github.com/gbdev/rgbds-www).
|
||||||
|
|
||||||
|
This is not done automatically for prereleases, since we do not normally publish documentation
|
||||||
|
for them. If you want to manually publish prerelease documentation, such as for an April Fools
|
||||||
|
joke prerelease,
|
||||||
|
|
||||||
|
1. Clone [rgbds-www](https://github.com/gbdev/rgbds-www). You can use
|
||||||
|
`git clone https://github.com/gbdev/rgbds-www.git`.
|
||||||
|
|
||||||
|
2. Make sure that you have installed `groff` and `mandoc`. You will
|
||||||
|
need `mandoc` 1.14.5 or later to support `-O toc`.
|
||||||
|
|
||||||
|
3. Inside of the `man` directory, run <code><i><path/to/rgbds-www></i>/maintainer/man_to_html.sh <i><tag></i> *</code> then <code><i><path/to/rgbds-www></i>/maintainer/new_release.sh <i><tag></i></code>.
|
||||||
|
This will render the RGBDS documentation as HTML and PDF and copy it to
|
||||||
|
`rgbds-www`.
|
||||||
|
|
||||||
|
If you do not have `groff` installed, you can change
|
||||||
|
`groff -Tpdf -mdoc -wall` to `mandoc -Tpdf -I os=Linux` in
|
||||||
|
[maintainer/man_to_html.sh](https://github.com/gbdev/rgbds-www/blob/master/maintainer/man_to_html.sh)
|
||||||
|
and it will suffice.
|
||||||
|
|
||||||
|
4. Commit and push the documentation. You can use <code>git commit -m
|
||||||
|
"Create RGBDS <i><tag></i> documentation"</code> and `git push origin master`
|
||||||
|
(within the `rgbds-www` directory, not RGBDS).
|
||||||
|
|
||||||
|
5. Write a changelog in the GitHub draft release.
|
||||||
|
|
||||||
|
6. Click the "Publish release" button to publish it!
|
||||||
|
|
||||||
|
7. Update the `release` branch. You can use `git push origin master:release`.
|
||||||
|
|
||||||
|
8. Update the following related projects.
|
||||||
|
|
||||||
|
1. [rgbds-www](https://github.com/gbdev/rgbds-www): update
|
||||||
|
[src/pages/versions.mdx](https://github.com/gbdev/rgbds-www/blob/master/src/pages/versions.mdx)
|
||||||
|
to list the new release.
|
||||||
|
2. [rgbds-live](https://github.com/gbdev/rgbds-live): update the `rgbds` submodule (and
|
||||||
|
[patches/rgbds.patch](https://github.com/gbdev/rgbds-live/blob/master/patches/rgbds.patch)
|
||||||
|
if necessary) to use the new release.
|
||||||
|
3. [rgbobj](https://github.com/gbdev/rgbobj) and [rgbds-obj](https://github.com/gbdev/rgbds-obj):
|
||||||
|
make sure that object files created by the latest RGBASM can be parsed and displayed.
|
||||||
|
If the object file revision has been updated, `rgbobj` will need a corresponding release.
|
||||||
@@ -0,0 +1,62 @@
|
|||||||
|
// SPDX-License-Identifier: MIT
|
||||||
|
|
||||||
|
#ifndef RGBDS_ASM_ACTIONS_HPP
|
||||||
|
#define RGBDS_ASM_ACTIONS_HPP
|
||||||
|
|
||||||
|
#include <optional>
|
||||||
|
#include <stddef.h>
|
||||||
|
#include <stdint.h>
|
||||||
|
#include <string>
|
||||||
|
#include <string_view>
|
||||||
|
#include <variant>
|
||||||
|
#include <vector>
|
||||||
|
|
||||||
|
#include "linkdefs.hpp" // AssertionType, RPNCommand
|
||||||
|
|
||||||
|
#include "asm/intern.hpp" // InternedStr
|
||||||
|
#include "asm/rpn.hpp" // Expression
|
||||||
|
|
||||||
|
struct AlignmentSpec {
|
||||||
|
uint8_t alignment;
|
||||||
|
uint16_t alignOfs;
|
||||||
|
};
|
||||||
|
|
||||||
|
void act_If(int32_t condition);
|
||||||
|
void act_Elif(int32_t condition);
|
||||||
|
void act_Else();
|
||||||
|
void act_Endc();
|
||||||
|
|
||||||
|
AlignmentSpec act_Alignment(int32_t alignment, int32_t alignOfs);
|
||||||
|
|
||||||
|
void act_Assert(AssertionType type, Expression const &expr, std::string const &message);
|
||||||
|
void act_StaticAssert(AssertionType type, int32_t condition, std::string const &message);
|
||||||
|
|
||||||
|
std::optional<std::string> act_ReadFile(std::string const &name, uint32_t maxLen);
|
||||||
|
|
||||||
|
uint32_t act_CharToNum(std::string const &str);
|
||||||
|
uint32_t act_StringToNum(std::string const &str);
|
||||||
|
|
||||||
|
int32_t act_CharVal(std::string const &str);
|
||||||
|
int32_t act_CharVal(std::string const &str, int32_t negIdx);
|
||||||
|
uint8_t act_StringByte(std::string const &str, int32_t negIdx);
|
||||||
|
|
||||||
|
size_t act_StringLen(std::string const &str, bool printErrors);
|
||||||
|
std::string
|
||||||
|
act_StringSlice(std::string const &str, int32_t negStart, std::optional<int32_t> negStop);
|
||||||
|
std::string act_StringSub(std::string const &str, int32_t negPos, std::optional<uint32_t> optLen);
|
||||||
|
|
||||||
|
size_t act_CharLen(std::string const &str);
|
||||||
|
std::string act_StringChar(std::string const &str, int32_t negIdx);
|
||||||
|
std::string act_CharSub(std::string const &str, int32_t negPos);
|
||||||
|
int32_t act_CharCmp(std::string_view str1, std::string_view str2);
|
||||||
|
|
||||||
|
std::string act_StringReplace(std::string_view str, std::string const &old, std::string const &rep);
|
||||||
|
std::string act_StringFormat(
|
||||||
|
std::string const &spec, std::vector<std::variant<uint32_t, std::string>> const &args
|
||||||
|
);
|
||||||
|
|
||||||
|
std::string act_SectionName(InternedStr symName);
|
||||||
|
|
||||||
|
void act_CompoundAssignment(InternedStr symName, RPNCommand op, int32_t constValue);
|
||||||
|
|
||||||
|
#endif // RGBDS_ASM_ACTIONS_HPP
|
||||||
@@ -1,25 +0,0 @@
|
|||||||
/*
|
|
||||||
* This file is part of RGBDS.
|
|
||||||
*
|
|
||||||
* Copyright (c) 1997-2018, Carsten Sorensen and RGBDS contributors.
|
|
||||||
*
|
|
||||||
* SPDX-License-Identifier: MIT
|
|
||||||
*/
|
|
||||||
|
|
||||||
#ifndef RGBDS_ASM_CHARMAP_H
|
|
||||||
#define RGBDS_ASM_CHARMAP_H
|
|
||||||
|
|
||||||
#include <stdint.h>
|
|
||||||
|
|
||||||
#define DEFAULT_CHARMAP_NAME "main"
|
|
||||||
|
|
||||||
struct Charmap *charmap_New(char const *name, char const *baseName);
|
|
||||||
void charmap_Delete(struct Charmap *charmap);
|
|
||||||
void charmap_Set(char const *name);
|
|
||||||
void charmap_Push(void);
|
|
||||||
void charmap_Pop(void);
|
|
||||||
void charmap_Add(char *mapping, uint8_t value);
|
|
||||||
size_t charmap_Convert(char const *input, uint8_t *output);
|
|
||||||
size_t charmap_ConvertNext(char const **input, uint8_t **output);
|
|
||||||
|
|
||||||
#endif // RGBDS_ASM_CHARMAP_H
|
|
||||||
@@ -0,0 +1,32 @@
|
|||||||
|
// SPDX-License-Identifier: MIT
|
||||||
|
|
||||||
|
#ifndef RGBDS_ASM_CHARMAP_HPP
|
||||||
|
#define RGBDS_ASM_CHARMAP_HPP
|
||||||
|
|
||||||
|
#include <optional>
|
||||||
|
#include <stddef.h>
|
||||||
|
#include <stdint.h>
|
||||||
|
#include <string>
|
||||||
|
#include <string_view>
|
||||||
|
#include <vector>
|
||||||
|
|
||||||
|
#include "asm/intern.hpp"
|
||||||
|
|
||||||
|
void charmap_Init();
|
||||||
|
bool charmap_ForEach(
|
||||||
|
void (*mapFunc)(InternedStr), void (*charFunc)(std::string const &, std::vector<int32_t>)
|
||||||
|
);
|
||||||
|
void charmap_New(InternedStr name, InternedStr const *baseName);
|
||||||
|
void charmap_Set(InternedStr name);
|
||||||
|
void charmap_Push();
|
||||||
|
void charmap_Pop();
|
||||||
|
void charmap_CheckStack();
|
||||||
|
void charmap_Add(std::string const &mapping, std::vector<int32_t> &&value);
|
||||||
|
bool charmap_HasChar(std::string const &mapping);
|
||||||
|
size_t charmap_CharSize(std::string const &mapping);
|
||||||
|
std::optional<int32_t> charmap_CharValue(std::string const &mapping, size_t idx);
|
||||||
|
std::vector<int32_t> charmap_Convert(std::string const &input);
|
||||||
|
size_t charmap_ConvertNext(std::string_view &input, std::vector<int32_t> *output);
|
||||||
|
std::string charmap_Reverse(std::vector<int32_t> const &value, bool &unique);
|
||||||
|
|
||||||
|
#endif // RGBDS_ASM_CHARMAP_HPP
|
||||||
@@ -1,20 +1,10 @@
|
|||||||
/*
|
// SPDX-License-Identifier: MIT
|
||||||
* This file is part of RGBDS.
|
|
||||||
*
|
|
||||||
* Copyright (c) 1997-2021, Carsten Sorensen and RGBDS contributors.
|
|
||||||
*
|
|
||||||
* SPDX-License-Identifier: MIT
|
|
||||||
*/
|
|
||||||
|
|
||||||
#ifndef RGBDS_ASM_FIXPOINT_H
|
#ifndef RGBDS_ASM_FIXPOINT_HPP
|
||||||
#define RGBDS_ASM_FIXPOINT_H
|
#define RGBDS_ASM_FIXPOINT_HPP
|
||||||
|
|
||||||
#include <stdint.h>
|
#include <stdint.h>
|
||||||
|
|
||||||
extern uint8_t fixPrecision;
|
|
||||||
|
|
||||||
uint8_t fix_Precision(void);
|
|
||||||
double fix_PrecisionFactor(void);
|
|
||||||
int32_t fix_Sin(int32_t i, int32_t q);
|
int32_t fix_Sin(int32_t i, int32_t q);
|
||||||
int32_t fix_Cos(int32_t i, int32_t q);
|
int32_t fix_Cos(int32_t i, int32_t q);
|
||||||
int32_t fix_Tan(int32_t i, int32_t q);
|
int32_t fix_Tan(int32_t i, int32_t q);
|
||||||
@@ -31,4 +21,4 @@ int32_t fix_Round(int32_t i, int32_t q);
|
|||||||
int32_t fix_Ceil(int32_t i, int32_t q);
|
int32_t fix_Ceil(int32_t i, int32_t q);
|
||||||
int32_t fix_Floor(int32_t i, int32_t q);
|
int32_t fix_Floor(int32_t i, int32_t q);
|
||||||
|
|
||||||
#endif // RGBDS_ASM_FIXPOINT_H
|
#endif // RGBDS_ASM_FIXPOINT_HPP
|
||||||
@@ -1,63 +0,0 @@
|
|||||||
/*
|
|
||||||
* This file is part of RGBDS.
|
|
||||||
*
|
|
||||||
* Copyright (c) 2020, RGBDS contributors.
|
|
||||||
*
|
|
||||||
* SPDX-License-Identifier: MIT
|
|
||||||
*/
|
|
||||||
|
|
||||||
#ifndef RGBDS_FORMAT_SPEC_H
|
|
||||||
#define RGBDS_FORMAT_SPEC_H
|
|
||||||
|
|
||||||
#include <stdbool.h>
|
|
||||||
#include <stdint.h>
|
|
||||||
|
|
||||||
enum FormatState {
|
|
||||||
FORMAT_SIGN, // expects '+' or ' ' (optional)
|
|
||||||
FORMAT_PREFIX, // expects '#' (optional)
|
|
||||||
FORMAT_ALIGN, // expects '-' (optional)
|
|
||||||
FORMAT_WIDTH, // expects '0'-'9', max 255 (optional) (leading '0' indicates pad)
|
|
||||||
FORMAT_FRAC, // got '.', expects '0'-'9', max 255 (optional)
|
|
||||||
FORMAT_DONE, // got [duXxbofs] (required)
|
|
||||||
FORMAT_INVALID, // got unexpected character
|
|
||||||
};
|
|
||||||
|
|
||||||
struct FormatSpec {
|
|
||||||
enum FormatState state;
|
|
||||||
int sign;
|
|
||||||
bool prefix;
|
|
||||||
bool alignLeft;
|
|
||||||
bool padZero;
|
|
||||||
size_t width;
|
|
||||||
bool hasFrac;
|
|
||||||
size_t fracWidth;
|
|
||||||
int type;
|
|
||||||
bool valid;
|
|
||||||
};
|
|
||||||
|
|
||||||
struct StrFmtArg {
|
|
||||||
union {
|
|
||||||
uint32_t number;
|
|
||||||
char *string;
|
|
||||||
};
|
|
||||||
bool isNumeric;
|
|
||||||
};
|
|
||||||
|
|
||||||
#define INITIAL_STRFMT_ARG_SIZE 4
|
|
||||||
struct StrFmtArgList {
|
|
||||||
char *format;
|
|
||||||
size_t nbArgs;
|
|
||||||
size_t capacity;
|
|
||||||
struct StrFmtArg *args;
|
|
||||||
};
|
|
||||||
|
|
||||||
struct FormatSpec fmt_NewSpec(void);
|
|
||||||
bool fmt_IsEmpty(struct FormatSpec const *fmt);
|
|
||||||
bool fmt_IsValid(struct FormatSpec const *fmt);
|
|
||||||
bool fmt_IsFinished(struct FormatSpec const *fmt);
|
|
||||||
void fmt_UseCharacter(struct FormatSpec *fmt, int c);
|
|
||||||
void fmt_FinishCharacters(struct FormatSpec *fmt);
|
|
||||||
void fmt_PrintString(char *buf, size_t bufLen, struct FormatSpec const *fmt, char const *value);
|
|
||||||
void fmt_PrintNumber(char *buf, size_t bufLen, struct FormatSpec const *fmt, uint32_t value);
|
|
||||||
|
|
||||||
#endif // RGBDS_FORMAT_SPEC_H
|
|
||||||
@@ -0,0 +1,33 @@
|
|||||||
|
// SPDX-License-Identifier: MIT
|
||||||
|
|
||||||
|
#ifndef RGBDS_ASM_FORMAT_HPP
|
||||||
|
#define RGBDS_ASM_FORMAT_HPP
|
||||||
|
|
||||||
|
#include <stddef.h>
|
||||||
|
#include <stdint.h>
|
||||||
|
#include <string>
|
||||||
|
|
||||||
|
class FormatSpec {
|
||||||
|
int sign;
|
||||||
|
bool exact;
|
||||||
|
bool alignLeft;
|
||||||
|
bool padZero;
|
||||||
|
size_t width;
|
||||||
|
bool hasFrac;
|
||||||
|
size_t fracWidth;
|
||||||
|
bool hasPrec;
|
||||||
|
size_t precision;
|
||||||
|
int type;
|
||||||
|
bool parsed;
|
||||||
|
|
||||||
|
public:
|
||||||
|
bool isValid() const { return !!type; }
|
||||||
|
bool isParsed() const { return parsed; }
|
||||||
|
|
||||||
|
size_t parseSpec(char const *spec);
|
||||||
|
|
||||||
|
void appendString(std::string &str, std::string const &value) const;
|
||||||
|
void appendNumber(std::string &str, uint32_t value) const;
|
||||||
|
};
|
||||||
|
|
||||||
|
#endif // RGBDS_ASM_FORMAT_HPP
|
||||||
@@ -1,83 +0,0 @@
|
|||||||
/*
|
|
||||||
* This file is part of RGBDS.
|
|
||||||
*
|
|
||||||
* Copyright (c) 1997-2018, Carsten Sorensen and RGBDS contributors.
|
|
||||||
*
|
|
||||||
* SPDX-License-Identifier: MIT
|
|
||||||
*/
|
|
||||||
|
|
||||||
// Contains some assembler-wide defines and externs
|
|
||||||
|
|
||||||
#ifndef RGBDS_ASM_FSTACK_H
|
|
||||||
#define RGBDS_ASM_FSTACK_H
|
|
||||||
|
|
||||||
#include <stdbool.h>
|
|
||||||
#include <stdint.h>
|
|
||||||
#include <stdio.h>
|
|
||||||
|
|
||||||
#include "asm/lexer.h"
|
|
||||||
|
|
||||||
|
|
||||||
struct FileStackNode {
|
|
||||||
struct FileStackNode *parent; // Pointer to parent node, for error reporting
|
|
||||||
// Line at which the parent context was exited; meaningless for the root level
|
|
||||||
uint32_t lineNo;
|
|
||||||
|
|
||||||
struct FileStackNode *next; // Next node in the output linked list
|
|
||||||
bool referenced; // If referenced, don't free!
|
|
||||||
uint32_t ID; // Set only if referenced: ID within the object file, -1 if not output yet
|
|
||||||
|
|
||||||
enum {
|
|
||||||
NODE_REPT,
|
|
||||||
NODE_FILE,
|
|
||||||
NODE_MACRO,
|
|
||||||
} type;
|
|
||||||
};
|
|
||||||
|
|
||||||
struct FileStackReptNode { // NODE_REPT
|
|
||||||
struct FileStackNode node;
|
|
||||||
uint32_t reptDepth;
|
|
||||||
// WARNING: if changing this type, change overflow check in `fstk_Init`
|
|
||||||
uint32_t iters[]; // REPT iteration counts since last named node, in reverse depth order
|
|
||||||
};
|
|
||||||
|
|
||||||
struct FileStackNamedNode { // NODE_FILE, NODE_MACRO
|
|
||||||
struct FileStackNode node;
|
|
||||||
char name[]; // File name for files, file::macro name for macros
|
|
||||||
};
|
|
||||||
|
|
||||||
#define DEFAULT_MAX_DEPTH 64
|
|
||||||
extern size_t maxRecursionDepth;
|
|
||||||
|
|
||||||
struct MacroArgs;
|
|
||||||
|
|
||||||
void fstk_Dump(struct FileStackNode const *node, uint32_t lineNo);
|
|
||||||
void fstk_DumpCurrent(void);
|
|
||||||
struct FileStackNode *fstk_GetFileStack(void);
|
|
||||||
// The lifetime of the returned chars is until reaching the end of that file
|
|
||||||
char const *fstk_GetFileName(void);
|
|
||||||
|
|
||||||
void fstk_AddIncludePath(char const *s);
|
|
||||||
void fstk_SetPreIncludeFile(char const *s);
|
|
||||||
/*
|
|
||||||
* @param path The user-provided file name
|
|
||||||
* @param fullPath The address of a pointer, which will be made to point at the full path
|
|
||||||
* The pointer's value must be a valid argument to `realloc`, including NULL
|
|
||||||
* @param size Current size of the buffer, or 0 if the pointer is NULL
|
|
||||||
* @return True if the file was found, false if no path worked
|
|
||||||
*/
|
|
||||||
bool fstk_FindFile(char const *path, char **fullPath, size_t *size);
|
|
||||||
|
|
||||||
bool yywrap(void);
|
|
||||||
void fstk_RunInclude(char const *path);
|
|
||||||
void fstk_RunMacro(char const *macroName, struct MacroArgs *args);
|
|
||||||
void fstk_RunRept(uint32_t count, int32_t reptLineNo, char *body, size_t size);
|
|
||||||
void fstk_RunFor(char const *symName, int32_t start, int32_t stop, int32_t step,
|
|
||||||
int32_t reptLineNo, char *body, size_t size);
|
|
||||||
void fstk_StopRept(void);
|
|
||||||
bool fstk_Break(void);
|
|
||||||
|
|
||||||
void fstk_NewRecursionDepth(size_t newDepth);
|
|
||||||
void fstk_Init(char const *mainPath, size_t maxDepth);
|
|
||||||
|
|
||||||
#endif // RGBDS_ASM_FSTACK_H
|
|
||||||
@@ -0,0 +1,88 @@
|
|||||||
|
// SPDX-License-Identifier: MIT
|
||||||
|
|
||||||
|
// Contains some assembler-wide defines and externs
|
||||||
|
|
||||||
|
#ifndef RGBDS_ASM_FSTACK_HPP
|
||||||
|
#define RGBDS_ASM_FSTACK_HPP
|
||||||
|
|
||||||
|
#include <memory>
|
||||||
|
#include <optional>
|
||||||
|
#include <stdint.h>
|
||||||
|
#include <stdio.h>
|
||||||
|
#include <string>
|
||||||
|
#include <variant>
|
||||||
|
#include <vector>
|
||||||
|
|
||||||
|
#include "linkdefs.hpp"
|
||||||
|
|
||||||
|
#include "asm/intern.hpp"
|
||||||
|
#include "asm/lexer.hpp"
|
||||||
|
|
||||||
|
struct FileStackNode {
|
||||||
|
FileStackNodeType type;
|
||||||
|
std::variant<
|
||||||
|
std::vector<uint32_t>, // NODE_REPT
|
||||||
|
std::string // NODE_FILE, NODE_MACRO
|
||||||
|
>
|
||||||
|
data;
|
||||||
|
bool isQuiet; // Whether to omit this node from error reporting
|
||||||
|
|
||||||
|
std::shared_ptr<FileStackNode> parent; // Pointer to parent node, for error reporting
|
||||||
|
// Line at which the parent context was exited
|
||||||
|
// Meaningless at the root level, but gets written to the object file anyway, so init it
|
||||||
|
uint32_t lineNo = 0;
|
||||||
|
|
||||||
|
// Set only if referenced: ID within the object file, `UINT32_MAX` if not output yet
|
||||||
|
uint32_t ID = UINT32_MAX;
|
||||||
|
|
||||||
|
// REPT iteration counts since last named node, in reverse depth order
|
||||||
|
std::vector<uint32_t> &iters() { return std::get<std::vector<uint32_t>>(data); }
|
||||||
|
std::vector<uint32_t> const &iters() const { return std::get<std::vector<uint32_t>>(data); }
|
||||||
|
// File name for files, file::macro name for macros
|
||||||
|
std::string &name() { return std::get<std::string>(data); }
|
||||||
|
std::string const &name() const { return std::get<std::string>(data); }
|
||||||
|
|
||||||
|
FileStackNode(
|
||||||
|
FileStackNodeType type_,
|
||||||
|
std::variant<std::vector<uint32_t>, std::string> data_,
|
||||||
|
bool isQuiet_
|
||||||
|
)
|
||||||
|
: type(type_), data(data_), isQuiet(isQuiet_) {}
|
||||||
|
|
||||||
|
void printBacktrace(uint32_t curLineNo) const;
|
||||||
|
};
|
||||||
|
|
||||||
|
struct MacroArgs;
|
||||||
|
|
||||||
|
void fstk_VerboseOutputConfig();
|
||||||
|
|
||||||
|
void fstk_TraceCurrent();
|
||||||
|
std::shared_ptr<FileStackNode> fstk_GetFileStack();
|
||||||
|
std::shared_ptr<std::string> fstk_GetUniqueIDStr();
|
||||||
|
MacroArgs *fstk_GetCurrentMacroArgs();
|
||||||
|
|
||||||
|
void fstk_AddIncludePath(std::string const &path);
|
||||||
|
void fstk_AddPreIncludeFile(std::string const &path);
|
||||||
|
std::optional<std::string> fstk_FindFile(std::string const &path);
|
||||||
|
bool fstk_FileError(std::string const &path, char const *description);
|
||||||
|
bool fstk_FailedOnMissingInclude();
|
||||||
|
|
||||||
|
bool yywrap();
|
||||||
|
bool fstk_RunInclude(std::string const &path, bool isQuiet);
|
||||||
|
void fstk_RunMacro(InternedStr macroName, std::shared_ptr<MacroArgs> macroArgs, bool isQuiet);
|
||||||
|
void fstk_RunRept(uint32_t count, int32_t reptLineNo, ContentSpan const &span, bool isQuiet);
|
||||||
|
void fstk_RunFor(
|
||||||
|
InternedStr symName,
|
||||||
|
int32_t start,
|
||||||
|
int32_t stop,
|
||||||
|
int32_t step,
|
||||||
|
int32_t reptLineNo,
|
||||||
|
ContentSpan const &span,
|
||||||
|
bool isQuiet
|
||||||
|
);
|
||||||
|
bool fstk_Break();
|
||||||
|
|
||||||
|
void fstk_NewRecursionDepth(size_t newDepth);
|
||||||
|
bool fstk_Init(std::string const &mainPath);
|
||||||
|
|
||||||
|
#endif // RGBDS_ASM_FSTACK_HPP
|
||||||
@@ -0,0 +1,34 @@
|
|||||||
|
// SPDX-License-Identifier: MIT
|
||||||
|
|
||||||
|
#ifndef RGBDS_ASM_INTERN_HPP
|
||||||
|
#define RGBDS_ASM_INTERN_HPP
|
||||||
|
|
||||||
|
#include <stddef.h>
|
||||||
|
#include <string>
|
||||||
|
#include <string_view>
|
||||||
|
#include <utility> // hash
|
||||||
|
|
||||||
|
class InternedStr {
|
||||||
|
size_t index;
|
||||||
|
|
||||||
|
public:
|
||||||
|
constexpr InternedStr() : index(static_cast<size_t>(-1)) {}
|
||||||
|
explicit constexpr InternedStr(size_t index_) : index(index_) {}
|
||||||
|
|
||||||
|
std::string const &str() const;
|
||||||
|
char const *c_str() const { return str().c_str(); }
|
||||||
|
|
||||||
|
bool operator==(InternedStr const &rhs) const { return index == rhs.index; }
|
||||||
|
|
||||||
|
template<typename T>
|
||||||
|
friend struct std::hash;
|
||||||
|
};
|
||||||
|
|
||||||
|
template<>
|
||||||
|
struct std::hash<InternedStr> {
|
||||||
|
size_t operator()(InternedStr const &str) const { return std::hash<size_t>{}(str.index); }
|
||||||
|
};
|
||||||
|
|
||||||
|
InternedStr intern(std::string_view str);
|
||||||
|
|
||||||
|
#endif // RGBDS_ASM_INTERN_HPP
|
||||||
@@ -1,100 +0,0 @@
|
|||||||
/*
|
|
||||||
* This file is part of RGBDS.
|
|
||||||
*
|
|
||||||
* Copyright (c) 1997-2018, Carsten Sorensen and RGBDS contributors.
|
|
||||||
*
|
|
||||||
* SPDX-License-Identifier: MIT
|
|
||||||
*/
|
|
||||||
|
|
||||||
#ifndef RGBDS_ASM_LEXER_H
|
|
||||||
#define RGBDS_ASM_LEXER_H
|
|
||||||
|
|
||||||
#include <stdbool.h>
|
|
||||||
|
|
||||||
#define MAXSTRLEN 255
|
|
||||||
|
|
||||||
struct LexerState;
|
|
||||||
extern struct LexerState *lexerState;
|
|
||||||
extern struct LexerState *lexerStateEOL;
|
|
||||||
|
|
||||||
static inline struct LexerState *lexer_GetState(void)
|
|
||||||
{
|
|
||||||
return lexerState;
|
|
||||||
}
|
|
||||||
|
|
||||||
static inline void lexer_SetState(struct LexerState *state)
|
|
||||||
{
|
|
||||||
lexerState = state;
|
|
||||||
}
|
|
||||||
|
|
||||||
static inline void lexer_SetStateAtEOL(struct LexerState *state)
|
|
||||||
{
|
|
||||||
lexerStateEOL = state;
|
|
||||||
}
|
|
||||||
|
|
||||||
extern char binDigits[2];
|
|
||||||
extern char gfxDigits[4];
|
|
||||||
|
|
||||||
static inline void lexer_SetBinDigits(char const digits[2])
|
|
||||||
{
|
|
||||||
binDigits[0] = digits[0];
|
|
||||||
binDigits[1] = digits[1];
|
|
||||||
}
|
|
||||||
|
|
||||||
static inline void lexer_SetGfxDigits(char const digits[4])
|
|
||||||
{
|
|
||||||
gfxDigits[0] = digits[0];
|
|
||||||
gfxDigits[1] = digits[1];
|
|
||||||
gfxDigits[2] = digits[2];
|
|
||||||
gfxDigits[3] = digits[3];
|
|
||||||
}
|
|
||||||
|
|
||||||
// `path` is referenced, but not held onto..!
|
|
||||||
struct LexerState *lexer_OpenFile(char const *path);
|
|
||||||
struct LexerState *lexer_OpenFileView(char const *path, char *buf, size_t size, uint32_t lineNo);
|
|
||||||
void lexer_RestartRept(uint32_t lineNo);
|
|
||||||
void lexer_DeleteState(struct LexerState *state);
|
|
||||||
void lexer_Init(void);
|
|
||||||
|
|
||||||
enum LexerMode {
|
|
||||||
LEXER_NORMAL,
|
|
||||||
LEXER_RAW,
|
|
||||||
LEXER_SKIP_TO_ELIF,
|
|
||||||
LEXER_SKIP_TO_ENDC,
|
|
||||||
LEXER_SKIP_TO_ENDR
|
|
||||||
};
|
|
||||||
|
|
||||||
void lexer_SetMode(enum LexerMode mode);
|
|
||||||
void lexer_ToggleStringExpansion(bool enable);
|
|
||||||
|
|
||||||
uint32_t lexer_GetIFDepth(void);
|
|
||||||
void lexer_IncIFDepth(void);
|
|
||||||
void lexer_DecIFDepth(void);
|
|
||||||
bool lexer_RanIFBlock(void);
|
|
||||||
bool lexer_ReachedELSEBlock(void);
|
|
||||||
void lexer_RunIFBlock(void);
|
|
||||||
void lexer_ReachELSEBlock(void);
|
|
||||||
|
|
||||||
struct CaptureBody {
|
|
||||||
uint32_t lineNo;
|
|
||||||
char *body;
|
|
||||||
size_t size;
|
|
||||||
};
|
|
||||||
|
|
||||||
void lexer_CheckRecursionDepth(void);
|
|
||||||
char const *lexer_GetFileName(void);
|
|
||||||
uint32_t lexer_GetLineNo(void);
|
|
||||||
uint32_t lexer_GetColNo(void);
|
|
||||||
void lexer_DumpStringExpansions(void);
|
|
||||||
int yylex(void);
|
|
||||||
bool lexer_CaptureRept(struct CaptureBody *capture);
|
|
||||||
bool lexer_CaptureMacroBody(struct CaptureBody *capture);
|
|
||||||
|
|
||||||
#define INITIAL_DS_ARG_SIZE 2
|
|
||||||
struct DsArgList {
|
|
||||||
size_t nbArgs;
|
|
||||||
size_t capacity;
|
|
||||||
struct Expression *args;
|
|
||||||
};
|
|
||||||
|
|
||||||
#endif // RGBDS_ASM_LEXER_H
|
|
||||||
@@ -0,0 +1,107 @@
|
|||||||
|
// SPDX-License-Identifier: MIT
|
||||||
|
|
||||||
|
#ifndef RGBDS_ASM_LEXER_HPP
|
||||||
|
#define RGBDS_ASM_LEXER_HPP
|
||||||
|
|
||||||
|
#include <deque>
|
||||||
|
#include <memory>
|
||||||
|
#include <optional>
|
||||||
|
#include <stddef.h>
|
||||||
|
#include <stdint.h>
|
||||||
|
#include <string>
|
||||||
|
#include <vector>
|
||||||
|
|
||||||
|
#include "asm/intern.hpp"
|
||||||
|
|
||||||
|
enum LexerMode {
|
||||||
|
LEXER_NORMAL,
|
||||||
|
LEXER_RAW,
|
||||||
|
LEXER_SKIP_TO_ELIF,
|
||||||
|
LEXER_SKIP_TO_ENDC,
|
||||||
|
LEXER_SKIP_TO_ENDR,
|
||||||
|
NB_LEXER_MODES
|
||||||
|
};
|
||||||
|
|
||||||
|
struct Expansion {
|
||||||
|
std::optional<InternedStr> name;
|
||||||
|
std::shared_ptr<std::string> contents;
|
||||||
|
size_t offset; // Cursor into `contents`
|
||||||
|
|
||||||
|
size_t size() const { return contents->size(); }
|
||||||
|
bool advance(); // Increment `offset`; return whether it then exceeds `contents`
|
||||||
|
};
|
||||||
|
|
||||||
|
struct ContentSpan {
|
||||||
|
std::shared_ptr<char[]> ptr;
|
||||||
|
size_t size;
|
||||||
|
};
|
||||||
|
|
||||||
|
struct IfStackEntry {
|
||||||
|
bool ranIfBlock; // Whether an IF/ELIF/ELSE block ran already
|
||||||
|
bool reachedElseBlock; // Whether an ELSE block ran already
|
||||||
|
};
|
||||||
|
|
||||||
|
struct LexerState {
|
||||||
|
std::string path;
|
||||||
|
|
||||||
|
LexerMode mode;
|
||||||
|
bool atLineStart;
|
||||||
|
uint32_t lineNo;
|
||||||
|
int lastToken;
|
||||||
|
int nextToken;
|
||||||
|
|
||||||
|
std::deque<IfStackEntry> ifStack; // Front is the innermost `IF` block
|
||||||
|
|
||||||
|
bool capturing; // Whether the text being lexed should be captured
|
||||||
|
size_t captureSize; // Amount of text captured
|
||||||
|
std::shared_ptr<std::vector<char>> captureBuf; // Buffer to send the captured text to if set
|
||||||
|
|
||||||
|
bool enableExpansions;
|
||||||
|
bool enableStringExpansions;
|
||||||
|
size_t expansionScanDistance; // Max distance already scanned for expansions
|
||||||
|
std::deque<Expansion> expansionStack; // Front is the innermost current expansion
|
||||||
|
|
||||||
|
ContentSpan content; // Span of chars
|
||||||
|
size_t offset = 0; // Cursor into `content.ptr`
|
||||||
|
|
||||||
|
~LexerState();
|
||||||
|
|
||||||
|
int peekChar();
|
||||||
|
int peekCharAhead();
|
||||||
|
|
||||||
|
void setAsCurrentState();
|
||||||
|
void setFileAsNextState(std::string const &filePath, bool updateStateNow);
|
||||||
|
void setViewAsNextState(char const *name, ContentSpan const &content_, uint32_t lineNo_);
|
||||||
|
|
||||||
|
void clear(uint32_t lineNo_);
|
||||||
|
};
|
||||||
|
|
||||||
|
void lexer_SetBinDigits(char const digits[2]);
|
||||||
|
void lexer_SetGfxDigits(char const digits[4]);
|
||||||
|
|
||||||
|
bool lexer_AtTopLevel();
|
||||||
|
void lexer_RestartRept(uint32_t lineNo);
|
||||||
|
void lexer_SetMode(LexerMode mode);
|
||||||
|
void lexer_ToggleStringExpansion(bool enable);
|
||||||
|
|
||||||
|
uint32_t lexer_GetIFDepth();
|
||||||
|
void lexer_IncIFDepth();
|
||||||
|
void lexer_DecIFDepth();
|
||||||
|
bool lexer_RanIFBlock();
|
||||||
|
bool lexer_ReachedELSEBlock();
|
||||||
|
void lexer_RunIFBlock();
|
||||||
|
void lexer_ReachELSEBlock();
|
||||||
|
|
||||||
|
void lexer_CheckRecursionDepth();
|
||||||
|
uint32_t lexer_GetLineNo();
|
||||||
|
void lexer_TraceStringExpansions();
|
||||||
|
|
||||||
|
struct Capture {
|
||||||
|
uint32_t lineNo;
|
||||||
|
ContentSpan span;
|
||||||
|
};
|
||||||
|
|
||||||
|
Capture lexer_CaptureRept();
|
||||||
|
Capture lexer_CaptureMacro();
|
||||||
|
|
||||||
|
#endif // RGBDS_ASM_LEXER_HPP
|
||||||
@@ -1,38 +0,0 @@
|
|||||||
/*
|
|
||||||
* This file is part of RGBDS.
|
|
||||||
*
|
|
||||||
* Copyright (c) 2020, Carsten Sorensen and RGBDS contributors.
|
|
||||||
*
|
|
||||||
* SPDX-License-Identifier: MIT
|
|
||||||
*/
|
|
||||||
|
|
||||||
#ifndef RGBDS_MACRO_H
|
|
||||||
#define RGBDS_MACRO_H
|
|
||||||
|
|
||||||
#include <stdint.h>
|
|
||||||
#include <stdbool.h>
|
|
||||||
#include <stdlib.h>
|
|
||||||
|
|
||||||
#include "asm/warning.h"
|
|
||||||
|
|
||||||
#include "helpers.h"
|
|
||||||
|
|
||||||
struct MacroArgs;
|
|
||||||
|
|
||||||
struct MacroArgs *macro_GetCurrentArgs(void);
|
|
||||||
struct MacroArgs *macro_NewArgs(void);
|
|
||||||
void macro_AppendArg(struct MacroArgs **args, char *s);
|
|
||||||
void macro_UseNewArgs(struct MacroArgs *args);
|
|
||||||
void macro_FreeArgs(struct MacroArgs *args);
|
|
||||||
char const *macro_GetArg(uint32_t i);
|
|
||||||
char const *macro_GetAllArgs(void);
|
|
||||||
|
|
||||||
uint32_t macro_GetUniqueID(void);
|
|
||||||
char const *macro_GetUniqueIDStr(void);
|
|
||||||
void macro_SetUniqueID(uint32_t id);
|
|
||||||
uint32_t macro_UseNewUniqueID(void);
|
|
||||||
uint32_t macro_UndefUniqueID(void);
|
|
||||||
void macro_ShiftCurrentArgs(int32_t count);
|
|
||||||
uint32_t macro_NbArgs(void);
|
|
||||||
|
|
||||||
#endif // RGBDS_MACRO_H
|
|
||||||
@@ -0,0 +1,23 @@
|
|||||||
|
// SPDX-License-Identifier: MIT
|
||||||
|
|
||||||
|
#ifndef RGBDS_ASM_MACRO_HPP
|
||||||
|
#define RGBDS_ASM_MACRO_HPP
|
||||||
|
|
||||||
|
#include <memory>
|
||||||
|
#include <stdint.h>
|
||||||
|
#include <string>
|
||||||
|
#include <vector>
|
||||||
|
|
||||||
|
struct MacroArgs {
|
||||||
|
uint32_t shift;
|
||||||
|
std::vector<std::shared_ptr<std::string>> args;
|
||||||
|
|
||||||
|
uint32_t nbArgs() const { return args.size() - shift; }
|
||||||
|
std::shared_ptr<std::string> getArg(int32_t num) const;
|
||||||
|
std::shared_ptr<std::string> getAllArgs() const;
|
||||||
|
|
||||||
|
void appendArg(std::shared_ptr<std::string> arg);
|
||||||
|
void shiftArgs(int32_t count);
|
||||||
|
};
|
||||||
|
|
||||||
|
#endif // RGBDS_ASM_MACRO_HPP
|
||||||
@@ -1,31 +0,0 @@
|
|||||||
/*
|
|
||||||
* This file is part of RGBDS.
|
|
||||||
*
|
|
||||||
* Copyright (c) 1997-2021, Carsten Sorensen and RGBDS contributors.
|
|
||||||
*
|
|
||||||
* SPDX-License-Identifier: MIT
|
|
||||||
*/
|
|
||||||
|
|
||||||
#ifndef RGBDS_MAIN_H
|
|
||||||
#define RGBDS_MAIN_H
|
|
||||||
|
|
||||||
#include <stdbool.h>
|
|
||||||
#include <stdint.h>
|
|
||||||
#include <stdio.h>
|
|
||||||
|
|
||||||
#include "helpers.h"
|
|
||||||
|
|
||||||
extern bool haltnop;
|
|
||||||
extern bool warnOnHaltNop;
|
|
||||||
extern bool optimizeLoads;
|
|
||||||
extern bool warnOnLdOpt;
|
|
||||||
extern bool verbose;
|
|
||||||
extern bool warnings; // True to enable warnings, false to disable them.
|
|
||||||
|
|
||||||
extern FILE *dependfile;
|
|
||||||
extern char *targetFileName;
|
|
||||||
extern bool generatedMissingIncludes;
|
|
||||||
extern bool failedOnMissingInclude;
|
|
||||||
extern bool generatePhonyDeps;
|
|
||||||
|
|
||||||
#endif // RGBDS_MAIN_H
|
|
||||||
@@ -0,0 +1,50 @@
|
|||||||
|
// SPDX-License-Identifier: MIT
|
||||||
|
|
||||||
|
#ifndef RGBDS_ASM_MAIN_HPP
|
||||||
|
#define RGBDS_ASM_MAIN_HPP
|
||||||
|
|
||||||
|
#include <optional>
|
||||||
|
#include <stdint.h>
|
||||||
|
#include <stdio.h>
|
||||||
|
#include <string>
|
||||||
|
|
||||||
|
#include "helpers.hpp" // assume
|
||||||
|
#include "util.hpp" // xfclose
|
||||||
|
|
||||||
|
enum MissingInclude {
|
||||||
|
INC_ERROR, // A missing included file is an error that halts assembly
|
||||||
|
GEN_EXIT, // A missing included file is assumed to be generated; exit normally
|
||||||
|
GEN_CONTINUE, // A missing included file is assumed to be generated; continue assembling
|
||||||
|
};
|
||||||
|
|
||||||
|
struct Options {
|
||||||
|
bool exportAll = false; // -E
|
||||||
|
uint8_t fixPrecision = 16; // -Q
|
||||||
|
size_t maxRecursionDepth = 64; // -r
|
||||||
|
char binDigits[2] = {'0', '1'}; // -b
|
||||||
|
char gfxDigits[4] = {'0', '1', '2', '3'}; // -g
|
||||||
|
FILE *dependFile = nullptr; // -M
|
||||||
|
std::optional<std::string> targetFileName{}; // -MQ, -MT
|
||||||
|
MissingInclude missingIncludeState = INC_ERROR; // -MC, -MG
|
||||||
|
bool generatePhonyDeps = false; // -MP
|
||||||
|
std::optional<std::string> objectFileName{}; // -o
|
||||||
|
uint8_t padByte = 0; // -p
|
||||||
|
uint64_t maxErrors = 0; // -X
|
||||||
|
|
||||||
|
~Options() {
|
||||||
|
if (dependFile) {
|
||||||
|
xfclose(dependFile);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
void printDep(std::string const &depName) {
|
||||||
|
if (dependFile) {
|
||||||
|
assume(targetFileName.has_value());
|
||||||
|
fprintf(dependFile, "%s: %s\n", targetFileName->c_str(), depName.c_str());
|
||||||
|
}
|
||||||
|
}
|
||||||
|
};
|
||||||
|
|
||||||
|
extern Options options;
|
||||||
|
|
||||||
|
#endif // RGBDS_ASM_MAIN_HPP
|
||||||
@@ -1,26 +0,0 @@
|
|||||||
/*
|
|
||||||
* This file is part of RGBDS.
|
|
||||||
*
|
|
||||||
* Copyright (c) 2021, Eldred Habert and RGBDS contributors.
|
|
||||||
*
|
|
||||||
* SPDX-License-Identifier: MIT
|
|
||||||
*/
|
|
||||||
|
|
||||||
#ifndef RGBDS_OPT_H
|
|
||||||
#define RGBDS_OPT_H
|
|
||||||
|
|
||||||
#include <stdbool.h>
|
|
||||||
#include <stdint.h>
|
|
||||||
|
|
||||||
void opt_B(char const chars[2]);
|
|
||||||
void opt_G(char const chars[4]);
|
|
||||||
void opt_P(uint8_t padByte);
|
|
||||||
void opt_Q(uint8_t precision);
|
|
||||||
void opt_L(bool optimize);
|
|
||||||
void opt_W(char const *flag);
|
|
||||||
void opt_Parse(char const *option);
|
|
||||||
|
|
||||||
void opt_Push(void);
|
|
||||||
void opt_Pop(void);
|
|
||||||
|
|
||||||
#endif // RGBDS_OPT_H
|
|
||||||
@@ -0,0 +1,19 @@
|
|||||||
|
// SPDX-License-Identifier: MIT
|
||||||
|
|
||||||
|
#ifndef RGBDS_ASM_OPT_HPP
|
||||||
|
#define RGBDS_ASM_OPT_HPP
|
||||||
|
|
||||||
|
#include <stdint.h>
|
||||||
|
|
||||||
|
void opt_B(char const binDigits[2]);
|
||||||
|
void opt_G(char const gfxDigits[4]);
|
||||||
|
void opt_P(uint8_t padByte);
|
||||||
|
void opt_Q(uint8_t fixPrecision);
|
||||||
|
void opt_W(char const *flag);
|
||||||
|
void opt_Parse(char const *option);
|
||||||
|
|
||||||
|
void opt_Push();
|
||||||
|
void opt_Pop();
|
||||||
|
void opt_CheckStack();
|
||||||
|
|
||||||
|
#endif // RGBDS_ASM_OPT_HPP
|
||||||
@@ -1,30 +0,0 @@
|
|||||||
/*
|
|
||||||
* This file is part of RGBDS.
|
|
||||||
*
|
|
||||||
* Copyright (c) 1997-2018, Carsten Sorensen and RGBDS contributors.
|
|
||||||
*
|
|
||||||
* SPDX-License-Identifier: MIT
|
|
||||||
*/
|
|
||||||
|
|
||||||
#ifndef RGBDS_ASM_OUTPUT_H
|
|
||||||
#define RGBDS_ASM_OUTPUT_H
|
|
||||||
|
|
||||||
#include <stdint.h>
|
|
||||||
|
|
||||||
#include "linkdefs.h"
|
|
||||||
|
|
||||||
struct Expression;
|
|
||||||
struct FileStackNode;
|
|
||||||
|
|
||||||
extern char *objectName;
|
|
||||||
extern struct Section *sectionList;
|
|
||||||
|
|
||||||
void out_RegisterNode(struct FileStackNode *node);
|
|
||||||
void out_ReplaceNode(struct FileStackNode *node);
|
|
||||||
void out_SetFileName(char *s);
|
|
||||||
void out_CreatePatch(uint32_t type, struct Expression const *expr, uint32_t ofs, uint32_t pcShift);
|
|
||||||
bool out_CreateAssert(enum AssertionType type, struct Expression const *expr,
|
|
||||||
char const *message, uint32_t ofs);
|
|
||||||
void out_WriteObject(void);
|
|
||||||
|
|
||||||
#endif // RGBDS_ASM_OUTPUT_H
|
|
||||||
@@ -0,0 +1,28 @@
|
|||||||
|
// SPDX-License-Identifier: MIT
|
||||||
|
|
||||||
|
#ifndef RGBDS_ASM_OUTPUT_HPP
|
||||||
|
#define RGBDS_ASM_OUTPUT_HPP
|
||||||
|
|
||||||
|
#include <memory>
|
||||||
|
#include <stdint.h>
|
||||||
|
#include <string>
|
||||||
|
#include <vector>
|
||||||
|
|
||||||
|
#include "linkdefs.hpp"
|
||||||
|
|
||||||
|
struct Expression;
|
||||||
|
struct FileStackNode;
|
||||||
|
struct Symbol;
|
||||||
|
|
||||||
|
enum StateFeature { STATE_EQU, STATE_VAR, STATE_EQUS, STATE_CHAR, STATE_MACRO, NB_STATE_FEATURES };
|
||||||
|
|
||||||
|
void out_RegisterNode(std::shared_ptr<FileStackNode> node);
|
||||||
|
void out_RegisterSymbol(Symbol &sym);
|
||||||
|
void out_CreatePatch(uint32_t type, Expression const &expr, uint32_t ofs, uint32_t pcShift);
|
||||||
|
void out_CreateAssert(
|
||||||
|
AssertionType type, Expression const &expr, std::string const &message, uint32_t ofs
|
||||||
|
);
|
||||||
|
void out_WriteObject();
|
||||||
|
void out_WriteState(std::string name, std::vector<StateFeature> const &features);
|
||||||
|
|
||||||
|
#endif // RGBDS_ASM_OUTPUT_HPP
|
||||||
@@ -1,66 +0,0 @@
|
|||||||
/*
|
|
||||||
* This file is part of RGBDS.
|
|
||||||
*
|
|
||||||
* Copyright (c) 1997-2018, Carsten Sorensen and RGBDS contributors.
|
|
||||||
*
|
|
||||||
* SPDX-License-Identifier: MIT
|
|
||||||
*/
|
|
||||||
|
|
||||||
#ifndef RGBDS_ASM_RPN_H
|
|
||||||
#define RGBDS_ASM_RPN_H
|
|
||||||
|
|
||||||
#include <stdint.h>
|
|
||||||
#include <stdbool.h>
|
|
||||||
|
|
||||||
#include "linkdefs.h"
|
|
||||||
|
|
||||||
#define MAXRPNLEN 1048576
|
|
||||||
|
|
||||||
struct Expression {
|
|
||||||
int32_t val; // If the expression's value is known, it's here
|
|
||||||
char *reason; // Why the expression is not known, if it isn't
|
|
||||||
bool isKnown; // Whether the expression's value is known
|
|
||||||
bool isSymbol; // Whether the expression represents a symbol
|
|
||||||
uint8_t *rpn; // Array of bytes serializing the RPN expression
|
|
||||||
uint32_t rpnCapacity; // Size of the `rpn` buffer
|
|
||||||
uint32_t rpnLength; // Used size of the `rpn` buffer
|
|
||||||
uint32_t rpnPatchSize; // Size the expression will take in the object file
|
|
||||||
};
|
|
||||||
|
|
||||||
// Determines if an expression is known at assembly time
|
|
||||||
static inline bool rpn_isKnown(struct Expression const *expr)
|
|
||||||
{
|
|
||||||
return expr->isKnown;
|
|
||||||
}
|
|
||||||
|
|
||||||
// Determines if an expression is a symbol suitable for const diffing
|
|
||||||
static inline bool rpn_isSymbol(const struct Expression *expr)
|
|
||||||
{
|
|
||||||
return expr->isSymbol;
|
|
||||||
}
|
|
||||||
|
|
||||||
void rpn_Symbol(struct Expression *expr, char const *symName);
|
|
||||||
void rpn_Number(struct Expression *expr, uint32_t i);
|
|
||||||
void rpn_LOGNOT(struct Expression *expr, const struct Expression *src);
|
|
||||||
struct Symbol const *rpn_SymbolOf(struct Expression const *expr);
|
|
||||||
bool rpn_IsDiffConstant(struct Expression const *src, struct Symbol const *symName);
|
|
||||||
void rpn_BinaryOp(enum RPNCommand op, struct Expression *expr,
|
|
||||||
const struct Expression *src1,
|
|
||||||
const struct Expression *src2);
|
|
||||||
void rpn_HIGH(struct Expression *expr, const struct Expression *src);
|
|
||||||
void rpn_LOW(struct Expression *expr, const struct Expression *src);
|
|
||||||
void rpn_ISCONST(struct Expression *expr, const struct Expression *src);
|
|
||||||
void rpn_UNNEG(struct Expression *expr, const struct Expression *src);
|
|
||||||
void rpn_UNNOT(struct Expression *expr, const struct Expression *src);
|
|
||||||
void rpn_BankSymbol(struct Expression *expr, char const *symName);
|
|
||||||
void rpn_BankSection(struct Expression *expr, char const *sectionName);
|
|
||||||
void rpn_BankSelf(struct Expression *expr);
|
|
||||||
void rpn_SizeOfSection(struct Expression *expr, char const *sectionName);
|
|
||||||
void rpn_StartOfSection(struct Expression *expr, char const *sectionName);
|
|
||||||
void rpn_Free(struct Expression *expr);
|
|
||||||
void rpn_CheckHRAM(struct Expression *expr, const struct Expression *src);
|
|
||||||
void rpn_CheckRST(struct Expression *expr, const struct Expression *src);
|
|
||||||
void rpn_CheckNBit(struct Expression const *expr, uint8_t n);
|
|
||||||
int32_t rpn_GetConstVal(struct Expression const *expr);
|
|
||||||
|
|
||||||
#endif // RGBDS_ASM_RPN_H
|
|
||||||
@@ -0,0 +1,66 @@
|
|||||||
|
// SPDX-License-Identifier: MIT
|
||||||
|
|
||||||
|
#ifndef RGBDS_ASM_RPN_HPP
|
||||||
|
#define RGBDS_ASM_RPN_HPP
|
||||||
|
|
||||||
|
#include <stdint.h>
|
||||||
|
#include <string>
|
||||||
|
#include <variant>
|
||||||
|
#include <vector>
|
||||||
|
|
||||||
|
#include "linkdefs.hpp"
|
||||||
|
|
||||||
|
#include "asm/intern.hpp"
|
||||||
|
|
||||||
|
struct Symbol;
|
||||||
|
|
||||||
|
struct RPNValue {
|
||||||
|
RPNCommand command; // The RPN_* command ID
|
||||||
|
std::variant<std::monostate, uint8_t, uint32_t, InternedStr> data; // Data after the ID, if any
|
||||||
|
|
||||||
|
RPNValue(RPNCommand cmd);
|
||||||
|
RPNValue(RPNCommand cmd, uint8_t val);
|
||||||
|
RPNValue(RPNCommand cmd, uint32_t val);
|
||||||
|
RPNValue(RPNCommand cmd, InternedStr name);
|
||||||
|
|
||||||
|
void appendEncoded(std::vector<uint8_t> &buffer) const;
|
||||||
|
};
|
||||||
|
|
||||||
|
struct Expression {
|
||||||
|
std::variant<
|
||||||
|
int32_t, // If the expression's value is known, it's here
|
||||||
|
std::string // Why the expression is not known, if it isn't
|
||||||
|
>
|
||||||
|
data = 0;
|
||||||
|
std::vector<RPNValue> rpn{}; // Values to be serialized into the RPN expression
|
||||||
|
|
||||||
|
bool isKnown() const { return std::holds_alternative<int32_t>(data); }
|
||||||
|
int32_t value() const { return std::get<int32_t>(data); }
|
||||||
|
|
||||||
|
int32_t getConstVal() const;
|
||||||
|
Symbol const *symbolOf() const;
|
||||||
|
bool isDiffConstant(Symbol const *symName) const;
|
||||||
|
|
||||||
|
void makeNumber(uint32_t value);
|
||||||
|
void makeSymbol(InternedStr symName);
|
||||||
|
void makeBankSymbol(InternedStr symName);
|
||||||
|
void makeBankSection(std::string const §Name);
|
||||||
|
void makeSizeOfSection(std::string const §Name);
|
||||||
|
void makeStartOfSection(std::string const §Name);
|
||||||
|
void makeSizeOfSectionType(SectionType type);
|
||||||
|
void makeStartOfSectionType(SectionType type);
|
||||||
|
void makeUnaryOp(RPNCommand op, Expression &&src);
|
||||||
|
void makeBinaryOp(RPNCommand op, Expression &&src1, Expression const &src2);
|
||||||
|
|
||||||
|
void addCheckHRAM();
|
||||||
|
void addCheckRST();
|
||||||
|
void addCheckBitIndex(uint8_t mask);
|
||||||
|
|
||||||
|
void checkNBit(uint8_t n) const;
|
||||||
|
|
||||||
|
void encode(std::vector<uint8_t> &buffer) const;
|
||||||
|
};
|
||||||
|
|
||||||
|
bool checkNBit(int32_t v, uint8_t n, char const *name);
|
||||||
|
|
||||||
|
#endif // RGBDS_ASM_RPN_HPP
|
||||||
@@ -1,82 +0,0 @@
|
|||||||
/*
|
|
||||||
* This file is part of RGBDS.
|
|
||||||
*
|
|
||||||
* Copyright (c) 2020, Carsten Sorensen and RGBDS contributors.
|
|
||||||
*
|
|
||||||
* SPDX-License-Identifier: MIT
|
|
||||||
*/
|
|
||||||
|
|
||||||
#ifndef RGBDS_SECTION_H
|
|
||||||
#define RGBDS_SECTION_H
|
|
||||||
|
|
||||||
#include <stdint.h>
|
|
||||||
#include <stdbool.h>
|
|
||||||
|
|
||||||
#include "linkdefs.h"
|
|
||||||
#include "platform.h" // NONNULL
|
|
||||||
|
|
||||||
extern uint8_t fillByte;
|
|
||||||
|
|
||||||
struct Expression;
|
|
||||||
|
|
||||||
struct Section {
|
|
||||||
char *name;
|
|
||||||
enum SectionType type;
|
|
||||||
enum SectionModifier modifier;
|
|
||||||
struct FileStackNode *src; // Where the section was defined
|
|
||||||
uint32_t fileLine; // Line where the section was defined
|
|
||||||
uint32_t size;
|
|
||||||
uint32_t org;
|
|
||||||
uint32_t bank;
|
|
||||||
uint8_t align; // Exactly as specified in `ALIGN[]`
|
|
||||||
uint16_t alignOfs;
|
|
||||||
struct Section *next;
|
|
||||||
struct Patch *patches;
|
|
||||||
uint8_t *data;
|
|
||||||
};
|
|
||||||
|
|
||||||
struct SectionSpec {
|
|
||||||
uint32_t bank;
|
|
||||||
uint8_t alignment;
|
|
||||||
uint16_t alignOfs;
|
|
||||||
};
|
|
||||||
|
|
||||||
extern struct Section *currentSection;
|
|
||||||
|
|
||||||
struct Section *sect_FindSectionByName(char const *name);
|
|
||||||
void sect_NewSection(char const *name, uint32_t secttype, uint32_t org,
|
|
||||||
struct SectionSpec const *attributes, enum SectionModifier mod);
|
|
||||||
void sect_SetLoadSection(char const *name, uint32_t secttype, uint32_t org,
|
|
||||||
struct SectionSpec const *attributes, enum SectionModifier mod);
|
|
||||||
void sect_EndLoadSection(void);
|
|
||||||
|
|
||||||
struct Section *sect_GetSymbolSection(void);
|
|
||||||
uint32_t sect_GetSymbolOffset(void);
|
|
||||||
uint32_t sect_GetOutputOffset(void);
|
|
||||||
void sect_AlignPC(uint8_t alignment, uint16_t offset);
|
|
||||||
|
|
||||||
void sect_StartUnion(void);
|
|
||||||
void sect_NextUnionMember(void);
|
|
||||||
void sect_EndUnion(void);
|
|
||||||
void sect_CheckUnionClosed(void);
|
|
||||||
|
|
||||||
void sect_AbsByte(uint8_t b);
|
|
||||||
void sect_AbsByteGroup(uint8_t const *s, size_t length);
|
|
||||||
void sect_AbsWordGroup(uint8_t const *s, size_t length);
|
|
||||||
void sect_AbsLongGroup(uint8_t const *s, size_t length);
|
|
||||||
void sect_Skip(uint32_t skip, bool ds);
|
|
||||||
void sect_String(char const *s);
|
|
||||||
void sect_RelByte(struct Expression *expr, uint32_t pcShift);
|
|
||||||
void sect_RelBytes(uint32_t n, struct Expression *exprs, size_t size);
|
|
||||||
void sect_RelWord(struct Expression *expr, uint32_t pcShift);
|
|
||||||
void sect_RelLong(struct Expression *expr, uint32_t pcShift);
|
|
||||||
void sect_PCRelByte(struct Expression *expr, uint32_t pcShift);
|
|
||||||
void sect_BinaryFile(char const *s, int32_t startPos);
|
|
||||||
void sect_BinaryFileSlice(char const *s, int32_t start_pos, int32_t length);
|
|
||||||
|
|
||||||
void sect_PushSection(void);
|
|
||||||
void sect_PopSection(void);
|
|
||||||
|
|
||||||
bool sect_IsSizeKnown(struct Section const NONNULL(name));
|
|
||||||
|
|
||||||
#endif // RGBDS_SECTION_H
|
|
||||||
@@ -0,0 +1,113 @@
|
|||||||
|
// SPDX-License-Identifier: MIT
|
||||||
|
|
||||||
|
#ifndef RGBDS_ASM_SECTION_HPP
|
||||||
|
#define RGBDS_ASM_SECTION_HPP
|
||||||
|
|
||||||
|
#include <deque>
|
||||||
|
#include <memory>
|
||||||
|
#include <optional>
|
||||||
|
#include <stddef.h>
|
||||||
|
#include <stdint.h>
|
||||||
|
#include <string>
|
||||||
|
#include <vector>
|
||||||
|
|
||||||
|
#include "intern.hpp"
|
||||||
|
#include "linkdefs.hpp"
|
||||||
|
|
||||||
|
struct Expression;
|
||||||
|
struct FileStackNode;
|
||||||
|
struct Section;
|
||||||
|
|
||||||
|
struct Patch {
|
||||||
|
std::shared_ptr<FileStackNode> src;
|
||||||
|
uint32_t lineNo;
|
||||||
|
uint32_t offset;
|
||||||
|
Section *pcSection;
|
||||||
|
uint32_t pcOffset;
|
||||||
|
uint8_t type;
|
||||||
|
std::vector<uint8_t> rpn;
|
||||||
|
};
|
||||||
|
|
||||||
|
struct Section {
|
||||||
|
std::string name;
|
||||||
|
SectionType type;
|
||||||
|
SectionModifier modifier;
|
||||||
|
std::shared_ptr<FileStackNode> src; // Where the section was defined
|
||||||
|
uint32_t fileLine; // Line where the section was defined
|
||||||
|
uint32_t size;
|
||||||
|
uint32_t org;
|
||||||
|
uint32_t bank;
|
||||||
|
uint8_t align; // Exactly as specified in `ALIGN[]`
|
||||||
|
uint16_t alignOfs;
|
||||||
|
std::deque<Patch> patches;
|
||||||
|
std::vector<uint8_t> data;
|
||||||
|
|
||||||
|
uint32_t getID() const; // ID of the section in the object file (`UINT32_MAX` if none)
|
||||||
|
bool isSizeKnown() const;
|
||||||
|
};
|
||||||
|
|
||||||
|
struct SectionSpec {
|
||||||
|
uint32_t bank;
|
||||||
|
uint8_t alignment;
|
||||||
|
uint16_t alignOfs;
|
||||||
|
};
|
||||||
|
|
||||||
|
size_t sect_CountSections();
|
||||||
|
void sect_ForEach(void (*callback)(Section &));
|
||||||
|
|
||||||
|
Section *sect_FindSectionByName(std::string const &name);
|
||||||
|
void sect_NewSection(
|
||||||
|
std::string const &name,
|
||||||
|
SectionType type,
|
||||||
|
uint32_t org,
|
||||||
|
SectionSpec const &attrs,
|
||||||
|
SectionModifier mod
|
||||||
|
);
|
||||||
|
void sect_SetLoadSection(
|
||||||
|
std::string const &name,
|
||||||
|
SectionType type,
|
||||||
|
uint32_t org,
|
||||||
|
SectionSpec const &attrs,
|
||||||
|
SectionModifier mod
|
||||||
|
);
|
||||||
|
void sect_EndLoadSection(char const *cause);
|
||||||
|
void sect_CheckLoadClosed();
|
||||||
|
|
||||||
|
Section *sect_GetSymbolSection();
|
||||||
|
uint32_t sect_GetSymbolOffset();
|
||||||
|
uint32_t sect_GetOutputOffset();
|
||||||
|
std::optional<uint32_t> sect_GetOutputBank();
|
||||||
|
|
||||||
|
Patch *sect_AddOutputPatch();
|
||||||
|
|
||||||
|
uint32_t sect_GetAlignBytes(uint8_t alignment, uint16_t offset);
|
||||||
|
void sect_AlignPC(uint8_t alignment, uint16_t offset);
|
||||||
|
|
||||||
|
void sect_CheckSizes();
|
||||||
|
|
||||||
|
void sect_StartUnion();
|
||||||
|
void sect_NextUnionMember();
|
||||||
|
void sect_EndUnion();
|
||||||
|
void sect_CheckUnionClosed();
|
||||||
|
|
||||||
|
void sect_ConstByte(uint8_t byte);
|
||||||
|
void sect_ByteString(std::vector<int32_t> const &str);
|
||||||
|
void sect_WordString(std::vector<int32_t> const &str);
|
||||||
|
void sect_LongString(std::vector<int32_t> const &str);
|
||||||
|
void sect_Skip(uint32_t skip, bool ds);
|
||||||
|
void sect_RelByte(Expression const &expr, uint32_t pcShift);
|
||||||
|
void sect_RelBytes(uint32_t n, std::vector<Expression> const &exprs);
|
||||||
|
void sect_RelWord(Expression const &expr, uint32_t pcShift);
|
||||||
|
void sect_RelLong(Expression const &expr, uint32_t pcShift);
|
||||||
|
void sect_PCRelByte(Expression const &expr, uint32_t pcShift);
|
||||||
|
bool sect_BinaryFile(std::string const &name, uint32_t startPos);
|
||||||
|
bool sect_BinaryFileSlice(std::string const &name, uint32_t startPos, uint32_t length);
|
||||||
|
|
||||||
|
void sect_EndSection();
|
||||||
|
void sect_PushSection();
|
||||||
|
void sect_PopSection();
|
||||||
|
void sect_CheckStack();
|
||||||
|
|
||||||
|
InternedStr sect_PushSectionFragmentLiteral();
|
||||||
|
|
||||||
|
#endif // RGBDS_ASM_SECTION_HPP
|
||||||
@@ -1,144 +0,0 @@
|
|||||||
/*
|
|
||||||
* This file is part of RGBDS.
|
|
||||||
*
|
|
||||||
* Copyright (c) 1997-2020, Carsten Sorensen and RGBDS contributors.
|
|
||||||
*
|
|
||||||
* SPDX-License-Identifier: MIT
|
|
||||||
*/
|
|
||||||
|
|
||||||
#ifndef RGBDS_SYMBOL_H
|
|
||||||
#define RGBDS_SYMBOL_H
|
|
||||||
|
|
||||||
#include <stdbool.h>
|
|
||||||
#include <stdint.h>
|
|
||||||
#include <string.h>
|
|
||||||
#include <time.h>
|
|
||||||
|
|
||||||
#include "asm/section.h"
|
|
||||||
|
|
||||||
#include "platform.h" // MIN_NB_ELMS
|
|
||||||
|
|
||||||
#define MAXSYMLEN 255
|
|
||||||
|
|
||||||
enum SymbolType {
|
|
||||||
SYM_LABEL,
|
|
||||||
SYM_EQU,
|
|
||||||
SYM_VAR,
|
|
||||||
SYM_MACRO,
|
|
||||||
SYM_EQUS,
|
|
||||||
SYM_REF // Forward reference to a label
|
|
||||||
};
|
|
||||||
|
|
||||||
struct Symbol {
|
|
||||||
char name[MAXSYMLEN + 1];
|
|
||||||
enum SymbolType type;
|
|
||||||
bool isExported; // Whether the symbol is to be exported
|
|
||||||
bool isBuiltin; // Whether the symbol is a built-in
|
|
||||||
struct Section *section;
|
|
||||||
struct FileStackNode *src; // Where the symbol was defined
|
|
||||||
uint32_t fileLine; // Line where the symbol was defined
|
|
||||||
|
|
||||||
bool hasCallback;
|
|
||||||
union {
|
|
||||||
// If sym_IsNumeric
|
|
||||||
int32_t value;
|
|
||||||
int32_t (*numCallback)(void);
|
|
||||||
// For SYM_MACRO and SYM_EQUS; TODO: have separate fields
|
|
||||||
struct {
|
|
||||||
size_t macroSize;
|
|
||||||
char *macro;
|
|
||||||
};
|
|
||||||
// For SYM_EQUS
|
|
||||||
char const *(*strCallback)(void);
|
|
||||||
};
|
|
||||||
|
|
||||||
uint32_t ID; // ID of the symbol in the object file (-1 if none)
|
|
||||||
struct Symbol *next; // Next object to output in the object file
|
|
||||||
};
|
|
||||||
|
|
||||||
bool sym_IsPC(struct Symbol const *sym);
|
|
||||||
|
|
||||||
static inline bool sym_IsDefined(struct Symbol const *sym)
|
|
||||||
{
|
|
||||||
return sym->type != SYM_REF;
|
|
||||||
}
|
|
||||||
|
|
||||||
static inline struct Section *sym_GetSection(struct Symbol const *sym)
|
|
||||||
{
|
|
||||||
return sym_IsPC(sym) ? sect_GetSymbolSection() : sym->section;
|
|
||||||
}
|
|
||||||
|
|
||||||
static inline bool sym_IsConstant(struct Symbol const *sym)
|
|
||||||
{
|
|
||||||
if (sym->type == SYM_LABEL) {
|
|
||||||
struct Section const *sect = sym_GetSection(sym);
|
|
||||||
|
|
||||||
return sect && sect->org != (uint32_t)-1;
|
|
||||||
}
|
|
||||||
return sym->type == SYM_EQU || sym->type == SYM_VAR;
|
|
||||||
}
|
|
||||||
|
|
||||||
static inline bool sym_IsNumeric(struct Symbol const *sym)
|
|
||||||
{
|
|
||||||
return sym->type == SYM_LABEL || sym->type == SYM_EQU || sym->type == SYM_VAR;
|
|
||||||
}
|
|
||||||
|
|
||||||
static inline bool sym_IsLabel(struct Symbol const *sym)
|
|
||||||
{
|
|
||||||
return sym->type == SYM_LABEL || sym->type == SYM_REF;
|
|
||||||
}
|
|
||||||
|
|
||||||
static inline bool sym_IsLocal(struct Symbol const *sym)
|
|
||||||
{
|
|
||||||
return sym_IsLabel(sym) && strchr(sym->name, '.');
|
|
||||||
}
|
|
||||||
|
|
||||||
static inline bool sym_IsExported(struct Symbol const *sym)
|
|
||||||
{
|
|
||||||
return sym->isExported;
|
|
||||||
}
|
|
||||||
|
|
||||||
// Get a string equate's value
|
|
||||||
static inline char const *sym_GetStringValue(struct Symbol const *sym)
|
|
||||||
{
|
|
||||||
if (sym->hasCallback)
|
|
||||||
return sym->strCallback();
|
|
||||||
return sym->macro;
|
|
||||||
}
|
|
||||||
|
|
||||||
void sym_ForEach(void (*func)(struct Symbol *, void *), void *arg);
|
|
||||||
|
|
||||||
int32_t sym_GetValue(struct Symbol const *sym);
|
|
||||||
void sym_SetExportAll(bool set);
|
|
||||||
struct Symbol *sym_AddLocalLabel(char const *symName);
|
|
||||||
struct Symbol *sym_AddLabel(char const *symName);
|
|
||||||
struct Symbol *sym_AddAnonLabel(void);
|
|
||||||
void sym_WriteAnonLabelName(char buf[MIN_NB_ELMS(MAXSYMLEN + 1)], uint32_t ofs, bool neg);
|
|
||||||
void sym_Export(char const *symName);
|
|
||||||
struct Symbol *sym_AddEqu(char const *symName, int32_t value);
|
|
||||||
struct Symbol *sym_RedefEqu(char const *symName, int32_t value);
|
|
||||||
struct Symbol *sym_AddVar(char const *symName, int32_t value);
|
|
||||||
uint32_t sym_GetPCValue(void);
|
|
||||||
uint32_t sym_GetConstantSymValue(struct Symbol const *sym);
|
|
||||||
uint32_t sym_GetConstantValue(char const *symName);
|
|
||||||
// Find a symbol by exact name, bypassing expansion checks
|
|
||||||
struct Symbol *sym_FindExactSymbol(char const *symName);
|
|
||||||
// Find a symbol by exact name; may not be scoped, produces an error if it is
|
|
||||||
struct Symbol *sym_FindUnscopedSymbol(char const *symName);
|
|
||||||
// Find a symbol, possibly scoped, by name
|
|
||||||
struct Symbol *sym_FindScopedSymbol(char const *symName);
|
|
||||||
// Find a scoped symbol by name; do not return `@` or `_NARG` when they have no value
|
|
||||||
struct Symbol *sym_FindScopedValidSymbol(char const *symName);
|
|
||||||
struct Symbol const *sym_GetPC(void);
|
|
||||||
struct Symbol *sym_AddMacro(char const *symName, int32_t defLineNo, char *body, size_t size);
|
|
||||||
struct Symbol *sym_Ref(char const *symName);
|
|
||||||
struct Symbol *sym_AddString(char const *symName, char const *value);
|
|
||||||
struct Symbol *sym_RedefString(char const *symName, char const *value);
|
|
||||||
void sym_Purge(char const *symName);
|
|
||||||
void sym_Init(time_t now);
|
|
||||||
|
|
||||||
// Functions to save and restore the current symbol scope.
|
|
||||||
char const *sym_GetCurrentSymbolScope(void);
|
|
||||||
void sym_SetCurrentSymbolScope(char const *newScope);
|
|
||||||
|
|
||||||
#endif // RGBDS_SYMBOL_H
|
|
||||||
@@ -0,0 +1,107 @@
|
|||||||
|
// SPDX-License-Identifier: MIT
|
||||||
|
|
||||||
|
#ifndef RGBDS_ASM_SYMBOL_HPP
|
||||||
|
#define RGBDS_ASM_SYMBOL_HPP
|
||||||
|
|
||||||
|
#include <memory>
|
||||||
|
#include <stdint.h>
|
||||||
|
#include <string>
|
||||||
|
#include <time.h>
|
||||||
|
#include <utility>
|
||||||
|
#include <variant>
|
||||||
|
|
||||||
|
#include "asm/intern.hpp"
|
||||||
|
#include "asm/lexer.hpp"
|
||||||
|
#include "asm/section.hpp"
|
||||||
|
|
||||||
|
enum SymbolType {
|
||||||
|
SYM_LABEL,
|
||||||
|
SYM_EQU,
|
||||||
|
SYM_VAR,
|
||||||
|
SYM_MACRO,
|
||||||
|
SYM_EQUS,
|
||||||
|
SYM_REF // Forward reference to a label
|
||||||
|
};
|
||||||
|
|
||||||
|
struct Symbol; // Forward declaration for `sym_IsPC`
|
||||||
|
bool sym_IsPC(Symbol const *sym); // Forward declaration for `getSection`
|
||||||
|
|
||||||
|
struct Symbol {
|
||||||
|
InternedStr name;
|
||||||
|
SymbolType type;
|
||||||
|
bool isBuiltin;
|
||||||
|
bool isExported; // Not relevant for SYM_MACRO or SYM_EQUS
|
||||||
|
bool isQuiet; // Only relevant for SYM_MACRO
|
||||||
|
Section *section;
|
||||||
|
std::shared_ptr<FileStackNode> src; // Where the symbol was defined
|
||||||
|
uint32_t fileLine; // Line where the symbol was defined
|
||||||
|
|
||||||
|
std::variant<
|
||||||
|
int32_t, // If isNumeric()
|
||||||
|
int32_t (*)(), // If isNumeric() via a callback
|
||||||
|
ContentSpan, // For SYM_MACRO
|
||||||
|
std::shared_ptr<std::string>, // For SYM_EQUS
|
||||||
|
std::shared_ptr<std::string> (*)() // For SYM_EQUS via a callback
|
||||||
|
>
|
||||||
|
data;
|
||||||
|
|
||||||
|
uint32_t ID; // ID of the symbol in the object file (`UINT32_MAX` if none)
|
||||||
|
uint32_t defIndex; // Ordering of the symbol in the state file
|
||||||
|
|
||||||
|
bool isDefined() const { return type != SYM_REF; }
|
||||||
|
bool isNumeric() const { return type == SYM_LABEL || type == SYM_EQU || type == SYM_VAR; }
|
||||||
|
bool isLabel() const { return type == SYM_LABEL || type == SYM_REF; }
|
||||||
|
|
||||||
|
bool isConstant() const {
|
||||||
|
if (type == SYM_LABEL) {
|
||||||
|
Section const *sect = getSection();
|
||||||
|
return sect && sect->org != UINT32_MAX;
|
||||||
|
}
|
||||||
|
return type == SYM_EQU || type == SYM_VAR;
|
||||||
|
}
|
||||||
|
|
||||||
|
Section *getSection() const { return sym_IsPC(this) ? sect_GetSymbolSection() : section; }
|
||||||
|
|
||||||
|
int32_t getValue() const;
|
||||||
|
int32_t getOutputValue() const;
|
||||||
|
ContentSpan const &getMacro() const;
|
||||||
|
std::shared_ptr<std::string> getEqus() const;
|
||||||
|
uint32_t getConstantValue() const;
|
||||||
|
};
|
||||||
|
|
||||||
|
bool sym_IsDotScope(InternedStr symName);
|
||||||
|
|
||||||
|
void sym_ForEach(void (*callback)(Symbol &));
|
||||||
|
|
||||||
|
Symbol *sym_AddLocalLabel(InternedStr symName);
|
||||||
|
Symbol *sym_AddLabel(InternedStr symName);
|
||||||
|
Symbol *sym_AddAnonLabel();
|
||||||
|
InternedStr sym_MakeAnonLabelName(uint32_t ofs, bool neg);
|
||||||
|
void sym_Export(InternedStr symName);
|
||||||
|
Symbol *sym_AddEqu(InternedStr symName, int32_t value);
|
||||||
|
Symbol *sym_RedefEqu(InternedStr symName, int32_t value);
|
||||||
|
Symbol *sym_AddVar(InternedStr symName, int32_t value);
|
||||||
|
int32_t sym_GetRSValue();
|
||||||
|
void sym_SetRSValue(int32_t value);
|
||||||
|
// Find a symbol by exact name, bypassing expansion checks
|
||||||
|
Symbol *sym_FindExactSymbol(InternedStr symName);
|
||||||
|
// Find a symbol, possibly scoped, by name
|
||||||
|
Symbol *sym_FindScopedSymbol(InternedStr symName);
|
||||||
|
// Find a scoped symbol by name; do not return `@` or `_NARG` when they have no value
|
||||||
|
Symbol *sym_FindScopedValidSymbol(InternedStr symName);
|
||||||
|
Symbol const *sym_GetPC();
|
||||||
|
Symbol *sym_AddMacro(InternedStr symName, int32_t defLineNo, ContentSpan const &span, bool isQuiet);
|
||||||
|
Symbol *sym_Ref(InternedStr symName);
|
||||||
|
Symbol *sym_AddString(InternedStr symName, std::shared_ptr<std::string> value);
|
||||||
|
Symbol *sym_RedefString(InternedStr symName, std::shared_ptr<std::string> value);
|
||||||
|
void sym_Purge(InternedStr symName);
|
||||||
|
bool sym_IsPurgedExact(InternedStr symName);
|
||||||
|
bool sym_IsPurgedScoped(InternedStr symName);
|
||||||
|
void sym_Init(time_t now);
|
||||||
|
|
||||||
|
// Functions to save and restore the current label scopes.
|
||||||
|
std::pair<Symbol const *, Symbol const *> sym_GetCurrentLabelScopes();
|
||||||
|
void sym_SetCurrentLabelScopes(std::pair<Symbol const *, Symbol const *> newScopes);
|
||||||
|
void sym_ResetCurrentLabelScopes();
|
||||||
|
|
||||||
|
#endif // RGBDS_ASM_SYMBOL_HPP
|
||||||
@@ -1,21 +0,0 @@
|
|||||||
/*
|
|
||||||
* This file is part of RGBDS.
|
|
||||||
*
|
|
||||||
* Copyright (c) 1997-2019, Carsten Sorensen and RGBDS contributors.
|
|
||||||
*
|
|
||||||
* SPDX-License-Identifier: MIT
|
|
||||||
*/
|
|
||||||
|
|
||||||
#ifndef RGBDS_UTIL_H
|
|
||||||
#define RGBDS_UTIL_H
|
|
||||||
|
|
||||||
#include <stdint.h>
|
|
||||||
|
|
||||||
char const *printChar(int c);
|
|
||||||
|
|
||||||
/*
|
|
||||||
* @return The number of bytes read, or 0 if invalid data was found
|
|
||||||
*/
|
|
||||||
size_t readUTF8Char(uint8_t *dest, char const *src);
|
|
||||||
|
|
||||||
#endif // RGBDS_UTIL_H
|
|
||||||
@@ -1,96 +0,0 @@
|
|||||||
/*
|
|
||||||
* This file is part of RGBDS.
|
|
||||||
*
|
|
||||||
* Copyright (c) 2019, Eldred Habert and RGBDS contributors.
|
|
||||||
*
|
|
||||||
* SPDX-License-Identifier: MIT
|
|
||||||
*/
|
|
||||||
|
|
||||||
#ifndef WARNING_H
|
|
||||||
#define WARNING_H
|
|
||||||
|
|
||||||
#include "helpers.h"
|
|
||||||
|
|
||||||
extern unsigned int nbErrors;
|
|
||||||
|
|
||||||
enum WarningState {
|
|
||||||
WARNING_DEFAULT,
|
|
||||||
WARNING_DISABLED,
|
|
||||||
WARNING_ENABLED,
|
|
||||||
WARNING_ERROR
|
|
||||||
};
|
|
||||||
|
|
||||||
enum WarningID {
|
|
||||||
WARNING_ASSERT, // Assertions
|
|
||||||
WARNING_BACKWARDS_FOR, // `for` loop with backwards range
|
|
||||||
WARNING_BUILTIN_ARG, // Invalid args to builtins
|
|
||||||
WARNING_CHARMAP_REDEF, // Charmap entry re-definition
|
|
||||||
WARNING_DIV, // Division undefined behavior
|
|
||||||
WARNING_EMPTY_DATA_DIRECTIVE, // `db`, `dw` or `dl` directive without data in ROM
|
|
||||||
WARNING_EMPTY_MACRO_ARG, // Empty macro argument
|
|
||||||
WARNING_EMPTY_STRRPL, // Empty second argument in `STRRPL`
|
|
||||||
WARNING_LARGE_CONSTANT, // Constants too large
|
|
||||||
WARNING_LONG_STR, // String too long for internal buffers
|
|
||||||
WARNING_MACRO_SHIFT, // Shift past available arguments in macro
|
|
||||||
WARNING_NESTED_COMMENT, // Comment-start delimiter in a block comment
|
|
||||||
WARNING_OBSOLETE, // Obsolete things
|
|
||||||
WARNING_SHIFT, // Shifting undefined behavior
|
|
||||||
WARNING_SHIFT_AMOUNT, // Strange shift amount
|
|
||||||
WARNING_USER, // User warnings
|
|
||||||
|
|
||||||
NB_PLAIN_WARNINGS,
|
|
||||||
|
|
||||||
// Warnings past this point are "parametric" warnings, only mapping to a single flag
|
|
||||||
#define PARAM_WARNINGS_START NB_PLAIN_WARNINGS
|
|
||||||
// Treating string as number may lose some bits
|
|
||||||
WARNING_NUMERIC_STRING_1 = PARAM_WARNINGS_START,
|
|
||||||
WARNING_NUMERIC_STRING_2,
|
|
||||||
// Implicit truncation loses some bits
|
|
||||||
WARNING_TRUNCATION_1,
|
|
||||||
WARNING_TRUNCATION_2,
|
|
||||||
// Character without charmap entry
|
|
||||||
WARNING_UNMAPPED_CHAR_1,
|
|
||||||
WARNING_UNMAPPED_CHAR_2,
|
|
||||||
|
|
||||||
NB_PLAIN_AND_PARAM_WARNINGS,
|
|
||||||
#define NB_PARAM_WARNINGS (NB_PLAIN_AND_PARAM_WARNINGS - PARAM_WARNINGS_START)
|
|
||||||
|
|
||||||
// Warnings past this point are "meta" warnings
|
|
||||||
#define META_WARNINGS_START NB_PLAIN_AND_PARAM_WARNINGS
|
|
||||||
WARNING_ALL = META_WARNINGS_START,
|
|
||||||
WARNING_EXTRA,
|
|
||||||
WARNING_EVERYTHING,
|
|
||||||
|
|
||||||
NB_WARNINGS,
|
|
||||||
#define NB_META_WARNINGS (NB_WARNINGS - META_WARNINGS_START)
|
|
||||||
};
|
|
||||||
|
|
||||||
extern enum WarningState warningStates[NB_PLAIN_AND_PARAM_WARNINGS];
|
|
||||||
extern bool warningsAreErrors;
|
|
||||||
|
|
||||||
void processWarningFlag(char *flag);
|
|
||||||
|
|
||||||
/*
|
|
||||||
* Used to warn the user about problems that don't prevent the generation of
|
|
||||||
* valid code.
|
|
||||||
*/
|
|
||||||
void warning(enum WarningID id, char const *fmt, ...) format_(printf, 2, 3);
|
|
||||||
|
|
||||||
/*
|
|
||||||
* Used for errors that compromise the whole assembly process by affecting the
|
|
||||||
* following code, potencially making the assembler generate errors caused by
|
|
||||||
* the first one and unrelated to the code that the assembler complains about.
|
|
||||||
* It is also used when the assembler goes into an invalid state (for example,
|
|
||||||
* when it fails to allocate memory).
|
|
||||||
*/
|
|
||||||
_Noreturn void fatalerror(char const *fmt, ...) format_(printf, 1, 2);
|
|
||||||
|
|
||||||
/*
|
|
||||||
* Used for errors that make it impossible to assemble correctly, but don't
|
|
||||||
* affect the following code. The code will fail to assemble but the user will
|
|
||||||
* get a list of all errors at the end, making it easier to fix all of them at
|
|
||||||
* once.
|
|
||||||
*/
|
|
||||||
void error(char const *fmt, ...) format_(printf, 1, 2);
|
|
||||||
|
|
||||||
#endif // WARNING_H
|
|
||||||
@@ -0,0 +1,89 @@
|
|||||||
|
// SPDX-License-Identifier: MIT
|
||||||
|
|
||||||
|
#ifndef RGBDS_ASM_WARNING_HPP
|
||||||
|
#define RGBDS_ASM_WARNING_HPP
|
||||||
|
|
||||||
|
#include <functional>
|
||||||
|
|
||||||
|
#include "diagnostics.hpp"
|
||||||
|
|
||||||
|
enum WarningLevel {
|
||||||
|
LEVEL_DEFAULT, // Warnings that are enabled by default
|
||||||
|
LEVEL_ALL, // Warnings that probably indicate an error
|
||||||
|
LEVEL_EXTRA, // Warnings that are less likely to indicate an error
|
||||||
|
LEVEL_EVERYTHING, // Literally every warning
|
||||||
|
};
|
||||||
|
|
||||||
|
enum WarningID {
|
||||||
|
WARNING_ASSERT, // Assertions
|
||||||
|
WARNING_BACKWARDS_FOR, // `FOR` loop with backwards range
|
||||||
|
WARNING_BUILTIN_ARG, // Invalid args to builtins
|
||||||
|
WARNING_CHARMAP_REDEF, // Charmap entry re-definition
|
||||||
|
WARNING_DIV, // Undefined division behavior
|
||||||
|
WARNING_EMPTY_DATA_DIRECTIVE, // `db`, `dw` or `dl` directive without data in ROM
|
||||||
|
WARNING_EMPTY_MACRO_ARG, // Empty macro argument
|
||||||
|
WARNING_EMPTY_STRRPL, // Empty second argument in `STRRPL`
|
||||||
|
WARNING_EXPORT_UNDEFINED, // `EXPORT` of an undefined symbol
|
||||||
|
WARNING_LARGE_CONSTANT, // Constants too large
|
||||||
|
WARNING_MACRO_SHIFT, // `SHIFT` past available arguments in macro
|
||||||
|
WARNING_NESTED_COMMENT, // Comment-start delimiter in a block comment
|
||||||
|
WARNING_OBSOLETE, // Obsolete/deprecated things
|
||||||
|
WARNING_SHIFT, // Undefined `SHIFT` behavior
|
||||||
|
WARNING_SHIFT_AMOUNT, // Strange `SHIFT` amount
|
||||||
|
WARNING_UNMATCHED_DIRECTIVE, // `PUSH[C|O|S]` without `POP[C|O|S]`
|
||||||
|
WARNING_UNTERMINATED_LOAD, // `LOAD` without `ENDL`
|
||||||
|
WARNING_USER, // User-defined `WARN`ings
|
||||||
|
|
||||||
|
NB_PLAIN_WARNINGS,
|
||||||
|
|
||||||
|
// Warnings past this point are "parametric" warnings, only mapping to a single flag
|
||||||
|
// Treating string as number may lose some bits
|
||||||
|
WARNING_NUMERIC_STRING_1 = NB_PLAIN_WARNINGS,
|
||||||
|
WARNING_NUMERIC_STRING_2,
|
||||||
|
// Purging an exported symbol or label
|
||||||
|
WARNING_PURGE_1,
|
||||||
|
WARNING_PURGE_2,
|
||||||
|
// Implicit truncation loses some bits
|
||||||
|
WARNING_TRUNCATION_1,
|
||||||
|
WARNING_TRUNCATION_2,
|
||||||
|
// Character without charmap entry
|
||||||
|
WARNING_UNMAPPED_CHAR_1,
|
||||||
|
WARNING_UNMAPPED_CHAR_2,
|
||||||
|
|
||||||
|
NB_WARNINGS,
|
||||||
|
};
|
||||||
|
|
||||||
|
extern Diagnostics<WarningLevel, WarningID> warnings;
|
||||||
|
|
||||||
|
// Used to warn the user about problems that don't prevent the generation of
|
||||||
|
// valid code.
|
||||||
|
[[gnu::format(printf, 2, 3)]]
|
||||||
|
void warning(WarningID id, char const *fmt, ...);
|
||||||
|
|
||||||
|
// Used for errors that compromise the whole assembly process by affecting the
|
||||||
|
// following code, potentially making the assembler generate errors caused by
|
||||||
|
// the first one and unrelated to the code that the assembler complains about.
|
||||||
|
// It is also used when the assembler goes into an invalid state (for example,
|
||||||
|
// when it fails to allocate memory).
|
||||||
|
[[gnu::format(printf, 1, 2), noreturn]]
|
||||||
|
void fatal(char const *fmt, ...);
|
||||||
|
|
||||||
|
// Used for fatal errors that handle their own backtrace output.
|
||||||
|
[[noreturn]]
|
||||||
|
void fatalNoTrace(std::function<void()> callback);
|
||||||
|
|
||||||
|
// Used for errors that make it impossible to assemble correctly, but don't
|
||||||
|
// affect the following code. The code will fail to assemble but the user will
|
||||||
|
// get a list of all errors at the end, making it easier to fix all of them at
|
||||||
|
// once.
|
||||||
|
[[gnu::format(printf, 1, 2)]]
|
||||||
|
void error(char const *fmt, ...);
|
||||||
|
|
||||||
|
// Used for errors that handle their own backtrace output. The code will fail
|
||||||
|
// to assemble but the user will get a list of all errors at the end, making it
|
||||||
|
// easier to fix all of them at once.
|
||||||
|
void errorNoTrace(std::function<void()> callback);
|
||||||
|
|
||||||
|
void requireZeroErrors();
|
||||||
|
|
||||||
|
#endif // RGBDS_ASM_WARNING_HPP
|
||||||
@@ -0,0 +1,94 @@
|
|||||||
|
// SPDX-License-Identifier: MIT
|
||||||
|
|
||||||
|
#ifndef RGBDS_BACKTRACE_HPP
|
||||||
|
#define RGBDS_BACKTRACE_HPP
|
||||||
|
|
||||||
|
#include <inttypes.h>
|
||||||
|
#include <stddef.h>
|
||||||
|
#include <stdint.h>
|
||||||
|
#include <stdio.h>
|
||||||
|
#include <vector>
|
||||||
|
|
||||||
|
#include "helpers.hpp" // InvocableR
|
||||||
|
#include "style.hpp"
|
||||||
|
|
||||||
|
#define TRACE_SEPARATOR "<-"
|
||||||
|
#define NODE_SEPARATOR "::"
|
||||||
|
#define REPT_NODE_PREFIX "REPT~"
|
||||||
|
|
||||||
|
struct Tracing {
|
||||||
|
uint64_t depth = 0;
|
||||||
|
bool collapse = false;
|
||||||
|
bool loud = false;
|
||||||
|
};
|
||||||
|
|
||||||
|
extern Tracing tracing;
|
||||||
|
|
||||||
|
bool trace_ParseTraceDepth(char const *arg);
|
||||||
|
|
||||||
|
template<typename NodeT>
|
||||||
|
void trace_PrintBacktrace(
|
||||||
|
std::vector<NodeT> const &stack,
|
||||||
|
InvocableR<char const *, NodeT const &> auto getName,
|
||||||
|
InvocableR<uint32_t, NodeT const &> auto getLineNo
|
||||||
|
) {
|
||||||
|
size_t n = stack.size();
|
||||||
|
if (n == 0) {
|
||||||
|
return; // LCOV_EXCL_LINE
|
||||||
|
}
|
||||||
|
|
||||||
|
auto printLocation = [&](size_t i) {
|
||||||
|
NodeT const &item = stack[n - i - 1];
|
||||||
|
style_Reset(stderr);
|
||||||
|
if (!tracing.collapse) {
|
||||||
|
fputs(" ", stderr); // Just three spaces; the fourth will be printed next
|
||||||
|
}
|
||||||
|
fprintf(stderr, " %s ", i == 0 ? "at" : TRACE_SEPARATOR);
|
||||||
|
style_Set(stderr, STYLE_CYAN, true);
|
||||||
|
fputs(getName(item), stderr);
|
||||||
|
style_Set(stderr, STYLE_CYAN, false);
|
||||||
|
fprintf(stderr, "(%" PRIu32 ")", getLineNo(item));
|
||||||
|
if (!tracing.collapse) {
|
||||||
|
putc('\n', stderr);
|
||||||
|
}
|
||||||
|
};
|
||||||
|
|
||||||
|
if (tracing.collapse) {
|
||||||
|
fputs(" ", stderr); // Just three spaces; the fourth will be handled by the loop
|
||||||
|
}
|
||||||
|
|
||||||
|
if (tracing.depth == 0 || static_cast<size_t>(tracing.depth) >= n) {
|
||||||
|
for (size_t i = 0; i < n; ++i) {
|
||||||
|
printLocation(i);
|
||||||
|
}
|
||||||
|
} else {
|
||||||
|
size_t last = tracing.depth / 2;
|
||||||
|
size_t first = tracing.depth - last;
|
||||||
|
size_t skipped = n - tracing.depth;
|
||||||
|
for (size_t i = 0; i < first; ++i) {
|
||||||
|
printLocation(i);
|
||||||
|
}
|
||||||
|
style_Reset(stderr);
|
||||||
|
|
||||||
|
if (tracing.collapse) {
|
||||||
|
fputs(" " TRACE_SEPARATOR, stderr);
|
||||||
|
} else {
|
||||||
|
fputs(" ", stderr); // Just three spaces; the fourth will be printed next
|
||||||
|
}
|
||||||
|
fprintf(stderr, " ...%zu more%s", skipped, last ? "..." : "");
|
||||||
|
if (!tracing.collapse) {
|
||||||
|
putc('\n', stderr);
|
||||||
|
}
|
||||||
|
|
||||||
|
for (size_t i = n - last; i < n; ++i) {
|
||||||
|
printLocation(i);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
if (tracing.collapse) {
|
||||||
|
putc('\n', stderr);
|
||||||
|
}
|
||||||
|
style_Reset(stderr);
|
||||||
|
}
|
||||||
|
|
||||||
|
#endif // RGBDS_BACKTRACE_HPP
|
||||||
@@ -0,0 +1,21 @@
|
|||||||
|
// SPDX-License-Identifier: MIT
|
||||||
|
|
||||||
|
#ifndef RGBDS_CLI_HPP
|
||||||
|
#define RGBDS_CLI_HPP
|
||||||
|
|
||||||
|
#include <stdarg.h>
|
||||||
|
#include <string>
|
||||||
|
|
||||||
|
#include "extern/getopt.hpp" // option
|
||||||
|
#include "usage.hpp"
|
||||||
|
|
||||||
|
void cli_ParseArgs(
|
||||||
|
int argc,
|
||||||
|
char *argv[],
|
||||||
|
char const *shortOpts,
|
||||||
|
option const *longOpts,
|
||||||
|
void (*parseArg)(int, char *),
|
||||||
|
Usage usage
|
||||||
|
);
|
||||||
|
|
||||||
|
#endif // RGBDS_CLI_HPP
|
||||||
@@ -1,39 +0,0 @@
|
|||||||
/*
|
|
||||||
* Allocator adaptor that interposes construct() calls to convert value-initialization
|
|
||||||
* (which is what you get with e.g. `vector::resize`) into default-initialization (which does not
|
|
||||||
* zero out non-class types).
|
|
||||||
* From
|
|
||||||
* https://stackoverflow.com/questions/21028299/is-this-behavior-of-vectorresizesize-type-n-under-c11-and-boost-container/21028912#21028912
|
|
||||||
*/
|
|
||||||
|
|
||||||
#ifndef DEFAULT_INIT_ALLOC_H
|
|
||||||
#define DEFAULT_INIT_ALLOC_H
|
|
||||||
|
|
||||||
#include <memory>
|
|
||||||
#include <vector>
|
|
||||||
|
|
||||||
template<typename T, typename A = std::allocator<T>>
|
|
||||||
class default_init_allocator : public A {
|
|
||||||
using a_t = std::allocator_traits<A>;
|
|
||||||
public:
|
|
||||||
template<typename U>
|
|
||||||
struct rebind {
|
|
||||||
using other = default_init_allocator<U, typename a_t::template rebind_alloc<U>>;
|
|
||||||
};
|
|
||||||
|
|
||||||
using A::A; // Inherit the allocator's constructors
|
|
||||||
|
|
||||||
template<typename U>
|
|
||||||
void construct(U *ptr) noexcept(std::is_nothrow_default_constructible_v<U>) {
|
|
||||||
::new (static_cast<void *>(ptr)) U;
|
|
||||||
}
|
|
||||||
template<typename U, typename... Args>
|
|
||||||
void construct(U *ptr, Args &&...args) {
|
|
||||||
a_t::construct(static_cast<A &>(*this), ptr, std::forward<Args>(args)...);
|
|
||||||
}
|
|
||||||
};
|
|
||||||
|
|
||||||
template<typename T>
|
|
||||||
using DefaultInitVec = std::vector<T, default_init_allocator<T>>;
|
|
||||||
|
|
||||||
#endif // DEFAULT_INIT_ALLOC_H
|
|
||||||
@@ -0,0 +1,261 @@
|
|||||||
|
// SPDX-License-Identifier: MIT
|
||||||
|
|
||||||
|
#ifndef RGBDS_DIAGNOSTICS_HPP
|
||||||
|
#define RGBDS_DIAGNOSTICS_HPP
|
||||||
|
|
||||||
|
#include <inttypes.h>
|
||||||
|
#include <optional>
|
||||||
|
#include <stdarg.h>
|
||||||
|
#include <stdint.h>
|
||||||
|
#include <stdio.h>
|
||||||
|
#include <stdlib.h>
|
||||||
|
#include <string>
|
||||||
|
#include <utility>
|
||||||
|
#include <vector>
|
||||||
|
|
||||||
|
#include "helpers.hpp"
|
||||||
|
#include "itertools.hpp"
|
||||||
|
#include "style.hpp"
|
||||||
|
|
||||||
|
[[gnu::format(printf, 1, 2)]]
|
||||||
|
void warnx(char const *fmt, ...);
|
||||||
|
[[gnu::format(printf, 1, 0)]]
|
||||||
|
void vwarnx(char const *fmt, va_list args);
|
||||||
|
[[gnu::format(printf, 1, 2)]]
|
||||||
|
void errorx(char const *fmt, ...);
|
||||||
|
[[gnu::format(printf, 1, 0)]]
|
||||||
|
void verrorx(char const *fmt, va_list args);
|
||||||
|
[[gnu::format(printf, 1, 2)]]
|
||||||
|
void fatalx(char const *fmt, ...);
|
||||||
|
[[gnu::format(printf, 1, 0)]]
|
||||||
|
void vfatalx(char const *fmt, va_list args);
|
||||||
|
|
||||||
|
enum WarningAbled { WARNING_DEFAULT, WARNING_ENABLED, WARNING_DISABLED };
|
||||||
|
|
||||||
|
struct WarningState {
|
||||||
|
WarningAbled state;
|
||||||
|
WarningAbled error;
|
||||||
|
|
||||||
|
void update(WarningState other);
|
||||||
|
};
|
||||||
|
|
||||||
|
std::pair<WarningState, std::optional<uint32_t>> getInitialWarningState(std::string &flag);
|
||||||
|
|
||||||
|
template<Enum LevelEnumT>
|
||||||
|
struct WarningFlag {
|
||||||
|
char const *name;
|
||||||
|
LevelEnumT level;
|
||||||
|
};
|
||||||
|
|
||||||
|
enum WarningBehavior { DISABLED, ENABLED, ERROR };
|
||||||
|
|
||||||
|
template<Enum WarningEnumT>
|
||||||
|
struct ParamWarning {
|
||||||
|
WarningEnumT firstID;
|
||||||
|
WarningEnumT lastID;
|
||||||
|
uint8_t defaultLevel;
|
||||||
|
};
|
||||||
|
|
||||||
|
template<Enum WarningEnumT>
|
||||||
|
struct DiagnosticsState {
|
||||||
|
WarningState flagStates[WarningEnumT::NB_WARNINGS];
|
||||||
|
WarningState metaStates[WarningEnumT::NB_WARNINGS];
|
||||||
|
bool warningsEnabled = true;
|
||||||
|
bool warningsAreErrors = false;
|
||||||
|
};
|
||||||
|
|
||||||
|
template<Enum LevelEnumT, Enum WarningEnumT>
|
||||||
|
struct Diagnostics {
|
||||||
|
std::vector<WarningFlag<LevelEnumT>> metaWarnings;
|
||||||
|
std::vector<WarningFlag<LevelEnumT>> warningFlags;
|
||||||
|
std::vector<ParamWarning<WarningEnumT>> paramWarnings;
|
||||||
|
DiagnosticsState<WarningEnumT> state;
|
||||||
|
uint64_t nbErrors;
|
||||||
|
|
||||||
|
void incrementErrors() {
|
||||||
|
if (nbErrors != UINT64_MAX) {
|
||||||
|
++nbErrors;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
WarningBehavior getWarningBehavior(WarningEnumT id) const;
|
||||||
|
void processWarningFlag(char const *flag);
|
||||||
|
};
|
||||||
|
|
||||||
|
template<Enum LevelEnumT, Enum WarningEnumT>
|
||||||
|
WarningBehavior Diagnostics<LevelEnumT, WarningEnumT>::getWarningBehavior(WarningEnumT id) const {
|
||||||
|
// Check if warnings are globally disabled
|
||||||
|
if (!state.warningsEnabled) {
|
||||||
|
return WarningBehavior::DISABLED;
|
||||||
|
}
|
||||||
|
|
||||||
|
// Get the state of this warning flag
|
||||||
|
WarningState const &flagState = state.flagStates[id];
|
||||||
|
WarningState const &metaState = state.metaStates[id];
|
||||||
|
|
||||||
|
// If subsequent checks determine that the warning flag is enabled, this checks whether it has
|
||||||
|
// -Werror without -Wno-error=<flag> or -Wno-error=<meta>, which makes it into an error
|
||||||
|
bool warningIsError = state.warningsAreErrors && flagState.error != WARNING_DISABLED
|
||||||
|
&& metaState.error != WARNING_DISABLED;
|
||||||
|
WarningBehavior enabledBehavior =
|
||||||
|
warningIsError ? WarningBehavior::ERROR : WarningBehavior::ENABLED;
|
||||||
|
|
||||||
|
// First, check the state of the specific warning flag
|
||||||
|
if (flagState.state == WARNING_DISABLED) { // -Wno-<flag>
|
||||||
|
return WarningBehavior::DISABLED;
|
||||||
|
}
|
||||||
|
if (flagState.error == WARNING_ENABLED) { // -Werror=<flag>
|
||||||
|
return WarningBehavior::ERROR;
|
||||||
|
}
|
||||||
|
if (flagState.state == WARNING_ENABLED) { // -W<flag>
|
||||||
|
return enabledBehavior;
|
||||||
|
}
|
||||||
|
|
||||||
|
// If no flag is specified, check the state of the "meta" flags that affect this warning flag
|
||||||
|
if (metaState.state == WARNING_DISABLED) { // -Wno-<meta>
|
||||||
|
return WarningBehavior::DISABLED;
|
||||||
|
}
|
||||||
|
if (metaState.error == WARNING_ENABLED) { // -Werror=<meta>
|
||||||
|
return WarningBehavior::ERROR;
|
||||||
|
}
|
||||||
|
if (metaState.state == WARNING_ENABLED) { // -W<meta>
|
||||||
|
return enabledBehavior;
|
||||||
|
}
|
||||||
|
|
||||||
|
// If no meta flag is specified, check the default state of this warning flag
|
||||||
|
if (warningFlags[id].level == LevelEnumT::LEVEL_DEFAULT) { // enabled by default
|
||||||
|
return enabledBehavior;
|
||||||
|
}
|
||||||
|
|
||||||
|
// No flag enables this warning, explicitly or implicitly
|
||||||
|
return WarningBehavior::DISABLED;
|
||||||
|
}
|
||||||
|
|
||||||
|
template<Enum LevelEnumT, Enum WarningEnumT>
|
||||||
|
void Diagnostics<LevelEnumT, WarningEnumT>::processWarningFlag(char const *flag) {
|
||||||
|
std::string rootFlag = flag;
|
||||||
|
|
||||||
|
// Check for `-Werror` or `-Wno-error` to return early
|
||||||
|
if (rootFlag == "error") {
|
||||||
|
// `-Werror` promotes warnings to errors
|
||||||
|
state.warningsAreErrors = true;
|
||||||
|
return;
|
||||||
|
} else if (rootFlag == "no-error") {
|
||||||
|
// `-Wno-error` disables promotion of warnings to errors
|
||||||
|
state.warningsAreErrors = false;
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
auto [flagState, param] = getInitialWarningState(rootFlag);
|
||||||
|
|
||||||
|
// Try to match the flag against a parametric warning
|
||||||
|
// If there was an equals sign, it will have set `param`; if not, `param` will be 0,
|
||||||
|
// which applies to all levels
|
||||||
|
for (ParamWarning<WarningEnumT> const ¶mWarning : paramWarnings) {
|
||||||
|
WarningEnumT baseID = paramWarning.firstID;
|
||||||
|
uint8_t maxParam = paramWarning.lastID - baseID + 1;
|
||||||
|
assume(paramWarning.defaultLevel <= maxParam);
|
||||||
|
|
||||||
|
if (rootFlag != warningFlags[baseID].name) {
|
||||||
|
continue;
|
||||||
|
}
|
||||||
|
|
||||||
|
// If making the warning an error but param is 0, set to the maximum
|
||||||
|
// This accommodates `-Werror=<flag>`, but also `-Werror=<flag>=0`, which is
|
||||||
|
// thus filtered out by the caller.
|
||||||
|
// A param of 0 makes sense for disabling everything, but neither for
|
||||||
|
// enabling nor "erroring". Use the default for those.
|
||||||
|
if (!param.has_value() || *param == 0) {
|
||||||
|
param = paramWarning.defaultLevel;
|
||||||
|
} else if (*param > maxParam) {
|
||||||
|
warnx(
|
||||||
|
"Invalid warning flag parameter \"%s=%" PRIu32 "\"; capping at maximum %" PRIu8,
|
||||||
|
rootFlag.c_str(),
|
||||||
|
*param,
|
||||||
|
maxParam
|
||||||
|
);
|
||||||
|
*param = maxParam;
|
||||||
|
}
|
||||||
|
|
||||||
|
// Set the first <param> to enabled/error, and disable the rest
|
||||||
|
for (uint32_t ofs = 0; ofs < maxParam; ++ofs) {
|
||||||
|
if (WarningState &warning = state.flagStates[baseID + ofs]; ofs < *param) {
|
||||||
|
warning.update(flagState);
|
||||||
|
} else {
|
||||||
|
warning.state = WARNING_DISABLED;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
if (param.has_value()) {
|
||||||
|
warnx("Unknown warning flag parameter \"%s=%" PRIu32 "\"", rootFlag.c_str(), *param);
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
// Try to match against a "meta" warning
|
||||||
|
for (WarningFlag<LevelEnumT> const &metaWarning : metaWarnings) {
|
||||||
|
if (rootFlag != metaWarning.name) {
|
||||||
|
continue;
|
||||||
|
}
|
||||||
|
|
||||||
|
// Set each of the warning flags that meets this level
|
||||||
|
for (WarningEnumT id : EnumSeq(WarningEnumT::NB_WARNINGS)) {
|
||||||
|
if (metaWarning.level >= warningFlags[id].level) {
|
||||||
|
state.metaStates[id].update(flagState);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
// Try to match against a "normal" flag
|
||||||
|
for (WarningEnumT id : EnumSeq(WarningEnumT::NB_PLAIN_WARNINGS)) {
|
||||||
|
if (rootFlag == warningFlags[id].name) {
|
||||||
|
state.flagStates[id].update(flagState);
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
warnx("Unknown warning flag \"%s\"", rootFlag.c_str());
|
||||||
|
}
|
||||||
|
|
||||||
|
template<Enum LevelEnumT, Enum WarningEnumT>
|
||||||
|
[[gnu::format(printf, 3, 0)]]
|
||||||
|
WarningBehavior printDiagnostic(
|
||||||
|
Diagnostics<LevelEnumT, WarningEnumT> const &warnings,
|
||||||
|
WarningEnumT id,
|
||||||
|
char const *fmt,
|
||||||
|
va_list args
|
||||||
|
) {
|
||||||
|
char const *flag = warnings.warningFlags[id].name;
|
||||||
|
WarningBehavior behavior = warnings.getWarningBehavior(id);
|
||||||
|
|
||||||
|
switch (behavior) {
|
||||||
|
case WarningBehavior::DISABLED:
|
||||||
|
break;
|
||||||
|
|
||||||
|
case WarningBehavior::ENABLED:
|
||||||
|
style_Set(stderr, STYLE_YELLOW, true);
|
||||||
|
fputs("warning: ", stderr);
|
||||||
|
style_Reset(stderr);
|
||||||
|
vfprintf(stderr, fmt, args);
|
||||||
|
style_Set(stderr, STYLE_YELLOW, true);
|
||||||
|
fprintf(stderr, " [-W%s]\n", flag);
|
||||||
|
style_Reset(stderr);
|
||||||
|
break;
|
||||||
|
|
||||||
|
case WarningBehavior::ERROR:
|
||||||
|
style_Set(stderr, STYLE_RED, true);
|
||||||
|
fputs("error: ", stderr);
|
||||||
|
style_Reset(stderr);
|
||||||
|
vfprintf(stderr, fmt, args);
|
||||||
|
style_Set(stderr, STYLE_RED, true);
|
||||||
|
fprintf(stderr, " [-Werror=%s]\n", flag);
|
||||||
|
style_Reset(stderr);
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
|
||||||
|
return behavior;
|
||||||
|
}
|
||||||
|
|
||||||
|
#endif // RGBDS_DIAGNOSTICS_HPP
|
||||||
@@ -1,29 +0,0 @@
|
|||||||
/*
|
|
||||||
* This file is part of RGBDS.
|
|
||||||
*
|
|
||||||
* Copyright (c) 1997-2021, RGBDS contributors.
|
|
||||||
*
|
|
||||||
* SPDX-License-Identifier: MIT
|
|
||||||
*/
|
|
||||||
|
|
||||||
#ifndef RGBDS_ERROR_H
|
|
||||||
#define RGBDS_ERROR_H
|
|
||||||
|
|
||||||
#include "helpers.h"
|
|
||||||
#include "platform.h"
|
|
||||||
|
|
||||||
#ifdef __cplusplus
|
|
||||||
extern "C" {
|
|
||||||
#endif
|
|
||||||
|
|
||||||
void warn(char const NONNULL(fmt), ...) format_(printf, 1, 2);
|
|
||||||
void warnx(char const NONNULL(fmt), ...) format_(printf, 1, 2);
|
|
||||||
|
|
||||||
_Noreturn void err(char const NONNULL(fmt), ...) format_(printf, 1, 2);
|
|
||||||
_Noreturn void errx(char const NONNULL(fmt), ...) format_(printf, 1, 2);
|
|
||||||
|
|
||||||
#ifdef __cplusplus
|
|
||||||
}
|
|
||||||
#endif
|
|
||||||
|
|
||||||
#endif // RGBDS_ERROR_H
|
|
||||||
Vendored
-54
@@ -1,54 +0,0 @@
|
|||||||
/*
|
|
||||||
* Copyright © 2005-2020 Rich Felker, et al.
|
|
||||||
*
|
|
||||||
* Permission is hereby granted, free of charge, to any person obtaining
|
|
||||||
* a copy of this software and associated documentation files (the
|
|
||||||
* "Software"), to deal in the Software without restriction, including
|
|
||||||
* without limitation the rights to use, copy, modify, merge, publish,
|
|
||||||
* distribute, sublicense, and/or sell copies of the Software, and to
|
|
||||||
* permit persons to whom the Software is furnished to do so, subject to
|
|
||||||
* the following conditions:
|
|
||||||
*
|
|
||||||
* The above copyright notice and this permission notice shall be
|
|
||||||
* included in all copies or substantial portions of the Software.
|
|
||||||
*
|
|
||||||
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
|
|
||||||
* EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
|
|
||||||
* MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.
|
|
||||||
* IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY
|
|
||||||
* CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT,
|
|
||||||
* TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE
|
|
||||||
* SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
|
|
||||||
*/
|
|
||||||
|
|
||||||
/* This implementation was taken from musl and modified for RGBDS */
|
|
||||||
|
|
||||||
#ifndef RGBDS_EXTERN_GETOPT_H
|
|
||||||
#define RGBDS_EXTERN_GETOPT_H
|
|
||||||
|
|
||||||
#ifdef __cplusplus
|
|
||||||
extern "C" {
|
|
||||||
#endif
|
|
||||||
|
|
||||||
extern char *musl_optarg;
|
|
||||||
extern int musl_optind, musl_opterr, musl_optopt, musl_optreset;
|
|
||||||
|
|
||||||
struct option {
|
|
||||||
char const *name;
|
|
||||||
int has_arg;
|
|
||||||
int *flag;
|
|
||||||
int val;
|
|
||||||
};
|
|
||||||
|
|
||||||
int musl_getopt_long_only(int argc, char **argv, char const *optstring,
|
|
||||||
const struct option *longopts, int *idx);
|
|
||||||
|
|
||||||
#define no_argument 0
|
|
||||||
#define required_argument 1
|
|
||||||
#define optional_argument 2
|
|
||||||
|
|
||||||
#ifdef __cplusplus
|
|
||||||
} // extern "C"
|
|
||||||
#endif
|
|
||||||
|
|
||||||
#endif
|
|
||||||
Vendored
+26
@@ -0,0 +1,26 @@
|
|||||||
|
// SPDX-License-Identifier: MIT
|
||||||
|
|
||||||
|
// This implementation was taken from musl and modified for RGBDS
|
||||||
|
|
||||||
|
#ifndef RGBDS_EXTERN_GETOPT_HPP
|
||||||
|
#define RGBDS_EXTERN_GETOPT_HPP
|
||||||
|
|
||||||
|
// clang-format off: vertically align values
|
||||||
|
static constexpr int no_argument = 0;
|
||||||
|
static constexpr int required_argument = 1;
|
||||||
|
static constexpr int optional_argument = 2;
|
||||||
|
// clang-format on
|
||||||
|
|
||||||
|
extern char *musl_optarg;
|
||||||
|
extern int musl_optind, musl_optopt;
|
||||||
|
|
||||||
|
struct option {
|
||||||
|
char const *name;
|
||||||
|
int has_arg;
|
||||||
|
int *flag;
|
||||||
|
int val;
|
||||||
|
};
|
||||||
|
|
||||||
|
int musl_getopt_long_only(int argc, char **argv, char const *optstring, option const *longopts);
|
||||||
|
|
||||||
|
#endif // RGBDS_EXTERN_GETOPT_HPP
|
||||||
Vendored
-14
@@ -1,14 +0,0 @@
|
|||||||
/*
|
|
||||||
* This file is part of RGBDS.
|
|
||||||
*
|
|
||||||
* Copyright (c) 2018, Antonio Nino Diaz and RGBDS contributors.
|
|
||||||
*
|
|
||||||
* SPDX-License-Identifier: MIT
|
|
||||||
*/
|
|
||||||
|
|
||||||
#ifndef EXTERN_UTF8DECODER_H
|
|
||||||
#define EXTERN_UTF8DECODER_H
|
|
||||||
|
|
||||||
uint32_t decode(uint32_t *state, uint32_t *codep, uint8_t byte);
|
|
||||||
|
|
||||||
#endif // EXTERN_UTF8DECODER_H
|
|
||||||
Some files were not shown because too many files have changed in this diff Show More
Reference in New Issue
Block a user