HowToBuildStendhal: Difference between revisions
Jump to navigation
Jump to search
Content deleted Content added
imported>AntumDeluge →IDE: Eclipse |
imported>AntumDeluge →Build Tools: contents moved to HowToBuildStendhal/BuildTools |
||
| Line 5: | Line 5: | ||
= Build Tools = |
= Build Tools = |
||
See [[HowToBuildStendhal/BuildTools|build tools page]]. |
|||
== JDK == |
|||
The Stendhal server and legacy client are both written in [https://www.java.com/ Java]. To run either requires a [https://en.wikipedia.org/wiki/Java_virtual_machine Java Runtime Environment (JRE)]. To compile server or client, a [https://en.wikipedia.org/wiki/Java_Development_Kit Java Development Kit (JDK)] is necessary. Most JDK distributions include a JRE. |
|||
=== JDK on Unix === |
|||
Some Unix/Linux/BSD systems have a JDK pre-installed (usually [https://openjdk.org/ OpenJDK]). If not, most will have a version available from the system package manager. |
|||
Example of installing on Ubuntu: |
|||
<pre> |
|||
# install version 17 |
|||
$ sudo apt install openjdk-17-jdk |
|||
</pre> |
|||
Example of installing on Arch: |
|||
<pre> |
|||
# install default version |
|||
$ sudo pacman -S jdk-openjdk |
|||
# install version 17 |
|||
$ sudo pacman -S jdk17-openjdk |
|||
</pre> |
|||
Example of installing on FreeBSD: |
|||
<pre> |
|||
# install pre-built package of version 17 |
|||
$ sudo pkg install openjdk17 |
|||
# compile version 17 from Ports source |
|||
$ cd /usr/ports/java/openjdk17 |
|||
$ sudo make install clean |
|||
</pre> |
|||
=== JDK on Windows === |
|||
Packages for Windows can be downloaded from either [https://www.oracle.com/java/technologies/downloads/ oracle.com] or for OpenJDK, from [https://jdk.java.net/ jdk.java.net]. If you download a portable .zip package, you will need to manually configure the PATH environment variable so the system knows where the <span style="color:darkred;">''java''</span> and <span style="color:darkred;">''javac''</span> executables are located. It may also be necessary to configure the <span style="color:darkgreen;">''JAVA_HOME''</span> environment variable. The recommended method is to use an installer package (.exe or .msi) as these will configure the necessary environment variables automatically. |
|||
Alternatively, a JDK can be installed from the [https://en.wikipedia.org/wiki/Windows_Package_Manager Windows Package Manager (WinGet)]. |
|||
Example of installing on Windows using WinGet: |
|||
<pre> |
|||
:: install Oracle JDK version 17 |
|||
> winget install Oracle.JDK.17 |
|||
:: install OpenJDK version 17 |
|||
> winget install ojdkbuild.openjdk.17.jdk |
|||
</pre> |
|||
=== JDK on macOS === |
|||
Packages for macOS can be downloaded from either [https://www.oracle.com/java/technologies/downloads/ oracle.com] or for OpenJDK, from [https://jdk.java.net/ jdk.java.net]. But the recommended method is to install from the [https://brew.sh/ Homebrew Package Manager] as it will configure the necessary environment variables automatically. |
|||
Example of installing on macOS using Homebrew: |
|||
<pre> |
|||
# install version 17 |
|||
$ brew install openjdk@17 |
|||
</pre> |
|||
== Ant == |
|||
[https://ant.apache.org/ Apache Ant] is the main tool for building from the command line. All components can be built using this method. However, some components are built using another tool to which Ant serves as a wrapper to call its commands. For example, the Android app is built using [https://gradle.org/ Gradle] (or a Gradle Wrapper). In this case, Gradle builds the app. Ant simply calls Gradle as a sub-command. |
|||
Apache provides executables for multiple systems from their [https://ant.apache.org/bindownload.cgi downloads page]. Alternatively, see the following instructions for specific systems. |
|||
=== Ant on Unix === |
|||
Most Unix/Linux/BSD distributions have a version of Ant available from the default package manager. |
|||
Example of installing on Ubuntu: |
|||
<pre> |
|||
$ sudo apt install ant |
|||
</pre> |
|||
Example of installing on Arch: |
|||
<pre> |
|||
$ sudo pacman -S ant |
|||
</pre> |
|||
Example of installing on FreeBSD: |
|||
<pre> |
|||
# install pre-built package |
|||
$ sudo pkg install apache-ant |
|||
# compile from Ports source |
|||
$ cd /usr/ports/devel/apache-ant |
|||
$ sudo make install clean |
|||
</pre> |
|||
=== Ant on Windows === |
|||
For Windows, follow these steps: |
|||
# Download one of the <span style="color:darkblue;">''apache-ant-<version>-bin</span> packages from the link above (Windows supports .zip archives by default). |
|||
# Extract the package contents to a unique directory. |
|||
# Add the directory path to your system's PATH environment variable. |
|||
# Open a command prompt (cmd). Type <span style="color:darkred;">''ant -version''</span> and press "enter". If it is set up correctly, version information will be printed. |
|||
=== Ant on macOS === |
|||
For macOS, the same instructions for [[HowToBuildStendhal#Ant_on_Windows|Windows]] can be used. Alternatively, it is also provided through Homebrew. |
|||
Example of installing on macOS using Homebrew: |
|||
<pre> |
|||
$ brew install ant |
|||
</pre> |
|||
== Node == |
|||
[https://nodejs.org/en Node.js] is the system used for building the Stendhal web client. Like other tools, Node.js build commands can be executed directly. But it is recommended to use the appropriate Ant wrapper command. |
|||
When Node is installed, the commands <span style="color:darkred;">''node''</span>, <span style="color:darkred;">''npm''</span> (Node Package Manager), and <span style="color:darkred;">''npx''</span> (Node Package Executor) will be available. Optionally, from the Stendhal source code root directory, you can execute <span style="color:darkred;">''npm install --no-package-lock''</span> to install the required Node modules. If you do not, they will automatically be installed when you execute any build instructions for a component that uses the Node build system (such as the web client). |
|||
In addition to the instructions below, the [https://nodejs.org/en/download download page] includes instructions on how to install/manage Node using the Node Version Manager (NVM) for common desktop systems. |
|||
=== Node on Unix === |
|||
Most Unix/Linux/BSD distributions have a version of Node available from the default package manager. |
|||
Example of installing on Ubuntu: |
|||
<pre> |
|||
$ sudo apt install nodejs ant |
|||
</pre> |
|||
Example of installing on Arch: |
|||
<pre> |
|||
$ sudo pacman -S nodejs npm |
|||
</pre> |
|||
Example of installing on FreeBSD: |
|||
<pre> |
|||
# install pre-built version 24 package |
|||
$ sudo pkg install node24 |
|||
# compile version 24 from Ports source |
|||
$ cd /usr/ports/www/node24 |
|||
$ sudo make install clean |
|||
</pre> |
|||
=== Node on Windows === |
|||
Node for Windows can be downloaded as an installer or portable .zip package from the [https://nodejs.org/en/download download page] (.zip requires manual configuration of environment variables). It is also available from the Windows Package Manager. |
|||
Example of installing on Windows using WinGet: |
|||
<pre> |
|||
> winget install OpenJS.NodeJS.LTS |
|||
</pre> |
|||
=== Node on macOS === |
|||
Node for macOS can be downloaded as an installer or portable .zip package from the [https://nodejs.org/en/download download page] (.zip requires manual configuration of environment variables). It is also available from Homebrew. |
|||
Example of installing on macOS using Homebrew: |
|||
<pre> |
|||
$ brew install node |
|||
</pre> |
|||
== Gradle == |
|||
The software comes bundled with a [https://docs.gradle.org/current/userguide/gradle_wrapper.html Gradle Wrapper] which is used to build the Android game client app. So it isn't necessary to install a version of [https://gradle.org/ Gradle] on your system. But if you wish to, the instructions are similar to those of installing other build tools. |
|||
* Unix-like systems will have a version of Gradle available from the system package manager. |
|||
* Portable .zip packages can be downloaded directly from [https://gradle.org/releases/ gradle.org] which contain executables for multiple systems. |
|||
== IDE == |
|||
Alternatively to building from the command line, an Integrated Development Environment can be used to build and run the software. The recommended IDE is [https://www.eclipse.org/ Eclipse], but others may work as well. |
|||
=== Eclipse === |
|||
See [[Stendhal on Eclipse]] for setup instructions. |
|||
= Systems = |
= Systems = |
||
Revision as of 22:46, 12 January 2026
Build Tools
See build tools page.