This repository has been archived by the owner on Jun 20, 2021. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 20
/
Copy pathWindows-Build.bat
1470 lines (1332 loc) · 44.7 KB
/
Windows-Build.bat
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
556
557
558
559
560
561
562
563
564
565
566
567
568
569
570
571
572
573
574
575
576
577
578
579
580
581
582
583
584
585
586
587
588
589
590
591
592
593
594
595
596
597
598
599
600
601
602
603
604
605
606
607
608
609
610
611
612
613
614
615
616
617
618
619
620
621
622
623
624
625
626
627
628
629
630
631
632
633
634
635
636
637
638
639
640
641
642
643
644
645
646
647
648
649
650
651
652
653
654
655
656
657
658
659
660
661
662
663
664
665
666
667
668
669
670
671
672
673
674
675
676
677
678
679
680
681
682
683
684
685
686
687
688
689
690
691
692
693
694
695
696
697
698
699
700
701
702
703
704
705
706
707
708
709
710
711
712
713
714
715
716
717
718
719
720
721
722
723
724
725
726
727
728
729
730
731
732
733
734
735
736
737
738
739
740
741
742
743
744
745
746
747
748
749
750
751
752
753
754
755
756
757
758
759
760
761
762
763
764
765
766
767
768
769
770
771
772
773
774
775
776
777
778
779
780
781
782
783
784
785
786
787
788
789
790
791
792
793
794
795
796
797
798
799
800
801
802
803
804
805
806
807
808
809
810
811
812
813
814
815
816
817
818
819
820
821
822
823
824
825
826
827
828
829
830
831
832
833
834
835
836
837
838
839
840
841
842
843
844
845
846
847
848
849
850
851
852
853
854
855
856
857
858
859
860
861
862
863
864
865
866
867
868
869
870
871
872
873
874
875
876
877
878
879
880
881
882
883
884
885
886
887
888
889
890
891
892
893
894
895
896
897
898
899
900
901
902
903
904
905
906
907
908
909
910
911
912
913
914
915
916
917
918
919
920
921
922
923
924
925
926
927
928
929
930
931
932
933
934
935
936
937
938
939
940
941
942
943
944
945
946
947
948
949
950
951
952
953
954
955
956
957
958
959
960
961
962
963
964
965
966
967
968
969
970
971
972
973
974
975
976
977
978
979
980
981
982
983
984
985
986
987
988
989
990
991
992
993
994
995
996
997
998
999
1000
echo off
cls
setlocal enabledelayedexpansion
SET EXEC_TYPE=""
SET BUILD_ARC="x86"
SET VER=0.4.1
SET THERE_IS_VS="false"
SET KEEP_DIST="false"
SET INSTALLATION_FOLDER=C:\Simple\
SET VERSION=s0.4.1
SET SIMPLE_DEBUG_VERSION=s0.4.1-debug
SET FULLTICK_BUILD_ISSUE="<https://github.com/simple-lang/simple/issues/16>"
SET BUILD_TOOL="any"
SET NO_BUILDTOOL="true"
SET GCC_ARC_VAR=-m32
SET ARC=32
SET USE_LATEST_VS="true"
for %%x in (%*) do (
if "%%x"=="--configure" (
if !EXEC_TYPE!=="install" (
SET EXEC_TYPE="install-configure"
) else (
SET EXEC_TYPE="configure"
)
)
if "%%x"=="-c" (
if !EXEC_TYPE!=="install" (
SET EXEC_TYPE="install-configure"
) else (
SET EXEC_TYPE="configure"
)
)
if "%%x"=="--install" (
if !EXEC_TYPE!=="configure" (
SET EXEC_TYPE="install-configure"
) else (
SET EXEC_TYPE="install"
)
)
if "%%x"=="-i" (
if !EXEC_TYPE!=="configure" (
SET EXEC_TYPE="install-configure"
) else (
SET EXEC_TYPE="install"
)
)
if "%%x"=="--debug" (
SET EXEC_TYPE="debug"
)
if "%%x"=="-d" (
SET EXEC_TYPE="debug"
)
if "%%x"=="x64" (
SET BUILD_ARC="x64"
SET GCC_ARC_VAR=-m64
SET ARC=64
)
if "%%x"=="--64-bit" (
SET BUILD_ARC="x64"
SET GCC_ARC_VAR=-m64
SET ARC=64
)
if "%%x"=="x86" (
SET BUILD_ARC="x86"
SET GCC_ARC_VAR=-m32
SET ARC=32
)
if "%%x"=="--32-bit" (
SET BUILD_ARC="x86"
SET GCC_ARC_VAR=-m32
SET ARC=32
)
if "%%x"=="--uninstall" (
call:uninstall
)
if "%%x"=="-u" (
call:uninstall
)
if "%%x"=="--temp" (
SET KEEP_DIST="true"
)
if "%%x"=="-t" (
SET KEEP_DIST="true"
)
if "%%x"=="--help" (
call:help
exit /b 0
)
if "%%x"=="-h" (
call:help
exit /b 0
)
if "%%x"=="-b" (
SET /p INSTALLATION_FOLDER=Enter the folder you want to install simple-lang to :
)
if "%%x"=="--install-folder" (
SET /b INSTALLATION_FOLDER=Enter the folder you want to install simple-lang to :
)
if "%%x"=="-so" (
if !EXEC_TYPE!=="install" (
SET EXEC_TYPE="simple-only-install"
) else (
SET EXEC_TYPE="simple-only-debug"
)
)
if "%%x"=="--simple-only" (
if !EXEC_TYPE!=="install" (
SET EXEC_TYPE="simple-only-install"
) else (
SET EXEC_TYPE="simple-only-debug"
)
)
if "%%x"=="-do" (
if !EXEC_TYPE!=="install" (
SET EXEC_TYPE="dependencies-only-install"
) else (
SET EXEC_TYPE="dependencies-only-debug"
)
)
if "%%x"=="--dep-only" (
if !EXEC_TYPE!=="install" (
SET EXEC_TYPE="dependencies-only-install"
) else (
SET EXEC_TYPE="dependencies-only-debug"
)
)
if "%%x"=="-io" (
if !EXEC_TYPE!=="install" (
SET EXEC_TYPE="include-only-install"
) else (
SET EXEC_TYPE="include-only-debug"
)
)
if "%%x"=="--include-only" (
if !EXEC_TYPE!=="install" (
SET EXEC_TYPE="include-only-install"
) else (
SET EXEC_TYPE="include-only-debug"
)
)
if "%%x"=="-yo" (
if !EXEC_TYPE!=="install" (
SET EXEC_TYPE="dymodules-only-install"
) else (
SET EXEC_TYPE="dymodules-only-debug"
)
)
if "%%x"=="--dymodules-only" (
if !EXEC_TYPE!=="install" (
SET EXEC_TYPE="dymodules-only-install"
) else (
SET EXEC_TYPE="dymodules-only-debug"
)
)
if "%%x"=="-mo" (
if !EXEC_TYPE!=="install" (
SET EXEC_TYPE="modules-only-install"
) else (
SET EXEC_TYPE="modules-only-debug"
)
)
if "%%x"=="--modules-only" (
if !EXEC_TYPE!=="install" (
SET EXEC_TYPE="modules-only-install"
) else (
SET EXEC_TYPE="modules-only-debug"
)
)
if "%%x"=="-eo" (
if !EXEC_TYPE!=="install" (
SET EXEC_TYPE="environment-only-install"
) else (
SET EXEC_TYPE="environment-only-debug"
)
)
if "%%x"=="--environment-only" (
if !EXEC_TYPE!=="install" (
SET EXEC_TYPE="environment-only-install"
) else (
SET EXEC_TYPE="environment-only-debug"
)
)
if "%%x"=="-min" (
if !EXEC_TYPE!=="install" (
SET EXEC_TYPE="minify-install"
) else (
SET EXEC_TYPE="minify-debug"
)
)
if "%%x"=="--minify" (
if !EXEC_TYPE!=="install" (
SET EXEC_TYPE="minify-install"
) else (
SET EXEC_TYPE="minify-debug"
)
)
if "%%x"=="-sl" (
if !EXEC_TYPE!=="install" (
SET EXEC_TYPE="simplelib-install"
) else (
SET EXEC_TYPE="simplelib-debug"
)
)
if "%%x"=="--simplelib" (
if !EXEC_TYPE!=="install" (
SET EXEC_TYPE="simplelib-install"
) else (
SET EXEC_TYPE="simplelib-debug"
)
)
if "%%x"=="-nl" (
SET USE_LATEST_VS="false"
)
if "%%x"=="--no-latest-vs" (
SET USE_LATEST_VS="false"
)
if "%%x"=="-vs" (
SET THERE_IS_VS="true"
)
if "%%x"=="--visual-studio" (
SET THERE_IS_VS="true"
)
if "%%x"=="-gcc" (
SET BUILD_TOOL="gcc"
)
if "%%x"=="--gnu" (
SET BUILD_TOOL="gcc"
)
if "%%x"=="-mg" (
SET BUILD_TOOL="mingw"
)
if "%%x"=="--mingw" (
SET BUILD_TOOL="mingw"
)
if "%%x"=="-cy" (
SET BUILD_TOOL="cygwin"
)
if "%%x"=="--cygwin" (
SET BUILD_TOOL="cygwin"
)
)
if !THERE_IS_VS!=="true" (
call:display configure "configure build %VERSION%"
call:locatevisualstudio !BUILD_ARC!
)
if !BUILD_TOOL!=="mingw" (
call:display configure "configure build %VERSION%"
call:locatemingw !BUILD_ARC!
)
if !BUILD_TOOL!=="cygwin" (
call:display configure "configure build %VERSION%"
call:locatecygwin !BUILD_ARC!
)
if !BUILD_TOOL!=="gcc" (
REM call:display configure "configure build %VERSION%"
REM call:locategcc !BUILD_ARC!
SET NO_BUILDTOOL="false"
)
if !BUILD_TOOL!=="any" (
call:configure
)
if !NO_BUILDTOOL!=="true" (
echo error:simple-lang:configure: no C/C++ compiler to found
echo error:simple-lang:configure: re-build with no C/C++ compiler flag to find available build tool
echo error:simple-lang:configure: stopping build...
exit /b 0
)
if !EXEC_TYPE!=="" (
SET EXEC_TYPE="install"
)
if !EXEC_TYPE!=="install" (
call:configure
call:installdebug
echo .
call:treatfinal
)
if !EXEC_TYPE!=="debug" (
call:configure
call:installdebug
echo .
call:treatfinal
)
if !EXEC_TYPE!=="install-configure" (
call:configure
SET EXEC_TYPE="install"
call:installdebug
echo .
call:treatfinal
)
if !EXEC_TYPE!=="configure" (
call:configure
)
REM STANDALONE BUILDS
if !EXEC_TYPE!=="simple-only-install" (
SET EXEC_TYPE="install"
call:display install "install simple-lang %VERSION%"
call:buildsimpledllexe
call:copysimpledllexe
call:removedistfolders
)
if !EXEC_TYPE!=="simple-only-debug" (
SET EXEC_TYPE="debug"
call:display debug "debug simple-lang %VERSION%"
call:buildsimpledllexe
call:copysimpledllexe
call:removedistfolders
)
if !EXEC_TYPE!=="dependencies-only-install" (
SET EXEC_TYPE="install"
call:resolvedependencies
)
if !EXEC_TYPE!=="dependencies-only-debug" (
SET EXEC_TYPE="debug"
call:resolvedependencies
)
if !EXEC_TYPE!=="include-only-install" (
SET EXEC_TYPE="install"
call:copysimpleincludes
)
if !EXEC_TYPE!=="include-only-debug" (
SET EXEC_TYPE="debug"
call:copysimpleincludes
)
if !EXEC_TYPE!=="modules-only-install" (
SET EXEC_TYPE="install"
call:copysimplemodule
)
if !EXEC_TYPE!=="modules-only-debug" (
SET EXEC_TYPE="debug"
call:copysimplemodule
)
if !EXEC_TYPE!=="environment-only-install" (
SET EXEC_TYPE="install"
call:buildsimplelangenvironments
)
if !EXEC_TYPE!=="environment-only-debug" (
SET EXEC_TYPE="debug"
call:buildsimplelangenvironments
)
if !EXEC_TYPE!=="minify-install" (
SET EXEC_TYPE="install"
call:minifysimplemodule
)
if !EXEC_TYPE!=="minify-debug" (
SET EXEC_TYPE="debug"
call:minifysimplemodule
)
if !EXEC_TYPE!=="simplelib-install" (
SET EXEC_TYPE="install"
call:createsimplelib
)
if !EXEC_TYPE!=="simplelib-debug" (
SET EXEC_TYPE="debug"
call:createsimplelib
)
if !EXEC_TYPE!=="dymodules-only-install" (
SET EXEC_TYPE="install"
call:display install "install simple-lang %VERSION%"
call:buildsimpledllexe
call:builddynamicmodules
call:copydynamicmodules
call:removedistfolders
)
if !EXEC_TYPE!=="dymodules-only-debug" (
SET EXEC_TYPE="debug"
call:display install "install simple-lang %VERSION%"
call:buildsimpledllexe
call:builddynamicmodules
call:copydynamicmodules
call:removedistfolders
)
:: configure and install for now
exit /b %ERRORLEVEL%
:display
echo ============================================================================
echo simple-lang:%1: %2
echo ============================================================================
exit /b 0
:configure
call:display configure "configure build %VERSION%"
echo simple-lang:configure:buildtool determining if a specific tool is specified
if !BUILD_TOOL!=="any" (
if !NO_BUILDTOOL!=="true" (
call:locategcc !BUILD_ARC!
) else (
exit /b 0
)
if !NO_BUILDTOOL!=="true" (
call:locatemingw !BUILD_ARC!
) else (
exit /b 0
)
if !NO_BUILDTOOL!=="true" (
call:locatecygwin !BUILD_ARC!
) else (
exit /b 0
)
if !NO_BUILDTOOL!=="true" (
echo visual studio still erroneous
REM call:locatevisualstudio !BUILD_ARC!
)
if !NO_BUILDTOOL!=="false" (
exit /b 0
)
echo simple-lang:configure no toolchain found resolveing to manual search...
echo simple-lang:configure serching for mingw and msys
echo simple-lang:configure:compiler please enter your C/C++ toolchain folder
SET /p COMPILER_PATH=Enter your C/C++ Toolchain directory :
echo simple-lang:configure:compiler your C/C++ Toolchain Directory ~ !COMPILER_PATH!
echo simple-lang:configure:compiler checking the presence of toolchain : gcc
if exist !COMPILER_PATH!/gcc.exe (
echo simple-lang:configure:compiler gcc : found
echo simple-lang:configure:compiler checking the presence of toolchain : g++
if exist "!COMPILER_PATH!/g++.exe" (
echo simple-lang:configure:compiler g++ : found
echo simple-lang:configure:compiler checking the presence of toolchain : make
if exist "!COMPILER_PATH!/make.exe" (
echo simple-lang:configure:compiler make : found
if !EXEC_TYPE!=="configure" (
SET PATH=!PATH!;!COMPILER_PATH!
) else (
call:setcompilerenv !COMPILER_PATH!
)
SET NO_BUILDTOOL="false"
if !BUILD_ARC!=="x64" (
call:confirmgccis64bits
)
) else (
echo error:simple-lang:configure make not found
echo simple-lang:configure enter make.exe folder if different from !COMPILER_PATH!
SET /p COMPILER_PATH2=Enter your Make.exe directory :
if exist "!COMPILER_PATH2!/make.exe" (
echo simple-lang:configure:compiler make : found
if !EXEC_TYPE!=="configure" (
SET PATH="%PATH%;%COMPILER_PATH%;%COMPILER_PATH2%"
) else (
call:setcompilerenv !COMPILER_PATH! !COMPILER_PATH2!
)
SET NO_BUILDTOOL="false"
if !BUILD_ARC!=="x64" (
call:confirmgccis64bits
)
) else (
call:compilernotfound make
)
)
) else (
call:compilernotfound g++
)
) else (
call:compilernotfound gcc
)
) else (
exit /b 0
)
exit /b 0
:installdebug
if !EXEC_TYPE!=="install" (
call:display install "install simple-lang %VERSION%"
REM Remove previous build of the current versions
if exist "!INSTALLATION_FOLDER!\%VERSION%\" (
echo a previous simple build %VERSION% is detected
echo removing previous build and performing a clean build
call:deletedirectories !INSTALLATION_FOLDER!\%VERSION%\
)
)
if !EXEC_TYPE!=="debug" (
call:display install "debug build %SIMPLE_DEBUG_VERSION%"
REM Remove previous build of the current versions
if exist "..\..\%SIMPLE_DEBUG_VERSION%\" (
echo a previous simple build %SIMPLE_DEBUG_VERSION% is detected
echo removing previous build and performing a clean build
call:deletedirectories %~dp0\..\..\%SIMPLE_DEBUG_VERSION%\
)
)
call:buildsimpledllexe
call:copysimpledllexe
call:copysimpleincludes
call:resolvedependencies
call:builddynamicmodules
call:copydynamicmodules
call:copysimplemodule
call:buildsimplelangenvironments
REM call:minifysimplemodule
call:removedistfolders
call:removestubornfiles
exit /b 0
:removedistfolders
if !KEEP_DIST!=="false" (
call:deletedirectories %~dp0.\-p %~dp0\..\simple\dist %~dp0\..\modules\dynamic_modules\dist\
)
exit /b 0
REM BULDING SIMPLE.EXE and SIMPLE.DLL
:buildsimpledllexe
if exist "%~dp0\..\simple\dist" (
echo simple: removing previous simple build
call:deletedirectories %~dp0\..\simple\dist
)
if !THERE_IS_VS!=="true" (
call:getsimplecfiles
echo simple-lang:install:visual-studio flies are !SIMPLE_C_FILES!
mkdir %~dp0\..\simple\dist
cl.exe /D_USRDLL /D_WINDLL /TC !SIMPLE_C_FILES! /MT /I %~dp0\..\simple\include\ /link /DLL /OUT:%~dp0\..\simple\dist\libsimple.dll
call:deletetempfiles *.obj *.exp *.cod
if exist "..\simple\dist\libsimple.lib" (
cl.exe /GA /MT /TC %~dp0\..\simple\simple.c /link /LIBPATH:%~dp0\..\simple\dist\ libsimple.lib /OUT:%~dp0\..\simple\dist\simple.exe
cl.exe /GA /MT /TC %~dp0\..\simple\simplew.c /link /SUBSYSTEM:windows /LIBPATH:%~dp0\..\simple\dist\ libsimple.lib /OUT:%~dp0\..\simple\dist\simplew.exe
call:deletetempfiles *.obj *.exp *.cod
)
exit /b 0
) else (
if exist "..\simple\makefiles\Makefile-Windows.mk" (
cd "..\simple\makefiles"
echo simple: building libsimple.dll and simple.exe
make -f Makefile-Windows.mk ARC_FLAG=!GCC_ARC_VAR! ARC=!ARC!
cd ..\..\build
) else (
echo error:simple: simple-lang %SIMPLE_DEBUG_VERSION% build
echo error:simple: the file 'Makefile-Windows.mk' does not exist in simple directory
echo error:simple: skipping simple Build
)
)
exit /b 0
REM SIMPLE.EXE AND SIMPLE.DLL HAS BEEN SUCCESSFUL CREATE AND COPY EXECUTABLE TO %SIMPLE_DEBUG_VERSION% DIRECTORY
:copysimpledllexe
echo Copying Executable and building %VERSION% and %SIMPLE_DEBUG_VERSION%
if !EXEC_TYPE!=="install" (
echo installation folder "!INSTALLATION_FOLDER!\%VERSION%\"
call:confirmfolderelsecreate "!INSTALLATION_FOLDER!\%VERSION%\bin\"
if exist "..\simple\dist\libsimple.dll" (
echo simple: copying simple.exe, libsimple.dll and libsimple.a to !INSTALLATION_FOLDER!\%VERSION%\bin\ directory
copy ..\simple\dist\*simple* !INSTALLATION_FOLDER!\%VERSION%\bin\
) else (
echo error:simple: build fails simple.exe, libsimple.dll and libsimple.a cannot be found
echo error:simple: try rebuilding individually
)
)
if !EXEC_TYPE!=="debug" (
call:confirmfolderelsecreate "..\..\%SIMPLE_DEBUG_VERSION%\bin\"
if exist "..\simple\dist\libsimple.dll" (
echo simple: copying simple.exe, libsimple.dll and libsimple.a to ..\..\%SIMPLE_DEBUG_VERSION%\bin directory
copy ..\simple\dist\*simple* ..\..\%SIMPLE_DEBUG_VERSION%\bin
) else (
echo error:simple: build fails simple.exe, libsimple.dll and libsimple.a cannot be found
echo error:simple: try rebuilding individually
)
)
exit /b 0
REM COPY THE INCLUDE DIRECTORY
:copysimpleincludes
call:display include "copying include directory for developer"
if !EXEC_TYPE!=="install" (
if exist "..\simple\include" (
echo include: copying include to !INSTALLATION_FOLDER!\%VERSION%\ directory
call:deletedirectories "!INSTALLATION_FOLDER!\%VERSION%\include"
xcopy "..\simple\include" "!INSTALLATION_FOLDER!\%VERSION%\include" /s /h /e /i /k /f /c
) else (
echo error:include: the include directory cannot be found
echo error:include: the repository appears to be currupted.
echo error:include: try clonning the simple repository again to resolve the issue
)
)
if !EXEC_TYPE!=="debug" (
if exist "..\simple\include" (
echo include: copying include to ..\..\%SIMPLE_DEBUG_VERSION%\ directory
call:deletedirectories "..\..\%SIMPLE_DEBUG_VERSION%\include"
xcopy "..\simple\include" "..\..\%SIMPLE_DEBUG_VERSION%\include" /s /h /e /i /k /f /c
) else (
echo error:include: the include directory cannot be found
echo error:include: the repository appears to be currupted.
echo error:include: try clonning the simple repository again to resolve the issue
)
)
exit /b 0
REM RESOLVE DEPENDENCIES
:resolvedependencies
call:display install "resolving simple-lang dependencies"
if !THERE_IS_VS!=="true" (
SET THERE_IS_VS_TEMP="true"
)
REM ssleay32.dll
echo dependencies: ssleay32.dll
if !BUILD_ARC!=="x64" (
if exist "..\modules\dynamic_modules\security\bin\ssleay64.dll" (
call:generatelibfromdll %~dp0\..\modules\dynamic_modules\security\bin\ssleay64.dll
call:movedependencytobin ssleay64.dll ssleay32.dll %~dp0\..\modules\dynamic_modules\security\bin\
) else (
call:dependencieserror ssleay64.dll
)
) else (
if exist "..\modules\dynamic_modules\security\bin\ssleay32.dll" (
call:generatelibfromdll %~dp0\..\modules\dynamic_modules\security\bin\ssleay32.dll
call:movedependencytobin ssleay32.dll ssleay32.dll %~dp0\..\modules\dynamic_modules\security\bin\
) else (
call:dependencieserror ssleay32.dll
)
)
REM libeay32.dll
echo dependencies: libeay32.dll
if !BUILD_ARC!=="x64" (
if exist "..\modules\dynamic_modules\security\bin\libeay64.dll" (
call:generatelibfromdll %~dp0\..\modules\dynamic_modules\security\bin\libeay64.dll
call:movedependencytobin libeay64.dll libeay32.dll %~dp0\..\modules\dynamic_modules\security\bin\
) else (
call:dependencieserror libeay64.dll
)
) else (
if exist "..\modules\dynamic_modules\security\bin\libeay32.dll" (
call:generatelibfromdll %~dp0\..\modules\dynamic_modules\security\bin\libeay32.dll
call:movedependencytobin libeay32.dll libeay32.dll %~dp0\..\modules\dynamic_modules\security\bin\
) else (
call:dependencieserror libeay32.dll
)
)
REM libcurl.dll
echo dependencies: libcurl.dll
if !BUILD_ARC!=="x64" (
if exist "..\modules\dynamic_modules\networker\lib\libcurl64.dll" (
call:generatelibfromdll %~dp0\..\modules\dynamic_modules\networker\lib\libcurl64.dll
call:movedependencytobin libcurl64.dll libcurl.dll %~dp0\..\modules\dynamic_modules\networker\lib\
) else (
call:dependencieserror libcurl64.dll
)
) else (
if exist "..\modules\dynamic_modules\networker\lib\libcurl32.dll" (
call:generatelibfromdll %~dp0\..\modules\dynamic_modules\networker\lib\libcurl32.dll
call:movedependencytobin libcurl32.dll libcurl.dll %~dp0\..\modules\dynamic_modules\networker\lib\
) else (
call:dependencieserror libcurl32.dll
)
)
if !THERE_IS_VS_TEMP!=="true" (
SET THERE_IS_VS="true"
)
exit /b 0
:generatelibfromdll
if !THERE_IS_VS!=="true" (
if exist "../examples/intermediate/libfromdll.sim" (
if exist "../examples/intermediate/fetchfunction.bat" (
SET LIBDLLBATCHPATH="%~dp0\..\examples\intermediate\fetchfunction.bat"
) else (
exit /b 0
)
if exist "../simple/dist/simple.exe" (
"%~dp0\..\simple\dist\simple.exe" "../examples/intermediate/libfromdll.sim" -bat !LIBDLLBATCHPATH! %1
exit /b 0
)
) else (
call:dependencieserror %1
)
)
exit /b 0
:movedependencytobin
echo dependencies: copying %1 to ..\..\%SIMPLE_DEBUG_VERSION%\bin directory
if !EXEC_TYPE!=="install" (
call:confirmfolderelsecreate "!INSTALLATION_FOLDER!\%VERSION%\bin\"
copy %3\%1 !INSTALLATION_FOLDER!\%VERSION%\bin\%2
)
if !EXEC_TYPE!=="debug" (
call:confirmfolderelsecreate "..\..\%SIMPLE_DEBUG_VERSION%\bin\"
copy %3\%1 ..\..\%SIMPLE_DEBUG_VERSION%\bin\%2
)
exit /b 0
:dependencieserror
echo error:dependencies: the dependency %1 cannot be found
echo error:dependencies: search for %1 for !BUILD_ARC! and download from reliable source
echo error:dependencies: manually copy to ..\..\%SIMPLE_DEBUG_VERSION%\bin directory
exit /b 0
REM BULDING DYNAMIC LIBRARIES
:builddynamicmodules
call:display dynamic_modules "dynamic modules for buiild %VERSION%"
if exist "%~dp0\..\modules\dynamic_modules\dist\" (
echo simple: removing previous simple build
call:deletedirectories %~dp0\..\modules\dynamic_modules\dist\
)
if !THERE_IS_VS!=="true" (
call:builddymodule c archiver
call:builddymodule c core_dynamic_module
call:builddymodule c file_savant
call:builddymodule c mathic
call:builddymodule cpp fulltick
call:builddymodule c string_savant
call:builddymodule c simple_sqlite
call:builddymodule c systemic
if exist "%~dp0\..\modules\dynamic_modules\networker\lib\libcurl!ARC!.lib" (
copy "%~dp0\..\modules\dynamic_modules\networker\lib\libcurl!ARC!.lib" "%~dp0\..\simple\dist\"
call:builddymodule c networker libcurl!ARC!.lib
call:deletetempfiles ..\simple\dist\libcurl!ARC!.lib
)
if exist "%~dp0\..\modules\dynamic_modules\security\bin\libeay!ARC!.lib" (
copy "%~dp0\..\modules\dynamic_modules\security\bin\libeay!ARC!.lib" "%~dp0\..\simple\dist\"
copy "%~dp0\..\modules\dynamic_modules\security\bin\ssleay!ARC!.lib" "%~dp0\..\simple\dist\"
call:builddymodule c security libeay!ARC!.lib ssleay!ARC!.lib
call:deletetempfiles ..\simple\dist\libeay!ARC!.lib ..\simple\dist\ssleay!ARC!.lib
)
call:confirmfolderelsecreate "..\modules\dynamic_modules\dist\"
move *.lib "..\modules\dynamic_modules\dist\"
move *.dll "..\modules\dynamic_modules\dist\"
call:deletetempfiles ..\modules\dynamic_modules\dist\*.lib
) else (
if exist "..\modules" (
cd "..\modules"
echo modules: modules repository detected
if exist ".\dynamic_modules\makefiles\Makefile-Windows.mk" (
cd .\dynamic_modules\makefiles
if exist "..\dist" (
echo dynamic_modules: removing previous dynamic modules build
rm -R ..\dist\
)
echo dynamic_modules: build starting...
make -f Makefile-Windows.mk ARC_FLAG=!GCC_ARC_VAR! ARC=!ARC!
cd ..\
) else (
call:repocurrupterror dynamic_modules
)
cd ..\..\build
) else (
call:repocurrupterror modules
)
)
call:confirmfulltickdymodule
exit /b 0
REM FULLTICK(GUI) DYNAMIC MODULE
:confirmfulltickdymodule
echo dynamic_modules:libfulltick: checking if libfulltick build successfully
if !BUILD_ARC!=="x64" (
REM SET FULLTICK_DY_MODULE="libfulltick!ARC!.dll"
) else (
REM SET FULLTICK_DY_MODULE="libfulltick.dll"
)
SET FULLTICK_DY_MODULE="libfulltick!ARC!.dll"
if exist "..\modules\dynamic_modules\dist\%FULLTICK_DY_MODULE%" (
echo dynamic_modules:libfulltick: libfulltick dynamic module built successfully
) else (
echo error:dynamic_modules:libfulltick: libfulltick dynamic module build failed
echo error:dynamic_modules:libfulltick: libfulltick build is sure to fail if you don't have fltk library installed or it is not configured as shared library
echo error:dynamic_modules:libfulltick: visit %FULLTICK_BUILD_ISSUE% for build instruction
echo dynamic_modules:libfulltick: falling back on available backup build.
if exist "..\modules\dynamic_modules\fulltick\dist\%FULLTICK_DY_MODULE%" (
echo dynamic_modules:libfulltick: backup build found but might be outdated
echo libfulltick: copying libfulltick.dysim to "..\modules\dynamic_modules\dist\fulltick.dysim" directory
copy "..\modules\dynamic_modules\fulltick\dist\%FULLTICK_DY_MODULE%" "..\modules\dynamic_modules\dist\libfulltick.dysim"
) else (
echo error:dynamic_modules:libfulltick: the backup libfulltick dynamic module cannot be found
echo error:dynamic_modules:libfulltick: the repository appears to be currupted.
echo error:dynamic_modules:libfulltick: try clonning the simple repository again to resolve the issue
echo error:dynamic_modules:libfulltick: or visit %FULLTICK_BUILD_ISSUE% to build instruction
)
)
exit /b 0
:builddymodule
echo building %2 dynamic module
call:getdynamicmodulefiles %1 %2
cl.exe /D_USRDLL /D_WINDLL /LD /MT !DY_MODULE_FILES! /link /DLL /LIBPATH:%~dp0\..\simple\dist\ libsimple.lib %3 %4
call:deletetempfiles *.obj *.exp *.cod
exit /b 0
:copydynamicmodules
call:display dynamic_modules "copying dynamic_modules to %VERSION%"
if !EXEC_TYPE!=="install" (
if exist "..\modules\dynamic_modules\dist\*systemic.dysim" (
echo dynamic_modules: copying dynamic modules to !INSTALLATION_FOLDER!\%VERSION%\modules\dynamic_modules directory
call:confirmfolderelsecreate "!INSTALLATION_FOLDER!\%VERSION%\modules\dynamic_modules"
copy ..\modules\dynamic_modules\dist\*.dysim !INSTALLATION_FOLDER!\%VERSION%\modules\dynamic_modules
) else (
call:dynamicmoduleserror
)
)
if !EXEC_TYPE!=="debug" (
if exist "..\modules\dynamic_modules\dist\*systemic.dysim" (
echo dynamic_modules: copying dynamic modules to ..\..\%SIMPLE_DEBUG_VERSION%\modules\dynamic_modules directory
call:confirmfolderelsecreate "%~dp0\..\..\%SIMPLE_DEBUG_VERSION%\modules\dynamic_modules"
copy ..\modules\dynamic_modules\dist\*.dysim ..\..\%SIMPLE_DEBUG_VERSION%\modules\dynamic_modules
) else (
call:dynamicmoduleserror
)
)
exit /b 0
REM DYNAMIC MODULE ERROR
:dynamicmoduleserror
echo error:dynamic_modules: build fails the dynamic modules cannot be found
echo error:dynamic_modules: try building each module individually
exit /b 0
REM CURRUPT REPOSITORY ERROR
:repocurrupterror
echo error:%1: %1 directory does not exist
echo error:%1: the repository appears to be currupted.
echo error:%1: try clonning the simple repository again to resolve the issue
exit /b 0
REM COPY THE SIMPLE MODULES
:copysimplemodule
call:display modules "copying simple modules to %SIMPLE_DEBUG_VERSION%"
call:copymodulesinloop archive fulltick parser simple web image
call:resolvefirstcalls
copy "..\modules\modules-dependencies.conf" "%~dp0\..\..\%SIMPLE_DEBUG_VERSION%\modules\"
exit /b 0
REM COPY ALL THE MODULE IN LOOP MODE
:copymodulesinloop
for %%x in (%*) do (
echo modules: %%x module
if exist "..\modules\%%x" (
if !EXEC_TYPE!=="install" (
echo modules: copying %%x module to !INSTALLATION_FOLDER!\%VERSION%\modules directory
xcopy "../modules/%%x" "!INSTALLATION_FOLDER!\%VERSION%\modules\%%x\" /s /h /e /k /f /c /y
)
if !EXEC_TYPE!=="debug" (
echo modules: copying %%x module to ..\..\%SIMPLE_DEBUG_VERSION%\modules directory
xcopy "../modules/%%x" "%~dp0\..\..\%SIMPLE_DEBUG_VERSION%\modules\%%x\" /s /h /e /k /f /c /y
)
) else (
call:modulecurrupterror %%x
)
)
exit /b 0
REM THE __FIRST_CALLS.SIM FILE IS IMPORTANT FOR SIMPLE-LANG MODULES TO FUNCTION
:resolvefirstcalls
echo modules:simple: treating the __first_calls.sim file
if !EXEC_TYPE!=="install" (
if exist "!INSTALLATION_FOLDER!\%VERSION%\modules\simple\core\__first_calls.sim" (
echo modules:simple: this is a windows system the corresponding callDynamicModule are filled
call:echodycalls !INSTALLATION_FOLDER!\%VERSION%\modules\simple\core\__first_calls.sim dll
) else (
call:modulecurrupterror "__first_calls.sim file in"
)
)
if !EXEC_TYPE!=="debug" (
if exist "..\..\%SIMPLE_DEBUG_VERSION%\modules\simple\core\__first_calls.sim" (
echo modules:simple: this is a windows system the corresponding callDynamicModule are filled
call:echodycalls %~dp0\..\..\%SIMPLE_DEBUG_VERSION%\modules\simple\core\__first_calls.sim dll
) else (
call:modulecurrupterror "__first_calls.sim file in"
)
)
exit /b 0
REM MINIFY ALL THE MODULE SOURCE (.sim) only
:minifysimplemodule
call:display minify "starting to minify the modules source"
SET MINIFICATION_PROGRAM="..\environment\minifier\minifier.sim"
if exist !MINIFICATION_PROGRAM! (
echo modules:minify: the minifying intermediate program found. procedding...
) else (
echo modules:minify: the minifying intermediate program not found. skipping minification
exit /b 0
)
if !EXEC_TYPE!=="install" (
if exist "!INSTALLATION_FOLDER!\%VERSION%\modules" (
echo modules:minifying: starting simple sources minification in !INSTALLATION_FOLDER!\%VERSION%\modules directory
!INSTALLATION_FOLDER!\%VERSION%\bin\simple.exe !MINIFICATION_PROGRAM! --source !INSTALLATION_FOLDER!\%VERSION%\modules -y
)
)
if !EXEC_TYPE!=="debug" (
if exist "..\..\%SIMPLE_DEBUG_VERSION%\modules" (
echo modules:minifying: starting simple sources minification in ..\..\%SIMPLE_DEBUG_VERSION%\modules directory
..\..\%SIMPLE_DEBUG_VERSION%\bin\simple.exe !MINIFICATION_PROGRAM! --source ..\..\%SIMPLE_DEBUG_VERSION%\modules -y
)
)
echo modules:minifying: minification complete
exit /b 0
:echodycalls
echo callDynamicModule("libsystemic.%2") callDynamicModule("libstring_savant.%2") >> %1
exit /b 0
REM CURRUPT MODULE ERROR
:modulecurrupterror
echo error:modules: the %1 module cannot be found
echo error:modules: the repository appears to be currupted.
echo error:modules: try clonning the simple repository again to resolve the issue
exit /b 0
REM SIMPLE_LANG ENVIRONMENT PROGRAMS
REM THE ENVIRONMENT PROGRAMS WILL ALSO BE INSTALLED IN SAME BIN DIRECTORY AS SIMPLE
:buildsimplelangenvironments
call:display environment "environment program build %VERSION%"
call:confirmsimplebuild
if !SIMPLE_EXECUTABLE!=="notfound" (
echo.
) else (
SET BAKE_EXECUTABLE="..\environment\bake\bake.sim"
if exist !BAKE_EXECUTABLE! (
echo environment:bake.sim: ..\environment\bake\bake.sim found
echo environment:bake.sim: starting environment programs build...
call:buildenvironmentinloop bake modular simplerepl simplebridge simplepad webworker minifier
) else (
call:environmentnotfound ..\environment\bake\bake.sim
)
)
exit /b 0
:buildenvironmentinloop
for %%x in (%*) do (
echo environment:build: %%x
if exist "..\environment\%%x\%%x.sim" (
if "%%x"=="simplepad" (
SET BAKE_FLAG_GUI=--gui
) else (
SET BAKE_FLAG_GUI=--no-gui
)
if exist ../../simple-arts/environment/%%x.ico (
call:buildsingleenvironment %%x !BAKE_FLAG_GUI! ../../simple-arts/environment/%%x.ico
) else (
call:buildsingleenvironment %%x !BAKE_FLAG_GUI!
)
) else (
echo error:environment:build ..\environment\%%x\%%x.sim cannot be found
echo error:environment:build skipping %%x
)
)
exit /b 0
:buildsingleenvironment
echo environment:build: building %1
!SIMPLE_EXECUTABLE! !BAKE_EXECUTABLE! %2 --icon=%3 --install ..\environment\%1\%1.sim !BUILD_ARC!
exit /b 0
REM CONFIRM SIMPLE.EXE IS BUILT SUCCESSFULLY
:confirmsimplebuild
if !EXEC_TYPE!=="install" (
SET SIMPLE_EXECUTABLE="!INSTALLATION_FOLDER!\%VERSION%\bin\simple.exe"
)
if !EXEC_TYPE!=="debug" (
SET SIMPLE_EXECUTABLE="%~dp0\..\..\%SIMPLE_DEBUG_VERSION%\bin\simple.exe"