diff --git a/.gitignore b/.gitignore index eef611b..3655760 100644 --- a/.gitignore +++ b/.gitignore @@ -1,11 +1,8 @@ build/ chat/ -clientdata/ configs/ data/ dependencies/ -dsrc/ -exe/ -src/ -stationapi/ +miff/ .setup +local.properties diff --git a/.gitmodules b/.gitmodules new file mode 100644 index 0000000..e8cf90d --- /dev/null +++ b/.gitmodules @@ -0,0 +1,17 @@ +[submodule "stationapi"] + path = stationapi + url = https://github.com/SWG-Source/stationapi.git +[submodule "dsrc"] + path = dsrc + url = https://github.com/SWG-Source/dsrc.git +[submodule "src"] + path = src + url = https://github.com/SWG-Source/src.git +[submodule "clientdata"] + path = clientdata + url = https://github.com/SWG-Source/clientdata.git +[submodule "exe"] + path = exe + url = https://github.com/SWG-Source/configs.git + ignore = dirty + diff --git a/README.md b/README.md old mode 100644 new mode 100755 index a0df072..b933b2f --- a/README.md +++ b/README.md @@ -1,7 +1,8 @@ -# SWGSource V1.2 Build Instructions +# SWGSource V2.0 (version pending) Build Instructions ## Credit -Credit the StellaBellum team (DarthArgus, Cekis, SilentGuardian, Ness, SwgNoobs, DevCodex) for making their repositories open. All source is forked from those repositories and progressed from that point. +Credit the StellaBellum team (DarthArgus, Cekis, SilentGuardian, Ness, SwgNoobs, DevCodex) for making their repositories open. All source is forked from +those repositories and progressed from that point. ## What Do You Need To Do To Get A Server Running? @@ -16,91 +17,37 @@ When the GIT repository has been cloned successfully, open the swg-main director cd /home/swg/swg-main -Create a .setup file such that the build script knows where to start: - - touch .setup - ## Building -The process is nearly fully automated by executing the build_linux.sh script located in swg-main. The script will ask you a series of questions with each -question corresponding to a different step in the build process. Each step is defined below. To complete building, kick off the build script and follow -these instructions as detailed here to understand each step. +### Requirements +- Java 8 (1.8_u101) +- Apache ANT 1.9+ + +First and foremost, IF YOU DO NOT HAVE ANT INSTALLED ALREADY, you'll need to install Apache ANT (at least version 1.9) on your VM. ANT is required for the build process to run successfully. ANT +will be included in the next VM build, but for now here are the steps to do so manually: + +1. Go to https://ant.apache.com/download and download the latest version of ANT (1.10.5 is latest as of this writing, but anything over 1.9.x should work fine). +2. Expand the ANT package (.zip or .tar) into your VM (or server) directories somewhere. Take note of the location where you expanded it. +3. Edit your .profile and add a line that sets the location where you expanded it as ANT_HOME. +4. While you're editing your profile, make sure that JAVA_HOME is set to the right spot too. You can figure out where Java is installed by using the +"which" command: ```which java``` +5. Save your .profile edits and test out that ANT_HOME is installed properly by typing in "ant" at any location on your command line. You should get a +non-standard error message about how build.xml is missing. If JAVA_HOME isn't set correctly, you'll get an error about that too. ### Starting the Build Process -Follow the instructions of the build script. The binary building phase will take roughly 1 hour for each CPU core assigned to your VM. Do not skip any steps. -Execute the following script to start building (see detail on each step below this): +To complete building, kick off the build script from your swg-main directory by typing in: ```ant swg``` - ./build_linux.sh +The build process is fully configured in the build.properties file. There is no need to touch this file unless you have a fully customized version that you +would like to run. For starters, just don't worry about touching it. -#### Cloning the Repositories -The script will first ask if you would like to retrieve any GIT folders necessary (it knows which ones it needs to get). It will attempt to get the pre-configured -repositories that are outlined in the build script by cloning them. It will simply do a pull if the repositories already exist to bring them up to date. -This currently includes "src", "dsrc", and others: +You can also run sections of the build script manually (not recommended until you are used to the environment of which you're working in). - Do you want to pull/update git? (y/n) +#### ANT Usage +DID YOU KNOW?: You can specify multiple ANT targets with a single command as well (this goes for any of these targets you give it). ANT will execute them and make sure all +of their dependencies are met in the order you provide them: -If you answer "y" to the question, it will attempt to retrieve the latest version set of the code. If you hit enter or choose "n" it will skip to the next step. - -### Compile Phase -After getting the latest version of the code, the build script will then attempt to build the server. - -#### Compile Mode -The system first needs to know how you will be compiling the code. You have a choice of either DEBUG (d) mode or RELEASE (r) mode. If you do not enter "d" or "debug" for the mode then it is assumed you wish to build a RELEASE build. (release is recommended unless you have a specific reason to want debug.) - - Is this for DEBUG mode or RELEASE mode? (d/r): - -#### Compiling SRC -The first compile step is to build the server C++ code. This is the source found in the "src" folder. Once compiled, you should have compiled code in the "build" directory of swg-main: - - Do you want to recompile the server code (C++) now? (y/n) - -#### Building the Server Configuration Files -The next step will attempt to build the configuration files. This step captures data needed for the server to execute properly. The following information is captured in this step: - - Do you want to build the config environment now? (y/n) - Enter your IP address (LAN for port forwarding or internal, outside IP for DMZ) - -Enter the IP address of the host machine that will be the server. This is typically your VM IP Address. - - Enter the DSN for the database connection - -Enter the name of the database. This is typically just "//127.0.0.1/swg" without quotes. It uses the 127.0.0.1 localhost loopback instead of the VM IP on purpose. - - Enter the database username - -Enter the user name for the database connection. This is also typically just "swg" without quotes. - - Enter the database password - -Enter the password for the database connection. This is also typically just "swg" without quotes. - - Enter a name for the galaxy cluster - -This will be the cluster name of the galaxy. Use something creative (or not), this is the name of the galaxy you're going to choose when creating a new character. NOTE: Remember your cluster name because you will need it again in a later step. - -#### Compiling DSRC -The next step will be to build the Java code that resides in the dsrc folder. This code is where 99% of the game content and AI resides. This step takes a long time so go watch a movie or something while it builds. Note: It will give you the option of using "multi" or "safe" building. Multi takes advantage of multi-threaded compiling (typically faster). However, it was found that using it SOMETIMES caused issues, but these issues are likely no around any longer. Needless to say, if you encounter issues using MULTI, try using Safe instead which does not use multi-threaded compiling: - - Do you want to recompile the scripts (.java)? (y/n) - -The Script will currently build the ENTIRE dsrc at this step. If you want to build just an individual part, please see `./build_dsrc.sh` information at the bottom of this readme. - -#### Build your chat server - -This step will (re)build the stationapi chat server. - - Do you want to build stationapi chat server now? (y/n) - -#### Importing the Database SQL -This step will attempt to create the database schema from the SQL files that are in the src directory structure. It will create all database tables, functions, views and stored procedures the game needs to use. You can run this step without fear of ruining anything that is currently in place. Keep in mind that if you do attempt to import the database over the top of an existing swg database, it will simply throw errors after a very short attempt, but will not cause issue with your current data. Basically, you can't mess this part up: - - Import database? (y/n) - -If you haven't previously entered the necessary database information above, it will ask you for that information here. - -#### Clientdata symlink -The Clientdata Repo is in /home/swg/swg-main/clientdata. You MUST have this in place and have the symbolic link created before the server can execute successfully: - - Do you want to create the symlink for the clientdata folder? (y/n) +``` +ant git_src git_dsrc +``` #### Final configuration: @@ -115,32 +62,44 @@ Point your login.cfg in your game folder (on your client machine, NOT the VM) to AND YOU'RE DONE! +#MORE READING... -## build_dsrc.sh - -You may want to build certain parts of the dsrc individually instead of all at once as done in build_linux.sh. Here is some information about the specific steps in build_dsrc.sh: +The following targets ARE NOT REQUIRED, but you may find yourself wanting to build certain parts of the dsrc individually instead of all at once as done in the +ANT build script. Here is some information about the specific targets in ANT build file: #### Compiling the mIFF files -This step will compile all *.mif files into *.iff binary files. +The "compile_miff" target will compile all *.mif files into *.iff binary files. - Do you want to build the mIFF files (.mif)? (y/n) + ```ant compile_miff``` #### Compiling the Datatable files -This step will compile all the *.tab files into *.iff binary files. Again, speed constraints aside, you have the choice of using MULTI or SAFE for compiling (see DSRC Compiling above): +The "compile_tab" target will compile all the *.tab files into *.iff binary files: - Do you want to build the datatables (.tab)? (y/n) + ```ant compile_tab``` #### Compiling Template Files -This step will compile all the *.tpf files into *.iff binary files. You have a choice of Multi or Safe here as well: +The "compile_tpf" target will compile all the *.tpf files into *.iff binary files: - Do you want to build the template files (.tpf)? (y/n) + ```ant compile_tpf``` -If you have built the TPF files in this step (i.e. you didn't skip this step) then the build script will also attempt to recreate the Object Template and Quest CRC tables and subsequently will attempt to push those changes to the database since this will also be required. A GREAT feature to have when creating new template files or changing existing ones. +If you have built the TPF files in this step (i.e. you didn't skip this step) then the target will also attempt to recreate the Object Template and Quest CRC +tables and subsequently will attempt to push those changes to the database since this will also be required. A GREAT feature to have when creating new template files +or changing existing ones. + +Again... if you wish to do a multiple of these things, you can string multiple targets together like so (not all 3 are required and they can be added in any order as +ANT handles any dependencies already): + +```ant compile_miff compile_tab compile_tpf``` + +This particular command will first build the MIFF files, then compile the TAB files, then compile and load the Template Files into the database. ### Database Phase #### Building Object Template and Quest CRC Files -This step will compile the object template and quest CRC files. These files translate the long name of these files (including file path) into a very short code that allows the server to identify them without the danger of long text being transferred over the internet in packets. Basically a optimization that SOE implemented: +This step will compile the object template and quest CRC files. These files translate the long name of these files (including file path) into a very short code that +allows the server to identify them without the danger of long text being transferred over the internet in packets. Basically an optimization that SOE implemented: - Do you want to build the Object Template or Quest CRC files? (y/n) + ```ant load_templates``` -Building these files will also trigger the build script to then populate the database with the CRC's that were generated. If you are doing this build script in pieces (i.e. you're selectively building), this is a GREAT way to re-import new or changed TPF file changes. In order to re-import CRC's into the database, if you haven't already entered it above, it will ask you for the database information here. +Building these files will also trigger the target to then populate the database with the CRC's that were generated. If you are doing this target in pieces +(i.e. you're selectively building), this is a GREAT way to re-import new or changed TPF file changes. In order to re-import CRC's into the database, if you haven't +already entered it above, it will ask you for the database information here. diff --git a/build.properties b/build.properties new file mode 100755 index 0000000..f91ceca --- /dev/null +++ b/build.properties @@ -0,0 +1,29 @@ +### Note: Please don't change these for your local setup. You may get a merge conflict when updating if ever this file gets changed by a dev. Instead, make a local.properties file for your own settings. Thanks! + +# General +# This handles if the database will be dropped or not. Turn this on if you want to drop the db and do a "ant drop_database" from the swg-main dir. +firstrun = false + +# SWG Server Settings +cluster_name = swg +# max_characters_per_account is the number of characters that a single account may have, across all clusters +max_characters_per_account = 10 +# max_characters_per_cluster is the number of characters that a single cluster may have +max_characters_per_cluster = 250 +# character_slots is the number of characters that a single account may have on one cluster +character_slots = 10 + +# Database Settings +db_username = swg +db_password = swg +db_service = swg + +# Git Settings +src_branch = master +dsrc_branch = master +clientdata_branch = master +configs_branch = master + +# SRC Compilation +compiler = gcc +src_build_type = Release diff --git a/build.xml b/build.xml new file mode 100755 index 0000000..ef05e50 --- /dev/null +++ b/build.xml @@ -0,0 +1,478 @@ + + + + This build file will build all aspects of the SWG Source Code. Created by Cekis (cekisswg@gmail.com). + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + IP Address: ${ADDR4} + + + + + + + + + + + + Cleaning the SRC build directory. + + + + + + Cleaning the DSRC directory. + + + + + + + + Cleaning the DSRC script directory. + + + + + + + + + + Architecture is ${arch} + + + + Creating a ${src_build_type} build + + + + + + + + + + Using the GCC compiler + + + + + + Using the CLang compiler + + + + + + + + We have ${nproc} processors (cores) to use. + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + insert into cluster_list (id, name, num_characters, address, secret, locked, not_recommended) + select (select nvl(max(id)+1,1) from cluster_list), '${cluster_name}', 0, '${ADDR4}', 'N', 'N', 'N' from dual + where not exists (select '${cluster_name}', '${ADDR4}' from cluster_list); + + + + + + update default_char_limits set account_limit = ${max_characters_per_account}, cluster_limit = ${max_characters_per_cluster}; + update default_character_slots set num_slots = ${character_slots} where character_type_id = 1; + + + + + + + + + + Database Drop Aborted. + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/build_dsrc.sh b/build_dsrc.sh deleted file mode 100755 index f617173..0000000 --- a/build_dsrc.sh +++ /dev/null @@ -1,179 +0,0 @@ -#!/bin/bash - -basedir=$PWD -PATH=$PATH:$basedir/build/bin -DBSERVICE= -DBUSERNAME= -DBPASSWORD= -HOSTIP= -CLUSTERNAME= -NODEID= -DSRC_DIR= -DATA_DIR= - -# Public facing - builds profdata -#MODE=RELWITHDEBINFO - -# Public facing, builds heavily optimized bins -#MODE=MINSIZEREL - -if [ ! -d $basedir/build ] -then - mkdir $basedir/build -fi - -echo -e "\n"; -echo -e "\033[1;33m ___ __ __ ___ ___ _ ___ "; -echo -e "\033[1;33m/ __|\ \ / // __| / __| ___ _ _ _ _ __ ___ __ __/ | |_ )"; -echo -e "\033[1;33m\__ \ \ \/\/ /| (_ | \__ \/ _ \| || || '_|/ _|/ -_) \ V /| | _ / /"; -echo -e "\033[1;33m|___/ \_/\_/ \___| |___/\___/ \_,_||_| \__|\___| \_/ |_|(_)/___|"; -echo -e "\033[1;31m"; - -echo -e "\033[1;36m"; -#Commenting this for now... This script doesn't pull anyways. -#read -p "What is your GIT username (so we can get the code correctly): " response -#GIT_USER=${response,,} -#GIT_URL=https://${GIT_USER}@github.com/SWG-Source/ -#GIT_REPO_DEPEND=${GIT_URL}dependencies.git -#GIT_REPO_SRC=${GIT_URL}src.git -#GIT_REPO_DSRC=${GIT_URL}dsrc.git -#GIT_REPO_CONFIG=${GIT_URL}configs.git -#GIT_REPO_CLIENTDATA=${GIT_URL}clientdata.git - -# specify git branches for each repo -#GIT_REPO_DEPEND_BRANCH=master -#GIT_REPO_SRC_BRANCH=master -#GIT_REPO_DSRC_BRANCH=master -#GIT_REPO_CONFIG_BRANCH=master -#GIT_REPO_CLIENTDATA_BRANCH=master - - -echo -e "\033[2;31m****************************************************************** -Begin individual building of scripts for /dsrc to /data -******************************************************************"; -echo -e "\033[2;36m"; -read -p "Do you want to recompile the scripts (.java)? (y/n) " response -response=${response,,} # tolower -if [[ $response =~ ^(yes|y| ) ]]; then - #prepare environment to run data file builders - oldPATH=$PATH - PATH=$basedir/build/bin:$PATH - - read -p "Do you wanna use multi-core building (default) or stick with the safe option? You may need to rerun the single version if there are stragglers. (multi/safe) " response - response=${response,,} - if [[ $response =~ ^(multi|m| ) ]]; then - $basedir/utils/build_java_multi.sh - else - $basedir/utils/build_java.sh - fi - - PATH=$oldPATH -fi - -buildTemplates=false - -read -p "Do you want to build the mIFF files (.mif)? (y/n) " response -response=${response,,} -if [[ $response =~ ^(yes|y| ) ]]; then - #prepare environment to run data file builders - oldPATH=$PATH - PATH=$basedir/build/bin:$PATH - - $basedir/utils/build_miff.sh - - buildTemplates=true - - PATH=$oldPATH -fi - -read -p "Do you want to build the datatables (.tab)? (y/n) " response -response=${response,,} -if [[ $response =~ ^(yes|y| ) ]]; then - #prepare environment to run data file builders - oldPATH=$PATH - PATH=$basedir/build/bin:$PATH - - read -p "Do you wanna use multi-core building (default) or stick with the safe option? You may need to rerun the single version if there are stragglers. (multi/safe) " response - response=${response,,} - if [[ $response =~ ^(multi|m| ) ]]; then - $basedir/utils/build_tab_multi.sh - else - $basedir/utils/build_tab.sh - fi - - buildTemplates=true - - PATH=$oldPATH -fi - -read -p "Do you want to build the template files (.tpf)? (y/n) " response -response=${response,,} -if [[ $response =~ ^(yes|y| ) ]]; then - #prepare environment to run data file builders - oldPATH=$PATH - PATH=$basedir/build/bin:$PATH - - read -p "Do you wanna use multi-core building (default) or stick with the safe option? You may need to rerun the single version if there are stragglers. (multi/safe) " response - response=${response,,} - if [[ $response =~ ^(multi|m| ) ]]; then - $basedir/utils/build_tpf_multi.sh - else - $basedir/utils/build_tpf.sh - fi - - buildTemplates=true - - PATH=$oldPATH -fi - -if [[ $buildTemplates = false ]]; then - read -p "Do you want to build the Object Template or Quest CRC files? (y/n) " response - response=${response,,} - if [[ $response =~ ^(yes|y| ) ]]; then - $buildTemplates=true - fi -fi - -templatesLoaded=false - -if [[ $buildTemplates = true ]]; then - echo "Object Template and Quest CRC files will now be built and re-imported into the database." - - if [[ -z "$DBSERVICE" ]]; then - echo "Enter the DSN for the database connection e.g. //127.0.0.1/swg" - read DBSERVICE - fi - - if [[ -z "$DBUSERNAME" ]]; then - echo "Enter the database username " - read DBUSERNAME - fi - - if [[ -z "$DBPASSWORD" ]]; then - echo "Enter the database password " - read DBPASSWORD - fi - - #prepare environment to run data file builders - oldPATH=$PATH - PATH=$basedir/build/bin:$PATH - - $basedir/utils/build_object_template_crc_string_tables.py - $basedir/utils/build_quest_crc_string_tables.py - - cd $basedir/src/game/server/database - - echo "Loading template list" - - perl ./templates/processTemplateList.pl < $basedir/dsrc/sku.0/sys.server/built/game/misc/object_template_crc_string_table.tab > $basedir/build/templates.sql - sqlplus ${DBUSERNAME}/${DBPASSWORD}@${DBSERVICE} @$basedir/build/templates.sql > $basedir/build/templates.out - - templatesLoaded=true - - cd $basedir - PATH=$oldPATH -fi -echo -e "\033[2;36m"; -echo -e "\033[1;31m****************************************************************** -END of individual building of scripts for /dsrc to /data -******************************************************************" diff --git a/build_linux.sh b/build_linux.sh deleted file mode 100755 index c2dd6fe..0000000 --- a/build_linux.sh +++ /dev/null @@ -1,541 +0,0 @@ -#!/bin/bash - -basedir=$PWD -PATH=$PATH:$basedir/build/bin -DBSERVICE= -DBUSERNAME= -DBPASSWORD= -HOSTIP= -CLUSTERNAME= -NODEID= -DSRC_DIR= -DATA_DIR= - -# Public facing - builds profdata -#MODE=RELWITHDEBINFO - -# Public facing, builds heavily optimized bins -#MODE=MINSIZEREL - -if [ ! -d $basedir/build ] -then - mkdir $basedir/build -fi - -echo -e "\n"; -echo -e "\033[1;33m ___ __ __ ___ ___ _ ___ "; -echo -e "\033[1;33m/ __|\ \ / // __| / __| ___ _ _ _ _ __ ___ __ __/ | |_ )"; -echo -e "\033[1;33m\__ \ \ \/\/ /| (_ | \__ \/ _ \| || || '_|/ _|/ -_) \ V /| | _ / /"; -echo -e "\033[1;33m|___/ \_/\_/ \___| |___/\___/ \_,_||_| \__|\___| \_/ |_|(_)/___|"; -echo -e "\033[1;31m"; - -echo -e "\033[1;36m"; -#read -p "What is your GIT username (so we can get the code correctly): " response -#GIT_USER=${response,,} -GIT_URL=https://github.com/SWG-Source/ -GIT_REPO_DEPEND=${GIT_URL}dependencies.git -GIT_REPO_SRC=${GIT_URL}src.git -GIT_REPO_DSRC=${GIT_URL}dsrc.git -GIT_REPO_CONFIG=${GIT_URL}configs.git -GIT_REPO_CLIENTDATA=${GIT_URL}clientdata.git -GIT_REPO_STATIONAPI=${GIT_URL}stationapi.git - -# specify git branches for each repo -GIT_REPO_DEPEND_BRANCH=master -GIT_REPO_SRC_BRANCH=master -GIT_REPO_DSRC_BRANCH=master -GIT_REPO_CONFIG_BRANCH=master -GIT_REPO_CLIENTDATA_BRANCH=master -GIT_REPO_STATIONAPI_BRANCH=master - -echo -e "\033[1;31m"; -if [ ! -f $basedir/.setup ]; then - if [[ $(lsb_release -a) =~ .*Ubuntu.* ]] || [ -f "/etc/debian_version" ] - then -read -p "****************************************************************** -This section of the build script will install latest dependencies -****************************************************************** -****************************************************************** -!!!ONLY RUN ONCE!!! Do you want to install dependencies (y/n)?" response - response=${response,,} # tolower - if [[ $response =~ ^(yes|y| ) ]]; then - if [[ $(git lfs install) = *"Git LFS initialized." ]]; then - if [ ! -d $basedir/dependencies ]; then - git clone -b $GIT_REPO_DEPEND_BRANCH $GIT_REPO_DEPEND dependencies - cd $basedir/dependencies - git lfs install - git lfs pull - cd $basedir - else - cd $basedir/dependencies - git pull - git lfs pull - cd $basedir - fi - $basedir/utils/init/debian.sh - source /etc/profile.d/java.sh - source /etc/profile.d/oracle.sh - touch $basedir/.setup - - echo "Please login and out or reboot as changes have been made to your PATH " - else - echo "Please install Git LFS and try again." - fi - fi - fi -fi - -echo -e "\033[1;36m"; -read -p "****************************************************************** -This section of script will pull latest src/dsrc from our github -repo. https://github.com/SWG-Source -****************************************************************** -****************************************************************** -Do you want to pull/update git? (y/n) " response -response=${response,,} # tolower -if [[ $response =~ ^(yes|y| ) ]]; then - # update main repo - git pull - - # update or clone each sub-repo - if [ ! -d $basedir/src ]; then - git clone -b $GIT_REPO_SRC_BRANCH $GIT_REPO_SRC src - else - cd $basedir/src - git pull - cd $basedir - fi - - if [ ! -d $basedir/dsrc ]; then - git clone -b $GIT_REPO_DSRC_BRANCH $GIT_REPO_DSRC dsrc - else - cd $basedir/dsrc - git pull - cd $basedir - fi - - if [ ! -d $basedir/configs ]; then - git clone -b $GIT_REPO_CONFIG_BRANCH $GIT_REPO_CONFIG configs - else - cd $basedir/configs - git pull - cd $basedir - fi - if [ ! -d $basedir/clientdata ]; then - git clone -b $GIT_REPO_CLIENTDATA_BRANCH $GIT_REPO_CLIENTDATA clientdata - else - cd $basedir/clientdata - git pull - cd $basedir - fi - if [ ! -d $basedir/stationapi/.git ]; then - rm -rf $basedir/stationapi - git clone -b $GIT_REPO_STATIONAPI_BRANCH $GIT_REPO_STATIONAPI stationapi - else - cd $basedir/stationapi - git pull - cd $basedir - fi -fi - -read -p "Is this for DEBUG mode or RELEASE mode? (d/r): " response -response=${response,,} -if [[ $response =~ ^(debug|d| ) ]]; then - MODE=Debug -else - MODE=Release -fi - -echo -e "\033[1;32m"; -read -p "****************************************************************** -G++ ONLY COMPILE METHOD!!! -This secton of script will compile the src to binaries. The new -binaries will be located in /home/swg/swg-main/build/bin -****************************************************************** -****************************************************************** -Do you want to recompile the server code (C++) (GCC) now? (y/n) " response -response=${response,,} # tolower -if [[ $response =~ ^(yes|y| ) ]]; then - - unset ORACLE_HOME; - unset ORACLE_SID; - unset JAVA_HOME; - export ORACLE_HOME=/usr/lib/oracle/12.2/client; - export JAVA_HOME=/usr/java; - export ORACLE_SID=swg; - rm -rf $basedir/build - mkdir $basedir/build - mkdir $basedir/build/bin - cd $basedir/build - - if [ $(arch) == "x86_64" ]; then - export LDFLAGS=-L/usr/lib32 - export CMAKE_PREFIX_PATH="/usr/lib32:/lib32:/usr/lib/i386-linux-gnu:/usr/include/i386-linux-gnu" - - cmake -DCMAKE_C_FLAGS=-m32 \ - -DCMAKE_CXX_FLAGS=-m32 \ - -DCMAKE_EXE_LINKER_FLAGS=-m32 \ - -DCMAKE_MODULE_LINKER_FLAGS=-m32 \ - -DCMAKE_SHARED_LINKER_FLAGS=-m32 \ - -DCMAKE_BUILD_TYPE=$MODE \ - $basedir/src - else - cmake $basedir/src -DCMAKE_BUILD_TYPE=$MODE - fi - - make -j$(nproc) - - # This option strips the bins of debug to make smaller size - if [[ $MODE =~ ^(Release) ]]; then - strip -s bin/* - fi - - cd $basedir - -fi - -#echo -e "\033[2;33m"; -#read -p "****************************************************************** -#CLANG ONLY COMPILER METHOD!!! -#This secton of script will compile the src to binaries. The new -#binaries will be located in /home/swg/swg-main/build/bin -#****************************************************************** -#****************************************************************** -#Do you want to recompile the server code (C++) (CLANG) now? (y/n) " response -#response=${response,,} # tolower -#if [[ $response =~ ^(yes|y| ) ]]; then -# -# unset ORACLE_HOME; -# unset ORACLE_SID; -# unset JAVA_HOME; -# export ORACLE_HOME=/usr/lib/oracle/12.2/client; -# export JAVA_HOME=/usr/java; -# export ORACLE_SID=swg; -# rm -rf /home/swg/swg-main/build -# mkdir /home/swg/swg-main/build -# mkdir /home/swg/swg-main/build/bin -# cd $basedir/build -# -# if type clang &> /dev/null; then -# export CC=clang -# export CXX=clang++ -# fi -# -# if [ $(arch) == "x86_64" ]; then -# export LDFLAGS=-L/usr/lib32 -# export CMAKE_PREFIX_PATH="/usr/lib32:/lib32:/usr/lib/i386-linux-gnu:/usr/include/i386-linux-gnu" -# -# cmake -DCMAKE_C_FLAGS=-m32 \ -# -DCMAKE_CXX_FLAGS=-m32 \ -# -DCMAKE_EXE_LINKER_FLAGS=-m32 \ -# -DCMAKE_MODULE_LINKER_FLAGS=-m32 \ -# -DCMAKE_SHARED_LINKER_FLAGS=-m32 \ -# -DCMAKE_BUILD_TYPE=$MODE \ -# $basedir/src -# else -# cmake $basedir/src -DCMAKE_BUILD_TYPE=$MODE -# fi -# -# make -j$(nproc) -# -# # This option strips the bins of debug to make smaller size -# if [[ $MODE =~ ^(Release) ]]; then -# strip -s bin/* -# fi -# -# cd $basedir -# -#fi -echo -e "\033[1;36m"; -read -p "****************************************************************** -This section of script will add your VM's IP to NGE Server configs -New configs will be built in /home/swg/swg-main/exe/linux -****************************************************************** -****************************************************************** -Do you want to build the config environment now? (y/n) " response -response=${response,,} # tolower -if [[ $response =~ ^(yes|y| ) ]]; then - - # Prompt for configuration environment. -# read -p "Configure environment (local, live, tc)? " config_env -# - # Make sure the configuration environment exists. -# if [ ! -d $basedir/configs/$config_env ]; then -# echo "Invalid configuration environment." -# exit -# fi -# - - echo "Enter your IP address (LAN for port forwarding or internal, outside IP for DMZ)" - read HOSTIP - - echo "Enter the DSN for the database connection. i.e. //127.0.0.1/swg " - read DBSERVICE - - echo "Enter the database username. i.e. swg " - read DBUSERNAME - - echo "Enter the database password. i.e. swg " - read DBPASSWORD - - echo "Enter a name for the galaxy cluster. Use the same name for importing your swg database. " - read CLUSTERNAME - - if [ -d $basedir/exe ]; then - rm -rf $basedir/exe - fi - - mkdir -p $basedir/exe/linux/logs - mkdir -p $basedir/exe/shared - - ln -s $basedir/build/bin $basedir/exe/linux/bin - - cp -u $basedir/configs/$config_env/linux/* $basedir/exe/linux - cp -u $basedir/configs/$config_env/shared/* $basedir/exe/shared - - for filename in $(find $basedir/exe -name '*.cfg'); do - sed -i -e "s@DBSERVICE@$DBSERVICE@g" -e "s@DBUSERNAME@$DBUSERNAME@g" -e "s@DBPASSWORD@$DBPASSWORD@g" -e "s@CLUSTERNAME@$CLUSTERNAME@g" -e "s@HOSTIP@$HOSTIP@g" $filename - done - - # - # Generate other config files if their template exists. - # - - # Generate at least 1 node that is the /etc/hosts IP. - $basedir/utils/build_node_list.sh -fi -echo -e "\033[2;32m"; -read -p "****************************************************************** -This section of script will compile your /dsrc to /data. It will -basically convert your Java scripts, tabs & tpf to .iff that server -will be able to read. -NOTE: It will do all the conversions at once, or you can skip this -section of the script and run each individually with next sections -of script. -****************************************************************** -****************************************************************** -Do you want to build all the scripts now? (y/n) " response -response=${response,,} # tolower -if [[ $response =~ ^(yes|y| ) ]]; then - #prepare environment to run data file builders - oldPATH=$PATH - PATH=$basedir/build/bin:$PATH - - read -p "Do you wanna use multicore scripts or the safe option? -Recommended you use safe for this VM operation.(multi/safe) " response - response=${response,,} - if [[ $response =~ ^(multi|m| ) ]]; then - $basedir/utils/build_java_multi.sh - $basedir/utils/build_miff.sh - $basedir/utils/build_tab_multi.sh - $basedir/utils/build_tpf_multi.sh - else - $basedir/utils/build_java.sh - $basedir/utils/build_miff.sh - $basedir/utils/build_tab.sh - $basedir/utils/build_tpf.sh - fi - - $basedir/utils/build_object_template_crc_string_tables.py - $basedir/utils/build_quest_crc_string_tables.py - - PATH=$oldPATH -fi -#echo -e "\033[2;31m****************************************************************** -#Begin individual building of scripts for /dsrc to /data -#******************************************************************"; -#echo -e "\033[2;36m"; -#read -p "Do you want to recompile the scripts (.java)? (y/n) " response -#response=${response,,} # tolower -#if [[ $response =~ ^(yes|y| ) ]]; then - #prepare environment to run data file builders -# oldPATH=$PATH -# PATH=$basedir/build/bin:$PATH -# -# read -p "Do you wanna use multi-core building (default) or stick with the safe option? You may need to rerun the single version if there are stragglers. (multi/safe) " response -# response=${response,,} -# if [[ $response =~ ^(multi|m| ) ]]; then -# $basedir/utils/build_java_multi.sh -# else -# $basedir/utils/build_java.sh -# fi -# -# PATH=$oldPATH -#fi -# -#buildTemplates=false -# -#read -p "Do you want to build the mIFF files (.mif)? (y/n) " response -#response=${response,,} -#if [[ $response =~ ^(yes|y| ) ]]; then -# #prepare environment to run data file builders -# oldPATH=$PATH -# PATH=$basedir/build/bin:$PATH -# -# $basedir/utils/build_miff.sh -# -# buildTemplates=true -# -# PATH=$oldPATH -#fi -# -#read -p "Do you want to build the datatables (.tab)? (y/n) " response -#response=${response,,} -#if [[ $response =~ ^(yes|y| ) ]]; then - #prepare environment to run data file builders -# oldPATH=$PATH -# PATH=$basedir/build/bin:$PATH -# -# read -p "Do you wanna use multi-core building (default) or stick with the safe option? You may need to rerun the single version if there are stragglers. (multi/safe) " response -# response=${response,,} -# if [[ $response =~ ^(multi|m| ) ]]; then -# $basedir/utils/build_tab_multi.sh -# else -# $basedir/utils/build_tab.sh -# fi -# -# buildTemplates=true -# -# PATH=$oldPATH -#fi -# -#read -p "Do you want to build the template files (.tpf)? (y/n) " response -#response=${response,,} -#if [[ $response =~ ^(yes|y| ) ]]; then -# #prepare environment to run data file builders -# oldPATH=$PATH -# PATH=$basedir/build/bin:$PATH -# -# read -p "Do you wanna use multi-core building (default) or stick with the safe option? You may need to rerun the single version if there are stragglers. (multi/safe) " response -# response=${response,,} -# if [[ $response =~ ^(multi|m| ) ]]; then -# $basedir/utils/build_tpf_multi.sh -# else -# $basedir/utils/build_tpf.sh -# fi -# -# buildTemplates=true -# -# PATH=$oldPATH -#fi -# -#if [[ $buildTemplates = false ]]; then -# read -p "Do you want to build the Object Template or Quest CRC files? (y/n) " response -# response=${response,,} -# if [[ $response =~ ^(yes|y| ) ]]; then -# buildTemplates=true -# fi -#fi -# -#templatesLoaded=false -# -#if [[ $buildTemplates = true ]]; then -# echo "Object Template and Quest CRC files will now be built and re-imported into the database." -# -# if [[ -z "$DBSERVICE" ]]; then -# echo "Enter the DSN for the database connection " -# read DBSERVICE -# fi -# -# if [[ -z "$DBUSERNAME" ]]; then -# echo "Enter the database username " -# read DBUSERNAME -# fi -# -# if [[ -z "$DBPASSWORD" ]]; then -# echo "Enter the database password " -# read DBPASSWORD -# fi -# -# #prepare environment to run data file builders -# oldPATH=$PATH -# PATH=$basedir/build/bin:$PATH -# -# $basedir/utils/build_object_template_crc_string_tables.py -# $basedir/utils/build_quest_crc_string_tables.py -# -# cd $basedir/src/game/server/database -# -# echo "Loading template list" -# -# perl ./templates/processTemplateList.pl < $basedir/dsrc/sku.0/sys.server/built/game/misc/object_template_crc_string_table.tab > $basedir/build/templates.sql -# sqlplus ${DBUSERNAME}/${DBPASSWORD}@${DBSERVICE} @$basedir/build/templates.sql > $basedir/build/templates.out -# -# templatesLoaded=true -# -# cd $basedir -# PATH=$oldPATH -#fi -#echo -e "\033[2;36m"; -#echo -e "\033[1;31m****************************************************************** -#END of individual building of scripts for /dsrc to /data -#******************************************************************" -# -echo -e "\033[2;32m"; -read -p "****************************************************************** -This script will (re)build your stationapi (chat server) -****************************************************************** -****************************************************************** -Do you want to build stationapi chat server now? (y/n) " response -response=${response,,} - if [[ $response =~ ^(yes|y| ) ]]; then - cd $basedir/stationapi - ./build.sh - mv -T $basedir/stationapi/build/bin $basedir/chat - cd $basedir -fi - -echo -e "\033[0;37m"; -read -p "****************************************************************** -This script will import the SWG database into Oracle 12.2 R2. -****************************************************************** -****************************************************************** -Do you want to import the database to Oracle? (y/n) " response -response=${response,,} -if [[ $response =~ ^(yes|y| ) ]]; then - cd $basedir/src/game/server/database/build/linux; - unset ORACLE_HOME; - unset ORACLE_SID; - unset JAVA_HOME; - export JAVA_HOME=/usr/java; - export ORACLE_HOME=/usr/lib/oracle/12.2/client; - export ORACLE_SID=swg; - export PATH=$ORACLE_HOME/bin:$PATH; - - if [[ -z "$DBSERVICE" ]]; then - echo "Enter the DSN for the database connection i.e. //127.0.0.1/swg " - read DBSERVICE - fi - - if [[ -z "$DBUSERNAME" ]]; then - echo "Enter the database username i.e. swg " - read DBUSERNAME - fi - - if [[ -z "$DBPASSWORD" ]]; then - echo "Enter the database password i.e. swg " - read DBPASSWORD - fi - - ./database_update.pl --username=$DBUSERNAME --password=$DBPASSWORD --service=$DBSERVICE --goldusername=$DBUSERNAME --loginusername=$DBUSERNAME --createnewcluster --packages - - if [[ $templatesLoaded = false ]]; then - echo "Loading template list from object_template_crc_string table " - perl $basedir/src/game/server/database/templates/processTemplateList.pl < $basedir/dsrc/sku.0/sys.server/built/game/misc/object_template_crc_string_table.tab > $basedir/build/templates.sql - sqlplus ${DBUSERNAME}/${DBPASSWORD}@${DBSERVICE} @$basedir/build/templates.sql > $basedir/build/templates.out - cd $basedir - fi -fi -read -p "****************************************************************** -This section will link your clientdata folder to sys.client in the server -*************************************************************************** -****************************************************************** -Do you want to create the symlink for the clientdata folder? (y/n) " response -response=${response,,} -if [[ $response =~ ^(yes|y| ) ]]; then -cd $basedir/data/sku.0/sys.client -mkdir compiled -ln -s $basedir/clientdata/ $basedir/data/sku.0/sys.client/compiled/ -fi -echo -e "\033[1;33m"; -echo "Congratulations build_linux script is complete!" diff --git a/build_tabs.sh b/build_tabs.sh deleted file mode 100755 index 41101e5..0000000 --- a/build_tabs.sh +++ /dev/null @@ -1,41 +0,0 @@ -#!/bin/bash - -server=$(find ./dsrc/sku.0/sys.server/compiled/game/datatables -name '*.tab') -inc=$(find ./dsrc/sku.0/sys.shared/compiled/game/datatables/include -name '*.tab') -shared=$(find ./dsrc/sku.0/sys.shared/compiled/game/datatables -name '*.tab') - -filenames=("${server[@]}" "${inc[@]}" "${shared[@]}") - -spinstr='|/-\' -i=0 -current=0 -total=$(ls ${filenames[@]} | wc -l) - -compile () { - ofilename=${filename/dsrc/data} - ofilename=${ofilename/.tab/.iff} - mkdir -p $(dirname $ofilename) - - [ -e $ofilename ] && rm "$ofilename" - - result=$(./exe/linux/bin/DataTableTool -i "$filename" -- -s SharedFile searchPath10=data/sku.0/sys.shared/compiled/game searchPath10=data/sku.0/sys.server/compiled/game 2>&1) - - if [[ ! $result =~ .*SUCCESS.* ]]; then - printf "\r$filename\n" - printf "$result\n\n" - fi -} - -for filename in ${filenames[@]}; do - current=$((current+1)) - i=$(( (i+1) %4 )) - perc=$(bc -l <<< "scale=0; $current*100/$total") - printf "\rGenerating Datatables: [${spinstr:$i:1}] $perc%%" - while [ `jobs | wc -l` -ge 12 ] - do - sleep 5 - done - compile $filename & done -wait - -echo "" diff --git a/clientdata b/clientdata new file mode 160000 index 0000000..e345de3 --- /dev/null +++ b/clientdata @@ -0,0 +1 @@ +Subproject commit e345de3e1f963be3b70f99add04e14e660122ead diff --git a/dsrc b/dsrc new file mode 160000 index 0000000..5c2e112 --- /dev/null +++ b/dsrc @@ -0,0 +1 @@ +Subproject commit 5c2e112349ad24d2f82d943c91e8994c37bd6adb diff --git a/exe b/exe new file mode 160000 index 0000000..2f5013d --- /dev/null +++ b/exe @@ -0,0 +1 @@ +Subproject commit 2f5013dea3b054f4a25b09b1a64e3c06683ad32c diff --git a/git_targets.xml b/git_targets.xml new file mode 100755 index 0000000..17f7f4e --- /dev/null +++ b/git_targets.xml @@ -0,0 +1,195 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + Pulling @{dir}, branch: @{branch} + + + + + + + + + + + + + Pushing @{dir} to @{branch} + + + + + + + + + + + + + Checking out @{branch} branch + + + + + + + + + + + + + + Commiting @{file} to git on branch @{branch} + + + + + + + + + + + + + + + + + + + + + + + + Tagging @{dir} @{version} + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + Cloning @{extn} with branch @{branch} (named: @{extn}@{branch}) + + + + + + + + + + + + + + + Updating @{dir}, extn: @{extn} + + + + + + diff --git a/src b/src new file mode 160000 index 0000000..a66c0d1 --- /dev/null +++ b/src @@ -0,0 +1 @@ +Subproject commit a66c0d1a915d700a9b8791245d2f08d145251d58 diff --git a/stationapi b/stationapi new file mode 160000 index 0000000..ae46b8a --- /dev/null +++ b/stationapi @@ -0,0 +1 @@ +Subproject commit ae46b8a6177ea800b0dde00630051a19876cffae diff --git a/updateServer.sh b/updateServer.sh deleted file mode 100755 index 71a1ff4..0000000 --- a/updateServer.sh +++ /dev/null @@ -1,104 +0,0 @@ -#!/bin/bash - -basedir=$PWD -PATH=$PATH:$basedir/build/bin -DBSERVICE= -DBUSERNAME= -DBPASSWORD= -HOSTIP= -CLUSTERNAME= -NODEID= -DSRC_DIR= -DATA_DIR= - -# Public facing - builds profdata -#MODE=RELWITHDEBINFO - -# Public facing, builds heavily optimized bins -#MODE=MINSIZEREL - -if [ ! -d $basedir/build ] -then - mkdir $basedir/build -fi - -echo -e "\n"; -echo -e "\033[1;33m ___ __ __ ___ ___ _ ___ "; -echo -e "\033[1;33m/ __|\ \ / // __| / __| ___ _ _ _ _ __ ___ __ __/ | |_ )"; -echo -e "\033[1;33m\__ \ \ \/\/ /| (_ | \__ \/ _ \| || || '_|/ _|/ -_) \ V /| | _ / /"; -echo -e "\033[1;33m|___/ \_/\_/ \___| |___/\___/ \_,_||_| \__|\___| \_/ |_|(_)/___|"; -echo -e "\033[1;31m"; - - -#GIT_USER=${response,,} -GIT_URL=https://github.com/SWG-Source/ -GIT_REPO_DEPEND=${GIT_URL}dependencies.git -GIT_REPO_SRC=${GIT_URL}src.git -GIT_REPO_DSRC=${GIT_URL}dsrc.git -GIT_REPO_CONFIG=${GIT_URL}configs.git -GIT_REPO_CLIENTDATA=${GIT_URL}clientdata.git -GIT_REPO_DEPEND_BRANCH=master -GIT_REPO_SRC_BRANCH=master -GIT_REPO_DSRC_BRANCH=master -GIT_REPO_CONFIG_BRANCH=master -GIT_REPO_CLIENTDATA_BRANCH=master - - - -git pull -cd $basedir/src -git pull -cd $basedir -cd $basedir/dsrc -git pull -cd $basedir -cd $basedir/configs -git pull -cd $basedir -cd $basedir/clientdata -git pull -cd $basedir -MODE=Release - - -unset ORACLE_HOME; -unset ORACLE_SID; -unset JAVA_HOME; -export ORACLE_HOME=/usr/lib/oracle/12.2/client; -export JAVA_HOME=/usr/java; -export ORACLE_SID=swg; -rm -rf /home/swg/swg-main/build -mkdir /home/swg/swg-main/build -mkdir /home/swg/swg-main/build/bin -cd $basedir/build -export LDFLAGS=-L/usr/lib32 -export CMAKE_PREFIX_PATH="/usr/lib32:/lib32:/usr/lib/i386-linux-gnu:/usr/include/i386-linux-gnu" -cmake -DCMAKE_C_FLAGS=-m32 \ --DCMAKE_CXX_FLAGS=-m32 \ --DCMAKE_EXE_LINKER_FLAGS=-m32 \ --DCMAKE_MODULE_LINKER_FLAGS=-m32 \ --DCMAKE_SHARED_LINKER_FLAGS=-m32 \ --DCMAKE_BUILD_TYPE=$MODE \ -$basedir/src -make -j$(nproc) -strip -s bin/* -cd $basedir -oldPATH=$PATH -PATH=$basedir/build/bin:$PATH -$basedir/utils/build_java_multi.sh -$basedir/utils/build_miff.sh -$basedir/utils/build_tab_multi.sh -$basedir/utils/build_tpf_multi.sh -$basedir/utils/build_object_template_crc_string_tables.py -$basedir/utils/build_quest_crc_string_tables.py -PATH=$oldPATH - - -cd $basedir/stationapi -./build.sh -mv -T /home/swg/swg-main/stationapi/build/bin /home/swg/swg-main/chat -cd $basedir - - -echo -e "\033[1;33m"; -echo "Congratulations the latest server updates have been downloaded and compiled!"