add a lib for rendering text in sdl2 and rules to make in makefile
This commit is contained in:
1485
SDL2_ttf/build-scripts/build-release.py
Executable file
1485
SDL2_ttf/build-scripts/build-release.py
Executable file
File diff suppressed because it is too large
Load Diff
18
SDL2_ttf/build-scripts/cmake-toolchain-mingw64-i686.cmake
Normal file
18
SDL2_ttf/build-scripts/cmake-toolchain-mingw64-i686.cmake
Normal file
@@ -0,0 +1,18 @@
|
||||
set(CMAKE_SYSTEM_NAME Windows)
|
||||
set(CMAKE_SYSTEM_PROCESSOR x86)
|
||||
|
||||
find_program(CMAKE_C_COMPILER NAMES i686-w64-mingw32-gcc)
|
||||
find_program(CMAKE_CXX_COMPILER NAMES i686-w64-mingw32-g++)
|
||||
find_program(CMAKE_RC_COMPILER NAMES i686-w64-mingw32-windres windres)
|
||||
|
||||
if(NOT CMAKE_C_COMPILER)
|
||||
message(FATAL_ERROR "Failed to find CMAKE_C_COMPILER.")
|
||||
endif()
|
||||
|
||||
if(NOT CMAKE_CXX_COMPILER)
|
||||
message(FATAL_ERROR "Failed to find CMAKE_CXX_COMPILER.")
|
||||
endif()
|
||||
|
||||
if(NOT CMAKE_RC_COMPILER)
|
||||
message(FATAL_ERROR "Failed to find CMAKE_RC_COMPILER.")
|
||||
endif()
|
||||
18
SDL2_ttf/build-scripts/cmake-toolchain-mingw64-x86_64.cmake
Normal file
18
SDL2_ttf/build-scripts/cmake-toolchain-mingw64-x86_64.cmake
Normal file
@@ -0,0 +1,18 @@
|
||||
set(CMAKE_SYSTEM_NAME Windows)
|
||||
set(CMAKE_SYSTEM_PROCESSOR x86_64)
|
||||
|
||||
find_program(CMAKE_C_COMPILER NAMES x86_64-w64-mingw32-gcc)
|
||||
find_program(CMAKE_CXX_COMPILER NAMES x86_64-w64-mingw32-g++)
|
||||
find_program(CMAKE_RC_COMPILER NAMES x86_64-w64-mingw32-windres windres)
|
||||
|
||||
if(NOT CMAKE_C_COMPILER)
|
||||
message(FATAL_ERROR "Failed to find CMAKE_C_COMPILER.")
|
||||
endif()
|
||||
|
||||
if(NOT CMAKE_CXX_COMPILER)
|
||||
message(FATAL_ERROR "Failed to find CMAKE_CXX_COMPILER.")
|
||||
endif()
|
||||
|
||||
if(NOT CMAKE_RC_COMPILER)
|
||||
message(FATAL_ERROR "Failed to find CMAKE_RC_COMPILER.")
|
||||
endif()
|
||||
45
SDL2_ttf/build-scripts/create-release.py
Executable file
45
SDL2_ttf/build-scripts/create-release.py
Executable file
@@ -0,0 +1,45 @@
|
||||
#!/usr/bin/env python3
|
||||
|
||||
import argparse
|
||||
from pathlib import Path
|
||||
import json
|
||||
import logging
|
||||
import re
|
||||
import subprocess
|
||||
|
||||
ROOT = Path(__file__).resolve().parents[1]
|
||||
|
||||
|
||||
def determine_remote() -> str:
|
||||
text = (ROOT / "build-scripts/release-info.json").read_text()
|
||||
release_info = json.loads(text)
|
||||
if "remote" in release_info:
|
||||
return release_info["remote"]
|
||||
project_with_version = release_info["name"]
|
||||
project, _ = re.subn("([^a-zA-Z_])", "", project_with_version)
|
||||
return f"libsdl-org/{project}"
|
||||
|
||||
|
||||
def main():
|
||||
default_remote = determine_remote()
|
||||
|
||||
parser = argparse.ArgumentParser(allow_abbrev=False)
|
||||
parser.add_argument("--ref", required=True, help=f"Name of branch or tag containing release.yml")
|
||||
parser.add_argument("--remote", "-R", default=default_remote, help=f"Remote repo (default={default_remote})")
|
||||
parser.add_argument("--commit", help=f"Input 'commit' of release.yml (default is the hash of the ref)")
|
||||
args = parser.parse_args()
|
||||
|
||||
if args.commit is None:
|
||||
args.commit = subprocess.check_output(["git", "rev-parse", args.ref], cwd=ROOT, text=True).strip()
|
||||
|
||||
|
||||
print(f"Running release.yml workflow:")
|
||||
print(f" remote = {args.remote}")
|
||||
print(f" ref = {args.ref}")
|
||||
print(f" commit = {args.commit}")
|
||||
|
||||
subprocess.check_call(["gh", "-R", args.remote, "workflow", "run", "release.yml", "--ref", args.ref, "-f", f"commit={args.commit}"], cwd=ROOT)
|
||||
|
||||
|
||||
if __name__ == "__main__":
|
||||
raise SystemExit(main())
|
||||
123
SDL2_ttf/build-scripts/release-info.json
Normal file
123
SDL2_ttf/build-scripts/release-info.json
Normal file
@@ -0,0 +1,123 @@
|
||||
{
|
||||
"name": "SDL2_ttf",
|
||||
"remote": "libsdl-org/SDL_ttf",
|
||||
"dependencies": {
|
||||
"SDL": {
|
||||
"startswith": "2.",
|
||||
"repo": "libsdl-org/SDL"
|
||||
}
|
||||
},
|
||||
"version": {
|
||||
"file": "SDL_ttf.h",
|
||||
"re_major": "^#define SDL_TTF_MAJOR_VERSION\\s+([0-9]+)$",
|
||||
"re_minor": "^#define SDL_TTF_MINOR_VERSION\\s+([0-9]+)$",
|
||||
"re_micro": "^#define SDL_TTF_PATCHLEVEL\\s+([0-9]+)$"
|
||||
},
|
||||
"source": {
|
||||
"extra-repos": [
|
||||
"external/freetype",
|
||||
"external/harfbuzz"
|
||||
],
|
||||
"checks": [
|
||||
"SDL_ttf.h",
|
||||
"SDL_ttf.c",
|
||||
"external/freetype/include/freetype/freetype.h",
|
||||
"external/harfbuzz/src/hb.h"
|
||||
]
|
||||
},
|
||||
"dmg": {
|
||||
"project": "Xcode/SDL_ttf.xcodeproj",
|
||||
"path": "Xcode/build/SDL2_ttf.dmg",
|
||||
"scheme": "Create DMG",
|
||||
"dependencies": {
|
||||
"SDL": {
|
||||
"artifact": "SDL2-*.dmg"
|
||||
}
|
||||
}
|
||||
},
|
||||
"mingw": {
|
||||
"autotools": {
|
||||
"archs": ["x86", "x64"],
|
||||
"args": [
|
||||
"--with-sdl-prefix=@<@DEP_PREFIX@>@",
|
||||
"CFLAGS=-O2 -I@<@DEP_PREFIX@>@/include -I@<@DEP_PREFIX@>@/include/SDL2",
|
||||
"LDFLAGS=-Wl,-s -L@<@DEP_PREFIX@>@/lib -lSDL2"
|
||||
]
|
||||
},
|
||||
"files": {
|
||||
"": [
|
||||
"CHANGES.txt",
|
||||
"LICENSE.txt",
|
||||
"README.txt",
|
||||
"mingw/pkg-support/Makefile"
|
||||
],
|
||||
"cmake": [
|
||||
"mingw/pkg-support/cmake/sdl2_ttf-config.cmake",
|
||||
"mingw/pkg-support/cmake/sdl2_ttf-config-version.cmake"
|
||||
]
|
||||
},
|
||||
"dependencies": {
|
||||
"SDL": {
|
||||
"artifact": "SDL2-devel-*-mingw.tar.gz",
|
||||
"install-command": "make install-package arch=@<@TRIPLET@>@ prefix=@<@PREFIX@>@"
|
||||
}
|
||||
}
|
||||
},
|
||||
"msvc": {
|
||||
"msbuild": {
|
||||
"archs": [
|
||||
"x86",
|
||||
"x64"
|
||||
],
|
||||
"projects": [
|
||||
"VisualC/SDL_ttf.vcxproj"
|
||||
],
|
||||
"files-lib": {
|
||||
"": [
|
||||
"VisualC/@<@PLATFORM@>@/@<@CONFIGURATION@>@/SDL2_ttf.dll"
|
||||
]
|
||||
},
|
||||
"files-devel": {
|
||||
"lib/@<@ARCH@>@": [
|
||||
"VisualC/@<@PLATFORM@>@/@<@CONFIGURATION@>@/SDL2_ttf.dll",
|
||||
"VisualC/@<@PLATFORM@>@/@<@CONFIGURATION@>@/SDL2_ttf.lib",
|
||||
"VisualC/@<@PLATFORM@>@/@<@CONFIGURATION@>@/SDL2_ttf.pdb"
|
||||
]
|
||||
}
|
||||
},
|
||||
"files-lib": {
|
||||
"": [
|
||||
"README.txt"
|
||||
]
|
||||
},
|
||||
"files-devel": {
|
||||
"": [
|
||||
"CHANGES.txt",
|
||||
"LICENSE.txt",
|
||||
"README.txt"
|
||||
],
|
||||
"include": [
|
||||
"SDL_ttf.h"
|
||||
],
|
||||
"cmake": [
|
||||
"VisualC/pkg-support/cmake/sdl2_ttf-config.cmake",
|
||||
"VisualC/pkg-support/cmake/sdl2_ttf-config-version.cmake"
|
||||
]
|
||||
},
|
||||
"dependencies": {
|
||||
"SDL": {
|
||||
"artifact": "SDL2-devel-*-VC.zip",
|
||||
"copy": [
|
||||
{
|
||||
"src": "lib/@<@ARCH@>@/SDL2.*",
|
||||
"dst": "../SDL/VisualC/@<@PLATFORM@>@/@<@CONFIGURATION@>@"
|
||||
},
|
||||
{
|
||||
"src": "include/*",
|
||||
"dst": "../SDL/include"
|
||||
}
|
||||
]
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
192
SDL2_ttf/build-scripts/test-versioning.sh
Executable file
192
SDL2_ttf/build-scripts/test-versioning.sh
Executable file
@@ -0,0 +1,192 @@
|
||||
#!/bin/sh
|
||||
# Copyright 2022 Collabora Ltd.
|
||||
# SPDX-License-Identifier: Zlib
|
||||
|
||||
set -eu
|
||||
|
||||
cd `dirname $0`/..
|
||||
|
||||
# Needed so sed doesn't report illegal byte sequences on macOS
|
||||
export LC_CTYPE=C
|
||||
|
||||
header=SDL_ttf.h
|
||||
ref_major=$(sed -ne 's/^#define SDL_TTF_MAJOR_VERSION *//p' $header)
|
||||
ref_minor=$(sed -ne 's/^#define SDL_TTF_MINOR_VERSION *//p' $header)
|
||||
ref_micro=$(sed -ne 's/^#define SDL_TTF_PATCHLEVEL *//p' $header)
|
||||
ref_version="${ref_major}.${ref_minor}.${ref_micro}"
|
||||
|
||||
tests=0
|
||||
failed=0
|
||||
|
||||
ok () {
|
||||
tests=$(( tests + 1 ))
|
||||
echo "ok - $*"
|
||||
}
|
||||
|
||||
not_ok () {
|
||||
tests=$(( tests + 1 ))
|
||||
echo "not ok - $*"
|
||||
failed=1
|
||||
}
|
||||
|
||||
major=$(sed -Ene 's/^m4_define\(\[MAJOR_VERSION_MACRO\], \[([0-9]*)\]\)$/\1/p' configure.ac)
|
||||
minor=$(sed -Ene 's/^m4_define\(\[MINOR_VERSION_MACRO\], \[([0-9]*)\]\)$/\1/p' configure.ac)
|
||||
micro=$(sed -Ene 's/^m4_define\(\[MICRO_VERSION_MACRO\], \[([0-9]*)\]\)$/\1/p' configure.ac)
|
||||
version="${major}.${minor}.${micro}"
|
||||
ref_sdl_req=$(sed -ne 's/^SDL_VERSION=//p' configure.ac)
|
||||
|
||||
if [ "$ref_version" = "$version" ]; then
|
||||
ok "configure.ac $version"
|
||||
else
|
||||
not_ok "configure.ac $version disagrees with $header $ref_version"
|
||||
fi
|
||||
|
||||
major=$(sed -ne 's/^MAJOR_VERSION=//p' configure)
|
||||
minor=$(sed -ne 's/^MINOR_VERSION=//p' configure)
|
||||
micro=$(sed -ne 's/^MICRO_VERSION=//p' configure)
|
||||
version="${major}.${minor}.${micro}"
|
||||
|
||||
if [ "$ref_version" = "$version" ]; then
|
||||
ok "configure $version"
|
||||
else
|
||||
not_ok "configure $version disagrees with $header $ref_version"
|
||||
fi
|
||||
|
||||
major=$(sed -ne 's/^set(MAJOR_VERSION \([0-9]*\))$/\1/p' CMakeLists.txt)
|
||||
minor=$(sed -ne 's/^set(MINOR_VERSION \([0-9]*\))$/\1/p' CMakeLists.txt)
|
||||
micro=$(sed -ne 's/^set(MICRO_VERSION \([0-9]*\))$/\1/p' CMakeLists.txt)
|
||||
sdl_req=$(sed -ne 's/^set(SDL_REQUIRED_VERSION \([0-9.]*\))$/\1/p' CMakeLists.txt)
|
||||
version="${major}.${minor}.${micro}"
|
||||
|
||||
if [ "$ref_version" = "$version" ]; then
|
||||
ok "CMakeLists.txt $version"
|
||||
else
|
||||
not_ok "CMakeLists.txt $version disagrees with $header $ref_version"
|
||||
fi
|
||||
|
||||
if [ "$ref_sdl_req" = "$sdl_req" ]; then
|
||||
ok "CMakeLists.txt $sdl_req"
|
||||
else
|
||||
not_ok "CMakeLists.txt SDL_REQUIRED_VERSION=$sdl_req disagrees with configure.ac SDL_VERSION=$ref_sdl_req"
|
||||
fi
|
||||
|
||||
major=$(sed -ne 's/^MAJOR_VERSION *= *//p' Makefile.os2)
|
||||
minor=$(sed -ne 's/^MINOR_VERSION *= *//p' Makefile.os2)
|
||||
micro=$(sed -ne 's/^MICRO_VERSION *= *//p' Makefile.os2)
|
||||
version="${major}.${minor}.${micro}"
|
||||
|
||||
if [ "$ref_version" = "$version" ]; then
|
||||
ok "Makefile.os2 $version"
|
||||
else
|
||||
not_ok "Makefile.os2 $version disagrees with $header $ref_version"
|
||||
fi
|
||||
|
||||
for rcfile in version.rc VisualC/Version.rc; do
|
||||
tuple=$(sed -ne 's/^ *FILEVERSION *//p' "$rcfile" | tr -d '\r')
|
||||
ref_tuple="${ref_major},${ref_minor},${ref_micro},0"
|
||||
|
||||
if [ "$ref_tuple" = "$tuple" ]; then
|
||||
ok "$rcfile FILEVERSION $tuple"
|
||||
else
|
||||
not_ok "$rcfile FILEVERSION $tuple disagrees with $header $ref_tuple"
|
||||
fi
|
||||
|
||||
tuple=$(sed -ne 's/^ *PRODUCTVERSION *//p' "$rcfile" | tr -d '\r')
|
||||
|
||||
if [ "$ref_tuple" = "$tuple" ]; then
|
||||
ok "$rcfile PRODUCTVERSION $tuple"
|
||||
else
|
||||
not_ok "$rcfile PRODUCTVERSION $tuple disagrees with $header $ref_tuple"
|
||||
fi
|
||||
|
||||
tuple=$(sed -Ene 's/^ *VALUE "FileVersion", "([0-9, ]*)\\0"\r?$/\1/p' "$rcfile" | tr -d '\r')
|
||||
ref_tuple="${ref_major}, ${ref_minor}, ${ref_micro}, 0"
|
||||
|
||||
if [ "$ref_tuple" = "$tuple" ]; then
|
||||
ok "$rcfile FileVersion $tuple"
|
||||
else
|
||||
not_ok "$rcfile FileVersion $tuple disagrees with $header $ref_tuple"
|
||||
fi
|
||||
|
||||
tuple=$(sed -Ene 's/^ *VALUE "ProductVersion", "([0-9, ]*)\\0"\r?$/\1/p' "$rcfile" | tr -d '\r')
|
||||
|
||||
if [ "$ref_tuple" = "$tuple" ]; then
|
||||
ok "$rcfile ProductVersion $tuple"
|
||||
else
|
||||
not_ok "$rcfile ProductVersion $tuple disagrees with $header $ref_tuple"
|
||||
fi
|
||||
done
|
||||
|
||||
version=$(sed -Ene '/CFBundleShortVersionString/,+1 s/.*<string>(.*)<\/string>.*/\1/p' Xcode/Info-Framework.plist)
|
||||
|
||||
if [ "$ref_version" = "$version" ]; then
|
||||
ok "Info-Framework.plist CFBundleShortVersionString $version"
|
||||
else
|
||||
not_ok "Info-Framework.plist CFBundleShortVersionString $version disagrees with $header $ref_version"
|
||||
fi
|
||||
|
||||
version=$(sed -Ene '/CFBundleVersion/,+1 s/.*<string>(.*)<\/string>.*/\1/p' Xcode/Info-Framework.plist)
|
||||
|
||||
if [ "$ref_version" = "$version" ]; then
|
||||
ok "Info-Framework.plist CFBundleVersion $version"
|
||||
else
|
||||
not_ok "Info-Framework.plist CFBundleVersion $version disagrees with $header $ref_version"
|
||||
fi
|
||||
|
||||
# For simplicity this assumes we'll never break ABI before SDL 3.
|
||||
dylib_compat=$(sed -Ene 's/.*DYLIB_COMPATIBILITY_VERSION = (.*);$/\1/p' Xcode/SDL_ttf.xcodeproj/project.pbxproj)
|
||||
|
||||
case "$ref_minor" in
|
||||
(*[02468])
|
||||
major="$(( ref_minor * 100 + 1 ))"
|
||||
minor="0"
|
||||
;;
|
||||
(*)
|
||||
major="$(( ref_minor * 100 + ref_micro + 1 ))"
|
||||
minor="0"
|
||||
;;
|
||||
esac
|
||||
|
||||
ref="${major}.${minor}.0
|
||||
${major}.${minor}.0"
|
||||
|
||||
if [ "$ref" = "$dylib_compat" ]; then
|
||||
ok "project.pbxproj DYLIB_COMPATIBILITY_VERSION is consistent"
|
||||
else
|
||||
not_ok "project.pbxproj DYLIB_COMPATIBILITY_VERSION is inconsistent, expected $ref, got $dylib_compat"
|
||||
fi
|
||||
|
||||
dylib_cur=$(sed -Ene 's/.*DYLIB_CURRENT_VERSION = (.*);$/\1/p' Xcode/SDL_ttf.xcodeproj/project.pbxproj)
|
||||
|
||||
case "$ref_minor" in
|
||||
(*[02468])
|
||||
major="$(( ref_minor * 100 + 1 ))"
|
||||
minor="$ref_micro"
|
||||
;;
|
||||
(*)
|
||||
major="$(( ref_minor * 100 + ref_micro + 1 ))"
|
||||
minor="0"
|
||||
;;
|
||||
esac
|
||||
|
||||
ref="${major}.${minor}.0
|
||||
${major}.${minor}.0"
|
||||
|
||||
if [ "$ref" = "$dylib_cur" ]; then
|
||||
ok "project.pbxproj DYLIB_CURRENT_VERSION is consistent"
|
||||
else
|
||||
not_ok "project.pbxproj DYLIB_CURRENT_VERSION is inconsistent, expected $ref, got $dylib_cur"
|
||||
fi
|
||||
|
||||
if [ -f .github/fetch_sdl_vc.ps1 ]; then
|
||||
sdl_req=$(sed -ne 's/\$sdl2_version = "\([0-9.]*\)"$/\1/p' .github/fetch_sdl_vc.ps1)
|
||||
|
||||
if [ "$ref_sdl_req" = "$sdl_req" ]; then
|
||||
ok ".github/fetch_sdl_vc.ps1 $sdl_req"
|
||||
else
|
||||
not_ok ".github/fetch_sdl_vc.ps1 sdl2_version=$sdl_req disagrees with configure.ac SDL_VERSION=$ref_sdl_req"
|
||||
fi
|
||||
fi
|
||||
|
||||
echo "1..$tests"
|
||||
exit "$failed"
|
||||
8
SDL2_ttf/build-scripts/touch-autofoo.sh
Executable file
8
SDL2_ttf/build-scripts/touch-autofoo.sh
Executable file
@@ -0,0 +1,8 @@
|
||||
#!/bin/sh
|
||||
|
||||
# Run this script from the root of $srcdir to touch the
|
||||
# autotools generated files, so that the build procedure
|
||||
# doesn't attempt to regenerate them.
|
||||
|
||||
cd `dirname $0`/..
|
||||
touch aclocal.m4 configure Makefile.in
|
||||
Reference in New Issue
Block a user