Subversion Repositories Kolibri OS

Rev

Rev 2314 | Blame | Last modification | View Log | Download | RSS feed

  1. @echo off
  2. cls
  3. set languages=en
  4. set drivers=3c59x dec21x4x i8255x mtd80x pcnet32 r6040 rtl8029 rtl8139 rtl8169 sis900
  5. set apps=arpcfg icmp netcfg netstat nslookup synergyc tcpserv telnet tftpc zeroconf
  6. set libs=network
  7. set targets=all kernel apps libs drivers clean
  8.  
  9. call :Check_Target %1
  10. for %%a in (all kernel) do if %%a==%target% call :Check_Lang %2
  11. call :Target_%target%
  12.  
  13. if ERRORLEVEL 0 goto Exit_OK
  14.  
  15. echo There was an error executing script.
  16. echo For any help, please send a report.
  17. pause
  18. goto :eof
  19.  
  20.  
  21.  
  22.  
  23. :Check_Lang
  24.    set res=%1
  25.   :Check_Lang_loop
  26.    for %%a in (%languages%) do if %%a==%res% set lang=%res%
  27.    if defined lang goto :eof
  28.  
  29.    echo Language '%res%' is incorrect
  30.    echo Enter valid language [ %languages% ]:
  31.  
  32.    set /P res=">
  33.    goto Check_Lang_loop
  34. goto :eof
  35.  
  36. :Check_Target
  37.    set res=%1
  38.   :Check_Target_loop
  39.    for %%a in (%targets%) do if %%a==%res% set target=%res%
  40.    if defined target goto :eof
  41.  
  42.    echo Target '%res%' is incorrect
  43.    echo Enter valid target [ %targets% ]:
  44.  
  45.    set /P res=">
  46.    goto Check_Target_loop
  47. goto :eof
  48.  
  49.  
  50. :Target_kernel
  51.    echo *** building kernel with language '%lang%' ...
  52.  
  53.    if not exist bin mkdir bin
  54.    echo lang fix %lang% > lang.inc
  55.    fasm -m 65536 kernel.asm bin\kernel.mnt
  56.    if not %errorlevel%==0 goto :Error_FasmFailed
  57.    erase lang.inc
  58. goto :eof
  59.  
  60.  
  61. :Target_all
  62.    call :Target_kernel
  63.    call :Target_apps
  64.    call :Target_libs
  65.    call :Target_drivers
  66. goto :eof
  67.  
  68.  
  69. :Target_apps
  70.    echo *** building applications ...
  71.  
  72.    if not exist bin\apps mkdir bin\apps
  73.    cd applications
  74.    for %%a in (%apps%) do (
  75.      fasm -m 65536 %%a\%%a.asm ..\bin\apps\%%a
  76.      if not %errorlevel%==0 goto :Error_FasmFailed
  77.    )
  78.    cd ..
  79.  
  80. goto :eof
  81.  
  82.  
  83. :Target_libs
  84.    echo *** building libraries ...
  85.  
  86.    if not exist bin\lib mkdir bin\lib
  87.    cd applications\libraries
  88.    for %%a in (%libs%) do (
  89.      fasm -m 65536 %%a\%%a.asm ..\..\bin\lib\%%a.obj
  90.      if not %errorlevel%==0 goto :Error_FasmFailed
  91.    )
  92.    cd ..\..
  93.  
  94. goto :eof
  95.  
  96.  
  97. :Target_drivers
  98.    echo *** building drivers ...
  99.  
  100.    if not exist bin\drivers mkdir bin\drivers
  101.    cd drivers
  102.    for %%a in (%drivers%) do (
  103.      fasm -m 65536 %%a.asm ..\bin\drivers\%%a.obj
  104.      if not %errorlevel%==0 goto :Error_FasmFailed
  105.    )
  106.    cd ..
  107.  
  108.  
  109. kpack >nul 2>&1
  110.  
  111. if %errorlevel%==9009 goto :Error_KpackFailed
  112.  
  113. echo *
  114. echo ##############################################
  115. echo *
  116. echo Kpack KolibriOS drivers?
  117. echo *    
  118.  
  119. set /P res=[y/n]?
  120.  
  121. if "%res%"=="y" (
  122.  
  123.   echo *
  124.   echo Compressing system
  125.  
  126.   echo *
  127.   for %%a in (bin\drivers\*.obj) do (
  128.     echo ================== kpack %%a
  129.     kpack %%a
  130.     if not %errorlevel%==0 goto :Error_KpackFailed
  131.   )
  132.  
  133. )
  134. goto :eof
  135.  
  136. :Target_clean
  137.    echo *** cleaning ...
  138.    rmdir /S /Q bin
  139. goto :Exit_OK
  140.  
  141.  
  142. :Error_FasmFailed
  143. echo error: fasm execution failed
  144. erase lang.inc >nul 2>&1
  145. echo.
  146. pause
  147. exit 1
  148.  
  149. :Error_KpackFailed
  150. echo   *** NOTICE ***
  151. echo If you want to pack all applications you may
  152. echo place "kpack" in accessible directory or system %PATH%.
  153. echo You can get this tool from KolibriOS distribution kit.
  154. pause
  155. exit 1
  156.  
  157. :Exit_OK
  158. echo.
  159. echo all operations have been done
  160. pause
  161. exit 0
  162.