1 |
@echo off |
2 |
|
3 |
rem Don't change it unless you edit IRCD_PREFIX in setup-win32.h too! |
4 |
set IRCD_PREFIX=C:\IRCD |
5 |
|
6 |
if exist src\ircd.c goto start |
7 |
if exist ..\src\ircd.c goto start2 |
8 |
echo Are you sure you are executing this from ircd-hybrid sources directory? |
9 |
goto end |
10 |
|
11 |
:start2 |
12 |
cd .. |
13 |
|
14 |
:start |
15 |
if %1'==msvc' goto build |
16 |
if %1'==bcc' goto build |
17 |
|
18 |
cls |
19 |
echo. |
20 |
echo IRCD-Hybrid Windows build script |
21 |
echo (C) Copyright 2005 by the past and present ircd coders, and others. |
22 |
echo. |
23 |
echo Do you want to edit default ircd settings now? [Type YES or NO] |
24 |
echo @echo off >yes.bat |
25 |
echo edit contrib\setup-win32.h >>yes.bat |
26 |
echo exit >>yes.bat |
27 |
copy yes.bat y.bat >nul |
28 |
echo @exit >no.bat |
29 |
echo @exit >n.bat |
30 |
%COMSPEC% /k prompt Your choice? |
31 |
del yes.bat |
32 |
del no.bat |
33 |
del y.bat |
34 |
del n.bat |
35 |
|
36 |
echo. |
37 |
echo ------------------------------------------------ |
38 |
echo. |
39 |
echo Which compiler do you want to use? |
40 |
echo * If you are going to compile with Borland C++ Compiler, type: BCC |
41 |
echo * If you want to use Microsoft Visual C++ Compiler, type: MSVC |
42 |
echo @echo off >msvc.bat |
43 |
echo call contrib\win32build msvc >>msvc.bat |
44 |
echo exit >>msvc.bat |
45 |
echo @echo off >bcc.bat |
46 |
echo call contrib\win32build bcc >>bcc.bat |
47 |
echo exit >>bcc.bat |
48 |
%COMSPEC% /k prompt Your choice? |
49 |
del bcc.bat |
50 |
del msvc.bat |
51 |
goto end2 |
52 |
|
53 |
:build |
54 |
echo. |
55 |
echo *** Building ircd-hybrid |
56 |
copy contrib\setup-win32.h include\setup.h >nul |
57 |
for %%a in (ircd.exe src\blalloc.c src\dynlink.c src\irc_res.c src\irc_reslib.c src\ircd_signal.c src\rsa.c src\s_bsd_*.c) do if exist %%a if not %%a==src\s_bsd_win32.c del %%a |
58 |
for %%a in (modules\m_challenge.c modules\m_cryptlink.c contrib\libc_vprintf.c contrib\m_mkpasswd.c contrib\example_module.c contrib\ip_cloaking.c) do if exist %%a del %%a |
59 |
|
60 |
if %1'==msvc' goto msvc |
61 |
set COMPILER=BCC |
62 |
bcc32 -tW -6 -O -w- -eircd.exe -I"include" -I"lib\pcre" src\*.c modules\*.c modules\core\*.c lib\pcre\*.c contrib\*.c |
63 |
if errorlevel 1 goto error |
64 |
if not exist ircd.exe goto error |
65 |
for %%a in (rehash remotd kill) do bcc32 -tW -6 -O -w- -e%%a.exe -I"include" tools\win32\%%a.c |
66 |
goto built |
67 |
|
68 |
:msvc |
69 |
set COMPILER=MSVC |
70 |
cl /nologo /O2 /w /Feircd.exe /I"include" /I"lib\pcre" src\*.c modules\*.c modules\core\*.c lib\pcre\*.c contrib\*.c user32.lib wsock32.lib /link /subsystem:windows |
71 |
if errorlevel 1 goto error |
72 |
if not exist ircd.exe goto error |
73 |
for %%a in (rehash remotd kill) do cl /nologo /O2 /w /Fe%%a.exe /I"include" tools\win32\%%a.c user32.lib /link /subsystem:windows |
74 |
|
75 |
:built |
76 |
if errorlevel 1 goto error |
77 |
for %%a in (rehash.exe remotd.exe kill.exe) do if not exist %%a goto error |
78 |
for %%a in (src\*.obj) do del %%a |
79 |
for %%a in (modules\*.obj) do del %%a |
80 |
for %%a in (modules\core\*.obj) do del %%a |
81 |
for %%a in (lib\pcre\*.obj) do del %%a |
82 |
for %%a in (*.obj) do del %%a |
83 |
|
84 |
echo. |
85 |
echo *** Installing ircd-hybrid into %IRCD_PREFIX% ... |
86 |
echo. |
87 |
if not exist %IRCD_PREFIX% md %IRCD_PREFIX% |
88 |
for %%a in (bin etc help help\opers help\users logs messages) do if not exist %IRCD_PREFIX%\%%a md %IRCD_PREFIX%\%%a |
89 |
copy ircd.exe %IRCD_PREFIX%\bin >nul |
90 |
copy rehash.exe %IRCD_PREFIX%\bin >nul |
91 |
copy remotd.exe %IRCD_PREFIX%\bin >nul |
92 |
copy kill.exe %IRCD_PREFIX%\bin >nul |
93 |
for %%a in (etc\*.conf etc\*.conf.quick) do copy %%a %IRCD_PREFIX%\etc >nul |
94 |
for %%a in (cresv.conf dline.conf nresv.conf rkline.conf rxline.conf xline.conf kline.conf) do type nul >>%IRCD_PREFIX%\etc\%%a |
95 |
for %%a in (help\opers\* help\users\*) do copy %%a %IRCD_PREFIX%\%%a >nul |
96 |
for %%a in (messages\*.lang messages\README) do copy %%a %IRCD_PREFIX%\%%a >nul |
97 |
echo *** Installation complete! |
98 |
echo. |
99 |
echo Remember to create the 'ircd.conf' file before actually starting the IRCD. |
100 |
goto end |
101 |
|
102 |
:error |
103 |
for %%a in (ircd.exe rehash.exe remotd.exe kill.exe) do if exist %%a del %%a |
104 |
for %%a in (src\*.obj) do del %%a |
105 |
for %%a in (modules\*.obj) do del %%a |
106 |
for %%a in (modules\core\*.obj) do del %%a |
107 |
for %%a in (lib\pcre\*.obj) do del %%a |
108 |
for %%a in (*.obj) do del %%a |
109 |
echo. |
110 |
echo The compilation has failed. Make sure the %COMPILER% compiler you choose |
111 |
echo is actually installed, and that you haven't accidentally corrupted |
112 |
echo your setup.h file. A common problem is also not having the directory of |
113 |
echo compiler binary in PATH environment variable. |
114 |
if %COMPILER%==MSVC goto end |
115 |
echo. |
116 |
echo Borland C++ Compiler 5.5 users please remember to set up BCC32.CFG |
117 |
echo in your C:\BCC\BIN directory (or wherever you installed it)! |
118 |
echo It should contain two lines like -IC:\BCC\INCLUDE and -LC:\BCC\LIB. |
119 |
|
120 |
:end |
121 |
echo. |
122 |
pause |
123 |
:end2 |
124 |
rem $Id$ |