From d94a374001fdfab6136af3f36d5c7ddfb96df0f4 Mon Sep 17 00:00:00 2001 From: surrealegg Date: Tue, 19 Sep 2023 10:30:54 +0400 Subject: [PATCH] Ports: Add libenet Libenet is a UDP networking library that is used by Love2D, a game framework I would like to port. --- Ports/AvailablePorts.md | 1 + Ports/libenet/package.sh | 19 ++++++++++++ .../patches/0001-Make-library-shared.patch | 24 +++++++++++++++ .../0002-Add-missing-install-options.patch | 30 +++++++++++++++++++ .../0003-Fix-cmake-deprecation-warning.patch | 22 ++++++++++++++ Ports/libenet/patches/ReadMe.md | 13 ++++++++ 6 files changed, 109 insertions(+) create mode 100755 Ports/libenet/package.sh create mode 100644 Ports/libenet/patches/0001-Make-library-shared.patch create mode 100644 Ports/libenet/patches/0002-Add-missing-install-options.patch create mode 100644 Ports/libenet/patches/0003-Fix-cmake-deprecation-warning.patch create mode 100644 Ports/libenet/patches/ReadMe.md diff --git a/Ports/AvailablePorts.md b/Ports/AvailablePorts.md index 11a679252dd..32e1ebd002b 100644 --- a/Ports/AvailablePorts.md +++ b/Ports/AvailablePorts.md @@ -136,6 +136,7 @@ This list is also available at [ports.serenityos.net](https://ports.serenityos.n | [`libarchive`](libarchive/) | libarchive | 3.6.1 | https://libarchive.org/ | | [`libassuan`](libassuan/) | libassuan | 2.5.5 | https://gnupg.org/software/libassuan/index.html | | [`libatomic_ops`](libatomic_ops/) | libatomic\_ops | 7.6.12 | https://www.hboehm.info/gc/ | +| [`libenet`](libenet/) | libenet | 1.3.17 | http://sauerbraten.org/enet/ | | [`libexpat`](libexpat/) | Expat | 2.4.8 | https://libexpat.github.io/ | | [`libffi`](libffi/) | libffi | 3.4.2 | https://www.sourceware.org/libffi/ | | [`libfftw3f`](libfftw3f/) | Fastest Fourier Transform in the West (single precision) | 3.3.10 | https://www.fftw.org/ | diff --git a/Ports/libenet/package.sh b/Ports/libenet/package.sh new file mode 100755 index 00000000000..719a387d2a0 --- /dev/null +++ b/Ports/libenet/package.sh @@ -0,0 +1,19 @@ +#!/usr/bin/env -S bash ../.port_include.sh +port='libenet' +version='1.3.17' +useconfigure='true' +files=( + "http://sauerbraten.org/enet/download/enet-${version}.tar.gz#a38f0f194555d558533b8b15c0c478e946310022d0ec7b34334e19e4574dcedc" +) +configopts=( + "-DCMAKE_TOOLCHAIN_FILE=${SERENITY_BUILD_DIR}/CMakeToolchain.txt" +) +workdir="enet-${version}" + +configure() { + run cmake "${configopts[@]}" +} + +install() { + run make install +} diff --git a/Ports/libenet/patches/0001-Make-library-shared.patch b/Ports/libenet/patches/0001-Make-library-shared.patch new file mode 100644 index 00000000000..2e5331b58a2 --- /dev/null +++ b/Ports/libenet/patches/0001-Make-library-shared.patch @@ -0,0 +1,24 @@ +From f3a57c5b7971c073f2405d97bf48a93c9b12ba44 Mon Sep 17 00:00:00 2001 +From: surrealegg +Date: Thu, 21 Sep 2023 16:35:39 +0400 +Subject: [PATCH 1/3] Make library shared + +--- + CMakeLists.txt | 2 +- + 1 file changed, 1 insertion(+), 1 deletion(-) + +diff --git a/CMakeLists.txt b/CMakeLists.txt +index d3d4aa8..091cb5a 100644 +--- a/CMakeLists.txt ++++ b/CMakeLists.txt +@@ -84,7 +84,7 @@ set(SOURCE_FILES + source_group(include FILES ${INCLUDE_FILES}) + source_group(source FILES ${SOURCE_FILES}) + +-add_library(enet STATIC ++add_library(enet SHARED + ${INCLUDE_FILES} + ${SOURCE_FILES} + ) +-- +2.41.0 diff --git a/Ports/libenet/patches/0002-Add-missing-install-options.patch b/Ports/libenet/patches/0002-Add-missing-install-options.patch new file mode 100644 index 00000000000..d41f40284e4 --- /dev/null +++ b/Ports/libenet/patches/0002-Add-missing-install-options.patch @@ -0,0 +1,30 @@ +From 16b8f344dd913ea6ac9ff88fbc31f8e4a93f06d0 Mon Sep 17 00:00:00 2001 +From: surrealegg +Date: Thu, 21 Sep 2023 16:46:57 +0400 +Subject: [PATCH 2/3] Add missing install options + +--- + CMakeLists.txt | 10 ++++++++++ + 1 file changed, 10 insertions(+) + +diff --git a/CMakeLists.txt b/CMakeLists.txt +index 091cb5a..532e628 100644 +--- a/CMakeLists.txt ++++ b/CMakeLists.txt +@@ -92,3 +92,13 @@ add_library(enet SHARED + if (MINGW) + target_link_libraries(enet winmm ws2_32) + endif() ++ ++install( ++ TARGETS enet ++ LIBRARY DESTINATION lib ++) ++ ++install( ++ DIRECTORY include/ ++ DESTINATION include ++) +-- +2.41.0 + diff --git a/Ports/libenet/patches/0003-Fix-cmake-deprecation-warning.patch b/Ports/libenet/patches/0003-Fix-cmake-deprecation-warning.patch new file mode 100644 index 00000000000..2f1f71bcda1 --- /dev/null +++ b/Ports/libenet/patches/0003-Fix-cmake-deprecation-warning.patch @@ -0,0 +1,22 @@ +From 67f1ac3f2f1d2c24035bf8b2cd0a279158b94d2e Mon Sep 17 00:00:00 2001 +From: surrealegg +Date: Thu, 21 Sep 2023 22:25:02 +0400 +Subject: [PATCH 3/3] Fix cmake deprecation warning + +--- + CMakeLists.txt | 2 +- + 1 file changed, 1 insertion(+), 1 deletion(-) + +diff --git a/CMakeLists.txt b/CMakeLists.txt +index 532e628..6281d7e 100644 +--- a/CMakeLists.txt ++++ b/CMakeLists.txt +@@ -1,4 +1,4 @@ +-cmake_minimum_required(VERSION 2.6) ++cmake_minimum_required(VERSION 2.8.12...3.20) + + project(enet) + +-- +2.41.0 + diff --git a/Ports/libenet/patches/ReadMe.md b/Ports/libenet/patches/ReadMe.md new file mode 100644 index 00000000000..97d0b06dffc --- /dev/null +++ b/Ports/libenet/patches/ReadMe.md @@ -0,0 +1,13 @@ +# Patches for libenet on SerenityOS + +## `0001-Make-library-shared.patch` + +Makes Library Shared + +## `0002-Add-missing-install-options.patch` + +Add missing install options + +## `0003-Fix-cmake-deprecation-warning.patch` + +Fix CMake deprecation warning