HowTo: Compile from SVN (Ubuntu/Debian)

Developer discussion of experimental fixes, changes, and improvements.

Moderators: Nexuiz Moderators, Moderators

HowTo: Compile from SVN (Ubuntu/Debian)

Postby FruitieX » Fri May 09, 2008 1:35 pm

This howto guides you through the process of compiling Nexuiz from SVN, which will fetch you the very latest development version of Nexuiz. The howto is designed especially for Ubuntu and Debian, but it works for other distributions too (except for dependency installing in step two, here you are on your own).

The Nexuiz SVN repository alone by the way, takes up around 3 GB of disk space, so make sure you have at least about 4 GB free space!

If for some reason it doesn't work, remember to post the error so we have a clue of what's going on! :)

Step one: Get the script
http://www.hrfdesign.com/crap/misc/svnup-nexuiz.sh

Make it executable:
Code: Select all
chmod +x /path/to/svnup-nexuiz.sh


Make running the script more convenient:
Code: Select all
sudo ln -s /path/to/svnup-nexuiz.sh /usr/bin/


Step two: Run the script!
First run the script like this to download all the required dependencies (debian-based systems only I'm afraid, it uses apt). Users of other distributions will have to find the dependencies themselves! :(
Code: Select all
svnup-nexuiz.sh -a


(optional) Edit the nex_root variable inside of the script. The default is ~/software/games/nexuiz

Okay, now run the script like this to checkout (download), compile and install Nexuiz from SVN!
Code: Select all
svnup-nexuiz.sh -s


Whenever you want to update Nexuiz in the future, just run the svnup-nexuiz.sh script without any arguments. To see what else the script can do, run svnup-nexuiz.sh -h
Last edited by FruitieX on Sat May 02, 2009 7:44 pm, edited 28 times in total.
FruitieX
Keyboard killer
 
Posts: 588
Joined: Mon Nov 13, 2006 4:47 pm
Location: Finland

Postby Mr. Bougo » Fri May 09, 2008 6:41 pm

Hey, let me waste the topic with some windows stuff.

Batch scripty, you must edit it to match your setup.

Updates the svn (you need svn)
Compiles the engine (you need compiling stuff, in my case mingw)
Compiles the game (you need a recent fteqcc.exe in your dir)
Packs everything up (you need 7zip)

Sooo you need some stuff it seems


Code: Select all
@echo off
setlocal ENABLEEXTENSIONS

::SETTINGS PART, feel free to edit the values
:: USE QUOTES around paths containing a space. Supports both relative and absolute.
set gamedir=C:\Nexuiz
set qcc=fteqcc.exe
set nexdir=nexuiz
set dpdir=darkplaces
::BE CAREFUL, DON'T USE AN EXISTING DIRECTORY, IT WILL BE ERASED
set builddir=SVNBuild
set szdir="%ProgramFiles%\7-zip\7z.exe"
set mingwdir=c:\dev\MinGW

set copyflag=2
::SETTINGS END HERE, don't edit what comes next!

::This will make the vars absolute
set spwd=%CD%
for %%A in (gamedir qcc nexdir dpdir builddir szdir mingwdir) do call:getabs %%A

set mingwdir=%mingwdir::=%
set mingwdir=%mingwdir:\=/%

if not exist %nexdir% call:co %nexdir% svn.icculus.org/nexuiz/trunk "1 GB"
if not exist %dpdir% call:co %dpdir% svn.icculus.org/twilight/trunk/darkplaces "10 MB"

::Params
:loop
if "%1"=="" goto Continue
if /i "%1"=="-y" set yesflag=1
if /i "%1"=="-up" set updateflag=1
if /i "%1"=="-nup" set updateflag=0
if /i "%1"=="-cp" set copyflag=1
shift
goto loop
:continue

if "%copyflag%"=="1" goto copy

if not "%updateflag%"=="0" (
   echo Updating Darkplaces SVN...
   svn update %dpdir%
   echo Updating Nexuiz SVN...
   svn update %nexdir%
)

if "%updateflag%"=="1" goto end
if "%yesflag%"=="1" goto compile

:promptcomp
echo.
echo Compile? [Y]/N
set /p compile=
if /i "%compile%"=="n" goto end
if /i "%compile%"=="y" goto compile
if /i "%compile%"=="" goto compile
echo Bad input
goto promptcomp

:compile
if exist %builddir% echo deleting %builddir%
if exist %builddir% pause
if exist %builddir% rd /s /q %builddir%
md %builddir%\data

::Engine
cd %dpdir%
make DP_MAKE_TARGET=mingw CC="gcc -I/%mingwdir%/include/darkplaces" cl-nexuiz
make DP_MAKE_TARGET=mingw CC="gcc -I/%mingwdir%/include/SDL" sdl-nexuiz
make DP_MAKE_TARGET=mingw sv-nexuiz

move /y nexuiz*.exe %builddir% > nul
make clean
cd ..

::Game
cd %nexdir%\data\qcsrc\menu
%qcc%
if exist %qcc:.exe=%.log del %qcc:.exe=%.log
cd ..\server
%qcc%
if exist %qcc:.exe=%.log del %qcc:.exe=%.log
cd ..\client
%qcc%
if exist %qcc:.exe=%.log del %qcc:.exe=%.log

cd ..\..
del *.lno

if exist %builddir%\data\data.pk3 del %builddir%\data\data.pk3
%szdir% a -tzip %builddir%\data\data.pk3 * -x!common-spog.pk3 -x!qcsrc -x!.svn -x!*\.svn -r
del progs.dat
del menu.dat
move csprogs.dat %builddir%\data\

if "%yesflag%"=="1" goto copy
if "%copyflag%"=="2" goto copy


:promptcp
echo.
echo Do you want to copy the files? (Make sure you're not running Nexuiz) [Y]/N
set /p copystuff=
if /i "%copystuff%"=="n" goto end
if /i "%copystuff%"=="y" goto copy
if /i "%copystuff%"=="" goto copy
echo Bad input
goto promptcp


:copy
cd %builddir%
if exist nexuiz*.exe if exist %gamedir%\nexuiz*.exe del %gamedir%\nexuiz*.exe
if exist nexuiz*.exe copy nexuiz*.exe %gamedir%\
if exist data\data.pk3 if exist %gamedir%\data\data.pk3 del %gamedir%\data\data.pk3
if exist data\data.pk3 copy data\data.pk3 %gamedir%\data\

if exist %gamedir%\data\progs.dat del %gamedir%\data\progs.dat
if exist data\progs.dat copy data\progs.dat %gamedir%\data\

if exist %gamedir%\data\menu.dat del %gamedir%\data\menu.dat
if exist data\menu.dat copy data\menu.dat %gamedir%\data\

if exist data\csprogs.dat del %gamedir%\data\csprogs.dat
if exist data\csprogs.dat copy data\csprogs.dat %gamedir%\data\


:end
pause
goto:EOF

::FUNCTIONS

:getabs
set vname=%1
call set r%vname%=%%%vname%%%
call call:getdir %vname% %%%vname%%%
call echo %vname%: %%r%vname%%% becomes %%%vname%%%
goto:eof
:getdir
set %1="%~f2"
goto:eof
:co
echo It appears that %~1 doesn't exist. Do you want to download the files from the SVN repository? [Y]/N
set /p cosvn=
if /i "%cosvn%"=="n" goto:eof
if /i "%cosvn%"=="" set cosvn=y
if /i "%cosvn%"=="y" echo Downloading from %~2, estimated size: %~3&&echo svn co "svn://%~2" %1&&goto:eof
echo Bad input
goto co
goto:eof

TODO:

use this http://www.robvanderwoude.com/datetiment.html#SortDate4 to make a datayyyymmdd.pk3 file instead of just data.pk3


And it has badass flags, badass buggy and not standard-compliant flags.
Last edited by Mr. Bougo on Mon Aug 18, 2008 8:38 am, edited 2 times in total.
Mr. Bougo
Keyboard killer
 
Posts: 760
Joined: Mon Sep 10, 2007 3:29 pm

Postby esteel » Sun May 11, 2008 1:01 pm

Wow that seems quite complicated.. i just do:

pushd ~/vc/twilight/trunk/darkplaces
(svn up .. && make release) 2>&1 | less

pushd ~/vc/fteqw/trunk/engine/qclib
(svn up ../.. && make) 2>&1 | less

pushd ~/vc/nexuiz/trunk
(svn up && (pushd data/qcsrc && (pushd server; ~/vc/fteqw/trunk/engine/qclib/fteqcc.bin) && (pushd menu; ~/vc/fteqw/trunk/engine/qclib/fteqcc.bin) && (pushd client; ~/vc/fteqw/trunk/engine/qclib/fteqcc.bin) && rm ../csprogs.*)) 2>&1 | less

And i also once link the dp binaries into nexuiz:
ln -s "$@" "$HOME/vc/twilight/trunk/darkplaces" darkplaces
ln -s "$@" darkplaces/darkplaces-dedicated nexuiz-dedicated
ln -s "$@" darkplaces/darkplaces-sdl nexuiz-sdl
ln -s "$@" darkplaces/darkplaces-glx nexuiz-glx
esteel
Site admin and forum addon
 
Posts: 3924
Joined: Wed Mar 01, 2006 8:27 am

Postby Mr. Bougo » Sun May 11, 2008 2:55 pm

Well, mine keeps the SVN reps as clean as possible... I don't want to put unwanted stuff in there. It would result in a mess.
So I build the data package and put it in my nexuiz dir... Less messy, I can tell which file is original, which has been downloaded etc.
Mr. Bougo
Keyboard killer
 
Posts: 760
Joined: Mon Sep 10, 2007 3:29 pm

Postby Spaceman » Tue May 27, 2008 12:35 pm

I'm using Kubuntu 7.10 and followed your great guide, I now have a folder called Games with two folders Nexuiz and Darkplaces.

The SVN retrieval went well, I have some data in both folders.

However, the build script appears to give some errors. I have slightly modified your build script - I have added some more echo commands.

Code: Select all
#!
nex_trunk=~/Games/Nexuiz/trunk # Path to Nexuiz SVN trunk, replace with path from earlier step
dp_trunk=~/Games/Darkplaces # Path to DarkPlaces SVN trunk, replace with path from earlier step
echo
echo "Starting the process"
echo
echo
echo "Updating Nexuiz from SVN"
cd "$nex_trunk"
svn up
echo "Nexuiz updated from SVN"
echo
echo
echo "Compiling menu"
cd "$nex_trunk/data/qcsrc/menu"
fteqcc
cd ..
echo "Menu compilation finished"
echo
echo
echo "Compiling server"
cd "$nex_trunk/data/qcsrc/server"
fteqcc
echo "Server compilation finished"
echo
echo
echo "Updating Darkplaces from SVN"
cd "$dp_trunk"
svn up
echo "Darkplaces updated from SVN"
echo
echo
echo "Compiling Darkplaces"
make nexuiz
echo "Darkplaces compiled"
echo
echo
echo "Linking engines"
ln -f nexuiz-glx "$nex_trunk/nexuiz-glx"
ln -f nexuiz-sdl "$nex_trunk/nexuiz-sdl"
echo "Engines linked"
echo
echo "Finished"

return

But, it appears to fail
Code: Select all
./svnup-nexuiz.sh

Starting the process

Updating Nexuiz from SVN
At revision 3664.
Nexuiz updated from SVN


Compiling menu
Source file: progs.src
outputfile: ../../menu.dat
compiling config.qh
compiling msys.qh
compiling mbuiltin.qh
compiling oo/base.h
compiling ../common/constants.qh
compiling ../common/util.qh
compiling ../common/mapinfo.qh
compiling ../common/campaign_common.qh
compiling gamecommand.qh
compiling menu.qh
compiling draw.qh
compiling skin.qh
compiling nexuiz/util.qh
compiling oo/classdefs.h
compiling classes.c
compiling oo/constructors.h
compiling classes.c
compiling oo/implementation.h
compiling classes.c
compiling ../common/util.qc
compiling ../common/gamecommand.qc
compiling gamecommand.qc
compiling menu.qc
compiling draw.qc
compiling nexuiz/util.qc
compiling ../common/campaign_file.qc
compiling ../common/campaign_setup.qc
compiling ../common/mapinfo.qc
Progs should run on any Quake executor
139804 strofs (of 1000000)
29767 numstatements (of 524288)
   766 numfunctions (of 16384)
  6875 numglobaldefs (of 32768)
   605 numfielddefs (565 unique) (of 2048)
  6877 numpr_globals (of 65536)
Writing ../../menu.dat
493052 TOTAL SIZE
Writing ../../menu.lno
Compile Complete

optres_shortenifnots 57
optres_overlaptemps 10544
optres_constantarithmatic 30
optres_nonvec_parms 6328
optres_assignments 473
optres_unreferenced 157
optres_dupconstdefs 98
numtemps 303
0 warnings
Menu compilation finished


Compiling server
Source file: progs.src
outputfile: ../../progs.dat
compiling sys.qh
compiling builtins.qh
compiling constants.qh
compiling ../common/constants.qh
compiling defs.qh
compiling extensions.qh
compiling campaign.qh
compiling ../common/campaign_common.qh
compiling ../common/util.qh
compiling ../common/util.qc
compiling ../common/mapinfo.qh
compiling ipban.qh
compiling keyhunt.qh
compiling antilag.qh
compiling miscfunctions.qc
compiling waypointsprites.qc
compiling bots.qc
compiling havocbot_roles.qc
compiling havocbot.qc
compiling g_subs.qc
compiling runematch.qc
compiling arena.qc
compiling g_violence.qc
compiling g_damage.qc
compiling teamplay.qc
compiling cl_physics.qc
compiling g_world.qc
compiling g_decors.qc
compiling g_casings.qc
compiling t_jumppads.qc
compiling t_teleporters.qc
compiling sv_main.qc
compiling sv_stats.qc
compiling g_triggers.qc
compiling cl_weaponsystem.qc
compiling w_common.qc
compiling w_laser.qc
compiling w_shotgun.qc
compiling w_uzi.qc
compiling w_grenadelauncher.qc
compiling w_electro.qc
compiling w_crylink.qc
compiling w_nex.qc
compiling w_hagar.qc
compiling w_rocketlauncher.qc
compiling t_items.qc
compiling cl_weapons.qc
compiling cl_impulse.qc
compiling cl_player.qc
compiling cl_client.qc
compiling t_plats.qc
compiling antilag.qc
compiling ctf.qc
compiling domination.qc
compiling mode_onslaught.qc
compiling g_hook.qc
compiling t_swamp.qc
compiling clientcommands.qc
compiling campaign.qc
compiling ../common/campaign_file.qc
compiling ../common/campaign_setup.qc
compiling ../common/gamecommand.qc
compiling gamecommand.qc
compiling keyhunt.qc
compiling assault.qc
compiling ipban.qc
compiling ../common/mapinfo.qc
compiling t_quake3.qc
compiling t_halflife.qc
compiling t_quake.qc
Recognised progs as regular Quake
Progs should run on any Quake executor
179264 strofs (of 1000000)
50214 numstatements (of 524288)
  1164 numfunctions (of 16384)
  8743 numglobaldefs (of 32768)
  1028 numfielddefs (898 unique) (of 2048)
  8963 numpr_globals (of 65536)
Writing ../../progs.dat
737088 TOTAL SIZE
Writing ../../progs.lno
112 unique precache_sounds
109 unique precache_models
Compile Complete

optres_shortenifnots 390
optres_overlaptemps 19939
optres_constantarithmatic 152
optres_nonvec_parms 11145
optres_assignments 1420
optres_unreferenced 229
optres_dupconstdefs 285
numtemps 555
0 warnings
Server compilation finished


Updating Darkplaces from SVN
Skipped '.'
Darkplaces updated from SVN


Compiling Darkplaces
make: *** No rule to make target `nexuiz'. Stop.
Darkplaces compiled


Linking engines
ln: accessing `nexuiz-glx': No such file or directory
ln: accessing `nexuiz-sdl': No such file or directory
Engines linked

Finished
./svnup-nexuiz.sh: line 45: return: can only `return' from a function or sourced script


What am I doing wrong?
Last edited by Spaceman on Sat May 31, 2008 4:43 pm, edited 1 time in total.
Spaceman
Alien trapper
 
Posts: 264
Joined: Tue Aug 28, 2007 10:53 am

Postby divVerent » Tue May 27, 2008 12:51 pm

The Darkplaces directory is not correctly checked out. No idea what exactly is wrong. In the Darkplaces directory, you SHOULD find lots of .c files. Can you verify that?
1. Open Notepad
2. Paste: ÿþMSMSMS
3. Save
4. Open the file in Notepad again

You can vary the number of "MS", so you can clearly see it's MS which is causing it.
divVerent
Site admin and keyboard killer
 
Posts: 3809
Joined: Thu Mar 02, 2006 4:46 pm
Location: BRLOGENSHFEGLE

Postby Spaceman » Tue May 27, 2008 1:44 pm

I found the .c files in /Games/Darkplaces/darkplaces. I modified line 3 of the build script to read
Code: Select all
dp_trunk=~/Games/Darkplaces/darkplaces # Path to DarkPlaces SVN trunk, replace with path from earlier step

and Darkplaces appears to have compiled.

Although the last line 'return' gave an error, I suspect it's not needed and can be deleted.

Many thanks for the big hint :D :D
Spaceman
Alien trapper
 
Posts: 264
Joined: Tue Aug 28, 2007 10:53 am

Postby FruitieX » Tue May 27, 2008 5:48 pm

victim [v] wrote:I found the .c files in /Games/Darkplaces/darkplaces. I modified line 3 of the build script to read
Code: Select all
dp_trunk=~/Games/Darkplaces/darkplaces # Path to DarkPlaces SVN trunk, replace with path from earlier step

and Darkplaces appears to have compiled.

Although the last line 'return' gave an error, I suspect it's not needed and can be deleted.

Many thanks for the big hint :D :D


Good to know it worked :)

About the return error: I'm no expert in bash scripting, do I even need the return command there? ^^
Image
FruitieX
Keyboard killer
 
Posts: 588
Joined: Mon Nov 13, 2006 4:47 pm
Location: Finland

Postby Spaceman » Tue May 27, 2008 6:33 pm

FruitieX wrote:About the return error: I'm no expert in bash scripting, do I even need the return command there? ^^
No, the return command is not needed.

Many thanks for the very easy to understand guide :D

I have modified your build script again
Code: Select all
Added several more helpful comments
Removed the line with return
Starts the game!

The copy/rename section will only created 686 based file names. With a bit of work it could rename the created executables with the correct name on 64 bit systems or not!
Code: Select all
#!
nex_trunk=~/Games/Nexuiz/trunk # Path to Nexuiz SVN trunk
dp_trunk=~/Games/Darkplaces/darkplaces # Path to DarkPlaces SVN trunk
echo
echo "Starting the process"
echo
echo
echo "1. Updating Nexuiz from SVN"
cd "$nex_trunk"
svn up
echo "Nexuiz updated from SVN"
echo
echo
echo "2. Compiling menu"
cd "$nex_trunk/data/qcsrc/menu"
fteqcc
cd ..
echo "Menu compilation finished"
echo
echo
echo "3. Compiling server"
cd "$nex_trunk/data/qcsrc/server"
fteqcc
echo "Server compilation finished"
echo
echo
echo "4. Updating Darkplaces from SVN"
cd "$dp_trunk"
svn up
echo "Darkplaces updated from SVN"
echo
echo
echo "5. Compiling Darkplaces"
make nexuiz
echo "Darkplaces compiled"
echo
echo
echo "6. Linking engines"
ln -f nexuiz-glx "$nex_trunk/nexuiz-glx"
ln -f nexuiz-sdl "$nex_trunk/nexuiz-sdl"
echo "Engines linked"
echo
echo
echo "Moving and renaming the three compiled files from $dp_trunk to $nex_trunk"
mv "$dp_trunk/nexuiz-dedicated" "$nex_trunk/nexuiz-linux-686-dedicated"
mv "$dp_trunk/nexuiz-glx" "$nex_trunk/nexuiz-linux-686-glx"
mv "$dp_trunk/nexuiz-sdl" "$nex_trunk/nexuiz-linux-686-sdl"
echo "Renamed the three compiled files"
echo
echo "Starting the game $nex_trunk/nexuiz-linux-sdl.sh"
cd "$nex_trunk"
./nexuiz-linux-sdl.sh
Last edited by Spaceman on Fri Jun 13, 2008 2:03 pm, edited 2 times in total.
Spaceman
Alien trapper
 
Posts: 264
Joined: Tue Aug 28, 2007 10:53 am

Postby [-z-] » Fri Jun 13, 2008 12:41 pm

I didn't get any 686 client bash scripts.

Code: Select all
6. Linking engines
ln: accessing `nexuiz-glx': No such file or directory
ln: accessing `nexuiz-sdl': No such file or directory
Engines linked

Finished compiling

Moving the compiled files to /home/detrate/Games
cp: cannot stat `/home/detrate/Games/Darkplaces/darkplaces/nexuiz-glx': No such file or directory
cp: cannot stat `/home/detrate/Games/Darkplaces/darkplaces/nexuiz-sdl': No such file or directory
Moved the compiled files


Code: Select all
detrate@detrate-laptop:~/Games/Nexuiz/trunk$ ls
artwork  data  Docs  gpl.txt  misc  modelsource  nexuiz-linux-glx.sh  nexuiz-linux-sdl.sh  pro  tools


Code: Select all
detrate@detrate-laptop:~/Games$ ls
Darkplaces  Nexuiz  nexuiz-linux-686-dedicated


This appears to be where the error occurs

Code: Select all
/usr/bin/ld: cannot find -lXext
collect2: ld returned 1 exit status
make[3]: *** [nexuiz-glx] Error 1
make[3]: Leaving directory `/home/detrate/Games/Darkplaces/darkplaces'
make[2]: *** [bin-release] Error 2
make[2]: Leaving directory `/home/detrate/Games/Darkplaces/darkplaces'
make[1]: *** [cl-nexuiz] Error 2
make[1]: Leaving directory `/home/detrate/Games/Darkplaces/darkplaces'
make: *** [nexuiz] Error 2
Darkplaces compiled
Last edited by [-z-] on Fri Jun 13, 2008 2:32 pm, edited 1 time in total.
[-z-]
Site Admin and Nexuiz Ninja
 
Posts: 1794
Joined: Mon Nov 13, 2006 12:20 am
Location: Florida

Next

Return to Nexuiz - Development

Who is online

Users browsing this forum: No registered users and 1 guest