port Glib

https://wiki.gnome.org/Projects/GLib

Fix #80
This commit is contained in:
Emery Hemingway
2017-08-03 10:08:32 -05:00
committed by Norman Feske
parent 2e44104873
commit a7e6bf698d
11 changed files with 2162 additions and 0 deletions

119
include/glib/glibconfig.h Normal file
View File

@@ -0,0 +1,119 @@
#ifndef __G_LIBCONFIG_H__
#define __G_LIBCONFIG_H__
/* Genode includes */
#include <base/fixed_stdint.h>
/* Libc includes */
//#include <float.h>
#include <sys/limits.h>
/* Glib includes */
#include <glib/gmacros.h>
G_BEGIN_DECLS
#define G_MINFLOAT FLT_MIN
#define G_MAXFLOAT FLT_MAX
#define G_MINDOUBLE DBL_MIN
#define G_MAXDOUBLE DBL_MAX
#define G_MINSHORT SHRT_MIN
#define G_MAXSHORT SHRT_MAX
#define G_MAXUSHORT USHRT_MAX
#define G_MININT INT_MIN
#define G_MAXINT INT_MAX
#define G_MAXUINT UINT_MAX
#define G_MINLONG LONG_MIN
#define G_MAXLONG LONG_MAX
#define G_MAXULONG ULONG_MAX
typedef genode_int8_t gint8;
typedef genode_uint8_t guint8;
typedef genode_int16_t gint16;
typedef genode_uint16_t guint16;
typedef genode_int32_t gint32;
typedef genode_uint32_t guint32;
typedef genode_int64_t gint64;
typedef genode_uint64_t guint64;
#define G_MAXSIZE G_MAXUINT64
#define G_MINSSIZE G_MININT64
#define G_MAXSSIZE G_MAXINT64
typedef unsigned long gsize;
typedef long gssize;
typedef long goffset;
#define G_MINOFFSET G_MININT64
#define G_MAXOFFSET G_MAXINT64
#define G_GOFFSET_MODIFIER G_GINT64_MODIFIER
#define G_GOFFSET_FORMAT G_GINT64_FORMAT
#define G_GOFFSET_CONSTANT(val) G_GINT64_CONSTANT(val)
#define GLIB_SIZEOF_VOID_P 8
#define GLIB_SIZEOF_LONG 8
#define GLIB_SIZEOF_SIZE_T 8
#define GPOINTER_TO_INT(p) ((gint64) (p))
#define GPOINTER_TO_UINT(p) ((guint64) (p))
#define GINT_TO_POINTER(i) ((gpointer) (i))
#define GUINT_TO_POINTER(u) ((gpointer) (u))
#define G_GSIZE_MODIFIER ""
#define G_GSSIZE_MODIFIER ""
#define G_GSIZE_FORMAT "u"
#define G_GSSIZE_FORMAT "i"
#define G_GINT16_FORMAT "i"
#define G_GUINT16_FORMAT "u"
#define G_GINT32_FORMAT "i"
#define G_GUINT32_FORMAT "u"
#define G_GINT64_FORMAT "i"
#define G_GUINT64_FORMAT "u"
#define G_BYTE_ORDER G_LITTLE_ENDIAN
#define GLIB_SYSDEF_POLLIN =1
#define GLIB_SYSDEF_POLLOUT =4
#define GLIB_SYSDEF_POLLPRI =2
#define GLIB_SYSDEF_POLLHUP =16
#define GLIB_SYSDEF_POLLERR =8
#define GLIB_SYSDEF_POLLNVAL =32
typedef char GPid;
#define G_GINT64_CONSTANT(val) (G_GNUC_EXTENSION (val##LL))
#define G_GUINT64_CONSTANT(val) (G_GNUC_EXTENSION (val##ULL))
#define G_VA_COPY va_copy
#define GINT16_TO_LE(val) ((gint16) (val))
#define GUINT16_TO_LE(val) ((guint16) (val))
#define GINT16_TO_BE(val) ((gint16) GUINT16_SWAP_LE_BE (val))
#define GUINT16_TO_BE(val) (GUINT16_SWAP_LE_BE (val))
#define GINT32_TO_LE(val) ((gint32) (val))
#define GUINT32_TO_LE(val) ((guint32) (val))
#define GINT32_TO_BE(val) ((gint32) GUINT32_SWAP_LE_BE (val))
#define GUINT32_TO_BE(val) (GUINT32_SWAP_LE_BE (val))
#define GINT64_TO_LE(val) ((gint64) (val))
#define GUINT64_TO_LE(val) ((guint64) (val))
#define GINT64_TO_BE(val) ((gint64) GUINT64_SWAP_LE_BE (val))
#define GUINT64_TO_BE(val) (GUINT64_SWAP_LE_BE (val))
#define GLONG_TO_LE(val) ((glong) GINT32_TO_LE (val))
#define GULONG_TO_LE(val) ((gulong) GUINT32_TO_LE (val))
#define GLONG_TO_BE(val) ((glong) GINT32_TO_BE (val))
#define GULONG_TO_BE(val) ((gulong) GUINT32_TO_BE (val))
#define GINT_TO_LE(val) ((gint) GINT32_TO_LE (val))
#define GUINT_TO_LE(val) ((guint) GUINT32_TO_LE (val))
#define GINT_TO_BE(val) ((gint) GINT32_TO_BE (val))
#define GUINT_TO_BE(val) ((guint) GUINT32_TO_BE (val))
#define GSIZE_TO_LE(val) ((gsize) GUINT32_TO_LE (val))
#define GSSIZE_TO_LE(val) ((gssize) GINT32_TO_LE (val))
#define GSIZE_TO_BE(val) ((gsize) GUINT32_TO_BE (val))
#define GSSIZE_TO_BE(val) ((gssize) GINT32_TO_BE (val))
#define G_BYTE_ORDER G_LITTLE_ENDIAN
#define G_GINT64_MODIFIER "I64"
G_END_DECLS
#endif /* GLIBCONFIG_H */

