--- games-mods.eclass-old 2007-04-03 18:10:10.000000000 +0100 +++ games-mods.eclass 2007-04-03 18:23:24.000000000 +0100 @@ -6,8 +6,9 @@ # GAME - (doom3, quake4 or ut2004, etc), unless ${PN} starts with e.g. "doom3-" # MOD_BINS - Name of the binary to run # MOD_DESC - Description for the mod -# MOD_DIR - Subdirectory name for the mod, if applicable +# MOD_DIR - Subdirectory name for the mod, if applicable # MOD_ICON - Custom icon for the mod, instead of the default +# MOD_MAP - Name of map to load at start, if applicable # MOD_NAME - Creates a command-line wrapper and desktop icon for the mod # MOD_TBZ2 - File to extract within the Makeself archive @@ -16,56 +17,47 @@ EXPORT_FUNCTIONS pkg_setup src_unpack src_install pkg_postinst [[ -z ${GAME} ]] && GAME=${PN%%-*} +GAME_EXE=${GAME} +DED_EXE=${GAME_EXE}-ded +DED_OPTIONS="+set dedicated 1 +exec server.cfg" +SELECT_MOD="+set fs_game " +SELECT_MAP="+map " # Set our default title, icon, and cli options case "${GAME}" in "doom3") GAME_TITLE="Doom III" DEFAULT_MOD_ICON="doom3.png" - SELECT_MOD="+set fs_game " - GAME_EXE="doom3" - DED_EXE="doom3-ded" - DED_OPTIONS="+set dedicated 1 +exec server.cfg" ;; "enemy-territory") GAME_TITLE="Enemy Territory" DEFAULT_MOD_ICON="ET.xpm" - SELECT_MOD="+set fs_game " GAME_EXE="et" DED_EXE="et-ded" - DED_OPTIONS="+set dedicated 1 +exec server.cfg" ;; "quake3") GAME_TITLE="Quake III" DEFAULT_MOD_ICON="quake3.xpm" - SELECT_MOD="+set fs_game " - GAME_EXE="quake3" - DED_EXE="quake3-ded" - DED_OPTIONS="+set dedicated 1 +exec server.cfg" ;; "quake4") GAME_TITLE="Quake IV" DEFAULT_MOD_ICON="quake4.bmp" - SELECT_MOD="+set fs_game " - GAME_EXE="q4" - DED_EXE="q4-ded" - DED_OPTIONS="+set dedicated 1 +exec server.cfg" ;; "ut2003") GAME_TITLE="UT2003" DEFAULT_MOD_ICON="ut2003.xpm" SELECT_MOD="-mod=" - GAME_EXE="ut2003" DED_EXE="ucc" DED_OPTIONS="" + SELECT_MAP="" ;; "ut2004") GAME_TITLE="UT2004" DEFAULT_MOD_ICON="ut2004.xpm" SELECT_MOD="-mod=" - GAME_EXE="ut2004" DED_EXE="ucc" DED_OPTIONS="" + SELECT_MAP="" ;; *) eerror "This game is either not supported or you must set the GAME" @@ -114,7 +106,7 @@ if has_version ${CATEGORY}/${GAME}-bin then if use dedicated && \ - ! built_with_use ${CATEGORY}/${GAME}-bin dedicated + ! built_with_use ${CATEGORY}/${GAME}-bin dedicated then die "You must merge ${CATEGORY}/${GAME}-bin with USE=dedicated!" fi @@ -169,10 +161,11 @@ done done # Since we remove all of these anyway, let's move it to the eclass - rm -f 3355_patch 3339_patch + [[ -e 3355_patch ]] && rm -f 3355_patch } games-mods_src_install() { + local binary local readme MOD_ICON_EXT new_bin_name bin_name mod files directories i j INS_DIR=${dir} @@ -222,6 +215,10 @@ fi # Set up command-line and desktop menu entries + local game_select="${SELECT_MOD}${MOD_DIR}" + [[ -n "${MOD_MAP}" ]] \ + && game_select="${game_select} ${SELECT_MAP}${MOD_MAP}" + if [[ -n "${MOD_BINS}" ]] then for binary in ${MOD_BINS} @@ -275,7 +272,7 @@ elif [[ -n "${MOD_DIR}" ]] then games_make_wrapper "${GAME_EXE}-${MOD_DIR}" \ - "${GAME_EXE} ${SELECT_MOD}${MOD_DIR}" "${dir}" "${dir}" + "${GAME_EXE} ${game_select}" "${dir}" "${dir}" make_desktop_entry "${GAME_EXE}-${MOD_DIR}" \ "${GAME_TITLE} - ${MOD_NAME}" "${MOD_ICON}" # Since only quake3 has both a binary and a source-based install, @@ -287,10 +284,10 @@ games_make_wrapper "${GAME_EXE}-bin-${MOD_DIR}" \ "${GAME_EXE}-bin ${SELECT_MOD}${MOD_DIR}" \ "${dir}" "${dir}" + make_desktop_entry "${GAME_EXE}-bin-${MOD_DIR}" \ + "${GAME_TITLE} - ${MOD_NAME} (binary)" \ + "${MOD_ICON}" fi - make_desktop_entry "${GAME_EXE}-bin-${MOD_DIR}" \ - "${GAME_TITLE} - ${MOD_NAME} (binary)" \ - "${MOD_ICON}" ;; esac fi