Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

switch: add ftgl #119

Open
wants to merge 8 commits into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
48 changes: 48 additions & 0 deletions switch/ftgl/PKGBUILD
Original file line number Diff line number Diff line change
@@ -0,0 +1,48 @@
# Maintainer: Rhys Koedijk <[email protected]>

pkgbasename=ftgl
pkgname=switch-$pkgbasename
pkgver=2.4.0
pkgrel=1
pkgdesc='FTGL is a free cross-platform Open Source C++ library that uses Freetype2 to simplify rendering fonts in OpenGL applications'
arch=('any')
url='https://github.com/frankheckenbach/ftgl/'
license=('MIT')
options=(!strip libtool staticlibs)
source=("${url}/archive/v${pkgver}.tar.gz")
sha256sums=('aa97da1c3442a8fd3941037655df18016d70b5266381c81d81e8b5335f196ea8')
depends=('switch-freetype' 'switch-glu' 'switch-mesa')
makedepends=('switch-pkg-config' 'devkitpro-pkgbuild-helpers')
groups=('switch-portlibs')

prepare() {
cd ${pkgbasename}-${pkgver}
patch -Np1 -i "${startdir}/${pkgbasename}-2.4.0-install_pkgconfig.patch"
patch -Np1 -i "${startdir}/${pkgbasename}-2.4.0-fix_libftgl_la_sources.patch"
}

build() {
cd ${pkgbasename}-${pkgver}

source /opt/devkitpro/switchvars.sh

cmake -G"Unix Makefiles" -DCMAKE_TOOLCHAIN_FILE=/opt/devkitpro/switch.cmake \
-DCMAKE_INSTALL_PREFIX=$PORTLIBS_PREFIX \
-DCMAKE_C_FLAGS="$CFLAGS $CPPFLAGS" \
-DCMAKE_CXX_FLAGS="$CFLAGS" \
-DCMAKE_AR="/opt/devkitpro/devkitA64/bin/aarch64-none-elf-gcc-ar" \
-DBUILD_SHARED_LIBS:BOOL=OFF \
-DOPENGL_USE_EGL:BOOL=ON \
-DOPENGL_opengl_LIBRARY="${PORTLIBS_PREFIX}/lib" \
.

make
}

package() {
cd ${pkgbasename}-${pkgver}

make DESTDIR="$pkgdir" install

install -Dm644 COPYING "$pkgdir"/opt/devkitpro/portlibs/switch/licenses/$pkgname/COPYING
}
12 changes: 12 additions & 0 deletions switch/ftgl/ftgl-2.4.0-fix_libftgl_la_sources.patch
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
diff --git a/src/CMakeLists.txt b/src/CMakeLists.txt
index 693e49f..b0f26f6 100644
--- a/src/CMakeLists.txt
+++ b/src/CMakeLists.txt
@@ -26,7 +26,6 @@ SET(libftgl_la_SOURCES
FTGlyphContainer.h
FTInternals.h
FTLibrary.cpp
- FTLibrary.h
FTList.h
FTPoint.cpp
FTSize.cpp
29 changes: 29 additions & 0 deletions switch/ftgl/ftgl-2.4.0-install_pkgconfig.patch
Original file line number Diff line number Diff line change
@@ -0,0 +1,29 @@
diff --git a/CMakeLists.txt b/CMakeLists.txt
index 303fcae..cdcf2c9 100644
--- a/CMakeLists.txt
+++ b/CMakeLists.txt
@@ -74,3 +74,12 @@ install(EXPORT FTGL-targets DESTINATION "${cmakedir}")
install(
FILES "${CMAKE_CURRENT_BINARY_DIR}/CMakeFiles/FTGLConfig.cmake"
DESTINATION "${cmakedir}")
+
+SET(PKGCONFIG_INSTALL_PREFIX "lib${LIB_SUFFIX}/pkgconfig/" CACHE STRING "Base directory for pkgconfig files")
+CONFIGURE_FILE(
+ ${CMAKE_CURRENT_SOURCE_DIR}/ftgl.pc.cmake
+ ${CMAKE_CURRENT_BINARY_DIR}/ftgl.pc
+ @ONLY)
+INSTALL(
+ FILES ${CMAKE_CURRENT_BINARY_DIR}/ftgl.pc
+ DESTINATION ${PKGCONFIG_INSTALL_PREFIX})
diff --git a/ftgl.pc.cmake b/ftgl.pc.cmake
new file mode 100644
index 0000000..d242667
--- /dev/null
+++ b/ftgl.pc.cmake
@@ -0,0 +1,6 @@
+Name: ftgl
+Description: OpenGL frontend to Freetype 2
+Requires.private: freetype2
+Version: @VERSION_SERIES@.@VERSION_MAJOR@.@VERSION_MINOR@
+Libs: -L@CMAKE_INSTALL_PREFIX@/lib -lftgl
+Cflags: -I@CMAKE_INSTALL_PREFIX@/include