View File

@@ -0,0 +1,2 @@
GLIB_PORT_DIR := $(call select_from_ports,glib)
INC_DIR += $(GLIB_PORT_DIR)/include/glib $(call select_from_repositories,include/glib)

60
lib/mk/glib.mk Normal file
View File

@@ -0,0 +1,60 @@
SHARED_LIB =1
GLIB_PORT_DIR = $(call select_from_ports,glib)
GLIB_SRC_DIR = $(GLIB_PORT_DIR)/src/lib/glib/glib
LIBS += libc libiconv
CC_DEF += \
-DGLIB_MAJOR_VERSION=2 -DGLIB_MINOR_VERSION=52 -DGLIB_MICRO_VERSION=2 \
-DGLIB_BINARY_AGE=5302 -DGLIB_INTERFACE_AGE=0 \
-DGLIB_COMPILATION \
-DG_OS_UNIX \
-DSUPPORT_UCP \
-DSUPPORT_UTF \
-DSUPPORT_UTF8 \
-DNEWLINE=-1 \
-DMATCH_LIMIT=10000000 \
-DMATCH_LIMIT_RECURSION=8192 \
-DMAX_NAME_SIZE=32 \
-DMAX_NAME_COUNT=10000 \
-DMAX_DUPLENGTH=30000 \
-DLINK_SIZE=2 \
-DPOSIX_MALLOC_THRESHOLD=10 \
-DPCRE_STATIC \
-UBSR_ANYCRLF \
-UEBCDIC \
CC_WARN += -Wno-unused-function -Wno-deprecated-declarations
INC_DIR += \
$(REP_DIR)/src/lib/glib \
$(GLIB_SRC_DIR) \
$(REP_DIR)/include/glib \
$(GLIB_PORT_DIR)/src/lib/glib \
$(GLIB_PORT_DIR)/include/glib \
DEPRECATED_SRC_C := $(notdir $(wildcard $(GLIB_SRC_DIR)/deprecated/*.c))
PCRE_SRC := $(notdir $(wildcard $(GLIB_SRC_DIR)/pcre/*.c))
LIBCHARSET_SRC := $(notdir $(wildcard $(GLIB_SRC_DIR)/libcharset/*.c))
GLIB_SRC := $(notdir $(wildcard $(GLIB_SRC_DIR)/*.c))
GLIB_FILTER := \
goption.c guuid.c win_iconv.c \
$(notdir $(wildcard $(GLIB_SRC_DIR)/*win32*.c)) \
$(notdir $(wildcard $(GLIB_SRC_DIR)/*win64*.c))
SRC_C = \
$(DEPRECATED_SRC_C) \
$(PCRE_SRC) \
$(LIBCHARSET_SRC) \
$(filter-out $(GLIB_FILTER),$(GLIB_SRC)) \
vpath %.c $(GLIB_SRC_DIR)
vpath %.c $(GLIB_SRC_DIR)/deprecated
vpath %.c $(GLIB_SRC_DIR)/pcre
vpath %.c $(GLIB_SRC_DIR)/libcharset

1631
lib/symbols/glib Normal file

File diff suppressed because it is too large Load Diff

1
ports/glib.hash Normal file
View File

@@ -0,0 +1 @@
eab68db7c06342b10624d81cdb95d167b2721e5d

99
ports/glib.port Normal file
View File

@@ -0,0 +1,99 @@
LICENSE := GPLv2
VERSION := 2.52.2
DOWNLOADS := glib.archive
URL(glib) := https://download.gnome.org/sources/glib/2.52/glib-$(VERSION).tar.xz
SHA(glib) := 50a5af7569af1a489e17f207142cd5a4cdefbf68
DIR(glib) := src/lib/glib
default: macro_sanity
# This is wacky automess kludge that
# cannot be managed by hand.
macro_sanity: $(DOWNLOADS)
$(VERBOSE)sed -i '/error/d' src/lib/glib/glib/gversionmacros.h
DIRS := include/glib include/glib/glib include/glib/glib/deprecated
DIR_CONTENT(include/glib) := src/lib/glib/glib/glib.h
DIR_CONTENT(include/glib/glib) := \
src/lib/glib/glib/galloca.h \
src/lib/glib/glib/garray.h \
src/lib/glib/glib/gasyncqueue.h \
src/lib/glib/glib/gatomic.h \
src/lib/glib/glib/glib-autocleanups.h \
src/lib/glib/glib/gbacktrace.h \
src/lib/glib/glib/gbase64.h \
src/lib/glib/glib/gbitlock.h \
src/lib/glib/glib/gbookmarkfile.h \
src/lib/glib/glib/gbytes.h \
src/lib/glib/glib/gcharset.h \
src/lib/glib/glib/gchecksum.h \
src/lib/glib/glib/gconvert.h \
src/lib/glib/glib/gdataset.h \
src/lib/glib/glib/gdate.h \
src/lib/glib/glib/gdatetime.h \
src/lib/glib/glib/gdir.h \
src/lib/glib/glib/genviron.h \
src/lib/glib/glib/gerror.h \
src/lib/glib/glib/gfileutils.h \
src/lib/glib/glib/ggettext.h \
src/lib/glib/glib/ghash.h \
src/lib/glib/glib/ghmac.h \
src/lib/glib/glib/ghook.h \
src/lib/glib/glib/ghostutils.h \
src/lib/glib/glib/giochannel.h \
src/lib/glib/glib/gkeyfile.h \
src/lib/glib/glib/glist.h \
src/lib/glib/glib/gmacros.h \
src/lib/glib/glib/gmain.h \
src/lib/glib/glib/gmappedfile.h \
src/lib/glib/glib/gmarkup.h \
src/lib/glib/glib/gmem.h \
src/lib/glib/glib/gmessages.h \
src/lib/glib/glib/gnode.h \
src/lib/glib/glib/goption.h \
src/lib/glib/glib/gpattern.h \
src/lib/glib/glib/gpoll.h \
src/lib/glib/glib/gprimes.h \
src/lib/glib/glib/gqsort.h \
src/lib/glib/glib/gquark.h \
src/lib/glib/glib/gqueue.h \
src/lib/glib/glib/grand.h \
src/lib/glib/glib/gregex.h \
src/lib/glib/glib/gscanner.h \
src/lib/glib/glib/gsequence.h \
src/lib/glib/glib/gshell.h \
src/lib/glib/glib/gslice.h \
src/lib/glib/glib/gslist.h \
src/lib/glib/glib/gspawn.h \
src/lib/glib/glib/gstdio.h \
src/lib/glib/glib/gstrfuncs.h \
src/lib/glib/glib/gstring.h \
src/lib/glib/glib/gstringchunk.h \
src/lib/glib/glib/gtestutils.h \
src/lib/glib/glib/gthread.h \
src/lib/glib/glib/gthreadpool.h \
src/lib/glib/glib/gtimer.h \
src/lib/glib/glib/gtimezone.h \
src/lib/glib/glib/gtrashstack.h \
src/lib/glib/glib/gtree.h \
src/lib/glib/glib/gtypes.h \
src/lib/glib/glib/gunicode.h \
src/lib/glib/glib/gurifuncs.h \
src/lib/glib/glib/gutils.h \
src/lib/glib/glib/guuid.h \
src/lib/glib/glib/gvarianttype.h \
src/lib/glib/glib/gvariant.h \
src/lib/glib/glib/gversion.h \
src/lib/glib/glib/gversionmacros.h \
src/lib/glib/glib/gprintf.h \
DIR_CONTENT(include/glib/glib/deprecated) := \
src/lib/glib/glib/deprecated/gallocator.h \
src/lib/glib/glib/deprecated/gcache.h \
src/lib/glib/glib/deprecated/gcompletion.h \
src/lib/glib/glib/deprecated/gmain.h \
src/lib/glib/glib/deprecated/grel.h \
src/lib/glib/glib/deprecated/gthread.h

61
run/glib.run Normal file
View File

@@ -0,0 +1,61 @@
build test/glib
create_boot_directory
import_from_depot \
genodelabs/src/[base_src] \
genodelabs/src/init \
install_config {
<config>
<parent-provides>
<service name="ROM"/>
<service name="IRQ"/>
<service name="IO_MEM"/>
<service name="IO_PORT"/>
<service name="PD"/>
<service name="RM"/>
<service name="CPU"/>
<service name="LOG"/>
</parent-provides>
<default-route>
<any-service> <parent/> <any-child/> </any-service>
</default-route>
<default caps="200"/>
<start name="timer">
<resource name="RAM" quantum="1M"/>
<provides> <service name="Timer"/> </provides>
</start>
<start name="test-glib">
<resource name="RAM" quantum="400M"/>
<config>
<vfs>
<!-- create an in-memory FS with what GLib expects -->
<ram/>
<dir name="home"> <ram/> </dir>
<dir name="var"> <dir name="tmp"> <ram/> </dir> </dir>
<dir name="dev"> <log/> </dir>
</vfs>
<libc stdout="/dev/log" stderr="/dev/log"/>
<env key="HOME" value="/home"/>
<arg value="testglib"/>
<arg value="--verbose"/>
</config>
</start>
</config>
}
build_boot_image {
glib.lib.so
libc.lib.so
libiconv.lib.so
libm.lib.so
posix.lib.so
pthread.lib.so
test-glib
}
append qemu_args " -nographic "
run_genode_until "child .* exited with exit value 0.*\n" 10

176
src/lib/glib/config.h Normal file
View File

@@ -0,0 +1,176 @@
/* The normal alignment of `guint32', in bytes. */
#define ALIGNOF_GUINT32 4
/* The normal alignment of `guint64', in bytes. */
#define ALIGNOF_GUINT64 8
/* The normal alignment of `unsigned long', in bytes. */
#define ALIGNOF_UNSIGNED_LONG 4
/* Define the gettext package to be used */
#define GETTEXT_PACKAGE "whatever"
/* Define if you have a version of the snprintf function with semantics as
specified by the ISO C99 standard. */
#define HAVE_C99_SNPRINTF
/* Define if you have a version of the vsnprintf function with semantics as
specified by the ISO C99 standard. */
#define HAVE_C99_VSNPRINTF
/* Define to 1 if you have the `clock_gettime' function. */
#define HAVE_CLOCK_GETTIME 1
/* Define to 1 if you have the <dirent.h> header file, and it defines `DIR'.
*/
#define HAVE_DIRENT_H 1
/* Define to 1 if you have the `fsync' function. */
#define HAVE_FSYNC 1
/* define to use system printf */
#define HAVE_GOOD_PRINTF
/* Define if you have the 'intmax_t' type in <stdint.h> or <inttypes.h>. */
#define HAVE_INTMAX_T 1
/* Define to 1 if you have the <inttypes.h> header file. */
#define HAVE_INTTYPES_H 1
/* Define if <inttypes.h> exists, doesn't clash with <sys/types.h>, and
declares uintmax_t. */
#define HAVE_INTTYPES_H_WITH_UINTMAX 1
/* Have function pthread_condattr_setclock */
#define HAVE_PTHREAD_CONDATTR_SETCLOCK 1
/* Define to 1 if you have the `readlink' function. */
#define HAVE_READLINK 1
/* Define to 1 if you have the `recvmmsg' function. */
#define HAVE_RECVMMSG 1
/* Define to 1 if you have the `sendmmsg' function. */
#define HAVE_SENDMMSG 1
/* Define to 1 if you have the `setenv' function. */
#define HAVE_SETENV 1
/* Define to 1 if you have the `snprintf' function. */
#define HAVE_SNPRINTF 1
/* Define to 1 if you have the <stdint.h> header file. */
#define HAVE_STDINT_H 1
/* Define if <stdint.h> exists, doesn't clash with <sys/types.h>, and declares
uintmax_t. */
#define HAVE_STDINT_H_WITH_UINTMAX
/* Define to 1 if you have the <stdlib.h> header file. */
#define HAVE_STDLIB_H 1
/* Define to 1 if you have the `stpcpy' function. */
#define HAVE_STPCPY 1
/* Define to 1 if you have the `strcasecmp' function. */
#define HAVE_STRCASECMP 1
/* Define to 1 if you have the <strings.h> header file. */
#define HAVE_STRINGS_H 1
/* Define to 1 if you have the <string.h> header file. */
#define HAVE_STRING_H 1
/* Have functions strlcpy and strlcat */
#define HAVE_STRLCPY 1
/* Define to 1 if you have the `strncasecmp' function. */
#define HAVE_STRNCASECMP 1
/* Define to 1 if you have the `strnlen' function. */
#define HAVE_STRNLEN 1
/* Define to 1 if you have the `symlink' function. */
#define HAVE_SYMLINK 1
/* Define to 1 if you have the <sys/dir.h> header file, and it defines `DIR'.
*/
#define HAVE_SYS_DIR_H 1
/* Define to 1 if you have the <sys/event.h> header file. */
#define HAVE_SYS_EVENT_H 1
/* Define to 1 if you have the <sys/filio.h> header file. */
#define HAVE_SYS_FILIO_H 1
/* Define to 1 if you have the <sys/mount.h> header file. */
#define HAVE_SYS_MOUNT_H 1
/* Define to 1 if you have the <sys/param.h> header file. */
#define HAVE_SYS_PARAM_H 1
/* Define to 1 if you have the <sys/resource.h> header file. */
#define HAVE_SYS_RESOURCE_H 1
/* found fd_set in sys/select.h */
#define HAVE_SYS_SELECT_H 1
/* Define to 1 if you have the <sys/statvfs.h> header file. */
#define HAVE_SYS_STATVFS_H 1
/* Define to 1 if you have the <sys/stat.h> header file. */
#define HAVE_SYS_STAT_H 1
/* Define to 1 if you have the <sys/sysctl.h> header file. */
#define HAVE_SYS_SYSCTL_H 1
/* Define to 1 if you have the <sys/time.h> header file. */
#define HAVE_SYS_TIME_H 1
/* Define to 1 if you have the <sys/types.h> header file. */
#define HAVE_SYS_TYPES_H 1
/* Define to 1 if you have the <termios.h> header file. */
#define HAVE_TERMIOS_H 1
/* Define to 1 if you have the <unistd.h> header file. */
#define HAVE_UNISTD_H 1
/* The size of `char', as computed by sizeof. */
#define SIZEOF_CHAR sizeof(char)
/* The size of `int', as computed by sizeof. */
#define SIZEOF_INT sizeof(int)
/* The size of `long', as computed by sizeof. */
#define SIZEOF_LONG sizeof(long)
/* The size of `long long', as computed by sizeof. */
#define SIZEOF_LONG_LONG sizeof()
/* The size of `short', as computed by sizeof. */
#define SIZEOF_SHORT sizeof(short)
/* The size of `size_t', as computed by sizeof. */
#define SIZEOF_SIZE_T sizeof(size_t)
/* The size of `ssize_t', as computed by sizeof. */
#define SIZEOF_SSIZE_T sizeof(ssize_t)
/* The size of `void *', as computed by sizeof. */
#define SIZEOF_VOID_P sizeof(void *)
/* The size of `__int64', as computed by sizeof. */
#define SIZEOF___INT64 sizeof(__int64)
/* Define to 1 if you have the ANSI C header files. */
#define STDC_HEADERS 1
/* Use no threads */
#define THREADS_NONE
/* Use pthreads */
#define THREADS_POSIX
/* Using GNU libiconv */
#define USE_LIBICONV_GNU

View File

@@ -0,0 +1,6 @@
#ifndef _CONFIGMAKE_H_
#define _CONFIGMAKE_H_
#define LIBDIR "/lib"
#endif

0
src/lib/glib/libintl.h Normal file
View File

7
src/test/glib/target.mk Normal file
View File

@@ -0,0 +1,7 @@
TARGET = test-glib
LIBS = libc pthread glib posix
SRC_C = main.c
# Strength through pointer arithmetic
main.c: $(call select_from_ports,glib)/src/lib/glib/tests/testglib.c
$(VERBOSE)sed 's/gintptr/int/' $< > $@