I have converted xmap2_compile from XreaL to work with q3map2 and Tremulous. This compile script reads the options directly from the map file's worldspawn entity, in the form of three keys called q3map_bspopts, q3map_visopts, and q3map_lightopts. If you compile your map with any special options, you can type these keys in for worldspawn, and assign the options you want for each, like you would on the command line like this:

The benefit to this method is that if you release your map source, other mappers will not only be able to see your map in radiant, but will also be able to see what options you used to compile the map.
Use of this script is easy. All you do is ./trem_mapcompile -all mapname.map and it will compile through all three stages. You can pick a stage to compile specifically with -bsp, -vis, and -light.
#!/bin/bash
################################################################################
# #
# Q3MAP2 map compilation script. #
# By Evan 'Odin' Goers #
# #
# To use this script, add your compilation options for each stage(bsp, vis, #
# light) to your map's worldspawn entity. You can do this by adding a key #
# called q3map_bspopts, q3map_visopts, or q3map_lightopts. An example is as #
# follows: #
# #
# "q3map_lightopts" "-fast -filter -bounce 2" #
# #
################################################################################
# this is the path to q3map2.
# it is most likely different than the default value specified already.
COMPILER='/home/megatog615/svn/netradiant/install/q3map2.x86'
# fs_basepath is generally '/usr/local/games/tremulous' on linux systems with
# tremulous installed via the official installer from the website.
# sometimes this can also be in your home directory, such as '$HOME/.tremulous'.
FS_BASEPATH='/home/megatog615/games/tremulous'
# fs_game is generally 'base'
FS_GAME='base'
# game should be 'tremulous'
GAME='tremulous'
# this is the compile string used to create the compilation commands.
COMPILE="$COMPILER -fs_basepath $FS_BASEPATH -fs_game $FS_GAME -game $GAME"
# DO NOT EDIT THIS LINE OR THE FOLLOWING LINES. DOING SO MAY RESULT IN
# UNEXPECTED SCRIPT BEHAVIOR.
MAP="$2"
THREADS=`grep processor /proc/cpuinfo | awk '{a++} END {print a}'`
# map_ convention used to prevent possible binary name collision
map_bsp() {
if ! $COMPILE -v -meta -leaktest $BSPOPTS $MAP; then exit 1; fi
}
map_debugportals() {
if ! $COMPILE -v -debugportals -meta -leaktest $MAP; then exit 1; fi
}
map_debugsurfaces() {
if ! $COMPILE -v -debugsurfaces -meta -leaktest $MAP; then exit 1; fi
}
map_fastvis() {
if ! $COMPILE -vis -fast $VISOPTS $MAP; then exit 1; fi
}
map_vis() {
if ! $COMPILE -vis $VISOPTS $MAP; then exit 1; fi
}
map_light() {
if ! $COMPILE -light -threads $THREADS -v $LIGHTOPTS $MAP; then exit 1; fi
}
map_scale() {
if ! $COMPILE -v -scale "$@" $MAP; then exit 1; fi
}
map_package() {
cd ..
DATE=`date +%Y%m%d`
MAP_STRIPPED=`basename $MAP .map`
PK3NAME=map-$MAP_STRIPPED-$DATE.pk3
zip $PK3NAME maps/$MAP_STRIPPED.bsp
zip $PK3NAME maps/$MAP_STRIPPED.map
zip $PK3NAME maps/$MAP_STRIPPED/*.tga # used for external lightmaps, if any
zip $PK3NAME maps/$MAP_STRIPPED/*.png # used for external lightmaps, if any
zip $PK3NAME levelshot/$MAP_STRIPPED.*
zip $PK3NAME scripts/$MAP_STRIPPED.arena
}
map_readbspopts() {
if [ -r $MAP ]; then
#grab the bspopts from the map
BSPOPTS=`grep -A 256 "^// entity 0$" $MAP | \
grep q3map_bspopts | \
head -n1 | \
sed -r 's/^"q3map_bspopts" "(.*)"$/\1/'`
if [[ $BSPOPTS != "" ]]; then
echo "BSPOPTS: $BSPOPTS"
fi
else
echo "$MAP: no such map."
exit 1
fi
}
map_readvisopts() {
if [ -r $MAP ]; then
#grab the visopts from the map
VISOPTS=`grep -A 256 "^// entity 0$" $MAP | \
grep q3map_visopts | \
head -n1 | \
sed -r 's/^"q3map_visopts" "(.*)"$/\1/'`
if [[ $VISOPTS != "" ]]; then
echo "VISOPTS: $VISOPTS"
fi
else
echo "$MAP: no such map."
exit 1
fi
}
map_readlightopts() {
if [ -r $MAP ]; then
#grab the lightopts from the map
LIGHTOPTS=`grep -A 256 "^// entity 0$" $MAP | \
grep q3map_lightopts | \
head -n1 | \
sed -r 's/^"q3map_lightopts" "(.*)"$/\1/'`
if [[ $LIGHTOPTS != "" ]]; then
echo "LIGHTOPTS: $LIGHTOPTS"
else
echo "Forcing '-fast' as per map bare minimum."
echo "Add 'q3map_lightopts in worldspawn to override."
LIGHTOPTS="-fast"
fi
else
echo "$MAP: no such map."
exit 1
fi
}
map_defaultcommand() {
echo "Usage: $0 [OPTION] [FILE]"
echo "Try \`$0 -h' for more information."
}
map_help() {
echo "Usage: $0 [OPTION] [FILE]"
echo "Compile a map into a BSP file and perform other functions."
echo "Example $0 -all arena1.map"
echo "Compile options(only one may be used):"
echo " -bsp Compile the map into a basic BSP."
echo " -vis Calculate VIS for an existing BSP."
echo " -fastvis Same as -vis, at the cost of accuracy."
echo " -light Calculate light for an existing BSP."
echo " -pk3 Attempt to automatically package a map project."
echo " -all Short for -bsp -vis -light."
echo " -h This help message."
echo ""
echo "This script will compile a map by using q3map2. To change compilation"
echo "options, add q3map_bspopts, q3map_visopts, or q3map_lightopts to your"
echo "map's worldspawn entity with the compile flags you want."
echo ""
echo "You may need to modify this script for it to operate correctly in your"
echo "development environment."
echo ""
echo "This compilation script was written by Evan 'Odin' Goers, with"
echo "help and additions from DavidSev, and Robert 'Tr3B' Beckebans."
}
check_compiler() {
if [ ! -f $COMPILER ]; then
echo "`basename $COMPILER` not found!"
echo "Did you enter the correct path for COMPILER?"
exit 1
fi
}
case $1 in
-bsp)
check_compiler;
map_readbspopts;
map_bsp $BSPOPTS;
;;
-debugportals)
check_compiler;
map_debugportals;
;;
-debugsurfaces)
check_compiler;
map_debugsurfaces;
;;
-fastvis)
check_compiler;
map_readvisopts;
map_fastvis $VISOPTS;
;;
-vis)
check_compiler;
map_readvisopts;
map_vis $VISOPTS;
;;
-light)
check_compiler;
map_readlightopts;
map_light $LIGHTOPTS;
;;
-pk3)
check_compiler;
map_package $PACKAGEOTPS;
;;
-all)
check_compiler;
map_readbspopts;
map_bsp $BSPOPTS;
map_readvisopts;
map_vis $VISOPTS;
map_readlightopts;
map_light $LIGHTOPTS;
;;
-h)
map_help;
;;
*)
map_defaultcommand;
;;
esac
Just select all, save into a blank file, save, and call the file trem_mapcompile. Give it executable permissions with chmod +x trem_mapcompile, and edit the variables at the top of the script to get it working with your development environment.
This script also has experimental support for automatically packaging your map into a pk3 with the -pk3 option.
UPDATE: The script now detects the number of CPUs/cores and adjusts -threads for -light accordingly.