Skip to content

Commit d8486da

Browse files
committed
FEAT: adding interactive building script with prebuild Windows r3 binary
1 parent d7f26c1 commit d8486da

10 files changed

+175
-40
lines changed

make-Win.bat

+1
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
make\prebuild\r3-make-win.exe -qs make\make.r3

make/build-Win-32bit.bat

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
make make OS_ID=0.3.1
1+
make make OS_ID=0.3.1 REBOL_TOOL=prebuild\r3-make-win.exe
22
make TOOLS=x:/MingW/i686-7.1.0-win32-dwarf-rt_v5-rev2/mingw32/bin/ all
33

44
SET BUILD_DIR=..\build\win-x86\

make/build-Win-64bit.bat

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
make make OS_ID=0.3.40
1+
make make OS_ID=0.3.40 REBOL_TOOL=prebuild\r3-make-win.exe
22
make TOOLS=x:/MingW/mingw64/bin/ all
33

44
SET BUILD_DIR=..\build\win-x64\

make/make-settings.r

+6
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,6 @@
1+
REBOL [
2+
purpose: {User defined building properties}
3+
]
4+
5+
TOOLS-Win32: "x:/MingW/i686-7.1.0-win32-dwarf-rt_v5-rev2/mingw32/bin/"
6+
TOOLS-Win64: "x:/MingW/mingw64/bin/"

make/make.r3

