From f2b3f96901a320a9cda78ddbee306d5b320342d3 Mon Sep 17 00:00:00 2001 From: Yaroslav Kolomiiets Date: Wed, 22 Apr 2026 13:01:21 +0000 Subject: [PATCH] [build] Add a Plan 9 port. * mkfile: Build instructions. * build/plan9/p9lib.h: Standard lib replacement. * build/plan9/README: Docs. --- builds/plan9/README | 34 +++++++++++++++++++ builds/plan9/p9lib.h | 79 ++++++++++++++++++++++++++++++++++++++++++++ mkfile | 75 +++++++++++++++++++++++++++++++++++++++++ 3 files changed, 188 insertions(+) create mode 100644 builds/plan9/README create mode 100644 builds/plan9/p9lib.h create mode 100644 mkfile diff --git a/builds/plan9/README b/builds/plan9/README new file mode 100644 index 000000000..344750d86 --- /dev/null +++ b/builds/plan9/README @@ -0,0 +1,34 @@ +README for the builds/plan9 subdirectory. + +Copyright (C) 2026 by Yaroslav Kolomiiets. + + +The mkfile is provided for Plan 9 from Bell Labs. To build, run: + + cd ../.. # to the top FreeType directory + mk + +It produces a library to link against as ../../libfreetype.a𝑂 archive. + + + +To integrate with your code, add to your mkfile: + +FTDIR=/your/path/to/freetype +LIB=$LIBDIR/libfreetype.a$O +LIBHFILES=$LIBDIR/builds/plan9/p9ftopt.h +HFILES=$HFILES $LIBHFILES + +CFLAGS=$CFLAGS -p -I$LIBDIR/builds/plan9 -I$LIBDIR/include \ + -D'FT_CONFIG_OPTIONS_H=' \ + -D'FT_CONFIG_STANDARD_LIBRARY_H=' \ + +$LIB $LIBHFILES: + cd $FTDIR; mk install + + +This file is part of the FreeType project, and may only be used, +modified, and distributed under the terms of the FreeType project +license, LICENSE.TXT. By continuing to use, modify, or distribute +this file you indicate that you have read the license and understand +and accept it fully. diff --git a/builds/plan9/p9lib.h b/builds/plan9/p9lib.h new file mode 100644 index 000000000..187e2a1c0 --- /dev/null +++ b/builds/plan9/p9lib.h @@ -0,0 +1,79 @@ +/**************************************************************************** + * + * ftstdlib.h + * + * Plan 9-specific library and header configuration file + * + * Copyright (C) 2002-2026 by + * David Turner, Robert Wilhelm, Werner Lemberg and Yaroslav Kolomiiets. + * + * This file is part of the FreeType project, and may only be used, + * modified, and distributed under the terms of the FreeType project + * license, LICENSE.TXT. By continuing to use, modify, or distribute + * this file you indicate that you have read the license and + * understand and accept it fully. + * + */ +#ifndef FTSTDLIB_H_ +#define FTSTDLIB_H_ + +#include +#include +#include +#include + +#define size_t ulong +#define ptrdiff_t int + +#define ft_ptrdiff_t ptrdiff_t + +#define FT_CHAR_BIT CHAR_BIT +#define FT_USHORT_MAX USHRT_MAX +#define FT_INT_MAX INT_MAX +#define FT_INT_MIN INT_MIN +#define FT_UINT_MAX UINT_MAX +#define FT_LONG_MIN LONG_MIN +#define FT_LONG_MAX LONG_MAX +#define FT_ULONG_MAX ULONG_MAX +#define FT_LLONG_MAX LLONG_MAX +#define FT_LLONG_MIN LLONG_MIN +#define FT_ULLONG_MAX ULLONG_MAX + +#define ft_memchr memchr +#define ft_memcmp memcmp +#define ft_memcpy memcpy +#define ft_memmove memmove +#define ft_memset memset +#define ft_strcat strcat +#define ft_strcmp strcmp +#define ft_strcpy strcpy +#define ft_strlen strlen +#define ft_strncmp strncmp +#define ft_strncpy strncpy +#define ft_strrchr strrchr +#define ft_strstr strstr + +#define FT_FILE FILE +#define ft_fclose fclose +#define ft_fopen fopen +#define ft_fread fread +#define ft_fseek fseek +#define ft_ftell ftell +#define ft_snprintf snprintf + +#define ft_qsort qsort + +#define ft_scalloc calloc +#define ft_sfree free +#define ft_smalloc malloc +#define ft_srealloc realloc + +#define ft_strtol strtol +#define ft_getenv getenv + +#define ft_jmp_buf jmp_buf + +#define ft_longjmp longjmp +#define ft_setjmp( b ) setjmp( *(ft_jmp_buf*) &(b) ) + +#endif /* FTSTDLIB_H_ */ diff --git a/mkfile b/mkfile new file mode 100644 index 000000000..e20511281 --- /dev/null +++ b/mkfile @@ -0,0 +1,75 @@ +# mkfile for Plan 9 from Bell Labs +# +# See builds/plan9/README for usage. +# +# Copyright (C) 2026 by Yaroslav Kolomiiets. +# +# This file is part of the FreeType project, and may only be used, +# modified, and distributed under the terms of the FreeType project +# license, LICENSE.TXT. By continuing to use, modify, or distribute +# this file you indicate that you have read the license and understand +# and accept it fully. +# +' \ + -D'FT_CONFIG_STANDARD_LIBRARY_H=' \ + -DFT2_BUILD_LIBRARY \ + + $target + +clean:V: + rm -f *.[$OS] src/*/*.[$OS] $CLEANFILES + +nuke:V: + rm -f *.[$OS] src/*/*.[$OS] $CLEANFILES + rm -f libfreetype.a[$OS] builds/plan9/p9ftopt.h