summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorGunnar Beutner <gbeutner@serenityos.org>2021-06-04 23:20:55 +0200
committerAndreas Kling <kling@serenityos.org>2021-06-05 10:56:37 +0200
commitaec941b46cd9f38690f4e7d9368a300d17776820 (patch)
tree273bb4208fc79b4a774b38b3f59ae2597d952caf
parent4cd45f5875e0145ca858c60c891de3aab3fa46cd (diff)
downloadserenity-aec941b46cd9f38690f4e7d9368a300d17776820.zip
Ports: Add port for freeciv
-rw-r--r--Ports/AvailablePorts.md1
-rwxr-xr-xPorts/freeciv/package.sh8
-rw-r--r--Ports/freeciv/patches/configure.patch12
-rw-r--r--Ports/freeciv/patches/log.patch41
4 files changed, 62 insertions, 0 deletions
diff --git a/Ports/AvailablePorts.md b/Ports/AvailablePorts.md
index dfde982405..c9622fc070 100644
--- a/Ports/AvailablePorts.md
+++ b/Ports/AvailablePorts.md
@@ -29,6 +29,7 @@ Please make sure to keep this list up to date when adding and updating ports. :^
| [`flatbuffers`](flatbuffers/) | Flatbuffers | 1.12.0 | https://github.com/google/flatbuffers |
| [`flex`](flex/) | flex | 2.6.4 | https://github.com/westes/flex |
| [`ffmpeg`](ffmpeg/) | ffmpeg | 4.4 | https://ffmpeg.org |
+| [`freeciv`](freeciv/) | Freeciv | 3.0.0-beta2 | http://freeciv.org/ |
| [`freetype`](freetype/) | FreeType | 2.10.4 | https://www.freetype.org/ |
| [`frotz`](frotz/) | Frotz | 2.53 | https://gitlab.com/DavidGriffith/frotz |
| [`gcc`](gcc/) | GNU Compiler Collection | 11.1.0 | https://gcc.gnu.org/ |
diff --git a/Ports/freeciv/package.sh b/Ports/freeciv/package.sh
new file mode 100755
index 0000000000..4347019854
--- /dev/null
+++ b/Ports/freeciv/package.sh
@@ -0,0 +1,8 @@
+#!/usr/bin/env -S bash ../.port_include.sh
+port=freeciv
+version=3.0.0-beta2
+useconfigure=true
+configopts="--enable-client=sdl2 --enable-fcmp=no"
+files="http://files.freeciv.org/beta/freeciv-${version}.tar.xz freeciv-${version}.tar.xz 9f44dc28068b239c18bda68192ddb27622030880f8ab9c17f777eac28391269e"
+auth_type=sha256
+depends="SDL2 SDL2_image SDL2_mixer SDL2_ttf zstd libicu xz gettext"
diff --git a/Ports/freeciv/patches/configure.patch b/Ports/freeciv/patches/configure.patch
new file mode 100644
index 0000000000..04bf7c4989
--- /dev/null
+++ b/Ports/freeciv/patches/configure.patch
@@ -0,0 +1,12 @@
+diff -Naur freeciv-3.0.0-beta2/bootstrap/config.sub freeciv-3.0.0-beta2.serenity/bootstrap/config.sub
+--- freeciv-3.0.0-beta2/bootstrap/config.sub 2021-05-14 12:38:07.000000000 +0200
++++ freeciv-3.0.0-beta2.serenity/bootstrap/config.sub 2021-06-04 23:07:31.952596066 +0200
+@@ -1363,7 +1363,7 @@
+ # The portable systems comes first.
+ # Each alternative MUST end in a * to match a version number.
+ # -sysv* is not here because it comes later, after sysvr4.
+- -gnu* | -bsd* | -mach* | -minix* | -genix* | -ultrix* | -irix* \
++ -gnu* | -bsd* | -mach* | -minix* | -genix* | -ultrix* | -irix* | -serenity* \
+ | -*vms* | -sco* | -esix* | -isc* | -aix* | -cnk* | -sunos | -sunos[34]*\
+ | -hpux* | -unos* | -osf* | -luna* | -dgux* | -auroraux* | -solaris* \
+ | -sym* | -kopensolaris* | -plan9* \
diff --git a/Ports/freeciv/patches/log.patch b/Ports/freeciv/patches/log.patch
new file mode 100644
index 0000000000..7498018fd1
--- /dev/null
+++ b/Ports/freeciv/patches/log.patch
@@ -0,0 +1,41 @@
+diff -Naur freeciv-3.0.0-beta2/client/connectdlg_common.c freeciv-3.0.0-beta2.serenity/client/connectdlg_common.c
+--- freeciv-3.0.0-beta2/client/connectdlg_common.c 2021-05-14 12:36:45.000000000 +0200
++++ freeciv-3.0.0-beta2.serenity/client/connectdlg_common.c 2021-06-05 00:22:43.151395241 +0200
+@@ -302,6 +302,7 @@
+ char dbg_lvl_buf[32]; /* Do not move this inside the block where it gets filled,
+ * it's needed via the argv[x] pointer later on, so must
+ * remain in scope. */
++ bool log_to_dev_null = FALSE;
+
+ /* Set up the command-line parameters. */
+ fc_snprintf(port_buf, sizeof(port_buf), "%d", internal_server_port);
+@@ -376,16 +377,21 @@
+ fclose(stdout);
+ fclose(stderr);
+
+- /* FIXME: include the port to avoid duplication? */
+- if (logfile) {
++ if (!logfile) {
++ log_to_dev_null = TRUE;
++ fd = open("/dev/null", O_WRONLY);
++ } else {
++ /* FIXME: include the port to avoid duplication? */
+ fd = open(logfile, O_WRONLY | O_CREAT | O_APPEND, 0644);
++ }
+
+- if (fd != 1) {
+- dup2(fd, 1);
+- }
+- if (fd != 2) {
+- dup2(fd, 2);
+- }
++ if (fd != 1) {
++ dup2(fd, 1);
++ }
++ if (fd != 2) {
++ dup2(fd, 2);
++ }
++ if (!log_to_dev_null) {
+ fchmod(1, 0644);
+ }
+