+99
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,99 @@
1+
REBOL []
2+
3+
;catch any error:
4+
if error? set/any 'err try [
5+
6+
TOOLS-Win32: ""
7+
TOOLS-Win64: ""
8+
9+
attempt [do %make-settings.r3]
10+
11+
cmd-menu: {^/^[[1;33;49mPlease choose version to build:^[[0m^/}
12+
13+
cmd-actions: [
14+
"q" [quit]
15+
"" [val: none]
16+
]
17+
18+
settings: []
19+
20+
rebol-tool: join "prebuild\r3-make" switch/default system/version/4 [
21+
1 [%-amiga ]
22+
2 [
23+
append settings [
24+
"OSX - PPC" [0.2.04 %..\build\osx-ppc\ ""]
25+
"OSX - Intel" [0.2.05 %..\build\osx-intel\ ""]
26+
"OSX - Intel x64" [0.2.40 %..\build\osx-intel-x64\ ""]
27+
]
28+
%-osx ]
29+
3 [
30+
append settings [
31+
"Win32 console" [0.3.01 %..\build\win-x86\ TOOLS-Win32]
32+
"Win64 console" [0.3.40 %..\build\win-x64\ TOOLS-Win64]
33+
]
34+
%-win.exe]
35+
4 [
36+
append settings [
37+
"Linux libc 2.3" [0.4.02 %../build/linux/ ""]
38+
"Linux libc 2.5" [0.4.03 %../build/linux/ ""]
39+
"Linux libc 2.11" [0.4.04 %../build/linux/ ""]
40+
"Linux PPC" [0.4.10 %../build/linux/ ""]
41+
"Linux ARM" [0.4.20 %../build/linux/ ""]
42+
"Linux ARM bionic (Android)" [0.4.21 %../build/linux/ ""]
43+
"Linux MIPS" [0.4.30 %../build/linux/ ""]
44+
"Linux x64" [0.4.40 %../build/linux/ ""]
45+
]
46+
%-linux ]
47+
5 [%-haiku ]
48+
7 [%-freebsd]
49+
9 [%-openbsd]
50+
13 [%-android]
51+
][ %"" ]
52+
53+
i: 1
54+
foreach [name data] settings [
55+
set [OS_ID BUILD_DIR TOOLS] data
56+
append cmd-menu rejoin ["^-^[[1;32;49m" i "^[[0m: " name " (" OS_ID ")^/"]
57+
append cmd-actions compose/deep [
58+
(form i) [OS_ID: (OS_ID) BUILD_DIR: (BUILD_DIR) TOOLS: (TOOLS)]
59+
]
60+
i: i + 1
61+
]
62+
append cmd-menu {^-^[[1;32;49mq^[[0m: Quit^/}
63+
64+
eval-cmd: func[cmd [string! block!] /local err][
65+
out: copy ""
66+
if block? cmd [cmd: rejoin cmd]
67+
prin "^[[1;33;49m"
68+
print [cmd "^[[0m^[[36m"]
69+
call/wait/shell cmd out
70+
print "^[[0m"
71+
;print out
72+
]
73+
74+
menu?: true
75+
forever [
76+
if menu? [print cmd-menu]
77+
error? try [val: trim/head/tail ask "^[[1;32;49mBuild version: ^[[0m"]
78+
switch/default val cmd-actions [
79+
print "What?"
80+
val: none
81+
]
82+
83+
if val [
84+
eval-cmd [rebol-tool " -qs ../src/tools/make-make.r " OS_ID]
85+
eval-cmd [{make TOOLS=} TOOLS { all}]
86+
87+
make-dir/deep BUILD_DIR
88+
eval-cmd [{move /Y r3.exe } to-local-file BUILD_DIR]
89+
eval-cmd [{move /Y host.exe } to-local-file BUILD_DIR]
90+
eval-cmd [{move /Y libr3.dll } to-local-file BUILD_DIR]
91+
eval-cmd [{dir } to-local-file BUILD_DIR]
92+
menu?: true
93+
]
94+
]
95+
96+
][ ; there was some error!
97+
print "ERROR!"
98+
print err
99+
]

make/makefile

+29-26
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
# REBOL Makefile -- Generated by make-make.r (do not edit) on 20-Oct-2017/12:45:26+2:00
1+
# REBOL Makefile -- Generated by make-make.r (do not edit) on 25-Oct-2017/17:18:42+2:00
22
# This makefile is intentional kept simple to make builds possible on
33
# a wider range of target platforms.
44

@@ -39,22 +39,22 @@ R= $S/core
3939
INCL ?= .
4040
I= -I$(INCL) -I$S/include/
4141

42-
TO_OS?= TO_WIN32_X64
43-
OS_ID?= 0.3.40
42+
TO_OS?= TO_WIN32
43+
OS_ID?= 0.3.1
4444
BIN_SUFFIX= .exe
4545
LIB_SUFFIX= .dll
4646
RES= "objs/r3.res"
47-
RAPI_FLAGS= -O2 -DUNICODE -D__LLP64__ -m64 -DENDIAN_LITTLE
48-
HOST_FLAGS= -DREB_EXE -O2 -DUNICODE -D__LLP64__ -m64 -DENDIAN_LITTLE -D_FILE_OFFSET_BITS=64
47+
RAPI_FLAGS= -O2 -DUNICODE -m32 -DENDIAN_LITTLE
48+
HOST_FLAGS= -DREB_EXE -O2 -DUNICODE -m32 -DENDIAN_LITTLE -D_FILE_OFFSET_BITS=64
4949
RLIB_FLAGS=
5050

5151
# Flags for core and for host:
5252
RFLAGS= -c -D$(TO_OS) -DREB_API $(RAPI_FLAGS) $I
5353
HFLAGS= -c -D$(TO_OS) -DREB_CORE $(HOST_FLAGS) $I
54-
CLIB= -lwsock32 -lcomdlg32 -mconsole -Wl,--stack=4194300 -lm
54+
CLIB= -m32 -lwsock32 -lcomdlg32 -mconsole -Wl,--stack=4194300 -lm
5555

5656
# REBOL is needed to build various include files:
57-
REBOL_TOOL= r3-make$(BIN_SUFFIX)
57+
REBOL_TOOL= prebuild/r3-make-win.exe
5858
REBOL= $(CD)$(REBOL_TOOL) -qs
5959

6060
# For running tests, ship, build, etc.
@@ -113,7 +113,7 @@ purge:
113113
$(MAKE) host$(BIN_SUFFIX)
114114

115115
testdo:
116-
r3$(BIN_SUFFIX) --do "print {^/^[[32mI'm READY^[[0m}"
116+
r3$(BIN_SUFFIX) --do "print {^/^[[1;32m### I'm READY ###^[[0m^/}"
117117

118118
test:
119119
$(CP) r3$(BIN_SUFFIX) $(UP)/src/tests/
@@ -142,24 +142,24 @@ OBJS = objs/a-constants.o objs/a-globals.o objs/a-lib.o objs/b-boot.o \
142142
objs/c-function.o objs/c-port.o objs/c-task.o objs/c-word.o \
143143
objs/d-crash.o objs/d-dump.o objs/d-print.o objs/f-blocks.o \
144144
objs/f-deci.o objs/f-dtoa.o objs/f-enbase.o objs/f-extension.o \
145-
objs/f-math.o objs/f-modify.o objs/f-qsort.o objs/f-random.o \
146-
objs/f-round.o objs/f-series.o objs/f-stubs.o objs/l-scan.o \
147-
objs/l-types.o objs/m-gc.o objs/m-pools.o objs/m-series.o \
148-
objs/n-control.o objs/n-data.o objs/n-io.o objs/n-loop.o \
149-
objs/n-math.o objs/n-sets.o objs/n-strings.o objs/n-system.o \
150-
objs/p-clipboard.o objs/p-console.o objs/p-dir.o objs/p-dns.o \
151-
objs/p-event.o objs/p-file.o objs/p-net.o objs/s-cases.o \
152-
objs/s-crc.o objs/s-file.o objs/s-find.o objs/s-make.o \
153-
objs/s-mold.o objs/s-ops.o objs/s-trim.o objs/s-unicode.o \
154-
objs/t-bitset.o objs/t-block.o objs/t-char.o objs/t-datatype.o \
155-
objs/t-date.o objs/t-decimal.o objs/t-event.o objs/t-function.o \
156-
objs/t-gob.o objs/t-image.o objs/t-integer.o objs/t-logic.o \
157-
objs/t-map.o objs/t-money.o objs/t-none.o objs/t-object.o \
158-
objs/t-pair.o objs/t-port.o objs/t-string.o objs/t-time.o \
159-
objs/t-tuple.o objs/t-typeset.o objs/t-utype.o objs/t-vector.o \
160-
objs/t-word.o objs/u-bmp.o objs/u-compress.o objs/u-dialect.o \
161-
objs/u-gif.o objs/u-jpg.o objs/u-md5.o objs/u-parse.o \
162-
objs/u-png.o objs/u-sha1.o objs/u-zlib.o
145+
objs/f-int.o objs/f-math.o objs/f-modify.o objs/f-qsort.o \
146+
objs/f-random.o objs/f-round.o objs/f-series.o objs/f-stubs.o \
147+
objs/l-scan.o objs/l-types.o objs/m-gc.o objs/m-pools.o \
148+
objs/m-series.o objs/n-control.o objs/n-data.o objs/n-io.o \
149+
objs/n-loop.o objs/n-math.o objs/n-sets.o objs/n-strings.o \
150+
objs/n-system.o objs/p-clipboard.o objs/p-console.o objs/p-dir.o \
151+
objs/p-dns.o objs/p-event.o objs/p-file.o objs/p-net.o \
152+
objs/s-cases.o objs/s-crc.o objs/s-file.o objs/s-find.o \
153+
objs/s-make.o objs/s-mold.o objs/s-ops.o objs/s-trim.o \
154+
objs/s-unicode.o objs/t-bitset.o objs/t-block.o objs/t-char.o \
155+
objs/t-datatype.o objs/t-date.o objs/t-decimal.o objs/t-event.o \
156+
objs/t-function.o objs/t-gob.o objs/t-image.o objs/t-integer.o \
157+
objs/t-logic.o objs/t-map.o objs/t-money.o objs/t-none.o \
158+
objs/t-object.o objs/t-pair.o objs/t-port.o objs/t-string.o \
159+
objs/t-time.o objs/t-tuple.o objs/t-typeset.o objs/t-utype.o \
160+
objs/t-vector.o objs/t-word.o objs/u-bmp.o objs/u-compress.o \
161+
objs/u-dialect.o objs/u-gif.o objs/u-jpg.o objs/u-md5.o \
162+
objs/u-parse.o objs/u-png.o objs/u-sha1.o objs/u-zlib.o
163163

164164
HOST = objs/host-main.o objs/host-args.o objs/host-device.o objs/host-stdio.o \
165165
objs/dev-net.o objs/dev-dns.o objs/host-lib.o objs/dev-stdio.o \
@@ -262,6 +262,9 @@ objs/f-enbase.o: $R/f-enbase.c
262262
objs/f-extension.o: $R/f-extension.c
263263
$(CC) $R/f-extension.c $(RFLAGS) -o objs/f-extension.o
264264

265+
objs/f-int.o: $R/f-int.c
266+
$(CC) $R/f-int.c $(RFLAGS) -o objs/f-int.o
267+
265268
objs/f-math.o: $R/f-math.c
266269
$(CC) $R/f-math.c $(RFLAGS) -o objs/f-math.o
267270

make/makefile.vc

+10-7
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,7 @@ I= /I..\src\include
1212
TO_OS= TO_WIN32
1313
OS_ID= 0.3.1
1414

15-
CFLAGS=/c /Os /D "UNICODE" /D "WIN32" /W3 /GR- /Zi /GS /Gy /GF /EHs-c- /GL /D "NDEBUG" /D "_CRT_SECURE_NO_WARNINGS"
15+
CFLAGS=/c /Os /D "UNICODE" /D "WIN32" /D "ENDIAN_LITTLE" /W3 /GR- /Zi /GS /Gy /GF /EHs-c- /GL /D "NDEBUG" /D "_CRT_SECURE_NO_WARNINGS"
1616

1717
RAPI_FLAGS= $(CFLAGS)
1818
HOST_FLAGS= $(CFLAGS)
@@ -24,27 +24,30 @@ HFLAGS= $(HOST_FLAGS) $(I) /D$(TO_OS) /DREB_CORE
2424
LIBS= user32.lib ws2_32.lib advapi32.lib shell32.lib comdlg32.lib
2525
LDFLAGS = /nologo /DEBUG /RELEASE /opt:ref /opt:icf /LTCG
2626

27-
REBOL= r3-make.exe -qs
27+
REBOL= prebuild\r3-make-win.exe -qs
2828

29-
all: prep r3.exe
29+
clean:
30+
DEL /s /q objs
3031

31-
prep:
32+
all: clean prep r3.exe
33+
34+
prep: objs
3235
$(REBOL) $T/make-headers.r
3336
$(REBOL) $T/make-boot.r $(OS_ID)
3437
$(REBOL) $T/make-host-init.r
3538
$(REBOL) $T/make-os-ext.r # ok, but not always
3639
$(REBOL) $T/make-host-ext.r
3740
$(REBOL) $T/make-reb-lib.r
38-
windres r3.rc -O coff -o objs/r3.res
41+
windres --target=pe-i386 r3.rc -O coff -o objs/r3.res
3942

4043
objs:
41-
mkdir objs
44+
if not exist objs MKDIR objs
4245

4346
OBJS = objs/a-constants.obj objs/a-globals.obj objs/a-lib.obj objs/b-boot.obj \
4447
objs/b-init.obj objs/c-do.obj objs/c-error.obj objs/c-frame.obj \
4548
objs/c-function.obj objs/c-port.obj objs/c-task.obj objs/c-word.obj \
4649
objs/d-crash.obj objs/d-dump.obj objs/d-print.obj objs/f-blocks.obj \
47-
objs/f-deci.obj objs/f-dtoa.obj objs/f-enbase.obj objs/f-extension.obj objs/f-math.obj \
50+
objs/f-deci.obj objs/f-dtoa.obj objs/f-enbase.obj objs/f-extension.obj objs/f-int.obj objs/f-math.obj \
4851
objs/f-modify.obj objs/f-random.obj objs/f-round.obj objs/f-series.obj \
4952
objs/f-stubs.obj objs/l-scan.obj objs/l-types.obj objs/m-gc.obj \
5053
objs/m-pools.obj objs/m-series.obj objs/n-control.obj objs/n-data.obj \

make/prebuild/r3-make-win.exe

625 KB
Binary file not shown.

make/vcbuild.bat

+13-2
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,12 @@
11
@ECHO OFF
22

33
REM Allow to explicitly specify the desired Visual Studio version
4+
5+
if exist "%ProgramFiles(x86)%\Microsoft Visual Studio\2017\Enterprise\Common7\Tools\VsDevCmd.bat" (
6+
CALL "%ProgramFiles(x86)%\Microsoft Visual Studio\2017\Community\Common7\Tools\VsDevCmd.bat"
7+
IF NOT ERRORLEVEL 1 GOTO BUILD
8+
)
9+
410
IF /I "%1" == "vc17" GOTO TRY_VS17
511
IF /I "%1" == "vc15" GOTO TRY_VS15
612
IF /I "%1" == "vc12" GOTO TRY_VS12
@@ -9,26 +15,31 @@ IF /I "%1" == "vc9" GOTO TRY_VS9
915

1016
REM vs15 is VS 2017
1117
:TRY_VS17
12-
CALL "%VS150COMNTOOLS%\VsDevCmd.bat" 2>NUL
18+
echo Trying VS17...
19+
CALL "%ProgramFiles(x86)%\Microsoft Visual Studio\2017\Community\Common7\Tools\VsDevCmd.bat" 2>NUL
1320
IF NOT ERRORLEVEL 1 GOTO BUILD
1421

1522
REM vs14 is VS 2015
16-
:TRY_VS17
23+
:TRY_VS15
24+
echo Trying VS15...
1725
CALL "%VS140COMNTOOLS%\vsvars32.bat" 2>NUL
1826
IF NOT ERRORLEVEL 1 GOTO BUILD
1927

2028
REM vs12 is VS 2012
2129
:TRY_VS12
30+
echo Trying VS12...
2231
CALL "%VS120COMNTOOLS%\vsvars32.bat" 2>NUL
2332
IF NOT ERRORLEVEL 1 GOTO BUILD
2433

2534
REM vs10 is VS 2010
2635
:TRY_VS10
36+
echo Trying VS10...
2737
CALL "%VS100COMNTOOLS%\vsvars32.bat" 2>NUL
2838
IF NOT ERRORLEVEL 1 GOTO BUILD
2939

3040
REM vs9 is VS 2008
3141
:TRY_VS9
42+
echo Trying VS9...
3243
CALL "%VS90COMNTOOLS%\vsvars32.bat" 2>NUL
3344
IF NOT ERRORLEVEL 1 GOTO BUILD
3445

src/tools/make-make.r

+15-3
Original file line numberDiff line numberDiff line change
@@ -88,7 +88,7 @@ HFLAGS= -c -D$(TO_OS) -DREB_CORE $(HOST_FLAGS) $I
8888
CLIB=
8989
9090
# REBOL is needed to build various include files:
91-
REBOL_TOOL= r3-make$(BIN_SUFFIX)
91+
REBOL_TOOL=
9292
REBOL= $(CD)$(REBOL_TOOL) -qs
9393
9494
# For running tests, ship, build, etc.
@@ -147,7 +147,7 @@ purge:
147147
$(MAKE) host$(BIN_SUFFIX)
148148
149149
testdo:
150-
r3$(BIN_SUFFIX) --do "print {^^/^^[[32mI'm READY^^[[0m}"
150+
r3$(BIN_SUFFIX) --do "print {^^/^^[[1;32m### I'm READY ###^^[[0m^^/}"
151151
152152
test:
153153
$(CP) r3$(BIN_SUFFIX) $(UP)/src/tests/
@@ -392,11 +392,23 @@ macro+ TO_OS to-def
392392
macro+ OS_ID os-plat
393393
macro+ LS pick ["dir" "ls -l"] flag? DIR
394394
macro+ CP pick [copy cp] flag? COP
395+
macro+ REBOL_TOOL join %prebuild/r3-make switch/default system/version/4 [
396+
1 [%-amiga ]
397+
2 [%-osx ]
398+
3 [%-win.exe]
399+
4 [%-linux ]
400+
5 [%-haiku ]
401+
7 [%-freebsd]
402+
9 [%-openbsd]
403+
13 [%-android]
404+
][ %"" ]
405+
395406
unless flag? -SP [ ; Use standard paths:
396407
macro+ UP ".."
397408
macro+ CD "./"
398409
]
399-
if os-plat/2 = 3 [macro+ REBOL ">NUL:"] ; Temporary workaround for R3 on Win7.
410+
;Oldes: Why there was the next line?
411+
;if os-plat/2 = 3 [macro+ REBOL ">NUL:"] ; Temporary workaround for R3 on Win7.
400412
either flag? EXE [
401413
macro+ BIN_SUFFIX %.exe
402414
macro+ LIB_SUFFIX %.dll

0 commit comments

Comments
 (0)