View Issue Details

IDProjectCategoryView StatusLast Update
0025535FPCPackagespublic2014-02-12 21:19
ReporterDennis Fehr Assigned ToYuriy Sydorov  
PrioritynormalSeverityminorReproducibilityN/A
Status assignedResolutionopen 
Product Version2.7.1 
Summary0025535: Patch for EGL/OpenGLES
DescriptionThis Patch splits EGL/OpenGLES, and should work for Android/Linux/Windows. It doesn't make sense that EGL should stay in OpenGLES, they are separate libraries and can be used separately. Hopefully someone includes! (I use it like this on my system, and works great in my Game Engine)
TagsNo tags attached.
Fixed in Revision
FPCOldBugId
FPCTarget
Attached Files

Relationships

related to 0025024 new Hanging at loading at android versions older than 3.0 

Activities

Dennis Fehr

2014-01-14 21:15

reporter  

egl_opengles_split.diff (252,666 bytes)   
Index: packages/egl/Makefile
===================================================================
--- packages/egl/Makefile	(revision 0)
+++ packages/egl/Makefile	(working copy)
@@ -0,0 +1,2812 @@
+#
+# Don't edit, this file is generated by FPCMake Version 2.0.0 [2013-11-16 rev 26097]
+#
+default: all
+MAKEFILETARGETS=i386-linux i386-go32v2 i386-win32 i386-os2 i386-freebsd i386-beos i386-haiku i386-netbsd i386-solaris i386-qnx i386-netware i386-openbsd i386-wdosx i386-darwin i386-emx i386-watcom i386-netwlibc i386-wince i386-embedded i386-symbian i386-nativent i386-iphonesim i386-android m68k-linux m68k-freebsd m68k-netbsd m68k-amiga m68k-atari m68k-openbsd m68k-palmos m68k-embedded powerpc-linux powerpc-netbsd powerpc-amiga powerpc-macos powerpc-darwin powerpc-morphos powerpc-embedded powerpc-wii powerpc-aix sparc-linux sparc-netbsd sparc-solaris sparc-embedded x86_64-linux x86_64-freebsd x86_64-netbsd x86_64-solaris x86_64-openbsd x86_64-darwin x86_64-win64 x86_64-embedded arm-linux arm-palmos arm-darwin arm-wince arm-gba arm-nds arm-embedded arm-symbian arm-android powerpc64-linux powerpc64-darwin powerpc64-embedded powerpc64-aix avr-embedded armeb-linux armeb-embedded mips-linux mipsel-linux jvm-java jvm-android i8086-msdos
+BSDs = freebsd netbsd openbsd darwin
+UNIXs = linux $(BSDs) solaris qnx haiku aix
+LIMIT83fs = go32v2 os2 emx watcom
+OSNeedsComspecToRunBatch = go32v2 watcom
+FORCE:
+.PHONY: FORCE
+override PATH:=$(patsubst %/,%,$(subst \,/,$(PATH)))
+ifneq ($(findstring darwin,$(OSTYPE)),)
+inUnix=1 #darwin
+SEARCHPATH:=$(filter-out .,$(subst :, ,$(PATH)))
+else
+ifeq ($(findstring ;,$(PATH)),)
+inUnix=1
+SEARCHPATH:=$(filter-out .,$(subst :, ,$(PATH)))
+else
+SEARCHPATH:=$(subst ;, ,$(PATH))
+endif
+endif
+SEARCHPATH+=$(patsubst %/,%,$(subst \,/,$(dir $(MAKE))))
+PWD:=$(strip $(wildcard $(addsuffix /pwd.exe,$(SEARCHPATH))))
+ifeq ($(PWD),)
+PWD:=$(strip $(wildcard $(addsuffix /pwd,$(SEARCHPATH))))
+ifeq ($(PWD),)
+$(error You need the GNU utils package to use this Makefile)
+else
+PWD:=$(firstword $(PWD))
+SRCEXEEXT=
+endif
+else
+PWD:=$(firstword $(PWD))
+SRCEXEEXT=.exe
+endif
+ifndef inUnix
+ifeq ($(OS),Windows_NT)
+inWinNT=1
+else
+ifdef OS2_SHELL
+inOS2=1
+endif
+endif
+else
+ifneq ($(findstring cygdrive,$(PATH)),)
+inCygWin=1
+endif
+endif
+ifdef inUnix
+SRCBATCHEXT=.sh
+else
+ifdef inOS2
+SRCBATCHEXT=.cmd
+else
+SRCBATCHEXT=.bat
+endif
+endif
+ifdef COMSPEC
+ifneq ($(findstring $(OS_SOURCE),$(OSNeedsComspecToRunBatch)),)
+ifndef RUNBATCH
+RUNBATCH=$(COMSPEC) /C
+endif
+endif
+endif
+ifdef inUnix
+PATHSEP=/
+else
+PATHSEP:=$(subst /,\,/)
+ifdef inCygWin
+PATHSEP=/
+endif
+endif
+ifdef PWD
+BASEDIR:=$(subst \,/,$(shell $(PWD)))
+ifdef inCygWin
+ifneq ($(findstring /cygdrive/,$(BASEDIR)),)
+BASENODIR:=$(patsubst /cygdrive%,%,$(BASEDIR))
+BASEDRIVE:=$(firstword $(subst /, ,$(BASENODIR)))
+BASEDIR:=$(subst /cygdrive/$(BASEDRIVE)/,$(BASEDRIVE):/,$(BASEDIR))
+endif
+endif
+else
+BASEDIR=.
+endif
+ifdef inOS2
+ifndef ECHO
+ECHO:=$(strip $(wildcard $(addsuffix /gecho$(SRCEXEEXT),$(SEARCHPATH))))
+ifeq ($(ECHO),)
+ECHO:=$(strip $(wildcard $(addsuffix /echo$(SRCEXEEXT),$(SEARCHPATH))))
+ifeq ($(ECHO),)
+ECHO=echo
+else
+ECHO:=$(firstword $(ECHO))
+endif
+else
+ECHO:=$(firstword $(ECHO))
+endif
+endif
+export ECHO
+endif
+override DEFAULT_FPCDIR=../..
+ifndef FPC
+ifdef PP
+FPC=$(PP)
+endif
+endif
+ifndef FPC
+FPCPROG:=$(strip $(wildcard $(addsuffix /fpc$(SRCEXEEXT),$(SEARCHPATH))))
+ifneq ($(FPCPROG),)
+FPCPROG:=$(firstword $(FPCPROG))
+ifneq ($(CPU_TARGET),)
+FPC:=$(shell $(FPCPROG) -P$(CPU_TARGET) -PB)
+else
+FPC:=$(shell $(FPCPROG) -PB)
+endif
+ifneq ($(findstring Error,$(FPC)),)
+override FPC=$(firstword $(strip $(wildcard $(addsuffix /ppc386$(SRCEXEEXT),$(SEARCHPATH)))))
+else
+ifeq ($(strip $(wildcard $(FPC))),)
+FPC:=$(firstword $(FPCPROG))
+endif
+endif
+else
+override FPC=$(firstword $(strip $(wildcard $(addsuffix /ppc386$(SRCEXEEXT),$(SEARCHPATH)))))
+endif
+endif
+override FPC:=$(subst $(SRCEXEEXT),,$(FPC))
+override FPC:=$(subst \,/,$(FPC))$(SRCEXEEXT)
+FOUNDFPC:=$(strip $(wildcard $(FPC)))
+ifeq ($(FOUNDFPC),)
+FOUNDFPC=$(strip $(wildcard $(addsuffix /$(FPC),$(SEARCHPATH))))
+ifeq ($(FOUNDFPC),)
+$(error Compiler $(FPC) not found)
+endif
+endif
+ifndef FPC_COMPILERINFO
+FPC_COMPILERINFO:=$(shell $(FPC) -iVSPTPSOTO)
+endif
+ifndef FPC_VERSION
+FPC_VERSION:=$(word 1,$(FPC_COMPILERINFO))
+endif
+export FPC FPC_VERSION FPC_COMPILERINFO
+unexport CHECKDEPEND ALLDEPENDENCIES
+ifndef CPU_TARGET
+ifdef CPU_TARGET_DEFAULT
+CPU_TARGET=$(CPU_TARGET_DEFAULT)
+endif
+endif
+ifndef OS_TARGET
+ifdef OS_TARGET_DEFAULT
+OS_TARGET=$(OS_TARGET_DEFAULT)
+endif
+endif
+ifndef CPU_SOURCE
+CPU_SOURCE:=$(word 2,$(FPC_COMPILERINFO))
+endif
+ifndef CPU_TARGET
+CPU_TARGET:=$(word 3,$(FPC_COMPILERINFO))
+endif
+ifndef OS_SOURCE
+OS_SOURCE:=$(word 4,$(FPC_COMPILERINFO))
+endif
+ifndef OS_TARGET
+OS_TARGET:=$(word 5,$(FPC_COMPILERINFO))
+endif
+FULL_TARGET=$(CPU_TARGET)-$(OS_TARGET)
+FULL_SOURCE=$(CPU_SOURCE)-$(OS_SOURCE)
+ifeq ($(CPU_TARGET),armeb)
+ARCH=arm
+override FPCOPT+=-Cb
+else
+ifeq ($(CPU_TARGET),armel)
+ARCH=arm
+override FPCOPT+=-CaEABI
+else
+ARCH=$(CPU_TARGET)
+endif
+endif
+ifeq ($(FULL_TARGET),arm-embedded)
+ifeq ($(SUBARCH),)
+$(error When compiling for arm-embedded, a sub-architecture (e.g. SUBARCH=armv4t or SUBARCH=armv7m) must be defined)
+endif
+override FPCOPT+=-Cp$(SUBARCH)
+endif
+ifneq ($(findstring $(OS_SOURCE),$(LIMIT83fs)),)
+TARGETSUFFIX=$(OS_TARGET)
+SOURCESUFFIX=$(OS_SOURCE)
+else
+ifneq ($(findstring $(OS_TARGET),$(LIMIT83fs)),)
+TARGETSUFFIX=$(OS_TARGET)
+else
+TARGETSUFFIX=$(FULL_TARGET)
+endif
+SOURCESUFFIX=$(FULL_SOURCE)
+endif
+ifneq ($(FULL_TARGET),$(FULL_SOURCE))
+CROSSCOMPILE=1
+endif
+ifeq ($(findstring makefile,$(MAKECMDGOALS)),)
+ifeq ($(findstring $(FULL_TARGET),$(MAKEFILETARGETS)),)
+$(error The Makefile doesn't support target $(FULL_TARGET), please run fpcmake first)
+endif
+endif
+ifneq ($(findstring $(OS_TARGET),$(BSDs)),)
+BSDhier=1
+endif
+ifeq ($(OS_TARGET),linux)
+linuxHier=1
+endif
+ifndef CROSSCOMPILE
+BUILDFULLNATIVE=1
+export BUILDFULLNATIVE
+endif
+ifdef BUILDFULLNATIVE
+BUILDNATIVE=1
+export BUILDNATIVE
+endif
+export OS_TARGET OS_SOURCE ARCH CPU_TARGET CPU_SOURCE FULL_TARGET FULL_SOURCE TARGETSUFFIX SOURCESUFFIX CROSSCOMPILE
+ifdef FPCDIR
+override FPCDIR:=$(subst \,/,$(FPCDIR))
+ifeq ($(wildcard $(addprefix $(FPCDIR)/,rtl units)),)
+override FPCDIR=wrong
+endif
+else
+override FPCDIR=wrong
+endif
+ifdef DEFAULT_FPCDIR
+ifeq ($(FPCDIR),wrong)
+override FPCDIR:=$(subst \,/,$(DEFAULT_FPCDIR))
+ifeq ($(wildcard $(addprefix $(FPCDIR)/,rtl units)),)
+override FPCDIR=wrong
+endif
+endif
+endif
+ifeq ($(FPCDIR),wrong)
+ifdef inUnix
+override FPCDIR=/usr/local/lib/fpc/$(FPC_VERSION)
+ifeq ($(wildcard $(FPCDIR)/units),)
+override FPCDIR=/usr/lib/fpc/$(FPC_VERSION)
+endif
+else
+override FPCDIR:=$(subst /$(FPC),,$(firstword $(strip $(wildcard $(addsuffix /$(FPC),$(SEARCHPATH))))))
+override FPCDIR:=$(FPCDIR)/..
+ifeq ($(wildcard $(addprefix $(FPCDIR)/,rtl units)),)
+override FPCDIR:=$(FPCDIR)/..
+ifeq ($(wildcard $(addprefix $(FPCDIR)/,rtl units)),)
+override FPCDIR:=$(BASEDIR)
+ifeq ($(wildcard $(addprefix $(FPCDIR)/,rtl units)),)
+override FPCDIR=c:/pp
+endif
+endif
+endif
+endif
+endif
+ifndef CROSSBINDIR
+CROSSBINDIR:=$(wildcard $(FPCDIR)/bin/$(TARGETSUFFIX))
+endif
+ifneq ($(findstring $(OS_TARGET),darwin iphonesim),)
+ifeq ($(OS_SOURCE),darwin)
+DARWIN2DARWIN=1
+endif
+endif
+ifndef BINUTILSPREFIX
+ifndef CROSSBINDIR
+ifdef CROSSCOMPILE
+ifndef DARWIN2DARWIN
+ifneq ($(CPU_TARGET),jvm)
+BINUTILSPREFIX=$(CPU_TARGET)-$(OS_TARGET)-
+ifeq ($(OS_TARGET),android)
+ifeq ($(CPU_TARGET),arm)
+BINUTILSPREFIX=arm-linux-androideabi-
+else
+ifeq ($(CPU_TARGET),i386)
+BINUTILSPREFIX=i686-linux-android-
+else
+ifeq ($(CPU_TARGET),mips)
+BINUTILSPREFIX=mipsel-linux-android-
+endif
+endif
+endif
+endif
+endif
+endif
+endif
+endif
+endif
+UNITSDIR:=$(wildcard $(FPCDIR)/units/$(TARGETSUFFIX))
+ifeq ($(UNITSDIR),)
+UNITSDIR:=$(wildcard $(FPCDIR)/units/$(OS_TARGET))
+endif
+PACKAGESDIR:=$(wildcard $(FPCDIR) $(FPCDIR)/packages $(FPCDIR)/packages/base $(FPCDIR)/packages/extra)
+ifndef FPCFPMAKE
+ifdef CROSSCOMPILE
+ifeq ($(strip $(wildcard $(addsuffix /compiler/ppc$(SRCEXEEXT),$(FPCDIR)))),)
+FPCPROG:=$(strip $(wildcard $(addsuffix /fpc$(SRCEXEEXT),$(SEARCHPATH))))
+ifneq ($(FPCPROG),)
+FPCPROG:=$(firstword $(FPCPROG))
+FPCFPMAKE:=$(shell $(FPCPROG) -PB)
+ifeq ($(strip $(wildcard $(FPCFPMAKE))),)
+FPCFPMAKE:=$(firstword $(FPCPROG))
+endif
+else
+override FPCFPMAKE=$(firstword $(strip $(wildcard $(addsuffix /ppc386$(SRCEXEEXT),$(SEARCHPATH)))))
+endif
+else
+FPCFPMAKE=$(strip $(wildcard $(addsuffix /compiler/ppc$(SRCEXEEXT),$(FPCDIR))))
+FPMAKE_SKIP_CONFIG=-n
+export FPCFPMAKE
+export FPMAKE_SKIP_CONFIG
+endif
+else
+FPMAKE_SKIP_CONFIG=-n
+FPCFPMAKE=$(FPC)
+endif
+endif
+override PACKAGE_NAME=egl
+override PACKAGE_VERSION=2.7.1
+ifeq ($(FULL_TARGET),i386-linux)
+override TARGET_UNITS+=egl
+endif
+ifeq ($(FULL_TARGET),i386-win32)
+override TARGET_UNITS+=egl
+endif
+ifeq ($(FULL_TARGET),i386-darwin)
+override TARGET_UNITS+=egl
+endif
+ifeq ($(FULL_TARGET),i386-wince)
+override TARGET_UNITS+=egl
+endif
+ifeq ($(FULL_TARGET),i386-android)
+override TARGET_UNITS+=egl
+endif
+ifeq ($(FULL_TARGET),m68k-linux)
+override TARGET_UNITS+=egl
+endif
+ifeq ($(FULL_TARGET),powerpc-linux)
+override TARGET_UNITS+=egl
+endif
+ifeq ($(FULL_TARGET),powerpc-darwin)
+override TARGET_UNITS+=egl
+endif
+ifeq ($(FULL_TARGET),sparc-linux)
+override TARGET_UNITS+=egl
+endif
+ifeq ($(FULL_TARGET),x86_64-linux)
+override TARGET_UNITS+=egl
+endif
+ifeq ($(FULL_TARGET),x86_64-darwin)
+override TARGET_UNITS+=egl
+endif
+ifeq ($(FULL_TARGET),x86_64-win64)
+override TARGET_UNITS+=egl
+endif
+ifeq ($(FULL_TARGET),arm-linux)
+override TARGET_UNITS+=egl
+endif
+ifeq ($(FULL_TARGET),arm-darwin)
+override TARGET_UNITS+=egl
+endif
+ifeq ($(FULL_TARGET),arm-wince)
+override TARGET_UNITS+=egl
+endif
+ifeq ($(FULL_TARGET),arm-android)
+override TARGET_UNITS+=egl
+endif
+ifeq ($(FULL_TARGET),powerpc64-linux)
+override TARGET_UNITS+=egl
+endif
+ifeq ($(FULL_TARGET),powerpc64-darwin)
+override TARGET_UNITS+=egl
+endif
+ifeq ($(FULL_TARGET),armeb-linux)
+override TARGET_UNITS+=egl
+endif
+ifeq ($(FULL_TARGET),mips-linux)
+override TARGET_UNITS+=egl
+endif
+ifeq ($(FULL_TARGET),mipsel-linux)
+override TARGET_UNITS+=egl
+endif
+ifeq ($(FULL_TARGET),jvm-android)
+override TARGET_UNITS+=egl
+endif
+ifeq ($(FULL_TARGET),i386-linux)
+override TARGET_EXAMPLEDIRS+=examples
+endif
+ifeq ($(FULL_TARGET),i386-go32v2)
+override TARGET_EXAMPLEDIRS+=examples
+endif
+ifeq ($(FULL_TARGET),i386-win32)
+override TARGET_EXAMPLEDIRS+=examples
+endif
+ifeq ($(FULL_TARGET),i386-os2)
+override TARGET_EXAMPLEDIRS+=examples
+endif
+ifeq ($(FULL_TARGET),i386-freebsd)
+override TARGET_EXAMPLEDIRS+=examples
+endif
+ifeq ($(FULL_TARGET),i386-beos)
+override TARGET_EXAMPLEDIRS+=examples
+endif
+ifeq ($(FULL_TARGET),i386-haiku)
+override TARGET_EXAMPLEDIRS+=examples
+endif
+ifeq ($(FULL_TARGET),i386-netbsd)
+override TARGET_EXAMPLEDIRS+=examples
+endif
+ifeq ($(FULL_TARGET),i386-solaris)
+override TARGET_EXAMPLEDIRS+=examples
+endif
+ifeq ($(FULL_TARGET),i386-qnx)
+override TARGET_EXAMPLEDIRS+=examples
+endif
+ifeq ($(FULL_TARGET),i386-netware)
+override TARGET_EXAMPLEDIRS+=examples
+endif
+ifeq ($(FULL_TARGET),i386-openbsd)
+override TARGET_EXAMPLEDIRS+=examples
+endif
+ifeq ($(FULL_TARGET),i386-wdosx)
+override TARGET_EXAMPLEDIRS+=examples
+endif
+ifeq ($(FULL_TARGET),i386-darwin)
+override TARGET_EXAMPLEDIRS+=examples
+endif
+ifeq ($(FULL_TARGET),i386-emx)
+override TARGET_EXAMPLEDIRS+=examples
+endif
+ifeq ($(FULL_TARGET),i386-watcom)
+override TARGET_EXAMPLEDIRS+=examples
+endif
+ifeq ($(FULL_TARGET),i386-netwlibc)
+override TARGET_EXAMPLEDIRS+=examples
+endif
+ifeq ($(FULL_TARGET),i386-wince)
+override TARGET_EXAMPLEDIRS+=examples
+endif
+ifeq ($(FULL_TARGET),i386-embedded)
+override TARGET_EXAMPLEDIRS+=examples
+endif
+ifeq ($(FULL_TARGET),i386-symbian)
+override TARGET_EXAMPLEDIRS+=examples
+endif
+ifeq ($(FULL_TARGET),i386-nativent)
+override TARGET_EXAMPLEDIRS+=examples
+endif
+ifeq ($(FULL_TARGET),i386-iphonesim)
+override TARGET_EXAMPLEDIRS+=examples
+endif
+ifeq ($(FULL_TARGET),i386-android)
+override TARGET_EXAMPLEDIRS+=examples
+endif
+ifeq ($(FULL_TARGET),m68k-linux)
+override TARGET_EXAMPLEDIRS+=examples
+endif
+ifeq ($(FULL_TARGET),m68k-freebsd)
+override TARGET_EXAMPLEDIRS+=examples
+endif
+ifeq ($(FULL_TARGET),m68k-netbsd)
+override TARGET_EXAMPLEDIRS+=examples
+endif
+ifeq ($(FULL_TARGET),m68k-amiga)
+override TARGET_EXAMPLEDIRS+=examples
+endif
+ifeq ($(FULL_TARGET),m68k-atari)
+override TARGET_EXAMPLEDIRS+=examples
+endif
+ifeq ($(FULL_TARGET),m68k-openbsd)
+override TARGET_EXAMPLEDIRS+=examples
+endif
+ifeq ($(FULL_TARGET),m68k-palmos)
+override TARGET_EXAMPLEDIRS+=examples
+endif
+ifeq ($(FULL_TARGET),m68k-embedded)
+override TARGET_EXAMPLEDIRS+=examples
+endif
+ifeq ($(FULL_TARGET),powerpc-linux)
+override TARGET_EXAMPLEDIRS+=examples
+endif
+ifeq ($(FULL_TARGET),powerpc-netbsd)
+override TARGET_EXAMPLEDIRS+=examples
+endif
+ifeq ($(FULL_TARGET),powerpc-amiga)
+override TARGET_EXAMPLEDIRS+=examples
+endif
+ifeq ($(FULL_TARGET),powerpc-macos)
+override TARGET_EXAMPLEDIRS+=examples
+endif
+ifeq ($(FULL_TARGET),powerpc-darwin)
+override TARGET_EXAMPLEDIRS+=examples
+endif
+ifeq ($(FULL_TARGET),powerpc-morphos)
+override TARGET_EXAMPLEDIRS+=examples
+endif
+ifeq ($(FULL_TARGET),powerpc-embedded)
+override TARGET_EXAMPLEDIRS+=examples
+endif
+ifeq ($(FULL_TARGET),powerpc-wii)
+override TARGET_EXAMPLEDIRS+=examples
+endif
+ifeq ($(FULL_TARGET),powerpc-aix)
+override TARGET_EXAMPLEDIRS+=examples
+endif
+ifeq ($(FULL_TARGET),sparc-linux)
+override TARGET_EXAMPLEDIRS+=examples
+endif
+ifeq ($(FULL_TARGET),sparc-netbsd)
+override TARGET_EXAMPLEDIRS+=examples
+endif
+ifeq ($(FULL_TARGET),sparc-solaris)
+override TARGET_EXAMPLEDIRS+=examples
+endif
+ifeq ($(FULL_TARGET),sparc-embedded)
+override TARGET_EXAMPLEDIRS+=examples
+endif
+ifeq ($(FULL_TARGET),x86_64-linux)
+override TARGET_EXAMPLEDIRS+=examples
+endif
+ifeq ($(FULL_TARGET),x86_64-freebsd)
+override TARGET_EXAMPLEDIRS+=examples
+endif
+ifeq ($(FULL_TARGET),x86_64-netbsd)
+override TARGET_EXAMPLEDIRS+=examples
+endif
+ifeq ($(FULL_TARGET),x86_64-solaris)
+override TARGET_EXAMPLEDIRS+=examples
+endif
+ifeq ($(FULL_TARGET),x86_64-openbsd)
+override TARGET_EXAMPLEDIRS+=examples
+endif
+ifeq ($(FULL_TARGET),x86_64-darwin)
+override TARGET_EXAMPLEDIRS+=examples
+endif
+ifeq ($(FULL_TARGET),x86_64-win64)
+override TARGET_EXAMPLEDIRS+=examples
+endif
+ifeq ($(FULL_TARGET),x86_64-embedded)
+override TARGET_EXAMPLEDIRS+=examples
+endif
+ifeq ($(FULL_TARGET),arm-linux)
+override TARGET_EXAMPLEDIRS+=examples
+endif
+ifeq ($(FULL_TARGET),arm-palmos)
+override TARGET_EXAMPLEDIRS+=examples
+endif
+ifeq ($(FULL_TARGET),arm-darwin)
+override TARGET_EXAMPLEDIRS+=examples
+endif
+ifeq ($(FULL_TARGET),arm-wince)
+override TARGET_EXAMPLEDIRS+=examples
+endif
+ifeq ($(FULL_TARGET),arm-gba)
+override TARGET_EXAMPLEDIRS+=examples
+endif
+ifeq ($(FULL_TARGET),arm-nds)
+override TARGET_EXAMPLEDIRS+=examples
+endif
+ifeq ($(FULL_TARGET),arm-embedded)
+override TARGET_EXAMPLEDIRS+=examples
+endif
+ifeq ($(FULL_TARGET),arm-symbian)
+override TARGET_EXAMPLEDIRS+=examples
+endif
+ifeq ($(FULL_TARGET),arm-android)
+override TARGET_EXAMPLEDIRS+=examples
+endif
+ifeq ($(FULL_TARGET),powerpc64-linux)
+override TARGET_EXAMPLEDIRS+=examples
+endif
+ifeq ($(FULL_TARGET),powerpc64-darwin)
+override TARGET_EXAMPLEDIRS+=examples
+endif
+ifeq ($(FULL_TARGET),powerpc64-embedded)
+override TARGET_EXAMPLEDIRS+=examples
+endif
+ifeq ($(FULL_TARGET),powerpc64-aix)
+override TARGET_EXAMPLEDIRS+=examples
+endif
+ifeq ($(FULL_TARGET),avr-embedded)
+override TARGET_EXAMPLEDIRS+=examples
+endif
+ifeq ($(FULL_TARGET),armeb-linux)
+override TARGET_EXAMPLEDIRS+=examples
+endif
+ifeq ($(FULL_TARGET),armeb-embedded)
+override TARGET_EXAMPLEDIRS+=examples
+endif
+ifeq ($(FULL_TARGET),mips-linux)
+override TARGET_EXAMPLEDIRS+=examples
+endif
+ifeq ($(FULL_TARGET),mipsel-linux)
+override TARGET_EXAMPLEDIRS+=examples
+endif
+ifeq ($(FULL_TARGET),jvm-java)
+override TARGET_EXAMPLEDIRS+=examples
+endif
+ifeq ($(FULL_TARGET),jvm-android)
+override TARGET_EXAMPLEDIRS+=examples
+endif
+ifeq ($(FULL_TARGET),i8086-msdos)
+override TARGET_EXAMPLEDIRS+=examples
+endif
+override INSTALL_FPCPACKAGE=y
+ifeq ($(FULL_TARGET),i386-linux)
+override COMPILER_INCLUDEDIR+=src
+endif
+ifeq ($(FULL_TARGET),i386-go32v2)
+override COMPILER_INCLUDEDIR+=src
+endif
+ifeq ($(FULL_TARGET),i386-win32)
+override COMPILER_INCLUDEDIR+=src
+endif
+ifeq ($(FULL_TARGET),i386-os2)
+override COMPILER_INCLUDEDIR+=src
+endif
+ifeq ($(FULL_TARGET),i386-freebsd)
+override COMPILER_INCLUDEDIR+=src
+endif
+ifeq ($(FULL_TARGET),i386-beos)
+override COMPILER_INCLUDEDIR+=src
+endif
+ifeq ($(FULL_TARGET),i386-haiku)
+override COMPILER_INCLUDEDIR+=src
+endif
+ifeq ($(FULL_TARGET),i386-netbsd)
+override COMPILER_INCLUDEDIR+=src
+endif
+ifeq ($(FULL_TARGET),i386-solaris)
+override COMPILER_INCLUDEDIR+=src
+endif
+ifeq ($(FULL_TARGET),i386-qnx)
+override COMPILER_INCLUDEDIR+=src
+endif
+ifeq ($(FULL_TARGET),i386-netware)
+override COMPILER_INCLUDEDIR+=src
+endif
+ifeq ($(FULL_TARGET),i386-openbsd)
+override COMPILER_INCLUDEDIR+=src
+endif
+ifeq ($(FULL_TARGET),i386-wdosx)
+override COMPILER_INCLUDEDIR+=src
+endif
+ifeq ($(FULL_TARGET),i386-darwin)
+override COMPILER_INCLUDEDIR+=src
+endif
+ifeq ($(FULL_TARGET),i386-emx)
+override COMPILER_INCLUDEDIR+=src
+endif
+ifeq ($(FULL_TARGET),i386-watcom)
+override COMPILER_INCLUDEDIR+=src
+endif
+ifeq ($(FULL_TARGET),i386-netwlibc)
+override COMPILER_INCLUDEDIR+=src
+endif
+ifeq ($(FULL_TARGET),i386-wince)
+override COMPILER_INCLUDEDIR+=src
+endif
+ifeq ($(FULL_TARGET),i386-embedded)
+override COMPILER_INCLUDEDIR+=src
+endif
+ifeq ($(FULL_TARGET),i386-symbian)
+override COMPILER_INCLUDEDIR+=src
+endif
+ifeq ($(FULL_TARGET),i386-nativent)
+override COMPILER_INCLUDEDIR+=src
+endif
+ifeq ($(FULL_TARGET),i386-iphonesim)
+override COMPILER_INCLUDEDIR+=src
+endif
+ifeq ($(FULL_TARGET),i386-android)
+override COMPILER_INCLUDEDIR+=src
+endif
+ifeq ($(FULL_TARGET),m68k-linux)
+override COMPILER_INCLUDEDIR+=src
+endif
+ifeq ($(FULL_TARGET),m68k-freebsd)
+override COMPILER_INCLUDEDIR+=src
+endif
+ifeq ($(FULL_TARGET),m68k-netbsd)
+override COMPILER_INCLUDEDIR+=src
+endif
+ifeq ($(FULL_TARGET),m68k-amiga)
+override COMPILER_INCLUDEDIR+=src
+endif
+ifeq ($(FULL_TARGET),m68k-atari)
+override COMPILER_INCLUDEDIR+=src
+endif
+ifeq ($(FULL_TARGET),m68k-openbsd)
+override COMPILER_INCLUDEDIR+=src
+endif
+ifeq ($(FULL_TARGET),m68k-palmos)
+override COMPILER_INCLUDEDIR+=src
+endif
+ifeq ($(FULL_TARGET),m68k-embedded)
+override COMPILER_INCLUDEDIR+=src
+endif
+ifeq ($(FULL_TARGET),powerpc-linux)
+override COMPILER_INCLUDEDIR+=src
+endif
+ifeq ($(FULL_TARGET),powerpc-netbsd)
+override COMPILER_INCLUDEDIR+=src
+endif
+ifeq ($(FULL_TARGET),powerpc-amiga)
+override COMPILER_INCLUDEDIR+=src
+endif
+ifeq ($(FULL_TARGET),powerpc-macos)
+override COMPILER_INCLUDEDIR+=src
+endif
+ifeq ($(FULL_TARGET),powerpc-darwin)
+override COMPILER_INCLUDEDIR+=src
+endif
+ifeq ($(FULL_TARGET),powerpc-morphos)
+override COMPILER_INCLUDEDIR+=src
+endif
+ifeq ($(FULL_TARGET),powerpc-embedded)
+override COMPILER_INCLUDEDIR+=src
+endif
+ifeq ($(FULL_TARGET),powerpc-wii)
+override COMPILER_INCLUDEDIR+=src
+endif
+ifeq ($(FULL_TARGET),powerpc-aix)
+override COMPILER_INCLUDEDIR+=src
+endif
+ifeq ($(FULL_TARGET),sparc-linux)
+override COMPILER_INCLUDEDIR+=src
+endif
+ifeq ($(FULL_TARGET),sparc-netbsd)
+override COMPILER_INCLUDEDIR+=src
+endif
+ifeq ($(FULL_TARGET),sparc-solaris)
+override COMPILER_INCLUDEDIR+=src
+endif
+ifeq ($(FULL_TARGET),sparc-embedded)
+override COMPILER_INCLUDEDIR+=src
+endif
+ifeq ($(FULL_TARGET),x86_64-linux)
+override COMPILER_INCLUDEDIR+=src
+endif
+ifeq ($(FULL_TARGET),x86_64-freebsd)
+override COMPILER_INCLUDEDIR+=src
+endif
+ifeq ($(FULL_TARGET),x86_64-netbsd)
+override COMPILER_INCLUDEDIR+=src
+endif
+ifeq ($(FULL_TARGET),x86_64-solaris)
+override COMPILER_INCLUDEDIR+=src
+endif
+ifeq ($(FULL_TARGET),x86_64-openbsd)
+override COMPILER_INCLUDEDIR+=src
+endif
+ifeq ($(FULL_TARGET),x86_64-darwin)
+override COMPILER_INCLUDEDIR+=src
+endif
+ifeq ($(FULL_TARGET),x86_64-win64)
+override COMPILER_INCLUDEDIR+=src
+endif
+ifeq ($(FULL_TARGET),x86_64-embedded)
+override COMPILER_INCLUDEDIR+=src
+endif
+ifeq ($(FULL_TARGET),arm-linux)
+override COMPILER_INCLUDEDIR+=src
+endif
+ifeq ($(FULL_TARGET),arm-palmos)
+override COMPILER_INCLUDEDIR+=src
+endif
+ifeq ($(FULL_TARGET),arm-darwin)
+override COMPILER_INCLUDEDIR+=src
+endif
+ifeq ($(FULL_TARGET),arm-wince)
+override COMPILER_INCLUDEDIR+=src
+endif
+ifeq ($(FULL_TARGET),arm-gba)
+override COMPILER_INCLUDEDIR+=src
+endif
+ifeq ($(FULL_TARGET),arm-nds)
+override COMPILER_INCLUDEDIR+=src
+endif
+ifeq ($(FULL_TARGET),arm-embedded)
+override COMPILER_INCLUDEDIR+=src
+endif
+ifeq ($(FULL_TARGET),arm-symbian)
+override COMPILER_INCLUDEDIR+=src
+endif
+ifeq ($(FULL_TARGET),arm-android)
+override COMPILER_INCLUDEDIR+=src
+endif
+ifeq ($(FULL_TARGET),powerpc64-linux)
+override COMPILER_INCLUDEDIR+=src
+endif
+ifeq ($(FULL_TARGET),powerpc64-darwin)
+override COMPILER_INCLUDEDIR+=src
+endif
+ifeq ($(FULL_TARGET),powerpc64-embedded)
+override COMPILER_INCLUDEDIR+=src
+endif
+ifeq ($(FULL_TARGET),powerpc64-aix)
+override COMPILER_INCLUDEDIR+=src
+endif
+ifeq ($(FULL_TARGET),avr-embedded)
+override COMPILER_INCLUDEDIR+=src
+endif
+ifeq ($(FULL_TARGET),armeb-linux)
+override COMPILER_INCLUDEDIR+=src
+endif
+ifeq ($(FULL_TARGET),armeb-embedded)
+override COMPILER_INCLUDEDIR+=src
+endif
+ifeq ($(FULL_TARGET),mips-linux)
+override COMPILER_INCLUDEDIR+=src
+endif
+ifeq ($(FULL_TARGET),mipsel-linux)
+override COMPILER_INCLUDEDIR+=src
+endif
+ifeq ($(FULL_TARGET),jvm-java)
+override COMPILER_INCLUDEDIR+=src
+endif
+ifeq ($(FULL_TARGET),jvm-android)
+override COMPILER_INCLUDEDIR+=src
+endif
+ifeq ($(FULL_TARGET),i8086-msdos)
+override COMPILER_INCLUDEDIR+=src
+endif
+ifeq ($(FULL_TARGET),i386-linux)
+override COMPILER_SOURCEDIR+=src examples
+endif
+ifeq ($(FULL_TARGET),i386-go32v2)
+override COMPILER_SOURCEDIR+=src examples
+endif
+ifeq ($(FULL_TARGET),i386-win32)
+override COMPILER_SOURCEDIR+=src examples
+endif
+ifeq ($(FULL_TARGET),i386-os2)
+override COMPILER_SOURCEDIR+=src examples
+endif
+ifeq ($(FULL_TARGET),i386-freebsd)
+override COMPILER_SOURCEDIR+=src examples
+endif
+ifeq ($(FULL_TARGET),i386-beos)
+override COMPILER_SOURCEDIR+=src examples
+endif
+ifeq ($(FULL_TARGET),i386-haiku)
+override COMPILER_SOURCEDIR+=src examples
+endif
+ifeq ($(FULL_TARGET),i386-netbsd)
+override COMPILER_SOURCEDIR+=src examples
+endif
+ifeq ($(FULL_TARGET),i386-solaris)
+override COMPILER_SOURCEDIR+=src examples
+endif
+ifeq ($(FULL_TARGET),i386-qnx)
+override COMPILER_SOURCEDIR+=src examples
+endif
+ifeq ($(FULL_TARGET),i386-netware)
+override COMPILER_SOURCEDIR+=src examples
+endif
+ifeq ($(FULL_TARGET),i386-openbsd)
+override COMPILER_SOURCEDIR+=src examples
+endif
+ifeq ($(FULL_TARGET),i386-wdosx)
+override COMPILER_SOURCEDIR+=src examples
+endif
+ifeq ($(FULL_TARGET),i386-darwin)
+override COMPILER_SOURCEDIR+=src examples
+endif
+ifeq ($(FULL_TARGET),i386-emx)
+override COMPILER_SOURCEDIR+=src examples
+endif
+ifeq ($(FULL_TARGET),i386-watcom)
+override COMPILER_SOURCEDIR+=src examples
+endif
+ifeq ($(FULL_TARGET),i386-netwlibc)
+override COMPILER_SOURCEDIR+=src examples
+endif
+ifeq ($(FULL_TARGET),i386-wince)
+override COMPILER_SOURCEDIR+=src examples
+endif
+ifeq ($(FULL_TARGET),i386-embedded)
+override COMPILER_SOURCEDIR+=src examples
+endif
+ifeq ($(FULL_TARGET),i386-symbian)
+override COMPILER_SOURCEDIR+=src examples
+endif
+ifeq ($(FULL_TARGET),i386-nativent)
+override COMPILER_SOURCEDIR+=src examples
+endif
+ifeq ($(FULL_TARGET),i386-iphonesim)
+override COMPILER_SOURCEDIR+=src examples
+endif
+ifeq ($(FULL_TARGET),i386-android)
+override COMPILER_SOURCEDIR+=src examples
+endif
+ifeq ($(FULL_TARGET),m68k-linux)
+override COMPILER_SOURCEDIR+=src examples
+endif
+ifeq ($(FULL_TARGET),m68k-freebsd)
+override COMPILER_SOURCEDIR+=src examples
+endif
+ifeq ($(FULL_TARGET),m68k-netbsd)
+override COMPILER_SOURCEDIR+=src examples
+endif
+ifeq ($(FULL_TARGET),m68k-amiga)
+override COMPILER_SOURCEDIR+=src examples
+endif
+ifeq ($(FULL_TARGET),m68k-atari)
+override COMPILER_SOURCEDIR+=src examples
+endif
+ifeq ($(FULL_TARGET),m68k-openbsd)
+override COMPILER_SOURCEDIR+=src examples
+endif
+ifeq ($(FULL_TARGET),m68k-palmos)
+override COMPILER_SOURCEDIR+=src examples
+endif
+ifeq ($(FULL_TARGET),m68k-embedded)
+override COMPILER_SOURCEDIR+=src examples
+endif
+ifeq ($(FULL_TARGET),powerpc-linux)
+override COMPILER_SOURCEDIR+=src examples
+endif
+ifeq ($(FULL_TARGET),powerpc-netbsd)
+override COMPILER_SOURCEDIR+=src examples
+endif
+ifeq ($(FULL_TARGET),powerpc-amiga)
+override COMPILER_SOURCEDIR+=src examples
+endif
+ifeq ($(FULL_TARGET),powerpc-macos)
+override COMPILER_SOURCEDIR+=src examples
+endif
+ifeq ($(FULL_TARGET),powerpc-darwin)
+override COMPILER_SOURCEDIR+=src examples
+endif
+ifeq ($(FULL_TARGET),powerpc-morphos)
+override COMPILER_SOURCEDIR+=src examples
+endif
+ifeq ($(FULL_TARGET),powerpc-embedded)
+override COMPILER_SOURCEDIR+=src examples
+endif
+ifeq ($(FULL_TARGET),powerpc-wii)
+override COMPILER_SOURCEDIR+=src examples
+endif
+ifeq ($(FULL_TARGET),powerpc-aix)
+override COMPILER_SOURCEDIR+=src examples
+endif
+ifeq ($(FULL_TARGET),sparc-linux)
+override COMPILER_SOURCEDIR+=src examples
+endif
+ifeq ($(FULL_TARGET),sparc-netbsd)
+override COMPILER_SOURCEDIR+=src examples
+endif
+ifeq ($(FULL_TARGET),sparc-solaris)
+override COMPILER_SOURCEDIR+=src examples
+endif
+ifeq ($(FULL_TARGET),sparc-embedded)
+override COMPILER_SOURCEDIR+=src examples
+endif
+ifeq ($(FULL_TARGET),x86_64-linux)
+override COMPILER_SOURCEDIR+=src examples
+endif
+ifeq ($(FULL_TARGET),x86_64-freebsd)
+override COMPILER_SOURCEDIR+=src examples
+endif
+ifeq ($(FULL_TARGET),x86_64-netbsd)
+override COMPILER_SOURCEDIR+=src examples
+endif
+ifeq ($(FULL_TARGET),x86_64-solaris)
+override COMPILER_SOURCEDIR+=src examples
+endif
+ifeq ($(FULL_TARGET),x86_64-openbsd)
+override COMPILER_SOURCEDIR+=src examples
+endif
+ifeq ($(FULL_TARGET),x86_64-darwin)
+override COMPILER_SOURCEDIR+=src examples
+endif
+ifeq ($(FULL_TARGET),x86_64-win64)
+override COMPILER_SOURCEDIR+=src examples
+endif
+ifeq ($(FULL_TARGET),x86_64-embedded)
+override COMPILER_SOURCEDIR+=src examples
+endif
+ifeq ($(FULL_TARGET),arm-linux)
+override COMPILER_SOURCEDIR+=src examples
+endif
+ifeq ($(FULL_TARGET),arm-palmos)
+override COMPILER_SOURCEDIR+=src examples
+endif
+ifeq ($(FULL_TARGET),arm-darwin)
+override COMPILER_SOURCEDIR+=src examples
+endif
+ifeq ($(FULL_TARGET),arm-wince)
+override COMPILER_SOURCEDIR+=src examples
+endif
+ifeq ($(FULL_TARGET),arm-gba)
+override COMPILER_SOURCEDIR+=src examples
+endif
+ifeq ($(FULL_TARGET),arm-nds)
+override COMPILER_SOURCEDIR+=src examples
+endif
+ifeq ($(FULL_TARGET),arm-embedded)
+override COMPILER_SOURCEDIR+=src examples
+endif
+ifeq ($(FULL_TARGET),arm-symbian)
+override COMPILER_SOURCEDIR+=src examples
+endif
+ifeq ($(FULL_TARGET),arm-android)
+override COMPILER_SOURCEDIR+=src examples
+endif
+ifeq ($(FULL_TARGET),powerpc64-linux)
+override COMPILER_SOURCEDIR+=src examples
+endif
+ifeq ($(FULL_TARGET),powerpc64-darwin)
+override COMPILER_SOURCEDIR+=src examples
+endif
+ifeq ($(FULL_TARGET),powerpc64-embedded)
+override COMPILER_SOURCEDIR+=src examples
+endif
+ifeq ($(FULL_TARGET),powerpc64-aix)
+override COMPILER_SOURCEDIR+=src examples
+endif
+ifeq ($(FULL_TARGET),avr-embedded)
+override COMPILER_SOURCEDIR+=src examples
+endif
+ifeq ($(FULL_TARGET),armeb-linux)
+override COMPILER_SOURCEDIR+=src examples
+endif
+ifeq ($(FULL_TARGET),armeb-embedded)
+override COMPILER_SOURCEDIR+=src examples
+endif
+ifeq ($(FULL_TARGET),mips-linux)
+override COMPILER_SOURCEDIR+=src examples
+endif
+ifeq ($(FULL_TARGET),mipsel-linux)
+override COMPILER_SOURCEDIR+=src examples
+endif
+ifeq ($(FULL_TARGET),jvm-java)
+override COMPILER_SOURCEDIR+=src examples
+endif
+ifeq ($(FULL_TARGET),jvm-android)
+override COMPILER_SOURCEDIR+=src examples
+endif
+ifeq ($(FULL_TARGET),i8086-msdos)
+override COMPILER_SOURCEDIR+=src examples
+endif
+ifdef REQUIRE_UNITSDIR
+override UNITSDIR+=$(REQUIRE_UNITSDIR)
+endif
+ifdef REQUIRE_PACKAGESDIR
+override PACKAGESDIR+=$(REQUIRE_PACKAGESDIR)
+endif
+ifdef ZIPINSTALL
+ifneq ($(findstring $(OS_TARGET),$(UNIXs)),)
+UNIXHier=1
+endif
+else
+ifneq ($(findstring $(OS_SOURCE),$(UNIXs)),)
+UNIXHier=1
+endif
+endif
+ifndef INSTALL_PREFIX
+ifdef PREFIX
+INSTALL_PREFIX=$(PREFIX)
+endif
+endif
+ifndef INSTALL_PREFIX
+ifdef UNIXHier
+INSTALL_PREFIX=/usr/local
+else
+ifdef INSTALL_FPCPACKAGE
+INSTALL_BASEDIR:=/pp
+else
+INSTALL_BASEDIR:=/$(PACKAGE_NAME)
+endif
+endif
+endif
+export INSTALL_PREFIX
+ifdef INSTALL_FPCSUBDIR
+export INSTALL_FPCSUBDIR
+endif
+ifndef DIST_DESTDIR
+DIST_DESTDIR:=$(BASEDIR)
+endif
+export DIST_DESTDIR
+ifndef COMPILER_UNITTARGETDIR
+ifdef PACKAGEDIR_MAIN
+COMPILER_UNITTARGETDIR=$(PACKAGEDIR_MAIN)/units/$(TARGETSUFFIX)
+else
+COMPILER_UNITTARGETDIR=units/$(TARGETSUFFIX)
+endif
+endif
+ifndef COMPILER_TARGETDIR
+COMPILER_TARGETDIR=.
+endif
+ifndef INSTALL_BASEDIR
+ifdef UNIXHier
+ifdef INSTALL_FPCPACKAGE
+INSTALL_BASEDIR:=$(INSTALL_PREFIX)/lib/fpc/$(FPC_VERSION)
+else
+INSTALL_BASEDIR:=$(INSTALL_PREFIX)/lib/$(PACKAGE_NAME)
+endif
+else
+INSTALL_BASEDIR:=$(INSTALL_PREFIX)
+endif
+endif
+ifndef INSTALL_BINDIR
+ifdef UNIXHier
+INSTALL_BINDIR:=$(INSTALL_PREFIX)/bin
+else
+INSTALL_BINDIR:=$(INSTALL_BASEDIR)/bin
+ifdef INSTALL_FPCPACKAGE
+ifdef CROSSCOMPILE
+ifdef CROSSINSTALL
+INSTALL_BINDIR:=$(INSTALL_BINDIR)/$(SOURCESUFFIX)
+else
+INSTALL_BINDIR:=$(INSTALL_BINDIR)/$(TARGETSUFFIX)
+endif
+else
+INSTALL_BINDIR:=$(INSTALL_BINDIR)/$(TARGETSUFFIX)
+endif
+endif
+endif
+endif
+ifndef INSTALL_UNITDIR
+INSTALL_UNITDIR:=$(INSTALL_BASEDIR)/units/$(TARGETSUFFIX)
+ifdef INSTALL_FPCPACKAGE
+ifdef PACKAGE_NAME
+INSTALL_UNITDIR:=$(INSTALL_UNITDIR)/$(PACKAGE_NAME)
+endif
+endif
+endif
+ifndef INSTALL_LIBDIR
+ifdef UNIXHier
+INSTALL_LIBDIR:=$(INSTALL_PREFIX)/lib
+else
+INSTALL_LIBDIR:=$(INSTALL_UNITDIR)
+endif
+endif
+ifndef INSTALL_SOURCEDIR
+ifdef UNIXHier
+ifdef BSDhier
+SRCPREFIXDIR=share/src
+else
+ifdef linuxHier
+SRCPREFIXDIR=share/src
+else
+SRCPREFIXDIR=src
+endif
+endif
+ifdef INSTALL_FPCPACKAGE
+ifdef INSTALL_FPCSUBDIR
+INSTALL_SOURCEDIR:=$(INSTALL_PREFIX)/$(SRCPREFIXDIR)/fpc-$(FPC_VERSION)/$(INSTALL_FPCSUBDIR)/$(PACKAGE_NAME)
+else
+INSTALL_SOURCEDIR:=$(INSTALL_PREFIX)/$(SRCPREFIXDIR)/fpc-$(FPC_VERSION)/$(PACKAGE_NAME)
+endif
+else
+INSTALL_SOURCEDIR:=$(INSTALL_PREFIX)/$(SRCPREFIXDIR)/$(PACKAGE_NAME)-$(PACKAGE_VERSION)
+endif
+else
+ifdef INSTALL_FPCPACKAGE
+ifdef INSTALL_FPCSUBDIR
+INSTALL_SOURCEDIR:=$(INSTALL_BASEDIR)/source/$(INSTALL_FPCSUBDIR)/$(PACKAGE_NAME)
+else
+INSTALL_SOURCEDIR:=$(INSTALL_BASEDIR)/source/$(PACKAGE_NAME)
+endif
+else
+INSTALL_SOURCEDIR:=$(INSTALL_BASEDIR)/source
+endif
+endif
+endif
+ifndef INSTALL_DOCDIR
+ifdef UNIXHier
+ifdef BSDhier
+DOCPREFIXDIR=share/doc
+else
+ifdef linuxHier
+DOCPREFIXDIR=share/doc
+else
+DOCPREFIXDIR=doc
+endif
+endif
+ifdef INSTALL_FPCPACKAGE
+INSTALL_DOCDIR:=$(INSTALL_PREFIX)/$(DOCPREFIXDIR)/fpc-$(FPC_VERSION)/$(PACKAGE_NAME)
+else
+INSTALL_DOCDIR:=$(INSTALL_PREFIX)/$(DOCPREFIXDIR)/$(PACKAGE_NAME)-$(PACKAGE_VERSION)
+endif
+else
+ifdef INSTALL_FPCPACKAGE
+INSTALL_DOCDIR:=$(INSTALL_BASEDIR)/doc/$(PACKAGE_NAME)
+else
+INSTALL_DOCDIR:=$(INSTALL_BASEDIR)/doc
+endif
+endif
+endif
+ifndef INSTALL_EXAMPLEDIR
+ifdef UNIXHier
+ifdef INSTALL_FPCPACKAGE
+ifdef BSDhier
+INSTALL_EXAMPLEDIR:=$(INSTALL_PREFIX)/share/examples/fpc-$(FPC_VERSION)/$(PACKAGE_NAME)
+else
+ifdef linuxHier
+INSTALL_EXAMPLEDIR:=$(INSTALL_DOCDIR)/examples
+else
+INSTALL_EXAMPLEDIR:=$(INSTALL_PREFIX)/doc/fpc-$(FPC_VERSION)/examples/$(PACKAGE_NAME)
+endif
+endif
+else
+ifdef BSDhier
+INSTALL_EXAMPLEDIR:=$(INSTALL_PREFIX)/share/examples/$(PACKAGE_NAME)-$(PACKAGE_VERSION)
+else
+ifdef linuxHier
+INSTALL_EXAMPLEDIR:=$(INSTALL_DOCDIR)/examples/$(PACKAGE_NAME)-$(PACKAGE_VERSION)
+else
+INSTALL_EXAMPLEDIR:=$(INSTALL_PREFIX)/doc/$(PACKAGE_NAME)-$(PACKAGE_VERSION)
+endif
+endif
+endif
+else
+ifdef INSTALL_FPCPACKAGE
+INSTALL_EXAMPLEDIR:=$(INSTALL_BASEDIR)/examples/$(PACKAGE_NAME)
+else
+INSTALL_EXAMPLEDIR:=$(INSTALL_BASEDIR)/examples
+endif
+endif
+endif
+ifndef INSTALL_DATADIR
+INSTALL_DATADIR=$(INSTALL_BASEDIR)
+endif
+ifndef INSTALL_SHAREDDIR
+INSTALL_SHAREDDIR=$(INSTALL_PREFIX)/lib
+endif
+ifdef CROSSCOMPILE
+ifndef CROSSBINDIR
+CROSSBINDIR:=$(wildcard $(CROSSTARGETDIR)/bin/$(SOURCESUFFIX))
+ifeq ($(CROSSBINDIR),)
+CROSSBINDIR:=$(wildcard $(INSTALL_BASEDIR)/cross/$(TARGETSUFFIX)/bin/$(FULL_SOURCE))
+endif
+endif
+else
+CROSSBINDIR=
+endif
+BATCHEXT=.bat
+LOADEREXT=.as
+EXEEXT=.exe
+PPLEXT=.ppl
+PPUEXT=.ppu
+OEXT=.o
+ASMEXT=.s
+SMARTEXT=.sl
+STATICLIBEXT=.a
+SHAREDLIBEXT=.so
+SHAREDLIBPREFIX=libfp
+STATICLIBPREFIX=libp
+IMPORTLIBPREFIX=libimp
+RSTEXT=.rst
+EXEDBGEXT=.dbg
+ifeq ($(OS_TARGET),go32v1)
+STATICLIBPREFIX=
+SHORTSUFFIX=v1
+endif
+ifeq ($(OS_TARGET),go32v2)
+STATICLIBPREFIX=
+SHORTSUFFIX=dos
+IMPORTLIBPREFIX=
+endif
+ifeq ($(OS_TARGET),watcom)
+STATICLIBPREFIX=
+OEXT=.obj
+ASMEXT=.asm
+SHAREDLIBEXT=.dll
+SHORTSUFFIX=wat
+IMPORTLIBPREFIX=
+endif
+ifneq ($(CPU_TARGET),jvm)
+ifeq ($(OS_TARGET),android)
+BATCHEXT=.sh
+EXEEXT=
+HASSHAREDLIB=1
+SHORTSUFFIX=lnx
+endif
+endif
+ifeq ($(OS_TARGET),linux)
+BATCHEXT=.sh
+EXEEXT=
+HASSHAREDLIB=1
+SHORTSUFFIX=lnx
+endif
+ifeq ($(OS_TARGET),freebsd)
+BATCHEXT=.sh
+EXEEXT=
+HASSHAREDLIB=1
+SHORTSUFFIX=fbs
+endif
+ifeq ($(OS_TARGET),netbsd)
+BATCHEXT=.sh
+EXEEXT=
+HASSHAREDLIB=1
+SHORTSUFFIX=nbs
+endif
+ifeq ($(OS_TARGET),openbsd)
+BATCHEXT=.sh
+EXEEXT=
+HASSHAREDLIB=1
+SHORTSUFFIX=obs
+endif
+ifeq ($(OS_TARGET),win32)
+SHAREDLIBEXT=.dll
+SHORTSUFFIX=w32
+endif
+ifeq ($(OS_TARGET),os2)
+BATCHEXT=.cmd
+AOUTEXT=.out
+STATICLIBPREFIX=
+SHAREDLIBEXT=.dll
+SHORTSUFFIX=os2
+ECHO=echo
+IMPORTLIBPREFIX=
+endif
+ifeq ($(OS_TARGET),emx)
+BATCHEXT=.cmd
+AOUTEXT=.out
+STATICLIBPREFIX=
+SHAREDLIBEXT=.dll
+SHORTSUFFIX=emx
+ECHO=echo
+IMPORTLIBPREFIX=
+endif
+ifeq ($(OS_TARGET),amiga)
+EXEEXT=
+SHAREDLIBEXT=.library
+SHORTSUFFIX=amg
+endif
+ifeq ($(OS_TARGET),morphos)
+EXEEXT=
+SHAREDLIBEXT=.library
+SHORTSUFFIX=mos
+endif
+ifeq ($(OS_TARGET),atari)
+EXEEXT=.ttp
+SHORTSUFFIX=ata
+endif
+ifeq ($(OS_TARGET),beos)
+BATCHEXT=.sh
+EXEEXT=
+SHORTSUFFIX=be
+endif
+ifeq ($(OS_TARGET),haiku)
+BATCHEXT=.sh
+EXEEXT=
+SHORTSUFFIX=hai
+endif
+ifeq ($(OS_TARGET),solaris)
+BATCHEXT=.sh
+EXEEXT=
+SHORTSUFFIX=sun
+endif
+ifeq ($(OS_TARGET),qnx)
+BATCHEXT=.sh
+EXEEXT=
+SHORTSUFFIX=qnx
+endif
+ifeq ($(OS_TARGET),netware)
+EXEEXT=.nlm
+STATICLIBPREFIX=
+SHORTSUFFIX=nw
+IMPORTLIBPREFIX=imp
+endif
+ifeq ($(OS_TARGET),netwlibc)
+EXEEXT=.nlm
+STATICLIBPREFIX=
+SHORTSUFFIX=nwl
+IMPORTLIBPREFIX=imp
+endif
+ifeq ($(OS_TARGET),macos)
+BATCHEXT=
+EXEEXT=
+DEBUGSYMEXT=.xcoff
+SHORTSUFFIX=mac
+IMPORTLIBPREFIX=imp
+endif
+ifneq ($(findstring $(OS_TARGET),darwin iphonesim),)
+BATCHEXT=.sh
+EXEEXT=
+HASSHAREDLIB=1
+SHORTSUFFIX=dwn
+EXEDBGEXT=.dSYM
+endif
+ifeq ($(OS_TARGET),gba)
+EXEEXT=.gba
+SHAREDLIBEXT=.so
+SHORTSUFFIX=gba
+endif
+ifeq ($(OS_TARGET),symbian)
+SHAREDLIBEXT=.dll
+SHORTSUFFIX=symbian
+endif
+ifeq ($(OS_TARGET),NativeNT)
+SHAREDLIBEXT=.dll
+SHORTSUFFIX=nativent
+endif
+ifeq ($(OS_TARGET),wii)
+EXEEXT=.dol
+SHAREDLIBEXT=.so
+SHORTSUFFIX=wii
+endif
+ifeq ($(OS_TARGET),aix)
+BATCHEXT=.sh
+EXEEXT=
+SHORTSUFFIX=aix
+endif
+ifeq ($(OS_TARGET),java)
+OEXT=.class
+ASMEXT=.j
+SHAREDLIBEXT=.jar
+SHORTSUFFIX=java
+endif
+ifeq ($(CPU_TARGET),jvm)
+ifeq ($(OS_TARGET),android)
+OEXT=.class
+ASMEXT=.j
+SHAREDLIBEXT=.jar
+SHORTSUFFIX=android
+endif
+endif
+ifneq ($(findstring $(OS_SOURCE),$(LIMIT83fs)),)
+FPCMADE=fpcmade.$(SHORTSUFFIX)
+ZIPSUFFIX=$(SHORTSUFFIX)
+ZIPCROSSPREFIX=
+ZIPSOURCESUFFIX=src
+ZIPEXAMPLESUFFIX=exm
+else
+FPCMADE=fpcmade.$(TARGETSUFFIX)
+ZIPSOURCESUFFIX=.source
+ZIPEXAMPLESUFFIX=.examples
+ifdef CROSSCOMPILE
+ZIPSUFFIX=.$(SOURCESUFFIX)
+ZIPCROSSPREFIX=$(TARGETSUFFIX)-
+else
+ZIPSUFFIX=.$(TARGETSUFFIX)
+ZIPCROSSPREFIX=
+endif
+endif
+ifndef ECHO
+ECHO:=$(strip $(wildcard $(addsuffix /gecho$(SRCEXEEXT),$(SEARCHPATH))))
+ifeq ($(ECHO),)
+ECHO:=$(strip $(wildcard $(addsuffix /echo$(SRCEXEEXT),$(SEARCHPATH))))
+ifeq ($(ECHO),)
+ECHO= __missing_command_ECHO
+else
+ECHO:=$(firstword $(ECHO))
+endif
+else
+ECHO:=$(firstword $(ECHO))
+endif
+endif
+export ECHO
+ifndef DATE
+DATE:=$(strip $(wildcard $(addsuffix /gdate$(SRCEXEEXT),$(SEARCHPATH))))
+ifeq ($(DATE),)
+DATE:=$(strip $(wildcard $(addsuffix /date$(SRCEXEEXT),$(SEARCHPATH))))
+ifeq ($(DATE),)
+DATE= __missing_command_DATE
+else
+DATE:=$(firstword $(DATE))
+endif
+else
+DATE:=$(firstword $(DATE))
+endif
+endif
+export DATE
+ifndef GINSTALL
+GINSTALL:=$(strip $(wildcard $(addsuffix /ginstall$(SRCEXEEXT),$(SEARCHPATH))))
+ifeq ($(GINSTALL),)
+GINSTALL:=$(strip $(wildcard $(addsuffix /install$(SRCEXEEXT),$(SEARCHPATH))))
+ifeq ($(GINSTALL),)
+GINSTALL= __missing_command_GINSTALL
+else
+GINSTALL:=$(firstword $(GINSTALL))
+endif
+else
+GINSTALL:=$(firstword $(GINSTALL))
+endif
+endif
+export GINSTALL
+ifndef CPPROG
+CPPROG:=$(strip $(wildcard $(addsuffix /cp$(SRCEXEEXT),$(SEARCHPATH))))
+ifeq ($(CPPROG),)
+CPPROG= __missing_command_CPPROG
+else
+CPPROG:=$(firstword $(CPPROG))
+endif
+endif
+export CPPROG
+ifndef RMPROG
+RMPROG:=$(strip $(wildcard $(addsuffix /rm$(SRCEXEEXT),$(SEARCHPATH))))
+ifeq ($(RMPROG),)
+RMPROG= __missing_command_RMPROG
+else
+RMPROG:=$(firstword $(RMPROG))
+endif
+endif
+export RMPROG
+ifndef MVPROG
+MVPROG:=$(strip $(wildcard $(addsuffix /mv$(SRCEXEEXT),$(SEARCHPATH))))
+ifeq ($(MVPROG),)
+MVPROG= __missing_command_MVPROG
+else
+MVPROG:=$(firstword $(MVPROG))
+endif
+endif
+export MVPROG
+ifndef MKDIRPROG
+MKDIRPROG:=$(strip $(wildcard $(addsuffix /gmkdir$(SRCEXEEXT),$(SEARCHPATH))))
+ifeq ($(MKDIRPROG),)
+MKDIRPROG:=$(strip $(wildcard $(addsuffix /mkdir$(SRCEXEEXT),$(SEARCHPATH))))
+ifeq ($(MKDIRPROG),)
+MKDIRPROG= __missing_command_MKDIRPROG
+else
+MKDIRPROG:=$(firstword $(MKDIRPROG))
+endif
+else
+MKDIRPROG:=$(firstword $(MKDIRPROG))
+endif
+endif
+export MKDIRPROG
+ifndef ECHOREDIR
+ifndef inUnix
+ECHOREDIR=echo
+else
+ECHOREDIR=$(ECHO)
+endif
+endif
+ifndef COPY
+COPY:=$(CPPROG) -fp
+endif
+ifndef COPYTREE
+COPYTREE:=$(CPPROG) -Rfp
+endif
+ifndef MKDIRTREE
+MKDIRTREE:=$(MKDIRPROG) -p
+endif
+ifndef MOVE
+MOVE:=$(MVPROG) -f
+endif
+ifndef DEL
+DEL:=$(RMPROG) -f
+endif
+ifndef DELTREE
+DELTREE:=$(RMPROG) -rf
+endif
+ifndef INSTALL
+ifdef inUnix
+INSTALL:=$(GINSTALL) -c -m 644
+else
+INSTALL:=$(COPY)
+endif
+endif
+ifndef INSTALLEXE
+ifdef inUnix
+INSTALLEXE:=$(GINSTALL) -c -m 755
+else
+INSTALLEXE:=$(COPY)
+endif
+endif
+ifndef MKDIR
+MKDIR:=$(GINSTALL) -m 755 -d
+endif
+export ECHOREDIR COPY COPYTREE MOVE DEL DELTREE INSTALL INSTALLEXE MKDIR
+ifndef PPUMOVE
+PPUMOVE:=$(strip $(wildcard $(addsuffix /ppumove$(SRCEXEEXT),$(SEARCHPATH))))
+ifeq ($(PPUMOVE),)
+PPUMOVE= __missing_command_PPUMOVE
+else
+PPUMOVE:=$(firstword $(PPUMOVE))
+endif
+endif
+export PPUMOVE
+ifndef FPCMAKE
+FPCMAKE:=$(strip $(wildcard $(addsuffix /fpcmake$(SRCEXEEXT),$(SEARCHPATH))))
+ifeq ($(FPCMAKE),)
+FPCMAKE= __missing_command_FPCMAKE
+else
+FPCMAKE:=$(firstword $(FPCMAKE))
+endif
+endif
+export FPCMAKE
+ifndef ZIPPROG
+ZIPPROG:=$(strip $(wildcard $(addsuffix /zip$(SRCEXEEXT),$(SEARCHPATH))))
+ifeq ($(ZIPPROG),)
+ZIPPROG= __missing_command_ZIPPROG
+else
+ZIPPROG:=$(firstword $(ZIPPROG))
+endif
+endif
+export ZIPPROG
+ifndef TARPROG
+TARPROG:=$(strip $(wildcard $(addsuffix /gtar$(SRCEXEEXT),$(SEARCHPATH))))
+ifeq ($(TARPROG),)
+TARPROG:=$(strip $(wildcard $(addsuffix /tar$(SRCEXEEXT),$(SEARCHPATH))))
+ifeq ($(TARPROG),)
+TARPROG= __missing_command_TARPROG
+else
+TARPROG:=$(firstword $(TARPROG))
+endif
+else
+TARPROG:=$(firstword $(TARPROG))
+endif
+endif
+export TARPROG
+ASNAME=$(BINUTILSPREFIX)as
+LDNAME=$(BINUTILSPREFIX)ld
+ARNAME=$(BINUTILSPREFIX)ar
+RCNAME=$(BINUTILSPREFIX)rc
+ifndef ASPROG
+ifdef CROSSBINDIR
+ASPROG=$(CROSSBINDIR)/$(ASNAME)$(SRCEXEEXT)
+else
+ASPROG=$(ASNAME)
+endif
+endif
+ifndef LDPROG
+ifdef CROSSBINDIR
+LDPROG=$(CROSSBINDIR)/$(LDNAME)$(SRCEXEEXT)
+else
+LDPROG=$(LDNAME)
+endif
+endif
+ifndef RCPROG
+ifdef CROSSBINDIR
+RCPROG=$(CROSSBINDIR)/$(RCNAME)$(SRCEXEEXT)
+else
+RCPROG=$(RCNAME)
+endif
+endif
+ifndef ARPROG
+ifdef CROSSBINDIR
+ARPROG=$(CROSSBINDIR)/$(ARNAME)$(SRCEXEEXT)
+else
+ARPROG=$(ARNAME)
+endif
+endif
+AS=$(ASPROG)
+LD=$(LDPROG)
+RC=$(RCPROG)
+AR=$(ARPROG)
+ifdef inUnix
+PPAS=./ppas$(SRCBATCHEXT)
+else
+PPAS=ppas$(SRCBATCHEXT)
+endif
+ifdef inUnix
+LDCONFIG=ldconfig
+else
+LDCONFIG=
+endif
+ifdef DATE
+DATESTR:=$(shell $(DATE) +%Y%m%d)
+else
+DATESTR=
+endif
+ZIPOPT=-9
+ZIPEXT=.zip
+ifeq ($(USETAR),bz2)
+TAROPT=vj
+TAREXT=.tar.bz2
+else
+TAROPT=vz
+TAREXT=.tar.gz
+endif
+override REQUIRE_PACKAGES=rtl 
+ifeq ($(FULL_TARGET),i386-linux)
+REQUIRE_PACKAGES_RTL=1
+endif
+ifeq ($(FULL_TARGET),i386-go32v2)
+REQUIRE_PACKAGES_RTL=1
+endif
+ifeq ($(FULL_TARGET),i386-win32)
+REQUIRE_PACKAGES_RTL=1
+endif
+ifeq ($(FULL_TARGET),i386-os2)
+REQUIRE_PACKAGES_RTL=1
+endif
+ifeq ($(FULL_TARGET),i386-freebsd)
+REQUIRE_PACKAGES_RTL=1
+endif
+ifeq ($(FULL_TARGET),i386-beos)
+REQUIRE_PACKAGES_RTL=1
+endif
+ifeq ($(FULL_TARGET),i386-haiku)
+REQUIRE_PACKAGES_RTL=1
+endif
+ifeq ($(FULL_TARGET),i386-netbsd)
+REQUIRE_PACKAGES_RTL=1
+endif
+ifeq ($(FULL_TARGET),i386-solaris)
+REQUIRE_PACKAGES_RTL=1
+endif
+ifeq ($(FULL_TARGET),i386-qnx)
+REQUIRE_PACKAGES_RTL=1
+endif
+ifeq ($(FULL_TARGET),i386-netware)
+REQUIRE_PACKAGES_RTL=1
+endif
+ifeq ($(FULL_TARGET),i386-openbsd)
+REQUIRE_PACKAGES_RTL=1
+endif
+ifeq ($(FULL_TARGET),i386-wdosx)
+REQUIRE_PACKAGES_RTL=1
+endif
+ifeq ($(FULL_TARGET),i386-darwin)
+REQUIRE_PACKAGES_RTL=1
+endif
+ifeq ($(FULL_TARGET),i386-emx)
+REQUIRE_PACKAGES_RTL=1
+endif
+ifeq ($(FULL_TARGET),i386-watcom)
+REQUIRE_PACKAGES_RTL=1
+endif
+ifeq ($(FULL_TARGET),i386-netwlibc)
+REQUIRE_PACKAGES_RTL=1
+endif
+ifeq ($(FULL_TARGET),i386-wince)
+REQUIRE_PACKAGES_RTL=1
+endif
+ifeq ($(FULL_TARGET),i386-embedded)
+REQUIRE_PACKAGES_RTL=1
+endif
+ifeq ($(FULL_TARGET),i386-symbian)
+REQUIRE_PACKAGES_RTL=1
+endif
+ifeq ($(FULL_TARGET),i386-nativent)
+REQUIRE_PACKAGES_RTL=1
+endif
+ifeq ($(FULL_TARGET),i386-iphonesim)
+REQUIRE_PACKAGES_RTL=1
+endif
+ifeq ($(FULL_TARGET),i386-android)
+REQUIRE_PACKAGES_RTL=1
+endif
+ifeq ($(FULL_TARGET),m68k-linux)
+REQUIRE_PACKAGES_RTL=1
+endif
+ifeq ($(FULL_TARGET),m68k-freebsd)
+REQUIRE_PACKAGES_RTL=1
+endif
+ifeq ($(FULL_TARGET),m68k-netbsd)
+REQUIRE_PACKAGES_RTL=1
+endif
+ifeq ($(FULL_TARGET),m68k-amiga)
+REQUIRE_PACKAGES_RTL=1
+endif
+ifeq ($(FULL_TARGET),m68k-atari)
+REQUIRE_PACKAGES_RTL=1
+endif
+ifeq ($(FULL_TARGET),m68k-openbsd)
+REQUIRE_PACKAGES_RTL=1
+endif
+ifeq ($(FULL_TARGET),m68k-palmos)
+REQUIRE_PACKAGES_RTL=1
+endif
+ifeq ($(FULL_TARGET),m68k-embedded)
+REQUIRE_PACKAGES_RTL=1
+endif
+ifeq ($(FULL_TARGET),powerpc-linux)
+REQUIRE_PACKAGES_RTL=1
+endif
+ifeq ($(FULL_TARGET),powerpc-netbsd)
+REQUIRE_PACKAGES_RTL=1
+endif
+ifeq ($(FULL_TARGET),powerpc-amiga)
+REQUIRE_PACKAGES_RTL=1
+endif
+ifeq ($(FULL_TARGET),powerpc-macos)
+REQUIRE_PACKAGES_RTL=1
+endif
+ifeq ($(FULL_TARGET),powerpc-darwin)
+REQUIRE_PACKAGES_RTL=1
+endif
+ifeq ($(FULL_TARGET),powerpc-morphos)
+REQUIRE_PACKAGES_RTL=1
+endif
+ifeq ($(FULL_TARGET),powerpc-embedded)
+REQUIRE_PACKAGES_RTL=1
+endif
+ifeq ($(FULL_TARGET),powerpc-wii)
+REQUIRE_PACKAGES_RTL=1
+endif
+ifeq ($(FULL_TARGET),powerpc-aix)
+REQUIRE_PACKAGES_RTL=1
+endif
+ifeq ($(FULL_TARGET),sparc-linux)
+REQUIRE_PACKAGES_RTL=1
+endif
+ifeq ($(FULL_TARGET),sparc-netbsd)
+REQUIRE_PACKAGES_RTL=1
+endif
+ifeq ($(FULL_TARGET),sparc-solaris)
+REQUIRE_PACKAGES_RTL=1
+endif
+ifeq ($(FULL_TARGET),sparc-embedded)
+REQUIRE_PACKAGES_RTL=1
+endif
+ifeq ($(FULL_TARGET),x86_64-linux)
+REQUIRE_PACKAGES_RTL=1
+endif
+ifeq ($(FULL_TARGET),x86_64-freebsd)
+REQUIRE_PACKAGES_RTL=1
+endif
+ifeq ($(FULL_TARGET),x86_64-netbsd)
+REQUIRE_PACKAGES_RTL=1
+endif
+ifeq ($(FULL_TARGET),x86_64-solaris)
+REQUIRE_PACKAGES_RTL=1
+endif
+ifeq ($(FULL_TARGET),x86_64-openbsd)
+REQUIRE_PACKAGES_RTL=1
+endif
+ifeq ($(FULL_TARGET),x86_64-darwin)
+REQUIRE_PACKAGES_RTL=1
+endif
+ifeq ($(FULL_TARGET),x86_64-win64)
+REQUIRE_PACKAGES_RTL=1
+endif
+ifeq ($(FULL_TARGET),x86_64-embedded)
+REQUIRE_PACKAGES_RTL=1
+endif
+ifeq ($(FULL_TARGET),arm-linux)
+REQUIRE_PACKAGES_RTL=1
+endif
+ifeq ($(FULL_TARGET),arm-palmos)
+REQUIRE_PACKAGES_RTL=1
+endif
+ifeq ($(FULL_TARGET),arm-darwin)
+REQUIRE_PACKAGES_RTL=1
+endif
+ifeq ($(FULL_TARGET),arm-wince)
+REQUIRE_PACKAGES_RTL=1
+endif
+ifeq ($(FULL_TARGET),arm-gba)
+REQUIRE_PACKAGES_RTL=1
+endif
+ifeq ($(FULL_TARGET),arm-nds)
+REQUIRE_PACKAGES_RTL=1
+endif
+ifeq ($(FULL_TARGET),arm-embedded)
+REQUIRE_PACKAGES_RTL=1
+endif
+ifeq ($(FULL_TARGET),arm-symbian)
+REQUIRE_PACKAGES_RTL=1
+endif
+ifeq ($(FULL_TARGET),arm-android)
+REQUIRE_PACKAGES_RTL=1
+endif
+ifeq ($(FULL_TARGET),powerpc64-linux)
+REQUIRE_PACKAGES_RTL=1
+endif
+ifeq ($(FULL_TARGET),powerpc64-darwin)
+REQUIRE_PACKAGES_RTL=1
+endif
+ifeq ($(FULL_TARGET),powerpc64-embedded)
+REQUIRE_PACKAGES_RTL=1
+endif
+ifeq ($(FULL_TARGET),powerpc64-aix)
+REQUIRE_PACKAGES_RTL=1
+endif
+ifeq ($(FULL_TARGET),avr-embedded)
+REQUIRE_PACKAGES_RTL=1
+endif
+ifeq ($(FULL_TARGET),armeb-linux)
+REQUIRE_PACKAGES_RTL=1
+endif
+ifeq ($(FULL_TARGET),armeb-embedded)
+REQUIRE_PACKAGES_RTL=1
+endif
+ifeq ($(FULL_TARGET),mips-linux)
+REQUIRE_PACKAGES_RTL=1
+endif
+ifeq ($(FULL_TARGET),mipsel-linux)
+REQUIRE_PACKAGES_RTL=1
+endif
+ifeq ($(FULL_TARGET),jvm-java)
+REQUIRE_PACKAGES_RTL=1
+endif
+ifeq ($(FULL_TARGET),jvm-android)
+REQUIRE_PACKAGES_RTL=1
+endif
+ifeq ($(FULL_TARGET),i8086-msdos)
+REQUIRE_PACKAGES_RTL=1
+endif
+ifdef REQUIRE_PACKAGES_RTL
+PACKAGEDIR_RTL:=$(firstword $(subst /Makefile.fpc,,$(strip $(wildcard $(addsuffix /rtl/Makefile.fpc,$(PACKAGESDIR))))))
+ifneq ($(PACKAGEDIR_RTL),)
+ifneq ($(wildcard $(PACKAGEDIR_RTL)/units/$(TARGETSUFFIX)),)
+UNITDIR_RTL=$(PACKAGEDIR_RTL)/units/$(TARGETSUFFIX)
+else
+UNITDIR_RTL=$(PACKAGEDIR_RTL)
+endif
+ifneq ($(wildcard $(PACKAGEDIR_RTL)/units/$(SOURCESUFFIX)),)
+UNITDIR_FPMAKE_RTL=$(PACKAGEDIR_RTL)/units/$(SOURCESUFFIX)
+else
+ifneq ($(wildcard $(PACKAGEDIR_RTL)/units_bs/$(SOURCESUFFIX)),)
+UNITDIR_FPMAKE_RTL=$(PACKAGEDIR_RTL)/units_bs/$(SOURCESUFFIX)
+else
+UNITDIR_FPMAKE_RTL=$(PACKAGEDIR_RTL)
+endif
+endif
+ifdef CHECKDEPEND
+$(PACKAGEDIR_RTL)/$(OS_TARGET)/$(FPCMADE):
+	$(MAKE) -C $(PACKAGEDIR_RTL)/$(OS_TARGET) $(FPCMADE)
+override ALLDEPENDENCIES+=$(PACKAGEDIR_RTL)/$(OS_TARGET)/$(FPCMADE)
+endif
+else
+PACKAGEDIR_RTL=
+UNITDIR_RTL:=$(subst /Package.fpc,,$(strip $(wildcard $(addsuffix /rtl/Package.fpc,$(UNITSDIR)))))
+ifneq ($(UNITDIR_RTL),)
+UNITDIR_RTL:=$(firstword $(UNITDIR_RTL))
+else
+UNITDIR_RTL=
+endif
+endif
+ifdef UNITDIR_RTL
+override COMPILER_UNITDIR+=$(UNITDIR_RTL)
+endif
+ifdef UNITDIR_FPMAKE_RTL
+override COMPILER_FPMAKE_UNITDIR+=$(UNITDIR_FPMAKE_RTL)
+endif
+endif
+ifndef NOCPUDEF
+override FPCOPTDEF=$(ARCH)
+endif
+ifneq ($(OS_TARGET),$(OS_SOURCE))
+override FPCOPT+=-T$(OS_TARGET)
+endif
+ifneq ($(CPU_TARGET),$(CPU_SOURCE))
+override FPCOPT+=-P$(ARCH)
+endif
+ifeq ($(OS_SOURCE),openbsd)
+override FPCOPT+=-FD$(NEW_BINUTILS_PATH)
+override FPCMAKEOPT+=-FD$(NEW_BINUTILS_PATH)
+endif
+ifndef CROSSBOOTSTRAP
+ifneq ($(BINUTILSPREFIX),)
+override FPCOPT+=-XP$(BINUTILSPREFIX)
+endif
+ifneq ($(BINUTILSPREFIX),)
+override FPCOPT+=-Xr$(RLINKPATH)
+endif
+endif
+ifndef CROSSCOMPILE
+ifneq ($(BINUTILSPREFIX),)
+override FPCMAKEOPT+=-XP$(BINUTILSPREFIX)
+endif
+endif
+ifdef UNITDIR
+override FPCOPT+=$(addprefix -Fu,$(UNITDIR))
+endif
+ifdef LIBDIR
+override FPCOPT+=$(addprefix -Fl,$(LIBDIR))
+endif
+ifdef OBJDIR
+override FPCOPT+=$(addprefix -Fo,$(OBJDIR))
+endif
+ifdef INCDIR
+override FPCOPT+=$(addprefix -Fi,$(INCDIR))
+endif
+ifdef LINKSMART
+override FPCOPT+=-XX
+endif
+ifdef CREATESMART
+override FPCOPT+=-CX
+endif
+ifdef DEBUG
+override FPCOPT+=-gl
+override FPCOPTDEF+=DEBUG
+endif
+ifdef RELEASE
+ifneq ($(findstring 2.0.,$(FPC_VERSION)),)
+ifeq ($(CPU_TARGET),i386)
+FPCCPUOPT:=-OG2p3
+endif
+ifeq ($(CPU_TARGET),powerpc)
+FPCCPUOPT:=-O1r
+endif
+else
+FPCCPUOPT:=-O2
+endif
+override FPCOPT+=-Ur -Xs $(FPCCPUOPT) -n
+override FPCOPTDEF+=RELEASE
+endif
+ifdef STRIP
+override FPCOPT+=-Xs
+endif
+ifdef OPTIMIZE
+override FPCOPT+=-O2
+endif
+ifdef VERBOSE
+override FPCOPT+=-vwni
+endif
+ifdef COMPILER_OPTIONS
+override FPCOPT+=$(COMPILER_OPTIONS)
+endif
+ifdef COMPILER_UNITDIR
+override FPCOPT+=$(addprefix -Fu,$(COMPILER_UNITDIR))
+endif
+ifdef COMPILER_LIBRARYDIR
+override FPCOPT+=$(addprefix -Fl,$(COMPILER_LIBRARYDIR))
+endif
+ifdef COMPILER_OBJECTDIR
+override FPCOPT+=$(addprefix -Fo,$(COMPILER_OBJECTDIR))
+endif
+ifdef COMPILER_INCLUDEDIR
+override FPCOPT+=$(addprefix -Fi,$(COMPILER_INCLUDEDIR))
+endif
+ifdef CROSSBINDIR
+override FPCOPT+=-FD$(CROSSBINDIR)
+endif
+ifdef COMPILER_TARGETDIR
+override FPCOPT+=-FE$(COMPILER_TARGETDIR)
+ifeq ($(COMPILER_TARGETDIR),.)
+override TARGETDIRPREFIX=
+else
+override TARGETDIRPREFIX=$(COMPILER_TARGETDIR)/
+endif
+endif
+ifdef COMPILER_UNITTARGETDIR
+override FPCOPT+=-FU$(COMPILER_UNITTARGETDIR)
+ifeq ($(COMPILER_UNITTARGETDIR),.)
+override UNITTARGETDIRPREFIX=
+else
+override UNITTARGETDIRPREFIX=$(COMPILER_UNITTARGETDIR)/
+endif
+else
+ifdef COMPILER_TARGETDIR
+override COMPILER_UNITTARGETDIR=$(COMPILER_TARGETDIR)
+override UNITTARGETDIRPREFIX=$(TARGETDIRPREFIX)
+endif
+endif
+ifdef CREATESHARED
+override FPCOPT+=-Cg
+endif
+ifneq ($(findstring $(OS_TARGET),freebsd openbsd netbsd linux solaris),)
+ifeq ($(CPU_TARGET),x86_64)
+override FPCOPT+=-Cg
+endif
+endif
+ifdef LINKSHARED
+endif
+ifdef OPT
+override FPCOPT+=$(OPT)
+endif
+ifdef FPCOPTDEF
+override FPCOPT+=$(addprefix -d,$(FPCOPTDEF))
+endif
+ifdef CFGFILE
+override FPCOPT+=@$(CFGFILE)
+endif
+ifdef USEENV
+override FPCEXTCMD:=$(FPCOPT)
+override FPCOPT:=!FPCEXTCMD
+export FPCEXTCMD
+endif
+override AFULL_TARGET=$(CPU_TARGET)-$(OS_TARGET)
+override AFULL_SOURCE=$(CPU_SOURCE)-$(OS_SOURCE)
+ifneq ($(AFULL_TARGET),$(AFULL_SOURCE))
+override ACROSSCOMPILE=1
+endif
+ifdef ACROSSCOMPILE
+override FPCOPT+=$(CROSSOPT)
+endif
+override COMPILER:=$(FPC) $(FPCOPT)
+ifeq (,$(findstring -s ,$(COMPILER)))
+EXECPPAS=
+else
+ifeq ($(FULL_SOURCE),$(FULL_TARGET))
+ifdef RUNBATCH
+EXECPPAS:=@$(RUNBATCH) $(PPAS)
+else
+EXECPPAS:=@$(PPAS)
+endif
+endif
+endif
+.PHONY: fpc_units
+ifneq ($(TARGET_UNITS)$(TARGET_IMPLICITUNITS),)
+override ALLTARGET+=fpc_units
+override UNITPPUFILES=$(addsuffix $(PPUEXT),$(TARGET_UNITS))
+override IMPLICITUNITPPUFILES=$(addsuffix $(PPUEXT),$(TARGET_IMPLICITUNITS))
+override INSTALLPPUFILES+=$(UNITPPUFILES) $(IMPLICITUNITPPUFILES)
+override CLEANPPUFILES+=$(UNITPPUFILES) $(IMPLICITUNITPPUFILES)
+endif
+fpc_units: $(COMPILER_UNITTARGETDIR) $(UNITPPUFILES)
+ifdef TARGET_RSTS
+override RSTFILES=$(addsuffix $(RSTEXT),$(TARGET_RSTS))
+override CLEANRSTFILES+=$(RSTFILES)
+endif
+.PHONY: fpc_examples
+ifneq ($(TARGET_EXAMPLES),)
+HASEXAMPLES=1
+override EXAMPLESOURCEFILES:=$(wildcard $(addsuffix .pp,$(TARGET_EXAMPLES)) $(addsuffix .pas,$(TARGET_EXAMPLES)) $(addsuffix .lpr,$(TARGET_EXAMPLES)) $(addsuffix .dpr,$(TARGET_EXAMPLES)))
+override EXAMPLEFILES:=$(addsuffix $(EXEEXT),$(TARGET_EXAMPLES))
+override EXAMPLEOFILES:=$(addsuffix $(OEXT),$(TARGET_EXAMPLES)) $(addprefix $(STATICLIBPREFIX),$(addsuffix $(STATICLIBEXT),$(TARGET_EXAMPLES))) $(addprefix $(IMPORTLIBPREFIX),$(addsuffix $(STATICLIBEXT),$(TARGET_EXAMPLES)))
+override EXAMPLEDBGFILES:=$(addsuffix $(EXEDBGEXT),$(TARGET_EXAMPLES))
+override CLEANEXEFILES+=$(EXAMPLEFILES) $(EXAMPLEOFILES)
+override CLEANEXEDBGFILES+=$(EXAMPLEDBGFILES)
+ifeq ($(OS_TARGET),os2)
+override CLEANEXEFILES+=$(addsuffix $(AOUTEXT),$(TARGET_EXAMPLES))
+endif
+ifeq ($(OS_TARGET),emx)
+override CLEANEXEFILES+=$(addsuffix $(AOUTEXT),$(TARGET_EXAMPLES))
+endif
+endif
+ifneq ($(TARGET_EXAMPLEDIRS),)
+HASEXAMPLES=1
+endif
+fpc_examples: all $(EXAMPLEFILES) $(addsuffix _all,$(TARGET_EXAMPLEDIRS))
+.PHONY: fpc_all fpc_smart fpc_debug fpc_release fpc_shared
+$(FPCMADE): $(ALLDEPENDENCIES) $(ALLTARGET)
+	@$(ECHOREDIR) Compiled > $(FPCMADE)
+fpc_all: $(FPCMADE)
+fpc_smart:
+	$(MAKE) all LINKSMART=1 CREATESMART=1
+fpc_debug:
+	$(MAKE) all DEBUG=1
+fpc_release:
+	$(MAKE) all RELEASE=1
+.SUFFIXES: $(EXEEXT) $(PPUEXT) $(OEXT) .pas .lpr .dpr .pp .rc .res
+$(COMPILER_UNITTARGETDIR):
+	$(MKDIRTREE) $(COMPILER_UNITTARGETDIR)
+$(COMPILER_TARGETDIR):
+	$(MKDIRTREE) $(COMPILER_TARGETDIR)
+%$(PPUEXT): %.pp
+	$(COMPILER) $<
+	$(EXECPPAS)
+%$(PPUEXT): %.pas
+	$(COMPILER) $<
+	$(EXECPPAS)
+%$(EXEEXT): %.pp
+	$(COMPILER) $<
+	$(EXECPPAS)
+%$(EXEEXT): %.pas
+	$(COMPILER) $<
+	$(EXECPPAS)
+%$(EXEEXT): %.lpr
+	$(COMPILER) $<
+	$(EXECPPAS)
+%$(EXEEXT): %.dpr
+	$(COMPILER) $<
+	$(EXECPPAS)
+%.res: %.rc
+	windres -i $< -o $@
+vpath %.pp $(COMPILER_SOURCEDIR) $(COMPILER_INCLUDEDIR)
+vpath %.pas $(COMPILER_SOURCEDIR) $(COMPILER_INCLUDEDIR)
+vpath %.lpr $(COMPILER_SOURCEDIR) $(COMPILER_INCLUDEDIR)
+vpath %.dpr $(COMPILER_SOURCEDIR) $(COMPILER_INCLUDEDIR)
+vpath %.inc $(COMPILER_INCLUDEDIR)
+vpath %$(OEXT) $(COMPILER_UNITTARGETDIR)
+vpath %$(PPUEXT) $(COMPILER_UNITTARGETDIR)
+.PHONY: fpc_shared
+override INSTALLTARGET+=fpc_shared_install
+ifndef SHARED_LIBVERSION
+SHARED_LIBVERSION=$(FPC_VERSION)
+endif
+ifndef SHARED_LIBNAME
+SHARED_LIBNAME=$(PACKAGE_NAME)
+endif
+ifndef SHARED_FULLNAME
+SHARED_FULLNAME=$(SHAREDLIBPREFIX)$(SHARED_LIBNAME)-$(SHARED_LIBVERSION)$(SHAREDLIBEXT)
+endif
+ifndef SHARED_LIBUNITS
+SHARED_LIBUNITS:=$(TARGET_UNITS) $(TARGET_IMPLICITUNITS)
+override SHARED_LIBUNITS:=$(filter-out $(INSTALL_BUILDUNIT),$(SHARED_LIBUNITS))
+endif
+fpc_shared:
+ifdef HASSHAREDLIB
+	$(MAKE) all CREATESHARED=1 LINKSHARED=1 CREATESMART=1
+ifneq ($(SHARED_BUILD),n)
+	$(PPUMOVE) -q $(SHARED_LIBUNITS) -i$(COMPILER_UNITTARGETDIR) -o$(SHARED_FULLNAME) -d$(COMPILER_UNITTARGETDIR)
+endif
+else
+	@$(ECHO) Shared Libraries not supported
+endif
+fpc_shared_install:
+ifneq ($(SHARED_BUILD),n)
+ifneq ($(SHARED_LIBUNITS),)
+ifneq ($(wildcard $(COMPILER_UNITTARGETDIR)/$(SHARED_FULLNAME)),)
+	$(INSTALL) $(COMPILER_UNITTARGETDIR)/$(SHARED_FULLNAME) $(INSTALL_SHAREDDIR)
+endif
+endif
+endif
+.PHONY: fpc_install fpc_sourceinstall fpc_exampleinstall
+ifdef INSTALL_UNITS
+override INSTALLPPUFILES+=$(addsuffix $(PPUEXT),$(INSTALL_UNITS))
+endif
+ifdef INSTALL_BUILDUNIT
+override INSTALLPPUFILES:=$(filter-out $(INSTALL_BUILDUNIT)$(PPUEXT),$(INSTALLPPUFILES))
+endif
+ifdef INSTALLPPUFILES
+override INSTALLPPULINKFILES:=$(subst $(PPUEXT),$(OEXT),$(INSTALLPPUFILES)) $(addprefix $(STATICLIBPREFIX),$(subst $(PPUEXT),$(STATICLIBEXT),$(INSTALLPPUFILES))) $(addprefix $(IMPORTLIBPREFIX),$(subst $(PPUEXT),$(STATICLIBEXT),$(INSTALLPPUFILES)))
+ifneq ($(UNITTARGETDIRPREFIX),)
+override INSTALLPPUFILES:=$(addprefix $(UNITTARGETDIRPREFIX),$(notdir $(INSTALLPPUFILES)))
+override INSTALLPPULINKFILES:=$(wildcard $(addprefix $(UNITTARGETDIRPREFIX),$(notdir $(INSTALLPPULINKFILES))))
+endif
+override INSTALL_CREATEPACKAGEFPC=1
+endif
+ifdef INSTALLEXEFILES
+ifneq ($(TARGETDIRPREFIX),)
+override INSTALLEXEFILES:=$(addprefix $(TARGETDIRPREFIX),$(notdir $(INSTALLEXEFILES)))
+endif
+endif
+fpc_install: all $(INSTALLTARGET)
+ifdef INSTALLEXEFILES
+	$(MKDIR) $(INSTALL_BINDIR)
+	$(INSTALLEXE) $(INSTALLEXEFILES) $(INSTALL_BINDIR)
+endif
+ifdef INSTALL_CREATEPACKAGEFPC
+ifdef FPCMAKE
+ifdef PACKAGE_VERSION
+ifneq ($(wildcard Makefile.fpc),)
+	$(FPCMAKE) -p -T$(CPU_TARGET)-$(OS_TARGET) Makefile.fpc
+	$(MKDIR) $(INSTALL_UNITDIR)
+	$(INSTALL) Package.fpc $(INSTALL_UNITDIR)
+endif
+endif
+endif
+endif
+ifdef INSTALLPPUFILES
+	$(MKDIR) $(INSTALL_UNITDIR)
+	$(INSTALL) $(INSTALLPPUFILES) $(INSTALL_UNITDIR)
+ifneq ($(INSTALLPPULINKFILES),)
+	$(INSTALL) $(INSTALLPPULINKFILES) $(INSTALL_UNITDIR)
+endif
+ifneq ($(wildcard $(LIB_FULLNAME)),)
+	$(MKDIR) $(INSTALL_LIBDIR)
+	$(INSTALL) $(LIB_FULLNAME) $(INSTALL_LIBDIR)
+ifdef inUnix
+	ln -sf $(LIB_FULLNAME) $(INSTALL_LIBDIR)/$(LIB_NAME)
+endif
+endif
+endif
+ifdef INSTALL_FILES
+	$(MKDIR) $(INSTALL_DATADIR)
+	$(INSTALL) $(INSTALL_FILES) $(INSTALL_DATADIR)
+endif
+fpc_sourceinstall: distclean
+	$(MKDIR) $(INSTALL_SOURCEDIR)
+	$(COPYTREE) $(BASEDIR)/* $(INSTALL_SOURCEDIR)
+fpc_exampleinstall: $(addsuffix _distclean,$(TARGET_EXAMPLEDIRS))
+ifdef HASEXAMPLES
+	$(MKDIR) $(INSTALL_EXAMPLEDIR)
+endif
+ifdef EXAMPLESOURCEFILES
+	$(COPY) $(EXAMPLESOURCEFILES) $(INSTALL_EXAMPLEDIR)
+endif
+ifdef TARGET_EXAMPLEDIRS
+	$(COPYTREE) $(addsuffix /*,$(TARGET_EXAMPLEDIRS)) $(INSTALL_EXAMPLEDIR)
+endif
+.PHONY: fpc_distinstall
+fpc_distinstall: install exampleinstall
+.PHONY: fpc_zipinstall fpc_zipsourceinstall fpc_zipexampleinstall
+ifndef PACKDIR
+ifndef inUnix
+PACKDIR=$(BASEDIR)/../fpc-pack
+else
+PACKDIR=/tmp/fpc-pack
+endif
+endif
+ifndef ZIPNAME
+ifdef DIST_ZIPNAME
+ZIPNAME=$(DIST_ZIPNAME)
+else
+ZIPNAME=$(PACKAGE_NAME)
+endif
+endif
+ifndef FULLZIPNAME
+FULLZIPNAME=$(ZIPCROSSPREFIX)$(ZIPPREFIX)$(ZIPNAME)$(ZIPSUFFIX)
+endif
+ifndef ZIPTARGET
+ifdef DIST_ZIPTARGET
+ZIPTARGET=DIST_ZIPTARGET
+else
+ZIPTARGET=install
+endif
+endif
+ifndef USEZIP
+ifdef inUnix
+USETAR=1
+endif
+endif
+ifndef inUnix
+USEZIPWRAPPER=1
+endif
+ifdef USEZIPWRAPPER
+ZIPPATHSEP=$(PATHSEP)
+ZIPWRAPPER=$(subst /,$(PATHSEP),$(DIST_DESTDIR)/fpczip$(SRCBATCHEXT))
+else
+ZIPPATHSEP=/
+endif
+ZIPCMD_CDPACK:=cd $(subst /,$(ZIPPATHSEP),$(PACKDIR))
+ZIPCMD_CDBASE:=cd $(subst /,$(ZIPPATHSEP),$(BASEDIR))
+ifdef USETAR
+ZIPDESTFILE:=$(DIST_DESTDIR)/$(FULLZIPNAME)$(TAREXT)
+ZIPCMD_ZIP:=$(TARPROG) c$(TAROPT)f $(ZIPDESTFILE) *
+else
+ZIPDESTFILE:=$(DIST_DESTDIR)/$(FULLZIPNAME)$(ZIPEXT)
+ZIPCMD_ZIP:=$(subst /,$(ZIPPATHSEP),$(ZIPPROG)) -Dr $(ZIPOPT) $(ZIPDESTFILE) *
+endif
+fpc_zipinstall:
+	$(MAKE) $(ZIPTARGET) INSTALL_PREFIX=$(PACKDIR) ZIPINSTALL=1
+	$(MKDIR) $(DIST_DESTDIR)
+	$(DEL) $(ZIPDESTFILE)
+ifdef USEZIPWRAPPER
+ifneq ($(ECHOREDIR),echo)
+	$(ECHOREDIR) -e "$(subst \,\\,$(ZIPCMD_CDPACK))" > $(ZIPWRAPPER)
+	$(ECHOREDIR) -e "$(subst \,\\,$(ZIPCMD_ZIP))" >> $(ZIPWRAPPER)
+	$(ECHOREDIR) -e "$(subst \,\\,$(ZIPCMD_CDBASE))" >> $(ZIPWRAPPER)
+else
+	echo $(ZIPCMD_CDPACK) > $(ZIPWRAPPER)
+	echo $(ZIPCMD_ZIP) >> $(ZIPWRAPPER)
+	echo $(ZIPCMD_CDBASE) >> $(ZIPWRAPPER)
+endif
+ifdef inUnix
+	/bin/sh $(ZIPWRAPPER)
+else
+ifdef RUNBATCH
+	$(RUNBATCH) $(ZIPWRAPPER)
+else
+	$(ZIPWRAPPER)
+endif
+endif
+	$(DEL) $(ZIPWRAPPER)
+else
+	$(ZIPCMD_CDPACK) ; $(ZIPCMD_ZIP) ; $(ZIPCMD_CDBASE)
+endif
+	$(DELTREE) $(PACKDIR)
+fpc_zipsourceinstall:
+	$(MAKE) fpc_zipinstall ZIPTARGET=sourceinstall ZIPSUFFIX=$(ZIPSOURCESUFFIX)
+fpc_zipexampleinstall:
+ifdef HASEXAMPLES
+	$(MAKE) fpc_zipinstall ZIPTARGET=exampleinstall ZIPSUFFIX=$(ZIPEXAMPLESUFFIX)
+endif
+fpc_zipdistinstall:
+	$(MAKE) fpc_zipinstall ZIPTARGET=distinstall
+.PHONY: fpc_clean fpc_cleanall fpc_distclean
+ifdef EXEFILES
+override CLEANEXEFILES:=$(addprefix $(TARGETDIRPREFIX),$(CLEANEXEFILES))
+override CLEANEXEDBGFILES:=$(addprefix $(TARGETDIRPREFIX),$(CLEANEXEDBGFILES))
+endif
+ifdef CLEAN_PROGRAMS
+override CLEANEXEFILES+=$(addprefix $(TARGETDIRPREFIX),$(addsuffix $(EXEEXT), $(CLEAN_PROGRAMS)))
+override CLEANEXEDBGFILES+=$(addprefix $(TARGETDIRPREFIX),$(addsuffix $(EXEDBGEXT), $(CLEAN_PROGRAMS)))
+endif
+ifdef CLEAN_UNITS
+override CLEANPPUFILES+=$(addsuffix $(PPUEXT),$(CLEAN_UNITS))
+endif
+ifdef CLEANPPUFILES
+override CLEANPPULINKFILES:=$(subst $(PPUEXT),$(OEXT),$(CLEANPPUFILES)) $(addprefix $(STATICLIBPREFIX),$(subst $(PPUEXT),$(STATICLIBEXT),$(CLEANPPUFILES))) $(addprefix $(IMPORTLIBPREFIX),$(subst $(PPUEXT),$(STATICLIBEXT),$(CLEANPPUFILES)))
+ifdef DEBUGSYMEXT
+override CLEANPPULINKFILES+=$(subst $(PPUEXT),$(DEBUGSYMEXT),$(CLEANPPUFILES))
+endif
+override CLEANPPUFILES:=$(addprefix $(UNITTARGETDIRPREFIX),$(CLEANPPUFILES))
+override CLEANPPULINKFILES:=$(wildcard $(addprefix $(UNITTARGETDIRPREFIX),$(CLEANPPULINKFILES)))
+endif
+fpc_clean: $(CLEANTARGET)
+ifdef CLEANEXEFILES
+	-$(DEL) $(CLEANEXEFILES)
+endif
+ifdef CLEANEXEDBGFILES
+	-$(DELTREE) $(CLEANEXEDBGFILES)
+endif
+ifdef CLEANPPUFILES
+	-$(DEL) $(CLEANPPUFILES)
+endif
+ifneq ($(CLEANPPULINKFILES),)
+	-$(DEL) $(CLEANPPULINKFILES)
+endif
+ifdef CLEANRSTFILES
+	-$(DEL) $(addprefix $(UNITTARGETDIRPREFIX),$(CLEANRSTFILES))
+endif
+ifdef CLEAN_FILES
+	-$(DEL) $(CLEAN_FILES)
+endif
+ifdef LIB_NAME
+	-$(DEL) $(LIB_NAME) $(LIB_FULLNAME)
+endif
+	-$(DEL) $(FPCMADE) Package.fpc $(PPAS) script.res link.res $(FPCEXTFILE) $(REDIRFILE)
+	-$(DEL) *$(ASMEXT) *_ppas$(BATCHEXT)
+fpc_cleanall: $(CLEANTARGET)
+ifdef CLEANEXEFILES
+	-$(DEL) $(CLEANEXEFILES)
+endif
+ifdef COMPILER_UNITTARGETDIR
+ifdef CLEANPPUFILES
+	-$(DEL) $(CLEANPPUFILES)
+endif
+ifneq ($(CLEANPPULINKFILES),)
+	-$(DEL) $(CLEANPPULINKFILES)
+endif
+ifdef CLEANRSTFILES
+	-$(DEL) $(addprefix $(UNITTARGETDIRPREFIX),$(CLEANRSTFILES))
+endif
+endif
+ifdef CLEAN_FILES
+	-$(DEL) $(CLEAN_FILES)
+endif
+	-$(DELTREE) units
+	-$(DEL) *$(OEXT) *$(PPUEXT) *$(RSTEXT) *$(ASMEXT) *$(STATICLIBEXT) *$(SHAREDLIBEXT) *$(PPLEXT)
+ifneq ($(PPUEXT),.ppu)
+	-$(DEL) *.o *.ppu *.a
+endif
+	-$(DELTREE) *$(SMARTEXT)
+	-$(DEL) fpcmade.* Package.fpc $(PPAS) script.res link.res $(FPCEXTFILE) $(REDIRFILE)
+	-$(DEL) *_ppas$(BATCHEXT)
+ifdef AOUTEXT
+	-$(DEL) *$(AOUTEXT)
+endif
+ifdef DEBUGSYMEXT
+	-$(DEL) *$(DEBUGSYMEXT)
+endif
+fpc_distclean: cleanall
+.PHONY: fpc_baseinfo
+override INFORULES+=fpc_baseinfo
+fpc_baseinfo:
+	@$(ECHO)
+	@$(ECHO)  == Package info ==
+	@$(ECHO)  Package Name..... $(PACKAGE_NAME)
+	@$(ECHO)  Package Version.. $(PACKAGE_VERSION)
+	@$(ECHO)
+	@$(ECHO)  == Configuration info ==
+	@$(ECHO)
+	@$(ECHO)  FPC.......... $(FPC)
+	@$(ECHO)  FPC Version.. $(FPC_VERSION)
+	@$(ECHO)  Source CPU... $(CPU_SOURCE)
+	@$(ECHO)  Target CPU... $(CPU_TARGET)
+	@$(ECHO)  Source OS.... $(OS_SOURCE)
+	@$(ECHO)  Target OS.... $(OS_TARGET)
+	@$(ECHO)  Full Source.. $(FULL_SOURCE)
+	@$(ECHO)  Full Target.. $(FULL_TARGET)
+	@$(ECHO)  SourceSuffix. $(SOURCESUFFIX)
+	@$(ECHO)  TargetSuffix. $(TARGETSUFFIX)
+	@$(ECHO)  FPC fpmake... $(FPCFPMAKE)
+	@$(ECHO)
+	@$(ECHO)  == Directory info ==
+	@$(ECHO)
+	@$(ECHO)  Required pkgs... $(REQUIRE_PACKAGES)
+	@$(ECHO)
+	@$(ECHO)  Basedir......... $(BASEDIR)
+	@$(ECHO)  FPCDir.......... $(FPCDIR)
+	@$(ECHO)  CrossBinDir..... $(CROSSBINDIR)
+	@$(ECHO)  UnitsDir........ $(UNITSDIR)
+	@$(ECHO)  PackagesDir..... $(PACKAGESDIR)
+	@$(ECHO)
+	@$(ECHO)  GCC library..... $(GCCLIBDIR)
+	@$(ECHO)  Other library... $(OTHERLIBDIR)
+	@$(ECHO)
+	@$(ECHO)  == Tools info ==
+	@$(ECHO)
+	@$(ECHO)  As........ $(AS)
+	@$(ECHO)  Ld........ $(LD)
+	@$(ECHO)  Ar........ $(AR)
+	@$(ECHO)  Rc........ $(RC)
+	@$(ECHO)
+	@$(ECHO)  Mv........ $(MVPROG)
+	@$(ECHO)  Cp........ $(CPPROG)
+	@$(ECHO)  Rm........ $(RMPROG)
+	@$(ECHO)  GInstall.. $(GINSTALL)
+	@$(ECHO)  Echo...... $(ECHO)
+	@$(ECHO)  Shell..... $(SHELL)
+	@$(ECHO)  Date...... $(DATE)
+	@$(ECHO)  FPCMake... $(FPCMAKE)
+	@$(ECHO)  PPUMove... $(PPUMOVE)
+	@$(ECHO)  Zip....... $(ZIPPROG)
+	@$(ECHO)
+	@$(ECHO)  == Object info ==
+	@$(ECHO)
+	@$(ECHO)  Target Loaders........ $(TARGET_LOADERS)
+	@$(ECHO)  Target Units.......... $(TARGET_UNITS)
+	@$(ECHO)  Target Implicit Units. $(TARGET_IMPLICITUNITS)
+	@$(ECHO)  Target Programs....... $(TARGET_PROGRAMS)
+	@$(ECHO)  Target Dirs........... $(TARGET_DIRS)
+	@$(ECHO)  Target Examples....... $(TARGET_EXAMPLES)
+	@$(ECHO)  Target ExampleDirs.... $(TARGET_EXAMPLEDIRS)
+	@$(ECHO)
+	@$(ECHO)  Clean Units......... $(CLEAN_UNITS)
+	@$(ECHO)  Clean Files......... $(CLEAN_FILES)
+	@$(ECHO)
+	@$(ECHO)  Install Units....... $(INSTALL_UNITS)
+	@$(ECHO)  Install Files....... $(INSTALL_FILES)
+	@$(ECHO)
+	@$(ECHO)  == Install info ==
+	@$(ECHO)
+	@$(ECHO)  DateStr.............. $(DATESTR)
+	@$(ECHO)  ZipName.............. $(ZIPNAME)
+	@$(ECHO)  ZipPrefix............ $(ZIPPREFIX)
+	@$(ECHO)  ZipCrossPrefix....... $(ZIPCROSSPREFIX)
+	@$(ECHO)  ZipSuffix............ $(ZIPSUFFIX)
+	@$(ECHO)  FullZipName.......... $(FULLZIPNAME)
+	@$(ECHO)  Install FPC Package.. $(INSTALL_FPCPACKAGE)
+	@$(ECHO)
+	@$(ECHO)  Install base dir..... $(INSTALL_BASEDIR)
+	@$(ECHO)  Install binary dir... $(INSTALL_BINDIR)
+	@$(ECHO)  Install library dir.. $(INSTALL_LIBDIR)
+	@$(ECHO)  Install units dir.... $(INSTALL_UNITDIR)
+	@$(ECHO)  Install source dir... $(INSTALL_SOURCEDIR)
+	@$(ECHO)  Install doc dir...... $(INSTALL_DOCDIR)
+	@$(ECHO)  Install example dir.. $(INSTALL_EXAMPLEDIR)
+	@$(ECHO)  Install data dir..... $(INSTALL_DATADIR)
+	@$(ECHO)
+	@$(ECHO)  Dist destination dir. $(DIST_DESTDIR)
+	@$(ECHO)  Dist zip name........ $(DIST_ZIPNAME)
+	@$(ECHO)
+.PHONY: fpc_info
+fpc_info: $(INFORULES)
+.PHONY: fpc_makefile fpc_makefiles fpc_makefile_sub1 fpc_makefile_sub2 \
+	fpc_makefile_dirs
+fpc_makefile:
+	$(FPCMAKE) -w -T$(OS_TARGET) Makefile.fpc
+fpc_makefile_sub1:
+ifdef TARGET_DIRS
+	$(FPCMAKE) -w -T$(OS_TARGET) $(addsuffix /Makefile.fpc,$(TARGET_DIRS))
+endif
+ifdef TARGET_EXAMPLEDIRS
+	$(FPCMAKE) -w -T$(OS_TARGET) $(addsuffix /Makefile.fpc,$(TARGET_EXAMPLEDIRS))
+endif
+fpc_makefile_sub2: $(addsuffix _makefile_dirs,$(TARGET_DIRS) $(TARGET_EXAMPLEDIRS))
+fpc_makefile_dirs: fpc_makefile_sub1 fpc_makefile_sub2
+fpc_makefiles: fpc_makefile fpc_makefile_dirs
+ifeq ($(FULL_TARGET),i386-linux)
+TARGET_EXAMPLEDIRS_EXAMPLES=1
+endif
+ifeq ($(FULL_TARGET),i386-go32v2)
+TARGET_EXAMPLEDIRS_EXAMPLES=1
+endif
+ifeq ($(FULL_TARGET),i386-win32)
+TARGET_EXAMPLEDIRS_EXAMPLES=1
+endif
+ifeq ($(FULL_TARGET),i386-os2)
+TARGET_EXAMPLEDIRS_EXAMPLES=1
+endif
+ifeq ($(FULL_TARGET),i386-freebsd)
+TARGET_EXAMPLEDIRS_EXAMPLES=1
+endif
+ifeq ($(FULL_TARGET),i386-beos)
+TARGET_EXAMPLEDIRS_EXAMPLES=1
+endif
+ifeq ($(FULL_TARGET),i386-haiku)
+TARGET_EXAMPLEDIRS_EXAMPLES=1
+endif
+ifeq ($(FULL_TARGET),i386-netbsd)
+TARGET_EXAMPLEDIRS_EXAMPLES=1
+endif
+ifeq ($(FULL_TARGET),i386-solaris)
+TARGET_EXAMPLEDIRS_EXAMPLES=1
+endif
+ifeq ($(FULL_TARGET),i386-qnx)
+TARGET_EXAMPLEDIRS_EXAMPLES=1
+endif
+ifeq ($(FULL_TARGET),i386-netware)
+TARGET_EXAMPLEDIRS_EXAMPLES=1
+endif
+ifeq ($(FULL_TARGET),i386-openbsd)
+TARGET_EXAMPLEDIRS_EXAMPLES=1
+endif
+ifeq ($(FULL_TARGET),i386-wdosx)
+TARGET_EXAMPLEDIRS_EXAMPLES=1
+endif
+ifeq ($(FULL_TARGET),i386-darwin)
+TARGET_EXAMPLEDIRS_EXAMPLES=1
+endif
+ifeq ($(FULL_TARGET),i386-emx)
+TARGET_EXAMPLEDIRS_EXAMPLES=1
+endif
+ifeq ($(FULL_TARGET),i386-watcom)
+TARGET_EXAMPLEDIRS_EXAMPLES=1
+endif
+ifeq ($(FULL_TARGET),i386-netwlibc)
+TARGET_EXAMPLEDIRS_EXAMPLES=1
+endif
+ifeq ($(FULL_TARGET),i386-wince)
+TARGET_EXAMPLEDIRS_EXAMPLES=1
+endif
+ifeq ($(FULL_TARGET),i386-embedded)
+TARGET_EXAMPLEDIRS_EXAMPLES=1
+endif
+ifeq ($(FULL_TARGET),i386-symbian)
+TARGET_EXAMPLEDIRS_EXAMPLES=1
+endif
+ifeq ($(FULL_TARGET),i386-nativent)
+TARGET_EXAMPLEDIRS_EXAMPLES=1
+endif
+ifeq ($(FULL_TARGET),i386-iphonesim)
+TARGET_EXAMPLEDIRS_EXAMPLES=1
+endif
+ifeq ($(FULL_TARGET),i386-android)
+TARGET_EXAMPLEDIRS_EXAMPLES=1
+endif
+ifeq ($(FULL_TARGET),m68k-linux)
+TARGET_EXAMPLEDIRS_EXAMPLES=1
+endif
+ifeq ($(FULL_TARGET),m68k-freebsd)
+TARGET_EXAMPLEDIRS_EXAMPLES=1
+endif
+ifeq ($(FULL_TARGET),m68k-netbsd)
+TARGET_EXAMPLEDIRS_EXAMPLES=1
+endif
+ifeq ($(FULL_TARGET),m68k-amiga)
+TARGET_EXAMPLEDIRS_EXAMPLES=1
+endif
+ifeq ($(FULL_TARGET),m68k-atari)
+TARGET_EXAMPLEDIRS_EXAMPLES=1
+endif
+ifeq ($(FULL_TARGET),m68k-openbsd)
+TARGET_EXAMPLEDIRS_EXAMPLES=1
+endif
+ifeq ($(FULL_TARGET),m68k-palmos)
+TARGET_EXAMPLEDIRS_EXAMPLES=1
+endif
+ifeq ($(FULL_TARGET),m68k-embedded)
+TARGET_EXAMPLEDIRS_EXAMPLES=1
+endif
+ifeq ($(FULL_TARGET),powerpc-linux)
+TARGET_EXAMPLEDIRS_EXAMPLES=1
+endif
+ifeq ($(FULL_TARGET),powerpc-netbsd)
+TARGET_EXAMPLEDIRS_EXAMPLES=1
+endif
+ifeq ($(FULL_TARGET),powerpc-amiga)
+TARGET_EXAMPLEDIRS_EXAMPLES=1
+endif
+ifeq ($(FULL_TARGET),powerpc-macos)
+TARGET_EXAMPLEDIRS_EXAMPLES=1
+endif
+ifeq ($(FULL_TARGET),powerpc-darwin)
+TARGET_EXAMPLEDIRS_EXAMPLES=1
+endif
+ifeq ($(FULL_TARGET),powerpc-morphos)
+TARGET_EXAMPLEDIRS_EXAMPLES=1
+endif
+ifeq ($(FULL_TARGET),powerpc-embedded)
+TARGET_EXAMPLEDIRS_EXAMPLES=1
+endif
+ifeq ($(FULL_TARGET),powerpc-wii)
+TARGET_EXAMPLEDIRS_EXAMPLES=1
+endif
+ifeq ($(FULL_TARGET),powerpc-aix)
+TARGET_EXAMPLEDIRS_EXAMPLES=1
+endif
+ifeq ($(FULL_TARGET),sparc-linux)
+TARGET_EXAMPLEDIRS_EXAMPLES=1
+endif
+ifeq ($(FULL_TARGET),sparc-netbsd)
+TARGET_EXAMPLEDIRS_EXAMPLES=1
+endif
+ifeq ($(FULL_TARGET),sparc-solaris)
+TARGET_EXAMPLEDIRS_EXAMPLES=1
+endif
+ifeq ($(FULL_TARGET),sparc-embedded)
+TARGET_EXAMPLEDIRS_EXAMPLES=1
+endif
+ifeq ($(FULL_TARGET),x86_64-linux)
+TARGET_EXAMPLEDIRS_EXAMPLES=1
+endif
+ifeq ($(FULL_TARGET),x86_64-freebsd)
+TARGET_EXAMPLEDIRS_EXAMPLES=1
+endif
+ifeq ($(FULL_TARGET),x86_64-netbsd)
+TARGET_EXAMPLEDIRS_EXAMPLES=1
+endif
+ifeq ($(FULL_TARGET),x86_64-solaris)
+TARGET_EXAMPLEDIRS_EXAMPLES=1
+endif
+ifeq ($(FULL_TARGET),x86_64-openbsd)
+TARGET_EXAMPLEDIRS_EXAMPLES=1
+endif
+ifeq ($(FULL_TARGET),x86_64-darwin)
+TARGET_EXAMPLEDIRS_EXAMPLES=1
+endif
+ifeq ($(FULL_TARGET),x86_64-win64)
+TARGET_EXAMPLEDIRS_EXAMPLES=1
+endif
+ifeq ($(FULL_TARGET),x86_64-embedded)
+TARGET_EXAMPLEDIRS_EXAMPLES=1
+endif
+ifeq ($(FULL_TARGET),arm-linux)
+TARGET_EXAMPLEDIRS_EXAMPLES=1
+endif
+ifeq ($(FULL_TARGET),arm-palmos)
+TARGET_EXAMPLEDIRS_EXAMPLES=1
+endif
+ifeq ($(FULL_TARGET),arm-darwin)
+TARGET_EXAMPLEDIRS_EXAMPLES=1
+endif
+ifeq ($(FULL_TARGET),arm-wince)
+TARGET_EXAMPLEDIRS_EXAMPLES=1
+endif
+ifeq ($(FULL_TARGET),arm-gba)
+TARGET_EXAMPLEDIRS_EXAMPLES=1
+endif
+ifeq ($(FULL_TARGET),arm-nds)
+TARGET_EXAMPLEDIRS_EXAMPLES=1
+endif
+ifeq ($(FULL_TARGET),arm-embedded)
+TARGET_EXAMPLEDIRS_EXAMPLES=1
+endif
+ifeq ($(FULL_TARGET),arm-symbian)
+TARGET_EXAMPLEDIRS_EXAMPLES=1
+endif
+ifeq ($(FULL_TARGET),arm-android)
+TARGET_EXAMPLEDIRS_EXAMPLES=1
+endif
+ifeq ($(FULL_TARGET),powerpc64-linux)
+TARGET_EXAMPLEDIRS_EXAMPLES=1
+endif
+ifeq ($(FULL_TARGET),powerpc64-darwin)
+TARGET_EXAMPLEDIRS_EXAMPLES=1
+endif
+ifeq ($(FULL_TARGET),powerpc64-embedded)
+TARGET_EXAMPLEDIRS_EXAMPLES=1
+endif
+ifeq ($(FULL_TARGET),powerpc64-aix)
+TARGET_EXAMPLEDIRS_EXAMPLES=1
+endif
+ifeq ($(FULL_TARGET),avr-embedded)
+TARGET_EXAMPLEDIRS_EXAMPLES=1
+endif
+ifeq ($(FULL_TARGET),armeb-linux)
+TARGET_EXAMPLEDIRS_EXAMPLES=1
+endif
+ifeq ($(FULL_TARGET),armeb-embedded)
+TARGET_EXAMPLEDIRS_EXAMPLES=1
+endif
+ifeq ($(FULL_TARGET),mips-linux)
+TARGET_EXAMPLEDIRS_EXAMPLES=1
+endif
+ifeq ($(FULL_TARGET),mipsel-linux)
+TARGET_EXAMPLEDIRS_EXAMPLES=1
+endif
+ifeq ($(FULL_TARGET),jvm-java)
+TARGET_EXAMPLEDIRS_EXAMPLES=1
+endif
+ifeq ($(FULL_TARGET),jvm-android)
+TARGET_EXAMPLEDIRS_EXAMPLES=1
+endif
+ifeq ($(FULL_TARGET),i8086-msdos)
+TARGET_EXAMPLEDIRS_EXAMPLES=1
+endif
+ifdef TARGET_EXAMPLEDIRS_EXAMPLES
+examples_all:
+	$(MAKE) -C examples all
+examples_debug:
+	$(MAKE) -C examples debug
+examples_smart:
+	$(MAKE) -C examples smart
+examples_release:
+	$(MAKE) -C examples release
+examples_units:
+	$(MAKE) -C examples units
+examples_examples:
+	$(MAKE) -C examples examples
+examples_shared:
+	$(MAKE) -C examples shared
+examples_install:
+	$(MAKE) -C examples install
+examples_sourceinstall:
+	$(MAKE) -C examples sourceinstall
+examples_exampleinstall:
+	$(MAKE) -C examples exampleinstall
+examples_distinstall:
+	$(MAKE) -C examples distinstall
+examples_zipinstall:
+	$(MAKE) -C examples zipinstall
+examples_zipsourceinstall:
+	$(MAKE) -C examples zipsourceinstall
+examples_zipexampleinstall:
+	$(MAKE) -C examples zipexampleinstall
+examples_zipdistinstall:
+	$(MAKE) -C examples zipdistinstall
+examples_clean:
+	$(MAKE) -C examples clean
+examples_distclean:
+	$(MAKE) -C examples distclean
+examples_cleanall:
+	$(MAKE) -C examples cleanall
+examples_info:
+	$(MAKE) -C examples info
+examples_makefiles:
+	$(MAKE) -C examples makefiles
+examples:
+	$(MAKE) -C examples all
+.PHONY: examples_all examples_debug examples_smart examples_release examples_units examples_examples examples_shared examples_install examples_sourceinstall examples_exampleinstall examples_distinstall examples_zipinstall examples_zipsourceinstall examples_zipexampleinstall examples_zipdistinstall examples_clean examples_distclean examples_cleanall examples_info examples_makefiles examples
+endif
+all: fpc_all
+debug: fpc_debug
+smart: fpc_smart
+release: fpc_release
+units: fpc_units
+examples: fpc_examples
+shared: fpc_shared
+install: fpc_install
+sourceinstall: fpc_sourceinstall
+exampleinstall: fpc_exampleinstall
+distinstall: fpc_distinstall
+zipinstall: fpc_zipinstall
+zipsourceinstall: fpc_zipsourceinstall
+zipexampleinstall: fpc_zipexampleinstall
+zipdistinstall: fpc_zipdistinstall
+clean: fpc_clean $(addsuffix _clean,$(TARGET_EXAMPLEDIRS))
+distclean: fpc_distclean
+cleanall: fpc_cleanall
+info: fpc_info
+makefiles: fpc_makefiles
+.PHONY: all debug smart release units examples shared install sourceinstall exampleinstall distinstall zipinstall zipsourceinstall zipexampleinstall zipdistinstall clean distclean cleanall info makefiles
+ifneq ($(wildcard fpcmake.loc),)
+include fpcmake.loc
+endif
+.NOTPARALLEL:
Index: packages/egl/Makefile.fpc
===================================================================
--- packages/egl/Makefile.fpc	(revision 0)
+++ packages/egl/Makefile.fpc	(working copy)
@@ -0,0 +1,91 @@
+#
+#   Makefile.fpc for running fpmake
+#
+
+[package]
+name=egl
+version=2.7.1
+
+[require]
+packages=rtl fpmkunit
+
+[install]
+fpcpackage=y
+
+[default]
+fpcdir=../..
+
+[prerules]
+FPMAKE_BIN_CLEAN=$(wildcard .$(PATHSEP)fpmake$(SRCEXEEXT))
+ifdef OS_TARGET
+FPC_TARGETOPT+=--os=$(OS_TARGET)
+endif
+ifdef CPU_TARGET
+FPC_TARGETOPT+=--cpu=$(CPU_TARGET)
+endif
+LOCALFPMAKE=.$(PATHSEP)fpmake$(SRCEXEEXT)
+
+[rules]
+# Do not pass the Makefile's unit and binary target locations. fpmake uses it's own.
+override FPCOPT:=$(filter-out -FU%,$(FPCOPT))
+override FPCOPT:=$(filter-out -FE%,$(FPCOPT))
+# Compose general fpmake-parameters
+ifdef FPMAKEOPT
+FPMAKE_OPT+=$(FPMAKEOPT)
+endif
+FPMAKE_OPT+=--localunitdir=../..
+FPMAKE_OPT+=--globalunitdir=..
+FPMAKE_OPT+=$(FPC_TARGETOPT)
+FPMAKE_OPT+=$(addprefix -o ,$(FPCOPT))
+FPMAKE_OPT+=--compiler=$(FPC)
+FPMAKE_OPT+=-bu
+.NOTPARALLEL:
+
+fpmake: fpmake.pp
+	$(FPCFPMAKE) fpmake.pp $(FPMAKE_SKIP_CONFIG) $(addprefix -Fu,$(COMPILER_FPMAKE_UNITDIR)) $(FPCMAKEOPT) $(OPT)
+all:	fpmake
+	$(LOCALFPMAKE) compile $(FPMAKE_OPT)
+smart:	fpmake
+	$(LOCALFPMAKE) compile $(FPMAKE_OPT) -o -XX -o -CX
+release:	fpmake
+	$(LOCALFPMAKE) compile $(FPMAKE_OPT) -o -dRELEASE
+debug:	fpmake
+	$(LOCALFPMAKE) compile $(FPMAKE_OPT) -o -dDEBUG
+# If no fpmake exists and (dist)clean is called, do not try to build fpmake, it will
+# most often fail because the dependencies are cleared.
+# In case of a clean, simply do nothing
+ifeq ($(FPMAKE_BIN_CLEAN),)
+clean:
+else
+clean:
+	$(FPMAKE_BIN_CLEAN) clean $(FPMAKE_OPT)
+endif
+# In case of a distclean, perform an 'old'-style distclean. This to avoid problems
+# when the package is compiled using fpcmake prior to running this clean using fpmake
+ifeq ($(FPMAKE_BIN_CLEAN),)
+distclean:	$(addsuffix _distclean,$(TARGET_DIRS)) fpc_cleanall
+else
+distclean:
+ifdef inUnix
+        { $(FPMAKE_BIN_CLEAN) distclean $(FPMAKE_OPT); if [ $$? != "0" ]; then { echo Something wrong with fpmake exectable. Remove the executable and call make recursively to recover.; $(DEL) $(FPMAKE_BIN_CLEAN); $(MAKE) fpc_cleanall; }; fi;  }
+else
+        $(FPMAKE_BIN_CLEAN) distclean $(FPMAKE_OPT)
+endif
+	-$(DEL) $(LOCALFPMAKE)
+endif
+cleanall: distclean
+install:	fpmake
+ifdef UNIXHier
+	$(LOCALFPMAKE) install $(FPMAKE_OPT) --prefix=$(INSTALL_PREFIX) --baseinstalldir=$(INSTALL_LIBDIR)/fpc/$(FPC_VERSION) --unitinstalldir=$(INSTALL_UNITDIR)
+else
+	$(LOCALFPMAKE) install $(FPMAKE_OPT) --prefix=$(INSTALL_BASEDIR) --unitinstalldir=$(INSTALL_UNITDIR)
+endif
+# distinstall also installs the example-sources
+distinstall:	fpmake
+ifdef UNIXHier
+	$(LOCALFPMAKE) install $(FPMAKE_OPT) --prefix=$(INSTALL_PREFIX) --baseinstalldir=$(INSTALL_LIBDIR)/fpc/$(FPC_VERSION) --unitinstalldir=$(INSTALL_UNITDIR) -ie
+else
+	$(LOCALFPMAKE) install $(FPMAKE_OPT) --prefix=$(INSTALL_BASEDIR)  --unitinstalldir=$(INSTALL_UNITDIR) -ie
+endif
+zipinstall:	fpmake
+	$(LOCALFPMAKE) zipinstall $(FPMAKE_OPT)
Index: packages/egl/Makefile.fpc.fpcmake
===================================================================
--- packages/egl/Makefile.fpc.fpcmake	(revision 0)
+++ packages/egl/Makefile.fpc.fpcmake	(working copy)
@@ -0,0 +1,29 @@
+#
+#   Makefile.fpc for EGL for FPC
+#
+
+[package]
+name=egl
+version=2.7.1
+
+[target]
+units_linux=egl
+units_wince=egl
+units_win32=egl
+units_win64=egl
+units_darwin=egl
+units_android=egl
+exampledirs=examples
+
+[install]
+fpcpackage=y
+
+[compiler]
+includedir=src
+sourcedir=src examples
+
+[default]
+fpcdir=../..
+
+[rules]
+.NOTPARALLEL:
Index: packages/egl/fpmake.pp
===================================================================
--- packages/egl/fpmake.pp	(revision 0)
+++ packages/egl/fpmake.pp	(working copy)
@@ -0,0 +1,36 @@
+{$ifndef ALLPACKAGES}
+{$mode objfpc}{$H+}
+program fpmake;
+
+uses fpmkunit;
+
+Var
+  P : TPackage;
+  T : TTarget;
+
+begin
+  With Installer do 
+    begin
+{$endif ALLPACKAGES}
+
+    P:=AddPackage('egl');
+{$ifdef ALLPACKAGES}
+    P.Directory:=ADirectory;
+{$endif ALLPACKAGES}
+    P.Version:='2.7.1';
+    P.Author := 'Free Pascal Development team';
+    P.License := 'LGPL with modification';
+    P.HomepageURL := 'www.freepascal.org';
+    P.OSes := [android,darwin,iphonesim,linux,win32,win64,wince];
+
+    P.SourcePath.Add('src');
+
+    T:=P.Targets.AddUnit('egl.pas',[linux,win32,win64,wince,darwin,android]);
+
+    P.Sources.AddExampleFiles('examples/*',false,'.');
+
+{$ifndef ALLPACKAGES}
+    Run;
+    end;
+end.
+{$endif ALLPACKAGES}
Index: packages/egl/src/egl.pas
===================================================================
--- packages/egl/src/egl.pas	(revision 0)
+++ packages/egl/src/egl.pas	(working copy)
@@ -0,0 +1,573 @@
+{** Separated from GLES/EGL by Dennis Fehr
+ **
+ ** Copyright (c) 2007-2009 The Khronos Group Inc.
+ **
+ ** Permission is hereby granted, free of charge, to any person obtaining a
+ ** copy of this software and/or associated documentation files (the
+ ** "Materials"), to deal in the Materials without restriction, including
+ ** without limitation the rights to use, copy, modify, merge, publish,
+ ** distribute, sublicense, and/or sell copies of the Materials, and to
+ ** permit persons to whom the Materials are furnished to do so, subject to
+ ** the following conditions:
+ **
+ ** The above copyright notice and this permission notice shall be included
+ ** in all copies or substantial portions of the Materials.
+ **
+ ** THE MATERIALS ARE PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
+ ** EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
+ ** MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.
+ ** IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY
+ ** CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT,
+ ** TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE 
+ ** MATERIALS OR THE USE OR OTHER DEALINGS IN THE MATERIALS.
+ **}
+unit egl;
+
+interface
+
+{$MODE objfpc}
+
+uses SysUtils,dynlibs{$ifdef windows},Windows{$endif};
+
+{$IFDEF FPC}
+  {$PACKRECORDS C}
+{$ENDIF}
+
+{ EGL Types  }
+{ EGLint is defined in eglplatform.h  }
+
+type
+
+  PEGLConfig  = ^EGLConfig;
+  PEGLInt     = ^EGLInt;
+  EGLInt      = {$IFDEF CPU64}int64{$ELSE}longint{$ENDIF};
+  EGLConfig   = pointer;
+  
+  EGLImageKHREGLConfig = pointer;
+
+  {$IF DEFINED(LINUX) }
+    EGLNativeDisplayType = ptrint;
+    EGLNativeWindowType  = cardinal;
+    EGLNativePixmapType  = cardinal;
+  {$ELSEIF DEFINED(WINDOWS) }
+    EGLNativeDisplayType = HDC;
+    EGLNativeWindowType  = HWND;
+    EGLNativePixmapType  = HBITMAP;
+  {$ELSE}
+    EGLNativeDisplayType = ptrint;
+    EGLNativeWindowType  = pointer;
+    EGLNativePixmapType  = pointer;
+  {$ENDIF}
+
+  EGLBoolean      = dword;
+  EGLenum         = dword;
+  EGLContext      = pointer;
+  EGLDisplay      = pointer;
+  EGLSurface      = pointer;
+  EGLClientBuffer = pointer;
+
+  { EGL Versioning  }
+
+const
+   EGL_VERSION_1_0 = 1;     
+   EGL_VERSION_1_1 = 1;     
+   EGL_VERSION_1_2 = 1;     
+   EGL_VERSION_1_3 = 1;     
+   EGL_VERSION_1_4 = 1;     
+
+{ EGL Enumerants. Bitmasks and other exceptional cases aside, most
+ * enums are assigned unique values starting at 0x3000.
+  }
+{ EGL aliases  }
+   EGL_FALSE = 0;
+   EGL_TRUE  = 1;
+{ Out-of-band handle values  }
+{ was #define dname def_expr }
+function EGL_DEFAULT_DISPLAY : EGLNativeDisplayType;    
+
+{ was #define dname def_expr }
+function EGL_NO_CONTEXT : EGLContext;    
+
+{ was #define dname def_expr }
+function EGL_NO_DISPLAY : EGLDisplay;    
+
+{ was #define dname def_expr }
+function EGL_NO_SURFACE : EGLSurface;    
+
+{ Out-of-band attribute value  }
+{ was #define dname def_expr }
+function EGL_DONT_CARE : EGLint;    
+
+{ Errors / GetError return values  }
+
+const
+   EGL_SUCCESS = $3000;     
+   EGL_NOT_INITIALIZED = $3001;     
+   EGL_BAD_ACCESS = $3002;     
+   EGL_BAD_ALLOC = $3003;     
+   EGL_BAD_ATTRIBUTE = $3004;     
+   EGL_BAD_CONFIG = $3005;     
+   EGL_BAD_CONTEXT = $3006;     
+   EGL_BAD_CURRENT_SURFACE = $3007;     
+   EGL_BAD_DISPLAY = $3008;     
+   EGL_BAD_MATCH = $3009;     
+   EGL_BAD_NATIVE_PIXMAP = $300A;     
+   EGL_BAD_NATIVE_WINDOW = $300B;     
+   EGL_BAD_PARAMETER = $300C;     
+   EGL_BAD_SURFACE = $300D;     
+{ EGL 1.1 - IMG_power_management  }
+   EGL_CONTEXT_LOST = $300E;     
+{ Reserved 0x300F-0x301F for additional errors  }
+{ Config attributes  }
+   EGL_BUFFER_SIZE = $3020;     
+   EGL_ALPHA_SIZE = $3021;     
+   EGL_BLUE_SIZE = $3022;     
+   EGL_GREEN_SIZE = $3023;     
+   EGL_RED_SIZE = $3024;     
+   EGL_DEPTH_SIZE = $3025;     
+   EGL_STENCIL_SIZE = $3026;     
+   EGL_CONFIG_CAVEAT = $3027;     
+   EGL_CONFIG_ID = $3028;     
+   EGL_LEVEL = $3029;     
+   EGL_MAX_PBUFFER_HEIGHT = $302A;     
+   EGL_MAX_PBUFFER_PIXELS = $302B;     
+   EGL_MAX_PBUFFER_WIDTH = $302C;     
+   EGL_NATIVE_RENDERABLE = $302D;     
+   EGL_NATIVE_VISUAL_ID = $302E;     
+   EGL_NATIVE_VISUAL_TYPE = $302F;     
+   EGL_PRESERVED_RESOURCES = $3030;     
+   EGL_SAMPLES = $3031;     
+   EGL_SAMPLE_BUFFERS = $3032;     
+   EGL_SURFACE_TYPE = $3033;     
+   EGL_TRANSPARENT_TYPE = $3034;     
+   EGL_TRANSPARENT_BLUE_VALUE = $3035;     
+   EGL_TRANSPARENT_GREEN_VALUE = $3036;     
+   EGL_TRANSPARENT_RED_VALUE = $3037;     
+{ Attrib list terminator  }
+   EGL_NONE = $3038;     
+   EGL_BIND_TO_TEXTURE_RGB = $3039;     
+   EGL_BIND_TO_TEXTURE_RGBA = $303A;     
+   EGL_MIN_SWAP_INTERVAL = $303B;     
+   EGL_MAX_SWAP_INTERVAL = $303C;     
+   EGL_LUMINANCE_SIZE = $303D;     
+   EGL_ALPHA_MASK_SIZE = $303E;     
+   EGL_COLOR_BUFFER_TYPE = $303F;     
+   EGL_RENDERABLE_TYPE = $3040;     
+{ Pseudo-attribute (not queryable)  }
+   EGL_MATCH_NATIVE_PIXMAP = $3041;     
+   EGL_CONFORMANT = $3042;     
+{ Reserved 0x3041-0x304F for additional config attributes  }
+{ Config attribute values  }
+{ EGL_CONFIG_CAVEAT value  }
+   EGL_SLOW_CONFIG = $3050;     
+{ EGL_CONFIG_CAVEAT value  }
+   EGL_NON_CONFORMANT_CONFIG = $3051;     
+{ EGL_TRANSPARENT_TYPE value  }
+   EGL_TRANSPARENT_RGB = $3052;     
+{ EGL_COLOR_BUFFER_TYPE value  }
+   EGL_RGB_BUFFER = $308E;     
+{ EGL_COLOR_BUFFER_TYPE value  }
+   EGL_LUMINANCE_BUFFER = $308F;     
+{ More config attribute values, for EGL_TEXTURE_FORMAT  }
+   EGL_NO_TEXTURE = $305C;     
+   EGL_TEXTURE_RGB = $305D;     
+   EGL_TEXTURE_RGBA = $305E;     
+   EGL_TEXTURE_2D = $305F;     
+{ Config attribute mask bits  }
+{ EGL_SURFACE_TYPE mask bits  }
+   EGL_PBUFFER_BIT = $0001;     
+{ EGL_SURFACE_TYPE mask bits  }
+   EGL_PIXMAP_BIT = $0002;     
+{ EGL_SURFACE_TYPE mask bits  }
+   EGL_WINDOW_BIT = $0004;     
+{ EGL_SURFACE_TYPE mask bits  }
+   EGL_VG_COLORSPACE_LINEAR_BIT = $0020;     
+{ EGL_SURFACE_TYPE mask bits  }
+   EGL_VG_ALPHA_FORMAT_PRE_BIT = $0040;     
+{ EGL_SURFACE_TYPE mask bits  }
+   EGL_MULTISAMPLE_RESOLVE_BOX_BIT = $0200;     
+{ EGL_SURFACE_TYPE mask bits  }
+   EGL_SWAP_BEHAVIOR_PRESERVED_BIT = $0400;     
+{ EGL_RENDERABLE_TYPE mask bits  }
+   EGL_OPENGL_ES_BIT = $0001;     
+{ EGL_RENDERABLE_TYPE mask bits  }
+   EGL_OPENVG_BIT = $0002;     
+{ EGL_RENDERABLE_TYPE mask bits  }
+   EGL_OPENGL_ES2_BIT = $0004;     
+{ EGL_RENDERABLE_TYPE mask bits  }
+   EGL_OPENGL_BIT = $0008;     
+{ QueryString targets  }
+   EGL_VENDOR = $3053;     
+   EGL_VERSION = $3054;     
+   EGL_EXTENSIONS = $3055;     
+   EGL_CLIENT_APIS = $308D;     
+{ QuerySurface / SurfaceAttrib / CreatePbufferSurface targets  }
+   EGL_HEIGHT = $3056;     
+   EGL_WIDTH = $3057;     
+   EGL_LARGEST_PBUFFER = $3058;     
+   EGL_TEXTURE_FORMAT = $3080;     
+   EGL_TEXTURE_TARGET = $3081;     
+   EGL_MIPMAP_TEXTURE = $3082;     
+   EGL_MIPMAP_LEVEL = $3083;     
+   EGL_RENDER_BUFFER = $3086;     
+   EGL_VG_COLORSPACE = $3087;     
+   EGL_VG_ALPHA_FORMAT = $3088;     
+   EGL_HORIZONTAL_RESOLUTION = $3090;     
+   EGL_VERTICAL_RESOLUTION = $3091;     
+   EGL_PIXEL_ASPECT_RATIO = $3092;     
+   EGL_SWAP_BEHAVIOR = $3093;     
+   EGL_MULTISAMPLE_RESOLVE = $3099;     
+{ EGL_RENDER_BUFFER values / BindTexImage / ReleaseTexImage buffer targets  }
+   EGL_BACK_BUFFER = $3084;     
+   EGL_SINGLE_BUFFER = $3085;     
+{ OpenVG color spaces  }
+{ EGL_VG_COLORSPACE value  }
+   EGL_VG_COLORSPACE_sRGB = $3089;     
+{ EGL_VG_COLORSPACE value  }
+   EGL_VG_COLORSPACE_LINEAR = $308A;     
+{ OpenVG alpha formats  }
+{ EGL_ALPHA_FORMAT value  }
+   EGL_VG_ALPHA_FORMAT_NONPRE = $308B;     
+{ EGL_ALPHA_FORMAT value  }
+   EGL_VG_ALPHA_FORMAT_PRE = $308C;     
+{ Constant scale factor by which fractional display resolutions &
+ * aspect ratio are scaled when queried as integer values.
+  }
+   EGL_DISPLAY_SCALING = 10000;     
+{ Unknown display resolution/aspect ratio  }
+{ was #define dname def_expr }
+function EGL_UNKNOWN : EGLint;    
+
+{ Back buffer swap behaviors  }
+{ EGL_SWAP_BEHAVIOR value  }
+
+const
+   EGL_BUFFER_PRESERVED = $3094;     
+{ EGL_SWAP_BEHAVIOR value  }
+   EGL_BUFFER_DESTROYED = $3095;     
+{ CreatePbufferFromClientBuffer buffer types  }
+   EGL_OPENVG_IMAGE = $3096;     
+{ QueryContext targets  }
+   EGL_CONTEXT_CLIENT_TYPE = $3097;     
+{ CreateContext attributes  }
+   EGL_CONTEXT_CLIENT_VERSION = $3098;     
+{ Multisample resolution behaviors  }
+{ EGL_MULTISAMPLE_RESOLVE value  }
+   EGL_MULTISAMPLE_RESOLVE_DEFAULT = $309A;     
+{ EGL_MULTISAMPLE_RESOLVE value  }
+   EGL_MULTISAMPLE_RESOLVE_BOX = $309B;     
+{ BindAPI/QueryAPI targets  }
+   EGL_OPENGL_ES_API = $30A0;     
+   EGL_OPENVG_API = $30A1;     
+   EGL_OPENGL_API = $30A2;     
+{ GetCurrentSurface targets  }
+   EGL_DRAW = $3059;     
+   EGL_READ = $305A;     
+{ WaitNative engines  }
+   EGL_CORE_NATIVE_ENGINE = $305B;     
+{ EGL 1.2 tokens renamed for consistency in EGL 1.3  }
+   EGL_COLORSPACE = EGL_VG_COLORSPACE;     
+   EGL_ALPHA_FORMAT = EGL_VG_ALPHA_FORMAT;     
+   EGL_COLORSPACE_sRGB = EGL_VG_COLORSPACE_sRGB;     
+   EGL_COLORSPACE_LINEAR = EGL_VG_COLORSPACE_LINEAR;     
+   EGL_ALPHA_FORMAT_NONPRE = EGL_VG_ALPHA_FORMAT_NONPRE;     
+   EGL_ALPHA_FORMAT_PRE = EGL_VG_ALPHA_FORMAT_PRE;     
+{ EGL extensions must request enum blocks from the Khronos
+ * API Registrar, who maintains the enumerant registry. Submit
+ * a bug in Khronos Bugzilla against task "Registry".
+  }
+{ EGL Functions  }
+
+var
+  eglGetError : function:EGLint;{$ifdef windows}stdcall;{$else}cdecl;{$endif}
+  eglGetDisplay : function(display_id:EGLNativeDisplayType):EGLDisplay;{$ifdef windows}stdcall;{$else}cdecl;{$endif}
+  eglInitialize : function(dpy:EGLDisplay; major:pEGLint; minor:pEGLint):EGLBoolean;{$ifdef windows}stdcall;{$else}cdecl;{$endif}
+  eglTerminate : function(dpy:EGLDisplay):EGLBoolean;{$ifdef windows}stdcall;{$else}cdecl;{$endif}
+(* Const before type ignored *)
+  eglQueryString : function(dpy:EGLDisplay; name:EGLint):pchar;{$ifdef windows}stdcall;{$else}cdecl;{$endif}
+  eglGetConfigs : function(dpy:EGLDisplay; configs:pEGLConfig; config_size:EGLint; num_config:pEGLint):EGLBoolean;{$ifdef windows}stdcall;{$else}cdecl;{$endif}
+(* Const before type ignored *)
+  eglChooseConfig : function(dpy:EGLDisplay; attrib_list:pEGLint; configs:pEGLConfig; config_size:EGLint; num_config:pEGLint):EGLBoolean;{$ifdef windows}stdcall;{$else}cdecl;{$endif}
+  eglGetConfigAttrib : function(dpy:EGLDisplay; config:EGLConfig; attribute:EGLint; value:pEGLint):EGLBoolean;{$ifdef windows}stdcall;{$else}cdecl;{$endif}
+(* Const before type ignored *)
+  eglCreateWindowSurface : function(dpy:EGLDisplay; config:EGLConfig; win:EGLNativeWindowType; attrib_list:pEGLint):EGLSurface;{$ifdef windows}stdcall;{$else}cdecl;{$endif}
+(* Const before type ignored *)
+  eglCreatePbufferSurface : function(dpy:EGLDisplay; config:EGLConfig; attrib_list:pEGLint):EGLSurface;{$ifdef windows}stdcall;{$else}cdecl;{$endif}
+(* Const before type ignored *)
+  eglCreatePixmapSurface : function(dpy:EGLDisplay; config:EGLConfig; pixmap:EGLNativePixmapType; attrib_list:pEGLint):EGLSurface;{$ifdef windows}stdcall;{$else}cdecl;{$endif}
+  eglDestroySurface : function(dpy:EGLDisplay; surface:EGLSurface):EGLBoolean;{$ifdef windows}stdcall;{$else}cdecl;{$endif}
+  eglQuerySurface : function(dpy:EGLDisplay; surface:EGLSurface; attribute:EGLint; value:pEGLint):EGLBoolean;{$ifdef windows}stdcall;{$else}cdecl;{$endif}
+  eglBindAPI : function(api:EGLenum):EGLBoolean;{$ifdef windows}stdcall;{$else}cdecl;{$endif}
+  eglQueryAPI : function:EGLenum;{$ifdef windows}stdcall;{$else}cdecl;{$endif}
+  eglWaitClient : function:EGLBoolean;{$ifdef windows}stdcall;{$else}cdecl;{$endif}
+  eglReleaseThread : function:EGLBoolean;{$ifdef windows}stdcall;{$else}cdecl;{$endif}
+(* Const before type ignored *)
+  eglCreatePbufferFromClientBuffer : function(dpy:EGLDisplay; buftype:EGLenum; buffer:EGLClientBuffer; config:EGLConfig; attrib_list:pEGLint):EGLSurface;{$ifdef windows}stdcall;{$else}cdecl;{$endif}
+  eglSurfaceAttrib : function(dpy:EGLDisplay; surface:EGLSurface; attribute:EGLint; value:EGLint):EGLBoolean;{$ifdef windows}stdcall;{$else}cdecl;{$endif}
+  eglBindTexImage : function(dpy:EGLDisplay; surface:EGLSurface; buffer:EGLint):EGLBoolean;{$ifdef windows}stdcall;{$else}cdecl;{$endif}
+  eglReleaseTexImage : function(dpy:EGLDisplay; surface:EGLSurface; buffer:EGLint):EGLBoolean;{$ifdef windows}stdcall;{$else}cdecl;{$endif}
+  eglSwapInterval : function(dpy:EGLDisplay; interval:EGLint):EGLBoolean;{$ifdef windows}stdcall;{$else}cdecl;{$endif}
+(* Const before type ignored *)
+  eglCreateContext : function(dpy:EGLDisplay; config:EGLConfig; share_context:EGLContext; attrib_list:pEGLint):EGLContext;{$ifdef windows}stdcall;{$else}cdecl;{$endif}
+  eglDestroyContext : function(dpy:EGLDisplay; ctx:EGLContext):EGLBoolean;{$ifdef windows}stdcall;{$else}cdecl;{$endif}
+  eglMakeCurrent : function(dpy:EGLDisplay; draw:EGLSurface; read:EGLSurface; ctx:EGLContext):EGLBoolean;{$ifdef windows}stdcall;{$else}cdecl;{$endif}
+  eglGetCurrentContext : function:EGLContext;{$ifdef windows}stdcall;{$else}cdecl;{$endif}
+  eglGetCurrentSurface : function(readdraw:EGLint):EGLSurface;{$ifdef windows}stdcall;{$else}cdecl;{$endif}
+  eglGetCurrentDisplay : function:EGLDisplay;{$ifdef windows}stdcall;{$else}cdecl;{$endif}
+  eglQueryContext : function(dpy:EGLDisplay; ctx:EGLContext; attribute:EGLint; value:pEGLint):EGLBoolean;{$ifdef windows}stdcall;{$else}cdecl;{$endif}
+  eglWaitGL : function:EGLBoolean;{$ifdef windows}stdcall;{$else}cdecl;{$endif}
+  eglWaitNative : function(engine:EGLint):EGLBoolean;{$ifdef windows}stdcall;{$else}cdecl;{$endif}
+  eglSwapBuffers : function(dpy:EGLDisplay; surface:EGLSurface):EGLBoolean;{$ifdef windows}stdcall;{$else}cdecl;{$endif}
+  eglCopyBuffers : function(dpy:EGLDisplay; surface:EGLSurface; target:EGLNativePixmapType):EGLBoolean;{$ifdef windows}stdcall;{$else}cdecl;{$endif}
+{ This is a generic function pointer type, whose name indicates it must
+ * be cast to the proper type *and calling convention* before use.
+  }
+
+var
+  eglGetProcAddress : function(procname:pchar):pointer;{$ifdef windows}stdcall;{$else}CDecl;{$endif}
+{ Header file version number  }
+{ Current version at http://www.khronos.org/registry/egl/  }
+
+const
+   EGL_EGLEXT_VERSION = 3;     
+   EGL_KHR_config_attribs = 1;     
+{ EGLConfig attribute  }
+   EGL_CONFORMANT_KHR = $3042;     
+{ EGL_SURFACE_TYPE bitfield  }
+   EGL_VG_COLORSPACE_LINEAR_BIT_KHR = $0020;     
+{ EGL_SURFACE_TYPE bitfield  }
+   EGL_VG_ALPHA_FORMAT_PRE_BIT_KHR = $0040;     
+   EGL_KHR_lock_surface = 1;     
+{ EGL_LOCK_USAGE_HINT_KHR bitfield  }
+   EGL_READ_SURFACE_BIT_KHR = $0001;     
+{ EGL_LOCK_USAGE_HINT_KHR bitfield  }
+   EGL_WRITE_SURFACE_BIT_KHR = $0002;     
+{ EGL_SURFACE_TYPE bitfield  }
+   EGL_LOCK_SURFACE_BIT_KHR = $0080;     
+{ EGL_SURFACE_TYPE bitfield  }
+   EGL_OPTIMAL_FORMAT_BIT_KHR = $0100;     
+{ EGLConfig attribute  }
+   EGL_MATCH_FORMAT_KHR = $3043;     
+{ EGL_MATCH_FORMAT_KHR value  }
+   EGL_FORMAT_RGB_565_EXACT_KHR = $30C0;     
+{ EGL_MATCH_FORMAT_KHR value  }
+   EGL_FORMAT_RGB_565_KHR = $30C1;     
+{ EGL_MATCH_FORMAT_KHR value  }
+   EGL_FORMAT_RGBA_8888_EXACT_KHR = $30C2;     
+{ EGL_MATCH_FORMAT_KHR value  }
+   EGL_FORMAT_RGBA_8888_KHR = $30C3;     
+{ eglLockSurfaceKHR attribute  }
+   EGL_MAP_PRESERVE_PIXELS_KHR = $30C4;     
+{ eglLockSurfaceKHR attribute  }
+   EGL_LOCK_USAGE_HINT_KHR = $30C5;     
+{ eglQuerySurface attribute  }
+   EGL_BITMAP_POINTER_KHR = $30C6;     
+{ eglQuerySurface attribute  }
+   EGL_BITMAP_PITCH_KHR = $30C7;     
+{ eglQuerySurface attribute  }
+   EGL_BITMAP_ORIGIN_KHR = $30C8;     
+{ eglQuerySurface attribute  }
+   EGL_BITMAP_PIXEL_RED_OFFSET_KHR = $30C9;     
+{ eglQuerySurface attribute  }
+   EGL_BITMAP_PIXEL_GREEN_OFFSET_KHR = $30CA;     
+{ eglQuerySurface attribute  }
+   EGL_BITMAP_PIXEL_BLUE_OFFSET_KHR = $30CB;     
+{ eglQuerySurface attribute  }
+   EGL_BITMAP_PIXEL_ALPHA_OFFSET_KHR = $30CC;     
+{ eglQuerySurface attribute  }
+   EGL_BITMAP_PIXEL_LUMINANCE_OFFSET_KHR = $30CD;     
+{ EGL_BITMAP_ORIGIN_KHR value  }
+   EGL_LOWER_LEFT_KHR = $30CE;     
+{ EGL_BITMAP_ORIGIN_KHR value  }
+   EGL_UPPER_LEFT_KHR = $30CF;     
+(* Const before type ignored *)
+
+const
+   EGL_KHR_image = 1;     
+{ eglCreateImageKHR target  }
+   EGL_NATIVE_PIXMAP_KHR = $30B0;     
+
+type
+  EGLImageKHR = pointer;
+  { was #define dname def_expr }
+
+function EGL_NO_IMAGE_KHR : EGLImageKHR;    
+
+(* Const before type ignored *)
+
+const
+   EGL_KHR_vg_parent_image = 1;     
+{ eglCreateImageKHR target  }
+   EGL_VG_PARENT_IMAGE_KHR = $30BA;     
+   EGL_KHR_gl_texture_2D_image = 1;     
+{ eglCreateImageKHR target  }
+   EGL_GL_TEXTURE_2D_KHR = $30B1;     
+{ eglCreateImageKHR attribute  }
+   EGL_GL_TEXTURE_LEVEL_KHR = $30BC;     
+   EGL_KHR_gl_texture_cubemap_image = 1;     
+{ eglCreateImageKHR target  }
+   EGL_GL_TEXTURE_CUBE_MAP_POSITIVE_X_KHR = $30B3;     
+{ eglCreateImageKHR target  }
+   EGL_GL_TEXTURE_CUBE_MAP_NEGATIVE_X_KHR = $30B4;     
+{ eglCreateImageKHR target  }
+   EGL_GL_TEXTURE_CUBE_MAP_POSITIVE_Y_KHR = $30B5;     
+{ eglCreateImageKHR target  }
+   EGL_GL_TEXTURE_CUBE_MAP_NEGATIVE_Y_KHR = $30B6;     
+{ eglCreateImageKHR target  }
+   EGL_GL_TEXTURE_CUBE_MAP_POSITIVE_Z_KHR = $30B7;     
+{ eglCreateImageKHR target  }
+   EGL_GL_TEXTURE_CUBE_MAP_NEGATIVE_Z_KHR = $30B8;     
+   EGL_KHR_gl_texture_3D_image = 1;     
+{ eglCreateImageKHR target  }
+   EGL_GL_TEXTURE_3D_KHR = $30B2;     
+{ eglCreateImageKHR attribute  }
+   EGL_GL_TEXTURE_ZOFFSET_KHR = $30BD;     
+   EGL_KHR_gl_renderbuffer_image = 1;     
+{ eglCreateImageKHR target  }
+   EGL_GL_RENDERBUFFER_KHR = $30B9;     
+   EGL_KHR_image_base = 1;     
+{ Most interfaces defined by EGL_KHR_image_pixmap above  }
+{ eglCreateImageKHR attribute  }
+   EGL_IMAGE_PRESERVED_KHR = $30D2;     
+   EGL_KHR_image_pixmap = 1;     
+{ Interfaces defined by EGL_KHR_image above  }
+
+implementation
+
+{ was #define dname def_expr }
+function EGL_DEFAULT_DISPLAY : EGLNativeDisplayType; inline;
+  begin
+     EGL_DEFAULT_DISPLAY:=EGLNativeDisplayType(0);
+  end;
+
+{ was #define dname def_expr }
+function EGL_NO_CONTEXT : EGLContext; inline;
+  begin
+     EGL_NO_CONTEXT:=EGLContext(0);
+  end;
+
+{ was #define dname def_expr }
+function EGL_NO_DISPLAY : EGLDisplay; inline;
+  begin
+     EGL_NO_DISPLAY:=EGLDisplay(0);
+  end;
+
+{ was #define dname def_expr }
+function EGL_NO_SURFACE : EGLSurface; inline;
+  begin
+     EGL_NO_SURFACE:=EGLSurface(0);
+  end;
+
+{ was #define dname def_expr }
+function EGL_DONT_CARE : EGLint; inline;
+  begin
+     EGL_DONT_CARE:=EGLint(-(1));
+  end;
+
+{ was #define dname def_expr }
+function EGL_UNKNOWN : EGLint; inline;
+  begin
+     EGL_UNKNOWN:=EGLint(-(1));
+  end;
+
+{ was #define dname def_expr }
+function EGL_NO_IMAGE_KHR : EGLImageKHR; inline;
+  begin
+     EGL_NO_IMAGE_KHR:=EGLImageKHR(0);
+  end;
+
+
+var
+  EGLLib : tlibhandle;
+
+procedure FreeEGL;
+  begin
+    if EGLLib<>0 then
+      FreeLibrary(EGLLib);
+
+    eglGetError:=nil;
+    eglGetDisplay:=nil;
+    eglInitialize:=nil;
+    eglTerminate:=nil;
+    eglQueryString:=nil;
+    eglGetConfigs:=nil;
+    eglChooseConfig:=nil;
+    eglGetConfigAttrib:=nil;
+    eglCreateWindowSurface:=nil;
+    eglCreatePbufferSurface:=nil;
+    eglCreatePixmapSurface:=nil;
+    eglDestroySurface:=nil;
+    eglQuerySurface:=nil;
+    eglBindAPI:=nil;
+    eglQueryAPI:=nil;
+    eglWaitClient:=nil;
+    eglReleaseThread:=nil;
+    eglCreatePbufferFromClientBuffer:=nil;
+    eglSurfaceAttrib:=nil;
+    eglBindTexImage:=nil;
+    eglReleaseTexImage:=nil;
+    eglSwapInterval:=nil;
+    eglCreateContext:=nil;
+    eglDestroyContext:=nil;
+    eglMakeCurrent:=nil;
+    eglGetCurrentContext:=nil;
+    eglGetCurrentSurface:=nil;
+    eglGetCurrentDisplay:=nil;
+    eglQueryContext:=nil;
+    eglWaitGL:=nil;
+    eglWaitNative:=nil;
+    eglSwapBuffers:=nil;
+    eglCopyBuffers:=nil;
+    eglGetProcAddress:=nil;
+  end;
+
+procedure LoadEGL(lib : pchar);
+  begin
+    FreeEGL;
+    EGLLib:=dynlibs.LoadLibrary(lib);
+    if EGLLib=0 then
+      raise Exception.Create(format('Could not load library: %s',[lib]));
+
+    pointer(eglGetProcAddress):=GetProcAddress(EGLLib,'eglGetProcAddress');
+
+    pointer(eglGetError):=GetProcAddress(EGLLib,'eglGetError');
+    pointer(eglGetDisplay):=GetProcAddress(EGLLib,'eglGetDisplay');
+    pointer(eglInitialize):=GetProcAddress(EGLLib,'eglInitialize');
+    pointer(eglTerminate):=GetProcAddress(EGLLib,'eglTerminate');
+    pointer(eglQueryString):=GetProcAddress(EGLLib,'eglQueryString');
+    pointer(eglGetConfigs):=GetProcAddress(EGLLib,'eglGetConfigs');
+    pointer(eglChooseConfig):=GetProcAddress(EGLLib,'eglChooseConfig');
+    pointer(eglGetConfigAttrib):=GetProcAddress(EGLLib,'eglGetConfigAttrib');
+    pointer(eglCreateWindowSurface):=GetProcAddress(EGLLib,'eglCreateWindowSurface');
+    pointer(eglCreatePbufferSurface):=GetProcAddress(EGLLib,'eglCreatePbufferSurface');
+    pointer(eglCreatePixmapSurface):=GetProcAddress(EGLLib,'eglCreatePixmapSurface');
+    pointer(eglDestroySurface):=GetProcAddress(EGLLib,'eglDestroySurface');
+    pointer(eglQuerySurface):=GetProcAddress(EGLLib,'eglQuerySurface');
+    pointer(eglBindAPI):=GetProcAddress(EGLLib,'eglBindAPI');
+    pointer(eglQueryAPI):=GetProcAddress(EGLLib,'eglQueryAPI');
+    pointer(eglWaitClient):=GetProcAddress(EGLLib,'eglWaitClient');
+    pointer(eglReleaseThread):=GetProcAddress(EGLLib,'eglReleaseThread');
+    pointer(eglCreatePbufferFromClientBuffer):=GetProcAddress(EGLLib,'eglCreatePbufferFromClientBuffer');
+    pointer(eglSurfaceAttrib):=GetProcAddress(EGLLib,'eglSurfaceAttrib');
+    pointer(eglBindTexImage):=GetProcAddress(EGLLib,'eglBindTexImage');
+    pointer(eglReleaseTexImage):=GetProcAddress(EGLLib,'eglReleaseTexImage');
+    pointer(eglSwapInterval):=GetProcAddress(EGLLib,'eglSwapInterval');
+    pointer(eglCreateContext):=GetProcAddress(EGLLib,'eglCreateContext');
+    pointer(eglDestroyContext):=GetProcAddress(EGLLib,'eglDestroyContext');
+    pointer(eglMakeCurrent):=GetProcAddress(EGLLib,'eglMakeCurrent');
+    pointer(eglGetCurrentContext):=GetProcAddress(EGLLib,'eglGetCurrentContext');
+    pointer(eglGetCurrentSurface):=GetProcAddress(EGLLib,'eglGetCurrentSurface');
+    pointer(eglGetCurrentDisplay):=GetProcAddress(EGLLib,'eglGetCurrentDisplay');
+    pointer(eglQueryContext):=GetProcAddress(EGLLib,'eglQueryContext');
+    pointer(eglWaitGL):=GetProcAddress(EGLLib,'eglWaitGL');
+    pointer(eglWaitNative):=GetProcAddress(EGLLib,'eglWaitNative');
+    pointer(eglSwapBuffers):=GetProcAddress(EGLLib,'eglSwapBuffers');
+    pointer(eglCopyBuffers):=GetProcAddress(EGLLib,'eglCopyBuffers');
+  end;
+
+initialization
+  EGLLib:=0;
+  LoadEGL({$ifdef windows}'libEGL.dll'{$else}'libEGL.so'{$endif});
+finalization
+  FreeEGL;
+end.
Index: packages/opengles/Makefile.fpc.fpcmake
===================================================================
--- packages/opengles/Makefile.fpc.fpcmake	(revision 26407)
+++ packages/opengles/Makefile.fpc.fpcmake	(working copy)
@@ -13,11 +13,13 @@
 [target]
 units_arm_darwin=gles11
 units_i386_iphonesim=gles11
+units_android=gles11
 units_linux=gles20
 units_wince=gles20
 units_win32=gles20
 units_win64=gles20
 units_darwin=gles20
+units_android=gles20
 exampledirs=examples
 
 [install]
Index: packages/opengles/examples/Makefile.fpc
===================================================================
--- packages/opengles/examples/Makefile.fpc	(revision 26407)
+++ packages/opengles/examples/Makefile.fpc	(working copy)
@@ -6,7 +6,7 @@
 programs=glutdemoes
 
 [require]
-packages=opengles
+packages=opengles egl
 
 [install]
 fpcpackage=y
Index: packages/opengles/examples/es2example1.pas
===================================================================
--- packages/opengles/examples/es2example1.pas	(revision 26407)
+++ packages/opengles/examples/es2example1.pas	(working copy)
@@ -14,7 +14,7 @@
  {$endif}
 {$endif}
 
-uses SysUtils,Classes,BaseUnix,Unix,UnixType,X,XLib,XUtil,XAtom{$ifdef ogles},gles20{$else},xf86vmode,GL,GLX,GLExt{$endif};
+uses SysUtils,Classes,BaseUnix,Unix,UnixType,X,XLib,XUtil,XAtom{$ifdef ogles},egl,gles20{$else},xf86vmode,GL,GLX,GLExt{$endif};
 
 const VertexArray:array[0..11] of single=(0,-1,0,1,
                                           1,1,0,1,
Index: packages/opengles/fpmake.pp
===================================================================
--- packages/opengles/fpmake.pp	(revision 26407)
+++ packages/opengles/fpmake.pp	(working copy)
@@ -21,18 +21,19 @@
     P.Author := 'Free Pascal Development team';
     P.License := 'LGPL with modification';
     P.HomepageURL := 'www.freepascal.org';
-    P.OSes := [darwin,iphonesim,linux,win32,win64,wince];
+    P.OSes := [android,darwin,iphonesim,linux,win32,win64,wince];
 
-    P.Dependencies.Add('x11',AllUnixOSes-[darwin,iphonesim]);
+    P.Dependencies.Add('x11',AllUnixOSes-[darwin,iphonesim,android]);
+    P.Dependencies.Add('egl',[linux,win32,win64,wince,darwin,android]);
+
     P.SourcePath.Add('src');
 
-    T:=P.Targets.AddUnit('gles11.pp',[darwin,iphonesim]);
-    T:=P.Targets.AddUnit('gles20.pas',[linux,win32,win64,wince,darwin]);
+    T:=P.Targets.AddUnit('gles11.pp',[darwin,iphonesim,android]);
+    T:=P.Targets.AddUnit('gles20.pas',[linux,win32,win64,wince,darwin,android]);
 
     P.Targets.AddExampleProgram('examples/es2example1.pas');
     P.Sources.AddExampleFiles('examples/*',false,'.');
 
-
 {$ifndef ALLPACKAGES}
     Run;
     end;
Index: packages/opengles/src/gles20.pas
===================================================================
--- packages/opengles/src/gles20.pas	(revision 26407)
+++ packages/opengles/src/gles20.pas	(working copy)
@@ -1,477 +1,26 @@
 {** OpenGL ES 2.0 headers 
  **
+ ** Separated from GLES/EGL by Dennis Fehr
+ **
  ** Ported/Translated for FreePascal by Benjamin 'BeRo' Rosseaux
  ** benjamin@rosseaux.com - http://www.rosseaux.com
  ** 
- ** EGL part:
- **
- ** Copyright (c) 2007-2009 The Khronos Group Inc.
- **
- ** Permission is hereby granted, free of charge, to any person obtaining a
- ** copy of this software and/or associated documentation files (the
- ** "Materials"), to deal in the Materials without restriction, including
- ** without limitation the rights to use, copy, modify, merge, publish,
- ** distribute, sublicense, and/or sell copies of the Materials, and to
- ** permit persons to whom the Materials are furnished to do so, subject to
- ** the following conditions:
- **
- ** The above copyright notice and this permission notice shall be included
- ** in all copies or substantial portions of the Materials.
- **
- ** THE MATERIALS ARE PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
- ** EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
- ** MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.
- ** IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY
- ** CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT,
- ** TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE 
- ** MATERIALS OR THE USE OR OTHER DEALINGS IN THE MATERIALS.
- **
- ** GLESv2 part:
- **
  ** This document is licensed under the SGI Free Software B License Version
  ** 2.0. For details, see http://oss.sgi.com/projects/FreeB/ 
  **}
 unit gles20;
+
 {$mode objfpc}
-{$ifdef linux}
-  {$define EGL}
-{$endif}
-{$ifdef windows}
-  {$define EGL}
-{$endif}
 
 interface
 
 uses SysUtils,dynlibs{$ifdef linux},x,xlib{$endif}{$ifdef windows},Windows{$endif};
 
 {$IFDEF FPC}
-{$PACKRECORDS C}
+  {$PACKRECORDS C}
 {$ENDIF}
 
-Type
-  Pchar  = ^char;
-  
-{$ifdef EGL}
 type
-  PEGLConfig  = ^EGLConfig;
-  PEGLint  = ^EGLint;
-     EGLint = {$ifdef win64}int64{$else}longint{$endif}; // Why int64 only on win64 and not even on 64-bit linux???
-
-     EGLConfig = pointer;
-
-  { EGL Types  }
-  { EGLint is defined in eglplatform.h  }
-
-  type
-
-{$ifdef linux}
-     EGLNativeDisplayType = PDisplay;
-
-     EGLNativeWindowType = TWindow;
-
-     EGLNativePixmapType = TPixmap;
-{$else linux}
-{$ifdef windows}
-     EGLNativeDisplayType = HDC;
-
-     EGLNativeWindowType = HWND;
-
-     EGLNativePixmapType = HBITMAP;
-{$else windows}
-     EGLNativeDisplayType = ptrint;
-
-     EGLNativeWindowType = pointer;
-
-     EGLNativePixmapType = pointer;
-{$endif windows}
-{$endif linux}
-
-     EGLBoolean = dword;
-
-     EGLenum = dword;
-
-
-     EGLContext = pointer;
-
-     EGLDisplay = pointer;
-
-     EGLSurface = pointer;
-
-     EGLClientBuffer = pointer;
-  { EGL Versioning  }
-
-  const
-     EGL_VERSION_1_0 = 1;     
-     EGL_VERSION_1_1 = 1;     
-     EGL_VERSION_1_2 = 1;     
-     EGL_VERSION_1_3 = 1;     
-     EGL_VERSION_1_4 = 1;     
-  { EGL Enumerants. Bitmasks and other exceptional cases aside, most
-   * enums are assigned unique values starting at 0x3000.
-    }
-  { EGL aliases  }
-     EGL_FALSE = 0;     
-     EGL_TRUE = 1;     
-  { Out-of-band handle values  }
-  { was #define dname def_expr }
-  function EGL_DEFAULT_DISPLAY : EGLNativeDisplayType;    
-
-  { was #define dname def_expr }
-  function EGL_NO_CONTEXT : EGLContext;    
-
-  { was #define dname def_expr }
-  function EGL_NO_DISPLAY : EGLDisplay;    
-
-  { was #define dname def_expr }
-  function EGL_NO_SURFACE : EGLSurface;    
-
-  { Out-of-band attribute value  }
-  { was #define dname def_expr }
-  function EGL_DONT_CARE : EGLint;    
-
-  { Errors / GetError return values  }
-
-  const
-     EGL_SUCCESS = $3000;     
-     EGL_NOT_INITIALIZED = $3001;     
-     EGL_BAD_ACCESS = $3002;     
-     EGL_BAD_ALLOC = $3003;     
-     EGL_BAD_ATTRIBUTE = $3004;     
-     EGL_BAD_CONFIG = $3005;     
-     EGL_BAD_CONTEXT = $3006;     
-     EGL_BAD_CURRENT_SURFACE = $3007;     
-     EGL_BAD_DISPLAY = $3008;     
-     EGL_BAD_MATCH = $3009;     
-     EGL_BAD_NATIVE_PIXMAP = $300A;     
-     EGL_BAD_NATIVE_WINDOW = $300B;     
-     EGL_BAD_PARAMETER = $300C;     
-     EGL_BAD_SURFACE = $300D;     
-  { EGL 1.1 - IMG_power_management  }
-     EGL_CONTEXT_LOST = $300E;     
-  { Reserved 0x300F-0x301F for additional errors  }
-  { Config attributes  }
-     EGL_BUFFER_SIZE = $3020;     
-     EGL_ALPHA_SIZE = $3021;     
-     EGL_BLUE_SIZE = $3022;     
-     EGL_GREEN_SIZE = $3023;     
-     EGL_RED_SIZE = $3024;     
-     EGL_DEPTH_SIZE = $3025;     
-     EGL_STENCIL_SIZE = $3026;     
-     EGL_CONFIG_CAVEAT = $3027;     
-     EGL_CONFIG_ID = $3028;     
-     EGL_LEVEL = $3029;     
-     EGL_MAX_PBUFFER_HEIGHT = $302A;     
-     EGL_MAX_PBUFFER_PIXELS = $302B;     
-     EGL_MAX_PBUFFER_WIDTH = $302C;     
-     EGL_NATIVE_RENDERABLE = $302D;     
-     EGL_NATIVE_VISUAL_ID = $302E;     
-     EGL_NATIVE_VISUAL_TYPE = $302F;     
-     EGL_PRESERVED_RESOURCES = $3030;     
-     EGL_SAMPLES = $3031;     
-     EGL_SAMPLE_BUFFERS = $3032;     
-     EGL_SURFACE_TYPE = $3033;     
-     EGL_TRANSPARENT_TYPE = $3034;     
-     EGL_TRANSPARENT_BLUE_VALUE = $3035;     
-     EGL_TRANSPARENT_GREEN_VALUE = $3036;     
-     EGL_TRANSPARENT_RED_VALUE = $3037;     
-  { Attrib list terminator  }
-     EGL_NONE = $3038;     
-     EGL_BIND_TO_TEXTURE_RGB = $3039;     
-     EGL_BIND_TO_TEXTURE_RGBA = $303A;     
-     EGL_MIN_SWAP_INTERVAL = $303B;     
-     EGL_MAX_SWAP_INTERVAL = $303C;     
-     EGL_LUMINANCE_SIZE = $303D;     
-     EGL_ALPHA_MASK_SIZE = $303E;     
-     EGL_COLOR_BUFFER_TYPE = $303F;     
-     EGL_RENDERABLE_TYPE = $3040;     
-  { Pseudo-attribute (not queryable)  }
-     EGL_MATCH_NATIVE_PIXMAP = $3041;     
-     EGL_CONFORMANT = $3042;     
-  { Reserved 0x3041-0x304F for additional config attributes  }
-  { Config attribute values  }
-  { EGL_CONFIG_CAVEAT value  }
-     EGL_SLOW_CONFIG = $3050;     
-  { EGL_CONFIG_CAVEAT value  }
-     EGL_NON_CONFORMANT_CONFIG = $3051;     
-  { EGL_TRANSPARENT_TYPE value  }
-     EGL_TRANSPARENT_RGB = $3052;     
-  { EGL_COLOR_BUFFER_TYPE value  }
-     EGL_RGB_BUFFER = $308E;     
-  { EGL_COLOR_BUFFER_TYPE value  }
-     EGL_LUMINANCE_BUFFER = $308F;     
-  { More config attribute values, for EGL_TEXTURE_FORMAT  }
-     EGL_NO_TEXTURE = $305C;     
-     EGL_TEXTURE_RGB = $305D;     
-     EGL_TEXTURE_RGBA = $305E;     
-     EGL_TEXTURE_2D = $305F;     
-  { Config attribute mask bits  }
-  { EGL_SURFACE_TYPE mask bits  }
-     EGL_PBUFFER_BIT = $0001;     
-  { EGL_SURFACE_TYPE mask bits  }
-     EGL_PIXMAP_BIT = $0002;     
-  { EGL_SURFACE_TYPE mask bits  }
-     EGL_WINDOW_BIT = $0004;     
-  { EGL_SURFACE_TYPE mask bits  }
-     EGL_VG_COLORSPACE_LINEAR_BIT = $0020;     
-  { EGL_SURFACE_TYPE mask bits  }
-     EGL_VG_ALPHA_FORMAT_PRE_BIT = $0040;     
-  { EGL_SURFACE_TYPE mask bits  }
-     EGL_MULTISAMPLE_RESOLVE_BOX_BIT = $0200;     
-  { EGL_SURFACE_TYPE mask bits  }
-     EGL_SWAP_BEHAVIOR_PRESERVED_BIT = $0400;     
-  { EGL_RENDERABLE_TYPE mask bits  }
-     EGL_OPENGL_ES_BIT = $0001;     
-  { EGL_RENDERABLE_TYPE mask bits  }
-     EGL_OPENVG_BIT = $0002;     
-  { EGL_RENDERABLE_TYPE mask bits  }
-     EGL_OPENGL_ES2_BIT = $0004;     
-  { EGL_RENDERABLE_TYPE mask bits  }
-     EGL_OPENGL_BIT = $0008;     
-  { QueryString targets  }
-     EGL_VENDOR = $3053;     
-     EGL_VERSION = $3054;     
-     EGL_EXTENSIONS = $3055;     
-     EGL_CLIENT_APIS = $308D;     
-  { QuerySurface / SurfaceAttrib / CreatePbufferSurface targets  }
-     EGL_HEIGHT = $3056;     
-     EGL_WIDTH = $3057;     
-     EGL_LARGEST_PBUFFER = $3058;     
-     EGL_TEXTURE_FORMAT = $3080;     
-     EGL_TEXTURE_TARGET = $3081;     
-     EGL_MIPMAP_TEXTURE = $3082;     
-     EGL_MIPMAP_LEVEL = $3083;     
-     EGL_RENDER_BUFFER = $3086;     
-     EGL_VG_COLORSPACE = $3087;     
-     EGL_VG_ALPHA_FORMAT = $3088;     
-     EGL_HORIZONTAL_RESOLUTION = $3090;     
-     EGL_VERTICAL_RESOLUTION = $3091;     
-     EGL_PIXEL_ASPECT_RATIO = $3092;     
-     EGL_SWAP_BEHAVIOR = $3093;     
-     EGL_MULTISAMPLE_RESOLVE = $3099;     
-  { EGL_RENDER_BUFFER values / BindTexImage / ReleaseTexImage buffer targets  }
-     EGL_BACK_BUFFER = $3084;     
-     EGL_SINGLE_BUFFER = $3085;     
-  { OpenVG color spaces  }
-  { EGL_VG_COLORSPACE value  }
-     EGL_VG_COLORSPACE_sRGB = $3089;     
-  { EGL_VG_COLORSPACE value  }
-     EGL_VG_COLORSPACE_LINEAR = $308A;     
-  { OpenVG alpha formats  }
-  { EGL_ALPHA_FORMAT value  }
-     EGL_VG_ALPHA_FORMAT_NONPRE = $308B;     
-  { EGL_ALPHA_FORMAT value  }
-     EGL_VG_ALPHA_FORMAT_PRE = $308C;     
-  { Constant scale factor by which fractional display resolutions &
-   * aspect ratio are scaled when queried as integer values.
-    }
-     EGL_DISPLAY_SCALING = 10000;     
-  { Unknown display resolution/aspect ratio  }
-  { was #define dname def_expr }
-  function EGL_UNKNOWN : EGLint;    
-
-  { Back buffer swap behaviors  }
-  { EGL_SWAP_BEHAVIOR value  }
-
-  const
-     EGL_BUFFER_PRESERVED = $3094;     
-  { EGL_SWAP_BEHAVIOR value  }
-     EGL_BUFFER_DESTROYED = $3095;     
-  { CreatePbufferFromClientBuffer buffer types  }
-     EGL_OPENVG_IMAGE = $3096;     
-  { QueryContext targets  }
-     EGL_CONTEXT_CLIENT_TYPE = $3097;     
-  { CreateContext attributes  }
-     EGL_CONTEXT_CLIENT_VERSION = $3098;     
-  { Multisample resolution behaviors  }
-  { EGL_MULTISAMPLE_RESOLVE value  }
-     EGL_MULTISAMPLE_RESOLVE_DEFAULT = $309A;     
-  { EGL_MULTISAMPLE_RESOLVE value  }
-     EGL_MULTISAMPLE_RESOLVE_BOX = $309B;     
-  { BindAPI/QueryAPI targets  }
-     EGL_OPENGL_ES_API = $30A0;     
-     EGL_OPENVG_API = $30A1;     
-     EGL_OPENGL_API = $30A2;     
-  { GetCurrentSurface targets  }
-     EGL_DRAW = $3059;     
-     EGL_READ = $305A;     
-  { WaitNative engines  }
-     EGL_CORE_NATIVE_ENGINE = $305B;     
-  { EGL 1.2 tokens renamed for consistency in EGL 1.3  }
-     EGL_COLORSPACE = EGL_VG_COLORSPACE;     
-     EGL_ALPHA_FORMAT = EGL_VG_ALPHA_FORMAT;     
-     EGL_COLORSPACE_sRGB = EGL_VG_COLORSPACE_sRGB;     
-     EGL_COLORSPACE_LINEAR = EGL_VG_COLORSPACE_LINEAR;     
-     EGL_ALPHA_FORMAT_NONPRE = EGL_VG_ALPHA_FORMAT_NONPRE;     
-     EGL_ALPHA_FORMAT_PRE = EGL_VG_ALPHA_FORMAT_PRE;     
-  { EGL extensions must request enum blocks from the Khronos
-   * API Registrar, who maintains the enumerant registry. Submit
-   * a bug in Khronos Bugzilla against task "Registry".
-    }
-  { EGL Functions  }
-
-  var
-    eglGetError : function:EGLint;{$ifdef windows}stdcall;{$else}cdecl;{$endif}
-    eglGetDisplay : function(display_id:EGLNativeDisplayType):EGLDisplay;{$ifdef windows}stdcall;{$else}cdecl;{$endif}
-    eglInitialize : function(dpy:EGLDisplay; major:pEGLint; minor:pEGLint):EGLBoolean;{$ifdef windows}stdcall;{$else}cdecl;{$endif}
-    eglTerminate : function(dpy:EGLDisplay):EGLBoolean;{$ifdef windows}stdcall;{$else}cdecl;{$endif}
-(* Const before type ignored *)
-    eglQueryString : function(dpy:EGLDisplay; name:EGLint):pchar;{$ifdef windows}stdcall;{$else}cdecl;{$endif}
-    eglGetConfigs : function(dpy:EGLDisplay; configs:pEGLConfig; config_size:EGLint; num_config:pEGLint):EGLBoolean;{$ifdef windows}stdcall;{$else}cdecl;{$endif}
-(* Const before type ignored *)
-    eglChooseConfig : function(dpy:EGLDisplay; attrib_list:pEGLint; configs:pEGLConfig; config_size:EGLint; num_config:pEGLint):EGLBoolean;{$ifdef windows}stdcall;{$else}cdecl;{$endif}
-    eglGetConfigAttrib : function(dpy:EGLDisplay; config:EGLConfig; attribute:EGLint; value:pEGLint):EGLBoolean;{$ifdef windows}stdcall;{$else}cdecl;{$endif}
-(* Const before type ignored *)
-    eglCreateWindowSurface : function(dpy:EGLDisplay; config:EGLConfig; win:EGLNativeWindowType; attrib_list:pEGLint):EGLSurface;{$ifdef windows}stdcall;{$else}cdecl;{$endif}
-(* Const before type ignored *)
-    eglCreatePbufferSurface : function(dpy:EGLDisplay; config:EGLConfig; attrib_list:pEGLint):EGLSurface;{$ifdef windows}stdcall;{$else}cdecl;{$endif}
-(* Const before type ignored *)
-    eglCreatePixmapSurface : function(dpy:EGLDisplay; config:EGLConfig; pixmap:EGLNativePixmapType; attrib_list:pEGLint):EGLSurface;{$ifdef windows}stdcall;{$else}cdecl;{$endif}
-    eglDestroySurface : function(dpy:EGLDisplay; surface:EGLSurface):EGLBoolean;{$ifdef windows}stdcall;{$else}cdecl;{$endif}
-    eglQuerySurface : function(dpy:EGLDisplay; surface:EGLSurface; attribute:EGLint; value:pEGLint):EGLBoolean;{$ifdef windows}stdcall;{$else}cdecl;{$endif}
-    eglBindAPI : function(api:EGLenum):EGLBoolean;{$ifdef windows}stdcall;{$else}cdecl;{$endif}
-    eglQueryAPI : function:EGLenum;{$ifdef windows}stdcall;{$else}cdecl;{$endif}
-    eglWaitClient : function:EGLBoolean;{$ifdef windows}stdcall;{$else}cdecl;{$endif}
-    eglReleaseThread : function:EGLBoolean;{$ifdef windows}stdcall;{$else}cdecl;{$endif}
-(* Const before type ignored *)
-    eglCreatePbufferFromClientBuffer : function(dpy:EGLDisplay; buftype:EGLenum; buffer:EGLClientBuffer; config:EGLConfig; attrib_list:pEGLint):EGLSurface;{$ifdef windows}stdcall;{$else}cdecl;{$endif}
-    eglSurfaceAttrib : function(dpy:EGLDisplay; surface:EGLSurface; attribute:EGLint; value:EGLint):EGLBoolean;{$ifdef windows}stdcall;{$else}cdecl;{$endif}
-    eglBindTexImage : function(dpy:EGLDisplay; surface:EGLSurface; buffer:EGLint):EGLBoolean;{$ifdef windows}stdcall;{$else}cdecl;{$endif}
-    eglReleaseTexImage : function(dpy:EGLDisplay; surface:EGLSurface; buffer:EGLint):EGLBoolean;{$ifdef windows}stdcall;{$else}cdecl;{$endif}
-    eglSwapInterval : function(dpy:EGLDisplay; interval:EGLint):EGLBoolean;{$ifdef windows}stdcall;{$else}cdecl;{$endif}
-(* Const before type ignored *)
-    eglCreateContext : function(dpy:EGLDisplay; config:EGLConfig; share_context:EGLContext; attrib_list:pEGLint):EGLContext;{$ifdef windows}stdcall;{$else}cdecl;{$endif}
-    eglDestroyContext : function(dpy:EGLDisplay; ctx:EGLContext):EGLBoolean;{$ifdef windows}stdcall;{$else}cdecl;{$endif}
-    eglMakeCurrent : function(dpy:EGLDisplay; draw:EGLSurface; read:EGLSurface; ctx:EGLContext):EGLBoolean;{$ifdef windows}stdcall;{$else}cdecl;{$endif}
-    eglGetCurrentContext : function:EGLContext;{$ifdef windows}stdcall;{$else}cdecl;{$endif}
-    eglGetCurrentSurface : function(readdraw:EGLint):EGLSurface;{$ifdef windows}stdcall;{$else}cdecl;{$endif}
-    eglGetCurrentDisplay : function:EGLDisplay;{$ifdef windows}stdcall;{$else}cdecl;{$endif}
-    eglQueryContext : function(dpy:EGLDisplay; ctx:EGLContext; attribute:EGLint; value:pEGLint):EGLBoolean;{$ifdef windows}stdcall;{$else}cdecl;{$endif}
-    eglWaitGL : function:EGLBoolean;{$ifdef windows}stdcall;{$else}cdecl;{$endif}
-    eglWaitNative : function(engine:EGLint):EGLBoolean;{$ifdef windows}stdcall;{$else}cdecl;{$endif}
-    eglSwapBuffers : function(dpy:EGLDisplay; surface:EGLSurface):EGLBoolean;{$ifdef windows}stdcall;{$else}cdecl;{$endif}
-    eglCopyBuffers : function(dpy:EGLDisplay; surface:EGLSurface; target:EGLNativePixmapType):EGLBoolean;{$ifdef windows}stdcall;{$else}cdecl;{$endif}
-  { This is a generic function pointer type, whose name indicates it must
-   * be cast to the proper type *and calling convention* before use.
-    }
-
-  type
-
-     __eglMustCastToProperFunctionPointerType = procedure (_para1:pointer);{$ifdef windows}stdcall;{$else}cdecl;{$endif}
-  { Now, define eglGetProcAddress using the generic function ptr. type  }
-(* Const before type ignored *)
-
-  var
-    eglGetProcAddress : function(procname:pchar):__eglMustCastToProperFunctionPointerType;{$ifdef windows}stdcall;{$else}cdecl;{$endif}
-  { Header file version number  }
-  { Current version at http://www.khronos.org/registry/egl/  }
-
-  const
-     EGL_EGLEXT_VERSION = 3;     
-     EGL_KHR_config_attribs = 1;     
-  { EGLConfig attribute  }
-     EGL_CONFORMANT_KHR = $3042;     
-  { EGL_SURFACE_TYPE bitfield  }
-     EGL_VG_COLORSPACE_LINEAR_BIT_KHR = $0020;     
-  { EGL_SURFACE_TYPE bitfield  }
-     EGL_VG_ALPHA_FORMAT_PRE_BIT_KHR = $0040;     
-     EGL_KHR_lock_surface = 1;     
-  { EGL_LOCK_USAGE_HINT_KHR bitfield  }
-     EGL_READ_SURFACE_BIT_KHR = $0001;     
-  { EGL_LOCK_USAGE_HINT_KHR bitfield  }
-     EGL_WRITE_SURFACE_BIT_KHR = $0002;     
-  { EGL_SURFACE_TYPE bitfield  }
-     EGL_LOCK_SURFACE_BIT_KHR = $0080;     
-  { EGL_SURFACE_TYPE bitfield  }
-     EGL_OPTIMAL_FORMAT_BIT_KHR = $0100;     
-  { EGLConfig attribute  }
-     EGL_MATCH_FORMAT_KHR = $3043;     
-  { EGL_MATCH_FORMAT_KHR value  }
-     EGL_FORMAT_RGB_565_EXACT_KHR = $30C0;     
-  { EGL_MATCH_FORMAT_KHR value  }
-     EGL_FORMAT_RGB_565_KHR = $30C1;     
-  { EGL_MATCH_FORMAT_KHR value  }
-     EGL_FORMAT_RGBA_8888_EXACT_KHR = $30C2;     
-  { EGL_MATCH_FORMAT_KHR value  }
-     EGL_FORMAT_RGBA_8888_KHR = $30C3;     
-  { eglLockSurfaceKHR attribute  }
-     EGL_MAP_PRESERVE_PIXELS_KHR = $30C4;     
-  { eglLockSurfaceKHR attribute  }
-     EGL_LOCK_USAGE_HINT_KHR = $30C5;     
-  { eglQuerySurface attribute  }
-     EGL_BITMAP_POINTER_KHR = $30C6;     
-  { eglQuerySurface attribute  }
-     EGL_BITMAP_PITCH_KHR = $30C7;     
-  { eglQuerySurface attribute  }
-     EGL_BITMAP_ORIGIN_KHR = $30C8;     
-  { eglQuerySurface attribute  }
-     EGL_BITMAP_PIXEL_RED_OFFSET_KHR = $30C9;     
-  { eglQuerySurface attribute  }
-     EGL_BITMAP_PIXEL_GREEN_OFFSET_KHR = $30CA;     
-  { eglQuerySurface attribute  }
-     EGL_BITMAP_PIXEL_BLUE_OFFSET_KHR = $30CB;     
-  { eglQuerySurface attribute  }
-     EGL_BITMAP_PIXEL_ALPHA_OFFSET_KHR = $30CC;     
-  { eglQuerySurface attribute  }
-     EGL_BITMAP_PIXEL_LUMINANCE_OFFSET_KHR = $30CD;     
-  { EGL_BITMAP_ORIGIN_KHR value  }
-     EGL_LOWER_LEFT_KHR = $30CE;     
-  { EGL_BITMAP_ORIGIN_KHR value  }
-     EGL_UPPER_LEFT_KHR = $30CF;     
-(* Const before type ignored *)
-
-  const
-     EGL_KHR_image = 1;     
-  { eglCreateImageKHR target  }
-     EGL_NATIVE_PIXMAP_KHR = $30B0;     
-
-type
-     EGLImageKHR = pointer;
-  { was #define dname def_expr }
-  function EGL_NO_IMAGE_KHR : EGLImageKHR;    
-
-(* Const before type ignored *)
-
-  const
-     EGL_KHR_vg_parent_image = 1;     
-  { eglCreateImageKHR target  }
-     EGL_VG_PARENT_IMAGE_KHR = $30BA;     
-     EGL_KHR_gl_texture_2D_image = 1;     
-  { eglCreateImageKHR target  }
-     EGL_GL_TEXTURE_2D_KHR = $30B1;     
-  { eglCreateImageKHR attribute  }
-     EGL_GL_TEXTURE_LEVEL_KHR = $30BC;     
-     EGL_KHR_gl_texture_cubemap_image = 1;     
-  { eglCreateImageKHR target  }
-     EGL_GL_TEXTURE_CUBE_MAP_POSITIVE_X_KHR = $30B3;     
-  { eglCreateImageKHR target  }
-     EGL_GL_TEXTURE_CUBE_MAP_NEGATIVE_X_KHR = $30B4;     
-  { eglCreateImageKHR target  }
-     EGL_GL_TEXTURE_CUBE_MAP_POSITIVE_Y_KHR = $30B5;     
-  { eglCreateImageKHR target  }
-     EGL_GL_TEXTURE_CUBE_MAP_NEGATIVE_Y_KHR = $30B6;     
-  { eglCreateImageKHR target  }
-     EGL_GL_TEXTURE_CUBE_MAP_POSITIVE_Z_KHR = $30B7;     
-  { eglCreateImageKHR target  }
-     EGL_GL_TEXTURE_CUBE_MAP_NEGATIVE_Z_KHR = $30B8;     
-     EGL_KHR_gl_texture_3D_image = 1;     
-  { eglCreateImageKHR target  }
-     EGL_GL_TEXTURE_3D_KHR = $30B2;     
-  { eglCreateImageKHR attribute  }
-     EGL_GL_TEXTURE_ZOFFSET_KHR = $30BD;     
-     EGL_KHR_gl_renderbuffer_image = 1;     
-  { eglCreateImageKHR target  }
-     EGL_GL_RENDERBUFFER_KHR = $30B9;     
-     EGL_KHR_image_base = 1;     
-  { Most interfaces defined by EGL_KHR_image_pixmap above  }
-  { eglCreateImageKHR attribute  }
-     EGL_IMAGE_PRESERVED_KHR = $30D2;     
-     EGL_KHR_image_pixmap = 1;     
-  { Interfaces defined by EGL_KHR_image above  }
-
-{$endif EGL}
-
-  
-type
   PGLubyte = ^GLubyte;
   PGLboolean  = ^GLboolean;
   PGLenum  = ^GLenum;
@@ -480,1396 +29,1241 @@
   PGLsizei  = ^GLsizei;
   PGLuint  = ^GLuint;
 
-  {-------------------------------------------------------------------------
-   * Data type definitions
-   *----------------------------------------------------------------------- }
+{-------------------------------------------------------------------------
+ * Data type definitions
+ *----------------------------------------------------------------------- }
 
-     GLvoid = pointer;
-     TGLvoid = GLvoid;
+   GLvoid = pointer;
+   TGLvoid = GLvoid;
 
-     GLenum = dword;
-     TGLenum = GLenum;
+   GLenum = dword;
+   TGLenum = GLenum;
 
-     GLboolean = byte;
-     TGLboolean = GLboolean;
+   GLboolean = byte;
+   TGLboolean = GLboolean;
 
-     GLbitfield = dword;
-     TGLbitfield = GLbitfield;
+   GLbitfield = dword;
+   TGLbitfield = GLbitfield;
 
-     GLbyte = shortint;
-     TGLbyte = GLbyte;
+   GLbyte = shortint;
+   TGLbyte = GLbyte;
 
-     GLshort = smallint;
-     TGLshort = GLshort;
+   GLshort = smallint;
+   TGLshort = GLshort;
 
-     GLint = longint;
-     TGLint = GLint;
+   GLint = longint;
+   TGLint = GLint;
 
-     GLsizei = longint;
-     TGLsizei = GLsizei;
+   GLsizei = longint;
+   TGLsizei = GLsizei;
 
-     GLubyte = byte;
-     TGLubyte = GLubyte;
+   GLubyte = byte;
+   TGLubyte = GLubyte;
 
-     GLushort = word;
-     TGLushort = GLushort;
+   GLushort = word;
+   TGLushort = GLushort;
 
-     GLuint = longword;
-     TGLuint = GLuint;
+   GLuint = longword;
+   TGLuint = GLuint;
 
-     GLfloat = single;
-     TGLfloat = GLfloat;
+   GLfloat = single;
+   TGLfloat = GLfloat;
 
-     GLclampf = single;
-     TGLclampf = GLclampf;
+   GLclampf = single;
+   TGLclampf = GLclampf;
 
-     GLfixed = longint;
-     TGLfixed = GLfixed;
-  { GL types for handling large vertex buffer objects  }
+   GLfixed = longint;
+   TGLfixed = GLfixed;
+{ GL types for handling large vertex buffer objects  }
 
-     GLintptr = ptrint;
+   GLintptr = ptrint;
 
-     GLsizeiptr = ptrint;
-  { OpenGL ES core versions  }
+   GLsizeiptr = ptrint;
+{ OpenGL ES core versions  }
 
-  const
-     GL_ES_VERSION_2_0 = 1;     
-  { ClearBufferMask  }
-     GL_DEPTH_BUFFER_BIT = $00000100;     
-     GL_STENCIL_BUFFER_BIT = $00000400;     
-     GL_COLOR_BUFFER_BIT = $00004000;     
-  { Boolean  }
-     GL_FALSE = 0;     
-     GL_TRUE = 1;     
-  { BeginMode  }
-     GL_POINTS = $0000;     
-     GL_LINES = $0001;     
-     GL_LINE_LOOP = $0002;     
-     GL_LINE_STRIP = $0003;     
-     GL_TRIANGLES = $0004;     
-     GL_TRIANGLE_STRIP = $0005;     
-     GL_TRIANGLE_FAN = $0006;     
-  { AlphaFunction (not supported in ES20)  }
-  {      GL_NEVER  }
-  {      GL_LESS  }
-  {      GL_EQUAL  }
-  {      GL_LEQUAL  }
-  {      GL_GREATER  }
-  {      GL_NOTEQUAL  }
-  {      GL_GEQUAL  }
-  {      GL_ALWAYS  }
-  { BlendingFactorDest  }
-     GL_ZERO = 0;     
-     GL_ONE = 1;     
-     GL_SRC_COLOR = $0300;     
-     GL_ONE_MINUS_SRC_COLOR = $0301;     
-     GL_SRC_ALPHA = $0302;     
-     GL_ONE_MINUS_SRC_ALPHA = $0303;     
-     GL_DST_ALPHA = $0304;     
-     GL_ONE_MINUS_DST_ALPHA = $0305;     
-  { BlendingFactorSrc  }
-  {      GL_ZERO  }
-  {      GL_ONE  }
-     GL_DST_COLOR = $0306;     
-     GL_ONE_MINUS_DST_COLOR = $0307;     
-     GL_SRC_ALPHA_SATURATE = $0308;     
-  {      GL_SRC_ALPHA  }
-  {      GL_ONE_MINUS_SRC_ALPHA  }
-  {      GL_DST_ALPHA  }
-  {      GL_ONE_MINUS_DST_ALPHA  }
-  { BlendEquationSeparate  }
-     GL_FUNC_ADD = $8006;     
-     GL_BLEND_EQUATION = $8009;     
-  { same as BLEND_EQUATION  }
-     GL_BLEND_EQUATION_RGB = $8009;     
-     GL_BLEND_EQUATION_ALPHA = $883D;     
-  { BlendSubtract  }
-     GL_FUNC_SUBTRACT = $800A;     
-     GL_FUNC_REVERSE_SUBTRACT = $800B;     
-  { Separate Blend Functions  }
-     GL_BLEND_DST_RGB = $80C8;     
-     GL_BLEND_SRC_RGB = $80C9;     
-     GL_BLEND_DST_ALPHA = $80CA;     
-     GL_BLEND_SRC_ALPHA = $80CB;     
-     GL_CONSTANT_COLOR = $8001;     
-     GL_ONE_MINUS_CONSTANT_COLOR = $8002;     
-     GL_CONSTANT_ALPHA = $8003;     
-     GL_ONE_MINUS_CONSTANT_ALPHA = $8004;     
-     GL_BLEND_COLOR = $8005;     
-  { Buffer Objects  }
-     GL_ARRAY_BUFFER = $8892;     
-     GL_ELEMENT_ARRAY_BUFFER = $8893;     
-     GL_ARRAY_BUFFER_BINDING = $8894;     
-     GL_ELEMENT_ARRAY_BUFFER_BINDING = $8895;     
-     GL_STREAM_DRAW = $88E0;     
-     GL_STATIC_DRAW = $88E4;     
-     GL_DYNAMIC_DRAW = $88E8;     
-     GL_BUFFER_SIZE = $8764;     
-     GL_BUFFER_USAGE = $8765;     
-     GL_CURRENT_VERTEX_ATTRIB = $8626;     
-  { CullFaceMode  }
-     GL_FRONT = $0404;     
-     GL_BACK = $0405;     
-     GL_FRONT_AND_BACK = $0408;     
-  { DepthFunction  }
-  {      GL_NEVER  }
-  {      GL_LESS  }
-  {      GL_EQUAL  }
-  {      GL_LEQUAL  }
-  {      GL_GREATER  }
-  {      GL_NOTEQUAL  }
-  {      GL_GEQUAL  }
-  {      GL_ALWAYS  }
-  { EnableCap  }
-     GL_TEXTURE_2D = $0DE1;     
-     GL_CULL_FACE = $0B44;     
-     GL_BLEND = $0BE2;     
-     GL_DITHER = $0BD0;     
-     GL_STENCIL_TEST = $0B90;     
-     GL_DEPTH_TEST = $0B71;     
-     GL_SCISSOR_TEST = $0C11;     
-     GL_POLYGON_OFFSET_FILL = $8037;     
-     GL_SAMPLE_ALPHA_TO_COVERAGE = $809E;     
-     GL_SAMPLE_COVERAGE = $80A0;     
-  { ErrorCode  }
-     GL_NO_ERROR = 0;     
-     GL_INVALID_ENUM = $0500;     
-     GL_INVALID_VALUE = $0501;     
-     GL_INVALID_OPERATION = $0502;     
-     GL_OUT_OF_MEMORY = $0505;     
-  { FrontFaceDirection  }
-     GL_CW = $0900;     
-     GL_CCW = $0901;     
-  { GetPName  }
-     GL_LINE_WIDTH = $0B21;     
-     GL_ALIASED_POINT_SIZE_RANGE = $846D;     
-     GL_ALIASED_LINE_WIDTH_RANGE = $846E;     
-     GL_CULL_FACE_MODE = $0B45;     
-     GL_FRONT_FACE = $0B46;     
-     GL_DEPTH_RANGE = $0B70;     
-     GL_DEPTH_WRITEMASK = $0B72;     
-     GL_DEPTH_CLEAR_VALUE = $0B73;     
-     GL_DEPTH_FUNC = $0B74;     
-     GL_STENCIL_CLEAR_VALUE = $0B91;     
-     GL_STENCIL_FUNC = $0B92;     
-     GL_STENCIL_FAIL = $0B94;     
-     GL_STENCIL_PASS_DEPTH_FAIL = $0B95;     
-     GL_STENCIL_PASS_DEPTH_PASS = $0B96;     
-     GL_STENCIL_REF = $0B97;     
-     GL_STENCIL_VALUE_MASK = $0B93;     
-     GL_STENCIL_WRITEMASK = $0B98;     
-     GL_STENCIL_BACK_FUNC = $8800;     
-     GL_STENCIL_BACK_FAIL = $8801;     
-     GL_STENCIL_BACK_PASS_DEPTH_FAIL = $8802;     
-     GL_STENCIL_BACK_PASS_DEPTH_PASS = $8803;     
-     GL_STENCIL_BACK_REF = $8CA3;     
-     GL_STENCIL_BACK_VALUE_MASK = $8CA4;     
-     GL_STENCIL_BACK_WRITEMASK = $8CA5;     
-     GL_VIEWPORT = $0BA2;     
-     GL_SCISSOR_BOX = $0C10;     
-  {      GL_SCISSOR_TEST  }
-     GL_COLOR_CLEAR_VALUE = $0C22;     
-     GL_COLOR_WRITEMASK = $0C23;     
-     GL_UNPACK_ALIGNMENT = $0CF5;     
-     GL_PACK_ALIGNMENT = $0D05;     
-     GL_MAX_TEXTURE_SIZE = $0D33;     
-     GL_MAX_VIEWPORT_DIMS = $0D3A;     
-     GL_SUBPIXEL_BITS = $0D50;     
-     GL_RED_BITS = $0D52;     
-     GL_GREEN_BITS = $0D53;     
-     GL_BLUE_BITS = $0D54;     
-     GL_ALPHA_BITS = $0D55;     
-     GL_DEPTH_BITS = $0D56;     
-     GL_STENCIL_BITS = $0D57;     
-     GL_POLYGON_OFFSET_UNITS = $2A00;     
-  {      GL_POLYGON_OFFSET_FILL  }
-     GL_POLYGON_OFFSET_FACTOR = $8038;     
-     GL_TEXTURE_BINDING_2D = $8069;     
-     GL_SAMPLE_BUFFERS = $80A8;     
-     GL_SAMPLES = $80A9;     
-     GL_SAMPLE_COVERAGE_VALUE = $80AA;     
-     GL_SAMPLE_COVERAGE_INVERT = $80AB;     
-  { GetTextureParameter  }
-  {      GL_TEXTURE_MAG_FILTER  }
-  {      GL_TEXTURE_MIN_FILTER  }
-  {      GL_TEXTURE_WRAP_S  }
-  {      GL_TEXTURE_WRAP_T  }
-     GL_NUM_COMPRESSED_TEXTURE_FORMATS = $86A2;     
-     GL_COMPRESSED_TEXTURE_FORMATS = $86A3;     
-  { HintMode  }
-     GL_DONT_CARE = $1100;     
-     GL_FASTEST = $1101;     
-     GL_NICEST = $1102;     
-  { HintTarget  }
-     GL_GENERATE_MIPMAP_HINT = $8192;     
-  { DataType  }
-     GL_BYTE = $1400;     
-     GL_UNSIGNED_BYTE = $1401;     
-     GL_SHORT = $1402;     
-     GL_UNSIGNED_SHORT = $1403;     
-     GL_INT = $1404;     
-     GL_UNSIGNED_INT = $1405;     
-     GL_FLOAT = $1406;     
-     GL_FIXED = $140C;     
-  { PixelFormat  }
-     GL_DEPTH_COMPONENT = $1902;     
-     GL_ALPHA = $1906;     
-     GL_RGB = $1907;     
-     GL_RGBA = $1908;     
-     GL_LUMINANCE = $1909;     
-     GL_LUMINANCE_ALPHA = $190A;     
-  { PixelType  }
-  {      GL_UNSIGNED_BYTE  }
-     GL_UNSIGNED_SHORT_4_4_4_4 = $8033;     
-     GL_UNSIGNED_SHORT_5_5_5_1 = $8034;     
-     GL_UNSIGNED_SHORT_5_6_5 = $8363;     
-  { Shaders  }
-     GL_FRAGMENT_SHADER = $8B30;     
-     GL_VERTEX_SHADER = $8B31;     
-     GL_MAX_VERTEX_ATTRIBS = $8869;     
-     GL_MAX_VERTEX_UNIFORM_VECTORS = $8DFB;     
-     GL_MAX_VARYING_VECTORS = $8DFC;     
-     GL_MAX_COMBINED_TEXTURE_IMAGE_UNITS = $8B4D;     
-     GL_MAX_VERTEX_TEXTURE_IMAGE_UNITS = $8B4C;     
-     GL_MAX_TEXTURE_IMAGE_UNITS = $8872;     
-     GL_MAX_FRAGMENT_UNIFORM_VECTORS = $8DFD;     
-     GL_SHADER_TYPE = $8B4F;     
-     GL_DELETE_STATUS = $8B80;     
-     GL_LINK_STATUS = $8B82;     
-     GL_VALIDATE_STATUS = $8B83;     
-     GL_ATTACHED_SHADERS = $8B85;     
-     GL_ACTIVE_UNIFORMS = $8B86;     
-     GL_ACTIVE_UNIFORM_MAX_LENGTH = $8B87;     
-     GL_ACTIVE_ATTRIBUTES = $8B89;     
-     GL_ACTIVE_ATTRIBUTE_MAX_LENGTH = $8B8A;     
-     GL_SHADING_LANGUAGE_VERSION = $8B8C;     
-     GL_CURRENT_PROGRAM = $8B8D;     
-  { StencilFunction  }
-     GL_NEVER = $0200;     
-     GL_LESS = $0201;     
-     GL_EQUAL = $0202;     
-     GL_LEQUAL = $0203;     
-     GL_GREATER = $0204;     
-     GL_NOTEQUAL = $0205;     
-     GL_GEQUAL = $0206;     
-     GL_ALWAYS = $0207;     
-  { StencilOp  }
-  {      GL_ZERO  }
-     GL_KEEP = $1E00;     
-     GL_REPLACE = $1E01;     
-     GL_INCR = $1E02;     
-     GL_DECR = $1E03;     
-     GL_INVERT = $150A;     
-     GL_INCR_WRAP = $8507;     
-     GL_DECR_WRAP = $8508;     
-  { StringName  }
-     GL_VENDOR = $1F00;     
-     GL_RENDERER = $1F01;     
-     GL_VERSION = $1F02;     
-     GL_EXTENSIONS = $1F03;     
-  { TextureMagFilter  }
-     GL_NEAREST = $2600;     
-     GL_LINEAR = $2601;     
-  { TextureMinFilter  }
-  {      GL_NEAREST  }
-  {      GL_LINEAR  }
-     GL_NEAREST_MIPMAP_NEAREST = $2700;     
-     GL_LINEAR_MIPMAP_NEAREST = $2701;     
-     GL_NEAREST_MIPMAP_LINEAR = $2702;     
-     GL_LINEAR_MIPMAP_LINEAR = $2703;     
-  { TextureParameterName  }
-     GL_TEXTURE_MAG_FILTER = $2800;     
-     GL_TEXTURE_MIN_FILTER = $2801;     
-     GL_TEXTURE_WRAP_S = $2802;     
-     GL_TEXTURE_WRAP_T = $2803;     
-  { TextureTarget  }
-  {      GL_TEXTURE_2D  }
-     GL_TEXTURE = $1702;     
-     GL_TEXTURE_CUBE_MAP = $8513;     
-     GL_TEXTURE_BINDING_CUBE_MAP = $8514;     
-     GL_TEXTURE_CUBE_MAP_POSITIVE_X = $8515;     
-     GL_TEXTURE_CUBE_MAP_NEGATIVE_X = $8516;     
-     GL_TEXTURE_CUBE_MAP_POSITIVE_Y = $8517;     
-     GL_TEXTURE_CUBE_MAP_NEGATIVE_Y = $8518;     
-     GL_TEXTURE_CUBE_MAP_POSITIVE_Z = $8519;     
-     GL_TEXTURE_CUBE_MAP_NEGATIVE_Z = $851A;     
-     GL_MAX_CUBE_MAP_TEXTURE_SIZE = $851C;     
-  { TextureUnit  }
-     GL_TEXTURE0 = $84C0;     
-     GL_TEXTURE1 = $84C1;     
-     GL_TEXTURE2 = $84C2;     
-     GL_TEXTURE3 = $84C3;     
-     GL_TEXTURE4 = $84C4;     
-     GL_TEXTURE5 = $84C5;     
-     GL_TEXTURE6 = $84C6;     
-     GL_TEXTURE7 = $84C7;     
-     GL_TEXTURE8 = $84C8;     
-     GL_TEXTURE9 = $84C9;     
-     GL_TEXTURE10 = $84CA;     
-     GL_TEXTURE11 = $84CB;     
-     GL_TEXTURE12 = $84CC;     
-     GL_TEXTURE13 = $84CD;     
-     GL_TEXTURE14 = $84CE;     
-     GL_TEXTURE15 = $84CF;     
-     GL_TEXTURE16 = $84D0;     
-     GL_TEXTURE17 = $84D1;     
-     GL_TEXTURE18 = $84D2;     
-     GL_TEXTURE19 = $84D3;     
-     GL_TEXTURE20 = $84D4;     
-     GL_TEXTURE21 = $84D5;     
-     GL_TEXTURE22 = $84D6;     
-     GL_TEXTURE23 = $84D7;     
-     GL_TEXTURE24 = $84D8;     
-     GL_TEXTURE25 = $84D9;     
-     GL_TEXTURE26 = $84DA;     
-     GL_TEXTURE27 = $84DB;     
-     GL_TEXTURE28 = $84DC;     
-     GL_TEXTURE29 = $84DD;     
-     GL_TEXTURE30 = $84DE;     
-     GL_TEXTURE31 = $84DF;     
-     GL_ACTIVE_TEXTURE = $84E0;     
-  { TextureWrapMode  }
-     GL_REPEAT = $2901;     
-     GL_CLAMP_TO_EDGE = $812F;     
-     GL_MIRRORED_REPEAT = $8370;     
-  { Uniform Types  }
-     GL_FLOAT_VEC2 = $8B50;     
-     GL_FLOAT_VEC3 = $8B51;     
-     GL_FLOAT_VEC4 = $8B52;     
-     GL_INT_VEC2 = $8B53;     
-     GL_INT_VEC3 = $8B54;     
-     GL_INT_VEC4 = $8B55;     
-     GL_BOOL = $8B56;     
-     GL_BOOL_VEC2 = $8B57;     
-     GL_BOOL_VEC3 = $8B58;     
-     GL_BOOL_VEC4 = $8B59;     
-     GL_FLOAT_MAT2 = $8B5A;     
-     GL_FLOAT_MAT3 = $8B5B;     
-     GL_FLOAT_MAT4 = $8B5C;     
-     GL_SAMPLER_2D = $8B5E;     
-     GL_SAMPLER_CUBE = $8B60;     
-  { Vertex Arrays  }
-     GL_VERTEX_ATTRIB_ARRAY_ENABLED = $8622;     
-     GL_VERTEX_ATTRIB_ARRAY_SIZE = $8623;     
-     GL_VERTEX_ATTRIB_ARRAY_STRIDE = $8624;     
-     GL_VERTEX_ATTRIB_ARRAY_TYPE = $8625;     
-     GL_VERTEX_ATTRIB_ARRAY_NORMALIZED = $886A;     
-     GL_VERTEX_ATTRIB_ARRAY_POINTER = $8645;     
-     GL_VERTEX_ATTRIB_ARRAY_BUFFER_BINDING = $889F;     
-  { Read Format  }
-     GL_IMPLEMENTATION_COLOR_READ_TYPE = $8B9A;     
-     GL_IMPLEMENTATION_COLOR_READ_FORMAT = $8B9B;     
-  { Shader Source  }
-     GL_COMPILE_STATUS = $8B81;     
-     GL_INFO_LOG_LENGTH = $8B84;     
-     GL_SHADER_SOURCE_LENGTH = $8B88;     
-     GL_SHADER_COMPILER = $8DFA;     
-  { Shader Binary  }
-     GL_SHADER_BINARY_FORMATS = $8DF8;     
-     GL_NUM_SHADER_BINARY_FORMATS = $8DF9;     
-  { Shader Precision-Specified Types  }
-     GL_LOW_FLOAT = $8DF0;     
-     GL_MEDIUM_FLOAT = $8DF1;     
-     GL_HIGH_FLOAT = $8DF2;     
-     GL_LOW_INT = $8DF3;     
-     GL_MEDIUM_INT = $8DF4;     
-     GL_HIGH_INT = $8DF5;     
-  { Framebuffer Object.  }
-     GL_FRAMEBUFFER = $8D40;     
-     GL_RENDERBUFFER = $8D41;     
-     GL_RGBA4 = $8056;     
-     GL_RGB5_A1 = $8057;     
-     GL_RGB565 = $8D62;     
-     GL_DEPTH_COMPONENT16 = $81A5;     
-     GL_STENCIL_INDEX = $1901;     
-     GL_STENCIL_INDEX8 = $8D48;     
-     GL_RENDERBUFFER_WIDTH = $8D42;     
-     GL_RENDERBUFFER_HEIGHT = $8D43;     
-     GL_RENDERBUFFER_INTERNAL_FORMAT = $8D44;     
-     GL_RENDERBUFFER_RED_SIZE = $8D50;     
-     GL_RENDERBUFFER_GREEN_SIZE = $8D51;     
-     GL_RENDERBUFFER_BLUE_SIZE = $8D52;     
-     GL_RENDERBUFFER_ALPHA_SIZE = $8D53;     
-     GL_RENDERBUFFER_DEPTH_SIZE = $8D54;     
-     GL_RENDERBUFFER_STENCIL_SIZE = $8D55;     
-     GL_FRAMEBUFFER_ATTACHMENT_OBJECT_TYPE = $8CD0;     
-     GL_FRAMEBUFFER_ATTACHMENT_OBJECT_NAME = $8CD1;     
-     GL_FRAMEBUFFER_ATTACHMENT_TEXTURE_LEVEL = $8CD2;     
-     GL_FRAMEBUFFER_ATTACHMENT_TEXTURE_CUBE_MAP_FACE = $8CD3;     
-     GL_COLOR_ATTACHMENT0 = $8CE0;     
-     GL_DEPTH_ATTACHMENT = $8D00;     
-     GL_STENCIL_ATTACHMENT = $8D20;     
-     GL_NONE = 0;     
-     GL_FRAMEBUFFER_COMPLETE = $8CD5;     
-     GL_FRAMEBUFFER_INCOMPLETE_ATTACHMENT = $8CD6;     
-     GL_FRAMEBUFFER_INCOMPLETE_MISSING_ATTACHMENT = $8CD7;     
-     GL_FRAMEBUFFER_INCOMPLETE_DIMENSIONS = $8CD9;     
-     GL_FRAMEBUFFER_UNSUPPORTED = $8CDD;     
-     GL_FRAMEBUFFER_BINDING = $8CA6;     
-     GL_RENDERBUFFER_BINDING = $8CA7;     
-     GL_MAX_RENDERBUFFER_SIZE = $84E8;     
-     GL_INVALID_FRAMEBUFFER_OPERATION = $0506;     
-  {-------------------------------------------------------------------------
-   * GL core functions.
-   *----------------------------------------------------------------------- }
+const
+   GL_ES_VERSION_2_0 = 1;
+{ ClearBufferMask  }
+   GL_DEPTH_BUFFER_BIT = $00000100;
+   GL_STENCIL_BUFFER_BIT = $00000400;
+   GL_COLOR_BUFFER_BIT = $00004000;
+{ Boolean  }
+   GL_FALSE = 0;
+   GL_TRUE = 1;
+{ BeginMode  }
+   GL_POINTS = $0000;
+   GL_LINES = $0001;
+   GL_LINE_LOOP = $0002;
+   GL_LINE_STRIP = $0003;
+   GL_TRIANGLES = $0004;
+   GL_TRIANGLE_STRIP = $0005;
+   GL_TRIANGLE_FAN = $0006;
+{ AlphaFunction (not supported in ES20)  }
+{      GL_NEVER  }
+{      GL_LESS  }
+{      GL_EQUAL  }
+{      GL_LEQUAL  }
+{      GL_GREATER  }
+{      GL_NOTEQUAL  }
+{      GL_GEQUAL  }
+{      GL_ALWAYS  }
+{ BlendingFactorDest  }
+   GL_ZERO = 0;
+   GL_ONE = 1;
+   GL_SRC_COLOR = $0300;
+   GL_ONE_MINUS_SRC_COLOR = $0301;
+   GL_SRC_ALPHA = $0302;
+   GL_ONE_MINUS_SRC_ALPHA = $0303;
+   GL_DST_ALPHA = $0304;
+   GL_ONE_MINUS_DST_ALPHA = $0305;
+{ BlendingFactorSrc  }
+{      GL_ZERO  }
+{      GL_ONE  }
+   GL_DST_COLOR = $0306;
+   GL_ONE_MINUS_DST_COLOR = $0307;
+   GL_SRC_ALPHA_SATURATE = $0308;
+{      GL_SRC_ALPHA  }
+{      GL_ONE_MINUS_SRC_ALPHA  }
+{      GL_DST_ALPHA  }
+{      GL_ONE_MINUS_DST_ALPHA  }
+{ BlendEquationSeparate  }
+   GL_FUNC_ADD = $8006;
+   GL_BLEND_EQUATION = $8009;
+{ same as BLEND_EQUATION  }
+   GL_BLEND_EQUATION_RGB = $8009;
+   GL_BLEND_EQUATION_ALPHA = $883D;
+{ BlendSubtract  }
+   GL_FUNC_SUBTRACT = $800A;
+   GL_FUNC_REVERSE_SUBTRACT = $800B;
+{ Separate Blend Functions  }
+   GL_BLEND_DST_RGB = $80C8;
+   GL_BLEND_SRC_RGB = $80C9;
+   GL_BLEND_DST_ALPHA = $80CA;
+   GL_BLEND_SRC_ALPHA = $80CB;
+   GL_CONSTANT_COLOR = $8001;
+   GL_ONE_MINUS_CONSTANT_COLOR = $8002;
+   GL_CONSTANT_ALPHA = $8003;
+   GL_ONE_MINUS_CONSTANT_ALPHA = $8004;
+   GL_BLEND_COLOR = $8005;
+{ Buffer Objects  }
+   GL_ARRAY_BUFFER = $8892;
+   GL_ELEMENT_ARRAY_BUFFER = $8893;
+   GL_ARRAY_BUFFER_BINDING = $8894;
+   GL_ELEMENT_ARRAY_BUFFER_BINDING = $8895;
+   GL_STREAM_DRAW = $88E0;
+   GL_STATIC_DRAW = $88E4;
+   GL_DYNAMIC_DRAW = $88E8;
+   GL_BUFFER_SIZE = $8764;
+   GL_BUFFER_USAGE = $8765;
+   GL_CURRENT_VERTEX_ATTRIB = $8626;
+{ CullFaceMode  }
+   GL_FRONT = $0404;
+   GL_BACK = $0405;
+   GL_FRONT_AND_BACK = $0408;
+{ DepthFunction  }
+{      GL_NEVER  }
+{      GL_LESS  }
+{      GL_EQUAL  }
+{      GL_LEQUAL  }
+{      GL_GREATER  }
+{      GL_NOTEQUAL  }
+{      GL_GEQUAL  }
+{      GL_ALWAYS  }
+{ EnableCap  }
+   GL_TEXTURE_2D = $0DE1;
+   GL_CULL_FACE = $0B44;
+   GL_BLEND = $0BE2;
+   GL_DITHER = $0BD0;
+   GL_STENCIL_TEST = $0B90;
+   GL_DEPTH_TEST = $0B71;
+   GL_SCISSOR_TEST = $0C11;
+   GL_POLYGON_OFFSET_FILL = $8037;
+   GL_SAMPLE_ALPHA_TO_COVERAGE = $809E;
+   GL_SAMPLE_COVERAGE = $80A0;
+{ ErrorCode  }
+   GL_NO_ERROR = 0;
+   GL_INVALID_ENUM = $0500;
+   GL_INVALID_VALUE = $0501;
+   GL_INVALID_OPERATION = $0502;
+   GL_OUT_OF_MEMORY = $0505;
+{ FrontFaceDirection  }
+   GL_CW = $0900;
+   GL_CCW = $0901;
+{ GetPName  }
+   GL_LINE_WIDTH = $0B21;
+   GL_ALIASED_POINT_SIZE_RANGE = $846D;
+   GL_ALIASED_LINE_WIDTH_RANGE = $846E;
+   GL_CULL_FACE_MODE = $0B45;
+   GL_FRONT_FACE = $0B46;
+   GL_DEPTH_RANGE = $0B70;
+   GL_DEPTH_WRITEMASK = $0B72;
+   GL_DEPTH_CLEAR_VALUE = $0B73;
+   GL_DEPTH_FUNC = $0B74;
+   GL_STENCIL_CLEAR_VALUE = $0B91;
+   GL_STENCIL_FUNC = $0B92;
+   GL_STENCIL_FAIL = $0B94;
+   GL_STENCIL_PASS_DEPTH_FAIL = $0B95;
+   GL_STENCIL_PASS_DEPTH_PASS = $0B96;
+   GL_STENCIL_REF = $0B97;
+   GL_STENCIL_VALUE_MASK = $0B93;
+   GL_STENCIL_WRITEMASK = $0B98;
+   GL_STENCIL_BACK_FUNC = $8800;
+   GL_STENCIL_BACK_FAIL = $8801;
+   GL_STENCIL_BACK_PASS_DEPTH_FAIL = $8802;
+   GL_STENCIL_BACK_PASS_DEPTH_PASS = $8803;
+   GL_STENCIL_BACK_REF = $8CA3;
+   GL_STENCIL_BACK_VALUE_MASK = $8CA4;
+   GL_STENCIL_BACK_WRITEMASK = $8CA5;
+   GL_VIEWPORT = $0BA2;
+   GL_SCISSOR_BOX = $0C10;
+{      GL_SCISSOR_TEST  }
+   GL_COLOR_CLEAR_VALUE = $0C22;
+   GL_COLOR_WRITEMASK = $0C23;
+   GL_UNPACK_ALIGNMENT = $0CF5;
+   GL_PACK_ALIGNMENT = $0D05;
+   GL_MAX_TEXTURE_SIZE = $0D33;
+   GL_MAX_VIEWPORT_DIMS = $0D3A;
+   GL_SUBPIXEL_BITS = $0D50;
+   GL_RED_BITS = $0D52;
+   GL_GREEN_BITS = $0D53;
+   GL_BLUE_BITS = $0D54;
+   GL_ALPHA_BITS = $0D55;
+   GL_DEPTH_BITS = $0D56;
+   GL_STENCIL_BITS = $0D57;
+   GL_POLYGON_OFFSET_UNITS = $2A00;
+{      GL_POLYGON_OFFSET_FILL  }
+   GL_POLYGON_OFFSET_FACTOR = $8038;
+   GL_TEXTURE_BINDING_2D = $8069;
+   GL_SAMPLE_BUFFERS = $80A8;
+   GL_SAMPLES = $80A9;
+   GL_SAMPLE_COVERAGE_VALUE = $80AA;
+   GL_SAMPLE_COVERAGE_INVERT = $80AB;
+{ GetTextureParameter  }
+{      GL_TEXTURE_MAG_FILTER  }
+{      GL_TEXTURE_MIN_FILTER  }
+{      GL_TEXTURE_WRAP_S  }
+{      GL_TEXTURE_WRAP_T  }
+   GL_NUM_COMPRESSED_TEXTURE_FORMATS = $86A2;
+   GL_COMPRESSED_TEXTURE_FORMATS = $86A3;
+{ HintMode  }
+   GL_DONT_CARE = $1100;
+   GL_FASTEST = $1101;
+   GL_NICEST = $1102;
+{ HintTarget  }
+   GL_GENERATE_MIPMAP_HINT = $8192;
+{ DataType  }
+   GL_BYTE = $1400;
+   GL_UNSIGNED_BYTE = $1401;
+   GL_SHORT = $1402;
+   GL_UNSIGNED_SHORT = $1403;
+   GL_INT = $1404;
+   GL_UNSIGNED_INT = $1405;
+   GL_FLOAT = $1406;
+   GL_FIXED = $140C;
+{ PixelFormat  }
+   GL_DEPTH_COMPONENT = $1902;
+   GL_ALPHA = $1906;
+   GL_RGB = $1907;
+   GL_RGBA = $1908;
+   GL_LUMINANCE = $1909;
+   GL_LUMINANCE_ALPHA = $190A;
+{ PixelType  }
+{      GL_UNSIGNED_BYTE  }
+   GL_UNSIGNED_SHORT_4_4_4_4 = $8033;
+   GL_UNSIGNED_SHORT_5_5_5_1 = $8034;
+   GL_UNSIGNED_SHORT_5_6_5 = $8363;
+{ Shaders  }
+   GL_FRAGMENT_SHADER = $8B30;
+   GL_VERTEX_SHADER = $8B31;
+   GL_MAX_VERTEX_ATTRIBS = $8869;
+   GL_MAX_VERTEX_UNIFORM_VECTORS = $8DFB;
+   GL_MAX_VARYING_VECTORS = $8DFC;
+   GL_MAX_COMBINED_TEXTURE_IMAGE_UNITS = $8B4D;
+   GL_MAX_VERTEX_TEXTURE_IMAGE_UNITS = $8B4C;
+   GL_MAX_TEXTURE_IMAGE_UNITS = $8872;
+   GL_MAX_FRAGMENT_UNIFORM_VECTORS = $8DFD;
+   GL_SHADER_TYPE = $8B4F;
+   GL_DELETE_STATUS = $8B80;
+   GL_LINK_STATUS = $8B82;
+   GL_VALIDATE_STATUS = $8B83;
+   GL_ATTACHED_SHADERS = $8B85;
+   GL_ACTIVE_UNIFORMS = $8B86;
+   GL_ACTIVE_UNIFORM_MAX_LENGTH = $8B87;
+   GL_ACTIVE_ATTRIBUTES = $8B89;
+   GL_ACTIVE_ATTRIBUTE_MAX_LENGTH = $8B8A;
+   GL_SHADING_LANGUAGE_VERSION = $8B8C;
+   GL_CURRENT_PROGRAM = $8B8D;
+{ StencilFunction  }
+   GL_NEVER = $0200;
+   GL_LESS = $0201;
+   GL_EQUAL = $0202;
+   GL_LEQUAL = $0203;
+   GL_GREATER = $0204;
+   GL_NOTEQUAL = $0205;
+   GL_GEQUAL = $0206;
+   GL_ALWAYS = $0207;
+{ StencilOp  }
+{      GL_ZERO  }
+   GL_KEEP = $1E00;
+   GL_REPLACE = $1E01;
+   GL_INCR = $1E02;
+   GL_DECR = $1E03;
+   GL_INVERT = $150A;
+   GL_INCR_WRAP = $8507;
+   GL_DECR_WRAP = $8508;
+{ StringName  }
+   GL_VENDOR = $1F00;
+   GL_RENDERER = $1F01;
+   GL_VERSION = $1F02;
+   GL_EXTENSIONS = $1F03;
+{ TextureMagFilter  }
+   GL_NEAREST = $2600;
+   GL_LINEAR = $2601;
+{ TextureMinFilter  }
+{      GL_NEAREST  }
+{      GL_LINEAR  }
+   GL_NEAREST_MIPMAP_NEAREST = $2700;
+   GL_LINEAR_MIPMAP_NEAREST = $2701;
+   GL_NEAREST_MIPMAP_LINEAR = $2702;
+   GL_LINEAR_MIPMAP_LINEAR = $2703;
+{ TextureParameterName  }
+   GL_TEXTURE_MAG_FILTER = $2800;
+   GL_TEXTURE_MIN_FILTER = $2801;
+   GL_TEXTURE_WRAP_S = $2802;
+   GL_TEXTURE_WRAP_T = $2803;
+{ TextureTarget  }
+{      GL_TEXTURE_2D  }
+   GL_TEXTURE = $1702;
+   GL_TEXTURE_CUBE_MAP = $8513;
+   GL_TEXTURE_BINDING_CUBE_MAP = $8514;
+   GL_TEXTURE_CUBE_MAP_POSITIVE_X = $8515;
+   GL_TEXTURE_CUBE_MAP_NEGATIVE_X = $8516;
+   GL_TEXTURE_CUBE_MAP_POSITIVE_Y = $8517;
+   GL_TEXTURE_CUBE_MAP_NEGATIVE_Y = $8518;
+   GL_TEXTURE_CUBE_MAP_POSITIVE_Z = $8519;
+   GL_TEXTURE_CUBE_MAP_NEGATIVE_Z = $851A;
+   GL_MAX_CUBE_MAP_TEXTURE_SIZE = $851C;
+{ TextureUnit  }
+   GL_TEXTURE0 = $84C0;
+   GL_TEXTURE1 = $84C1;
+   GL_TEXTURE2 = $84C2;
+   GL_TEXTURE3 = $84C3;
+   GL_TEXTURE4 = $84C4;
+   GL_TEXTURE5 = $84C5;
+   GL_TEXTURE6 = $84C6;
+   GL_TEXTURE7 = $84C7;
+   GL_TEXTURE8 = $84C8;
+   GL_TEXTURE9 = $84C9;
+   GL_TEXTURE10 = $84CA;
+   GL_TEXTURE11 = $84CB;
+   GL_TEXTURE12 = $84CC;
+   GL_TEXTURE13 = $84CD;
+   GL_TEXTURE14 = $84CE;
+   GL_TEXTURE15 = $84CF;
+   GL_TEXTURE16 = $84D0;
+   GL_TEXTURE17 = $84D1;
+   GL_TEXTURE18 = $84D2;
+   GL_TEXTURE19 = $84D3;
+   GL_TEXTURE20 = $84D4;
+   GL_TEXTURE21 = $84D5;
+   GL_TEXTURE22 = $84D6;
+   GL_TEXTURE23 = $84D7;
+   GL_TEXTURE24 = $84D8;
+   GL_TEXTURE25 = $84D9;
+   GL_TEXTURE26 = $84DA;
+   GL_TEXTURE27 = $84DB;
+   GL_TEXTURE28 = $84DC;
+   GL_TEXTURE29 = $84DD;
+   GL_TEXTURE30 = $84DE;
+   GL_TEXTURE31 = $84DF;
+   GL_ACTIVE_TEXTURE = $84E0;
+{ TextureWrapMode  }
+   GL_REPEAT = $2901;
+   GL_CLAMP_TO_EDGE = $812F;
+   GL_MIRRORED_REPEAT = $8370;
+{ Uniform Types  }
+   GL_FLOAT_VEC2 = $8B50;
+   GL_FLOAT_VEC3 = $8B51;
+   GL_FLOAT_VEC4 = $8B52;
+   GL_INT_VEC2 = $8B53;
+   GL_INT_VEC3 = $8B54;
+   GL_INT_VEC4 = $8B55;
+   GL_BOOL = $8B56;
+   GL_BOOL_VEC2 = $8B57;
+   GL_BOOL_VEC3 = $8B58;
+   GL_BOOL_VEC4 = $8B59;
+   GL_FLOAT_MAT2 = $8B5A;
+   GL_FLOAT_MAT3 = $8B5B;
+   GL_FLOAT_MAT4 = $8B5C;
+   GL_SAMPLER_2D = $8B5E;
+   GL_SAMPLER_CUBE = $8B60;
+{ Vertex Arrays  }
+   GL_VERTEX_ATTRIB_ARRAY_ENABLED = $8622;
+   GL_VERTEX_ATTRIB_ARRAY_SIZE = $8623;
+   GL_VERTEX_ATTRIB_ARRAY_STRIDE = $8624;
+   GL_VERTEX_ATTRIB_ARRAY_TYPE = $8625;
+   GL_VERTEX_ATTRIB_ARRAY_NORMALIZED = $886A;
+   GL_VERTEX_ATTRIB_ARRAY_POINTER = $8645;
+   GL_VERTEX_ATTRIB_ARRAY_BUFFER_BINDING = $889F;
+{ Read Format  }
+   GL_IMPLEMENTATION_COLOR_READ_TYPE = $8B9A;
+   GL_IMPLEMENTATION_COLOR_READ_FORMAT = $8B9B;
+{ Shader Source  }
+   GL_COMPILE_STATUS = $8B81;
+   GL_INFO_LOG_LENGTH = $8B84;
+   GL_SHADER_SOURCE_LENGTH = $8B88;
+   GL_SHADER_COMPILER = $8DFA;
+{ Shader Binary  }
+   GL_SHADER_BINARY_FORMATS = $8DF8;
+   GL_NUM_SHADER_BINARY_FORMATS = $8DF9;
+{ Shader Precision-Specified Types  }
+   GL_LOW_FLOAT = $8DF0;
+   GL_MEDIUM_FLOAT = $8DF1;
+   GL_HIGH_FLOAT = $8DF2;
+   GL_LOW_INT = $8DF3;
+   GL_MEDIUM_INT = $8DF4;
+   GL_HIGH_INT = $8DF5;
+{ Framebuffer Object.  }
+   GL_FRAMEBUFFER = $8D40;
+   GL_RENDERBUFFER = $8D41;
+   GL_RGBA4 = $8056;
+   GL_RGB5_A1 = $8057;
+   GL_RGB565 = $8D62;
+   GL_DEPTH_COMPONENT16 = $81A5;
+   GL_STENCIL_INDEX = $1901;
+   GL_STENCIL_INDEX8 = $8D48;
+   GL_RENDERBUFFER_WIDTH = $8D42;
+   GL_RENDERBUFFER_HEIGHT = $8D43;
+   GL_RENDERBUFFER_INTERNAL_FORMAT = $8D44;
+   GL_RENDERBUFFER_RED_SIZE = $8D50;
+   GL_RENDERBUFFER_GREEN_SIZE = $8D51;
+   GL_RENDERBUFFER_BLUE_SIZE = $8D52;
+   GL_RENDERBUFFER_ALPHA_SIZE = $8D53;
+   GL_RENDERBUFFER_DEPTH_SIZE = $8D54;
+   GL_RENDERBUFFER_STENCIL_SIZE = $8D55;
+   GL_FRAMEBUFFER_ATTACHMENT_OBJECT_TYPE = $8CD0;
+   GL_FRAMEBUFFER_ATTACHMENT_OBJECT_NAME = $8CD1;
+   GL_FRAMEBUFFER_ATTACHMENT_TEXTURE_LEVEL = $8CD2;
+   GL_FRAMEBUFFER_ATTACHMENT_TEXTURE_CUBE_MAP_FACE = $8CD3;
+   GL_COLOR_ATTACHMENT0 = $8CE0;
+   GL_DEPTH_ATTACHMENT = $8D00;
+   GL_STENCIL_ATTACHMENT = $8D20;
+   GL_NONE = 0;
+   GL_FRAMEBUFFER_COMPLETE = $8CD5;
+   GL_FRAMEBUFFER_INCOMPLETE_ATTACHMENT = $8CD6;
+   GL_FRAMEBUFFER_INCOMPLETE_MISSING_ATTACHMENT = $8CD7;
+   GL_FRAMEBUFFER_INCOMPLETE_DIMENSIONS = $8CD9;
+   GL_FRAMEBUFFER_UNSUPPORTED = $8CDD;
+   GL_FRAMEBUFFER_BINDING = $8CA6;
+   GL_RENDERBUFFER_BINDING = $8CA7;
+   GL_MAX_RENDERBUFFER_SIZE = $84E8;
+   GL_INVALID_FRAMEBUFFER_OPERATION = $0506;
+{-------------------------------------------------------------------------
+ * GL core functions.
+ *----------------------------------------------------------------------- }
 
-  var
-    glActiveTexture : procedure(texture:GLenum);{$ifdef windows}stdcall;{$else}cdecl;{$endif}
-    glAttachShader : procedure(_program:GLuint; shader:GLuint);{$ifdef windows}stdcall;{$else}cdecl;{$endif}
+var
+  glActiveTexture : procedure(texture:GLenum);{$ifdef windows}stdcall;{$else}cdecl;{$endif}
+  glAttachShader : procedure(_program:GLuint; shader:GLuint);{$ifdef windows}stdcall;{$else}cdecl;{$endif}
 (* Const before type ignored *)
-    glBindAttribLocation : procedure(_program:GLuint; index:GLuint; name:pchar);{$ifdef windows}stdcall;{$else}cdecl;{$endif}
-    glBindBuffer : procedure(target:GLenum; buffer:GLuint);{$ifdef windows}stdcall;{$else}cdecl;{$endif}
-    glBindFramebuffer : procedure(target:GLenum; framebuffer:GLuint);{$ifdef windows}stdcall;{$else}cdecl;{$endif}
-    glBindRenderbuffer : procedure(target:GLenum; renderbuffer:GLuint);{$ifdef windows}stdcall;{$else}cdecl;{$endif}
-    glBindTexture : procedure(target:GLenum; texture:GLuint);{$ifdef windows}stdcall;{$else}cdecl;{$endif}
-    glBlendColor : procedure(red:GLclampf; green:GLclampf; blue:GLclampf; alpha:GLclampf);{$ifdef windows}stdcall;{$else}cdecl;{$endif}
-    glBlendEquation : procedure(mode:GLenum);{$ifdef windows}stdcall;{$else}cdecl;{$endif}
-    glBlendEquationSeparate : procedure(modeRGB:GLenum; modeAlpha:GLenum);{$ifdef windows}stdcall;{$else}cdecl;{$endif}
-    glBlendFunc : procedure(sfactor:GLenum; dfactor:GLenum);{$ifdef windows}stdcall;{$else}cdecl;{$endif}
-    glBlendFuncSeparate : procedure(srcRGB:GLenum; dstRGB:GLenum; srcAlpha:GLenum; dstAlpha:GLenum);{$ifdef windows}stdcall;{$else}cdecl;{$endif}
+  glBindAttribLocation : procedure(_program:GLuint; index:GLuint; name:pchar);{$ifdef windows}stdcall;{$else}cdecl;{$endif}
+  glBindBuffer : procedure(target:GLenum; buffer:GLuint);{$ifdef windows}stdcall;{$else}cdecl;{$endif}
+  glBindFramebuffer : procedure(target:GLenum; framebuffer:GLuint);{$ifdef windows}stdcall;{$else}cdecl;{$endif}
+  glBindRenderbuffer : procedure(target:GLenum; renderbuffer:GLuint);{$ifdef windows}stdcall;{$else}cdecl;{$endif}
+  glBindTexture : procedure(target:GLenum; texture:GLuint);{$ifdef windows}stdcall;{$else}cdecl;{$endif}
+  glBlendColor : procedure(red:GLclampf; green:GLclampf; blue:GLclampf; alpha:GLclampf);{$ifdef windows}stdcall;{$else}cdecl;{$endif}
+  glBlendEquation : procedure(mode:GLenum);{$ifdef windows}stdcall;{$else}cdecl;{$endif}
+  glBlendEquationSeparate : procedure(modeRGB:GLenum; modeAlpha:GLenum);{$ifdef windows}stdcall;{$else}cdecl;{$endif}
+  glBlendFunc : procedure(sfactor:GLenum; dfactor:GLenum);{$ifdef windows}stdcall;{$else}cdecl;{$endif}
+  glBlendFuncSeparate : procedure(srcRGB:GLenum; dstRGB:GLenum; srcAlpha:GLenum; dstAlpha:GLenum);{$ifdef windows}stdcall;{$else}cdecl;{$endif}
 (* Const before type ignored *)
-    glBufferData : procedure(target:GLenum; size:GLsizeiptr; data:pointer; usage:GLenum);{$ifdef windows}stdcall;{$else}cdecl;{$endif}
+  glBufferData : procedure(target:GLenum; size:GLsizeiptr; data:pointer; usage:GLenum);{$ifdef windows}stdcall;{$else}cdecl;{$endif}
 (* Const before type ignored *)
-    glBufferSubData : procedure(target:GLenum; offset:GLintptr; size:GLsizeiptr; data:pointer);{$ifdef windows}stdcall;{$else}cdecl;{$endif}
-    glCheckFramebufferStatus : function(target:GLenum):GLenum;{$ifdef windows}stdcall;{$else}cdecl;{$endif}
-    glClear : procedure(mask:GLbitfield);{$ifdef windows}stdcall;{$else}cdecl;{$endif}
-    glClearColor : procedure(red:GLclampf; green:GLclampf; blue:GLclampf; alpha:GLclampf);{$ifdef windows}stdcall;{$else}cdecl;{$endif}
-    glClearDepthf : procedure(depth:GLclampf);{$ifdef windows}stdcall;{$else}cdecl;{$endif}
-    glClearStencil : procedure(s:GLint);{$ifdef windows}stdcall;{$else}cdecl;{$endif}
-    glColorMask : procedure(red:GLboolean; green:GLboolean; blue:GLboolean; alpha:GLboolean);{$ifdef windows}stdcall;{$else}cdecl;{$endif}
-    glCompileShader : procedure(shader:GLuint);{$ifdef windows}stdcall;{$else}cdecl;{$endif}
+  glBufferSubData : procedure(target:GLenum; offset:GLintptr; size:GLsizeiptr; data:pointer);{$ifdef windows}stdcall;{$else}cdecl;{$endif}
+  glCheckFramebufferStatus : function(target:GLenum):GLenum;{$ifdef windows}stdcall;{$else}cdecl;{$endif}
+  glClear : procedure(mask:GLbitfield);{$ifdef windows}stdcall;{$else}cdecl;{$endif}
+  glClearColor : procedure(red:GLclampf; green:GLclampf; blue:GLclampf; alpha:GLclampf);{$ifdef windows}stdcall;{$else}cdecl;{$endif}
+  glClearDepthf : procedure(depth:GLclampf);{$ifdef windows}stdcall;{$else}cdecl;{$endif}
+  glClearStencil : procedure(s:GLint);{$ifdef windows}stdcall;{$else}cdecl;{$endif}
+  glColorMask : procedure(red:GLboolean; green:GLboolean; blue:GLboolean; alpha:GLboolean);{$ifdef windows}stdcall;{$else}cdecl;{$endif}
+  glCompileShader : procedure(shader:GLuint);{$ifdef windows}stdcall;{$else}cdecl;{$endif}
 (* Const before type ignored *)
-    glCompressedTexImage2D : procedure(target:GLenum; level:GLint; internalformat:GLenum; width:GLsizei; height:GLsizei; 
-      border:GLint; imageSize:GLsizei; data:pointer);{$ifdef windows}stdcall;{$else}cdecl;{$endif}
+  glCompressedTexImage2D : procedure(target:GLenum; level:GLint; internalformat:GLenum; width:GLsizei; height:GLsizei;
+    border:GLint; imageSize:GLsizei; data:pointer);{$ifdef windows}stdcall;{$else}cdecl;{$endif}
 (* Const before type ignored *)
-    glCompressedTexSubImage2D : procedure(target:GLenum; level:GLint; xoffset:GLint; yoffset:GLint; width:GLsizei; 
-      height:GLsizei; format:GLenum; imageSize:GLsizei; data:pointer);{$ifdef windows}stdcall;{$else}cdecl;{$endif}
-    glCopyTexImage2D : procedure(target:GLenum; level:GLint; internalformat:GLenum; x:GLint; y:GLint; 
-      width:GLsizei; height:GLsizei; border:GLint);{$ifdef windows}stdcall;{$else}cdecl;{$endif}
-    glCopyTexSubImage2D : procedure(target:GLenum; level:GLint; xoffset:GLint; yoffset:GLint; x:GLint; 
-      y:GLint; width:GLsizei; height:GLsizei);{$ifdef windows}stdcall;{$else}cdecl;{$endif}
-    glCreateProgram : function:GLuint;{$ifdef windows}stdcall;{$else}cdecl;{$endif}
-    glCreateShader : function(_type:GLenum):GLuint;{$ifdef windows}stdcall;{$else}cdecl;{$endif}
-    glCullFace : procedure(mode:GLenum);{$ifdef windows}stdcall;{$else}cdecl;{$endif}
+  glCompressedTexSubImage2D : procedure(target:GLenum; level:GLint; xoffset:GLint; yoffset:GLint; width:GLsizei;
+    height:GLsizei; format:GLenum; imageSize:GLsizei; data:pointer);{$ifdef windows}stdcall;{$else}cdecl;{$endif}
+  glCopyTexImage2D : procedure(target:GLenum; level:GLint; internalformat:GLenum; x:GLint; y:GLint;
+    width:GLsizei; height:GLsizei; border:GLint);{$ifdef windows}stdcall;{$else}cdecl;{$endif}
+  glCopyTexSubImage2D : procedure(target:GLenum; level:GLint; xoffset:GLint; yoffset:GLint; x:GLint;
+    y:GLint; width:GLsizei; height:GLsizei);{$ifdef windows}stdcall;{$else}cdecl;{$endif}
+  glCreateProgram : function:GLuint;{$ifdef windows}stdcall;{$else}cdecl;{$endif}
+  glCreateShader : function(_type:GLenum):GLuint;{$ifdef windows}stdcall;{$else}cdecl;{$endif}
+  glCullFace : procedure(mode:GLenum);{$ifdef windows}stdcall;{$else}cdecl;{$endif}
 (* Const before type ignored *)
-    glDeleteBuffers : procedure(n:GLsizei; buffers:pGLuint);{$ifdef windows}stdcall;{$else}cdecl;{$endif}
+  glDeleteBuffers : procedure(n:GLsizei; buffers:pGLuint);{$ifdef windows}stdcall;{$else}cdecl;{$endif}
 (* Const before type ignored *)
-    glDeleteFramebuffers : procedure(n:GLsizei; framebuffers:pGLuint);{$ifdef windows}stdcall;{$else}cdecl;{$endif}
-    glDeleteProgram : procedure(_program:GLuint);{$ifdef windows}stdcall;{$else}cdecl;{$endif}
+  glDeleteFramebuffers : procedure(n:GLsizei; framebuffers:pGLuint);{$ifdef windows}stdcall;{$else}cdecl;{$endif}
+  glDeleteProgram : procedure(_program:GLuint);{$ifdef windows}stdcall;{$else}cdecl;{$endif}
 (* Const before type ignored *)
-    glDeleteRenderbuffers : procedure(n:GLsizei; renderbuffers:pGLuint);{$ifdef windows}stdcall;{$else}cdecl;{$endif}
-    glDeleteShader : procedure(shader:GLuint);{$ifdef windows}stdcall;{$else}cdecl;{$endif}
+  glDeleteRenderbuffers : procedure(n:GLsizei; renderbuffers:pGLuint);{$ifdef windows}stdcall;{$else}cdecl;{$endif}
+  glDeleteShader : procedure(shader:GLuint);{$ifdef windows}stdcall;{$else}cdecl;{$endif}
 (* Const before type ignored *)
-    glDeleteTextures : procedure(n:GLsizei; textures:pGLuint);{$ifdef windows}stdcall;{$else}cdecl;{$endif}
-    glDepthFunc : procedure(func:GLenum);{$ifdef windows}stdcall;{$else}cdecl;{$endif}
-    glDepthMask : procedure(flag:GLboolean);{$ifdef windows}stdcall;{$else}cdecl;{$endif}
-    glDepthRangef : procedure(zNear:GLclampf; zFar:GLclampf);{$ifdef windows}stdcall;{$else}cdecl;{$endif}
-    glDetachShader : procedure(_program:GLuint; shader:GLuint);{$ifdef windows}stdcall;{$else}cdecl;{$endif}
-    glDisable : procedure(cap:GLenum);{$ifdef windows}stdcall;{$else}cdecl;{$endif}
-    glDisableVertexAttribArray : procedure(index:GLuint);{$ifdef windows}stdcall;{$else}cdecl;{$endif}
-    glDrawArrays : procedure(mode:GLenum; first:GLint; count:GLsizei);{$ifdef windows}stdcall;{$else}cdecl;{$endif}
+  glDeleteTextures : procedure(n:GLsizei; textures:pGLuint);{$ifdef windows}stdcall;{$else}cdecl;{$endif}
+  glDepthFunc : procedure(func:GLenum);{$ifdef windows}stdcall;{$else}cdecl;{$endif}
+  glDepthMask : procedure(flag:GLboolean);{$ifdef windows}stdcall;{$else}cdecl;{$endif}
+  glDepthRangef : procedure(zNear:GLclampf; zFar:GLclampf);{$ifdef windows}stdcall;{$else}cdecl;{$endif}
+  glDetachShader : procedure(_program:GLuint; shader:GLuint);{$ifdef windows}stdcall;{$else}cdecl;{$endif}
+  glDisable : procedure(cap:GLenum);{$ifdef windows}stdcall;{$else}cdecl;{$endif}
+  glDisableVertexAttribArray : procedure(index:GLuint);{$ifdef windows}stdcall;{$else}cdecl;{$endif}
+  glDrawArrays : procedure(mode:GLenum; first:GLint; count:GLsizei);{$ifdef windows}stdcall;{$else}cdecl;{$endif}
 (* Const before type ignored *)
-    glDrawElements : procedure(mode:GLenum; count:GLsizei; _type:GLenum; indices:pointer);{$ifdef windows}stdcall;{$else}cdecl;{$endif}
-    glEnable : procedure(cap:GLenum);{$ifdef windows}stdcall;{$else}cdecl;{$endif}
-    glEnableVertexAttribArray : procedure(index:GLuint);{$ifdef windows}stdcall;{$else}cdecl;{$endif}
-    glFinish : procedure;{$ifdef windows}stdcall;{$else}cdecl;{$endif}
-    glFlush : procedure;{$ifdef windows}stdcall;{$else}cdecl;{$endif}
-    glFramebufferRenderbuffer : procedure(target:GLenum; attachment:GLenum; renderbuffertarget:GLenum; renderbuffer:GLuint);{$ifdef windows}stdcall;{$else}cdecl;{$endif}
-    glFramebufferTexture2D : procedure(target:GLenum; attachment:GLenum; textarget:GLenum; texture:GLuint; level:GLint);{$ifdef windows}stdcall;{$else}cdecl;{$endif}
-    glFrontFace : procedure(mode:GLenum);{$ifdef windows}stdcall;{$else}cdecl;{$endif}
-    glGenBuffers : procedure(n:GLsizei; buffers:pGLuint);{$ifdef windows}stdcall;{$else}cdecl;{$endif}
-    glGenerateMipmap : procedure(target:GLenum);{$ifdef windows}stdcall;{$else}cdecl;{$endif}
-    glGenFramebuffers : procedure(n:GLsizei; framebuffers:pGLuint);{$ifdef windows}stdcall;{$else}cdecl;{$endif}
-    glGenRenderbuffers : procedure(n:GLsizei; renderbuffers:pGLuint);{$ifdef windows}stdcall;{$else}cdecl;{$endif}
-    glGenTextures : procedure(n:GLsizei; textures:pGLuint);{$ifdef windows}stdcall;{$else}cdecl;{$endif}
-    glGetActiveAttrib : procedure(_program:GLuint; index:GLuint; bufsize:GLsizei; length:pGLsizei; size:pGLint; 
-      _type:pGLenum; name:pchar);{$ifdef windows}stdcall;{$else}cdecl;{$endif}
-    glGetActiveUniform : procedure(_program:GLuint; index:GLuint; bufsize:GLsizei; length:pGLsizei; size:pGLint; 
-      _type:pGLenum; name:pchar);{$ifdef windows}stdcall;{$else}cdecl;{$endif}
-    glGetAttachedShaders : procedure(_program:GLuint; maxcount:GLsizei; count:pGLsizei; shaders:pGLuint);{$ifdef windows}stdcall;{$else}cdecl;{$endif}
+  glDrawElements : procedure(mode:GLenum; count:GLsizei; _type:GLenum; indices:pointer);{$ifdef windows}stdcall;{$else}cdecl;{$endif}
+  glEnable : procedure(cap:GLenum);{$ifdef windows}stdcall;{$else}cdecl;{$endif}
+  glEnableVertexAttribArray : procedure(index:GLuint);{$ifdef windows}stdcall;{$else}cdecl;{$endif}
+  glFinish : procedure;{$ifdef windows}stdcall;{$else}cdecl;{$endif}
+  glFlush : procedure;{$ifdef windows}stdcall;{$else}cdecl;{$endif}
+  glFramebufferRenderbuffer : procedure(target:GLenum; attachment:GLenum; renderbuffertarget:GLenum; renderbuffer:GLuint);{$ifdef windows}stdcall;{$else}cdecl;{$endif}
+  glFramebufferTexture2D : procedure(target:GLenum; attachment:GLenum; textarget:GLenum; texture:GLuint; level:GLint);{$ifdef windows}stdcall;{$else}cdecl;{$endif}
+  glFrontFace : procedure(mode:GLenum);{$ifdef windows}stdcall;{$else}cdecl;{$endif}
+  glGenBuffers : procedure(n:GLsizei; buffers:pGLuint);{$ifdef windows}stdcall;{$else}cdecl;{$endif}
+  glGenerateMipmap : procedure(target:GLenum);{$ifdef windows}stdcall;{$else}cdecl;{$endif}
+  glGenFramebuffers : procedure(n:GLsizei; framebuffers:pGLuint);{$ifdef windows}stdcall;{$else}cdecl;{$endif}
+  glGenRenderbuffers : procedure(n:GLsizei; renderbuffers:pGLuint);{$ifdef windows}stdcall;{$else}cdecl;{$endif}
+  glGenTextures : procedure(n:GLsizei; textures:pGLuint);{$ifdef windows}stdcall;{$else}cdecl;{$endif}
+  glGetActiveAttrib : procedure(_program:GLuint; index:GLuint; bufsize:GLsizei; length:pGLsizei; size:pGLint;
+    _type:pGLenum; name:pchar);{$ifdef windows}stdcall;{$else}cdecl;{$endif}
+  glGetActiveUniform : procedure(_program:GLuint; index:GLuint; bufsize:GLsizei; length:pGLsizei; size:pGLint;
+    _type:pGLenum; name:pchar);{$ifdef windows}stdcall;{$else}cdecl;{$endif}
+  glGetAttachedShaders : procedure(_program:GLuint; maxcount:GLsizei; count:pGLsizei; shaders:pGLuint);{$ifdef windows}stdcall;{$else}cdecl;{$endif}
 (* Const before type ignored *)
-    glGetAttribLocation : function(_program:GLuint; name:pchar):longint;{$ifdef windows}stdcall;{$else}cdecl;{$endif}
-    glGetBooleanv : procedure(pname:GLenum; params:pGLboolean);{$ifdef windows}stdcall;{$else}cdecl;{$endif}
-    glGetBufferParameteriv : procedure(target:GLenum; pname:GLenum; params:pGLint);{$ifdef windows}stdcall;{$else}cdecl;{$endif}
-    glGetError : function:GLenum;{$ifdef windows}stdcall;{$else}cdecl;{$endif}
-    glGetFloatv : procedure(pname:GLenum; params:pGLfloat);{$ifdef windows}stdcall;{$else}cdecl;{$endif}
-    glGetFramebufferAttachmentParameteriv : procedure(target:GLenum; attachment:GLenum; pname:GLenum; params:pGLint);{$ifdef windows}stdcall;{$else}cdecl;{$endif}
-    glGetIntegerv : procedure(pname:GLenum; params:pGLint);{$ifdef windows}stdcall;{$else}cdecl;{$endif}
-    glGetProgramiv : procedure(_program:GLuint; pname:GLenum; params:pGLint);{$ifdef windows}stdcall;{$else}cdecl;{$endif}
-    glGetProgramInfoLog : procedure(_program:GLuint; bufsize:GLsizei; length:pGLsizei; infolog:pchar);{$ifdef windows}stdcall;{$else}cdecl;{$endif}
-    glGetRenderbufferParameteriv : procedure(target:GLenum; pname:GLenum; params:pGLint);{$ifdef windows}stdcall;{$else}cdecl;{$endif}
-    glGetShaderiv : procedure(shader:GLuint; pname:GLenum; params:pGLint);{$ifdef windows}stdcall;{$else}cdecl;{$endif}
-    glGetShaderInfoLog : procedure(shader:GLuint; bufsize:GLsizei; length:pGLsizei; infolog:pchar);{$ifdef windows}stdcall;{$else}cdecl;{$endif}
-    glGetShaderPrecisionFormat : procedure(shadertype:GLenum; precisiontype:GLenum; range:pGLint; precision:pGLint);{$ifdef windows}stdcall;{$else}cdecl;{$endif}
-    glGetShaderSource : procedure(shader:GLuint; bufsize:GLsizei; length:pGLsizei; source:pchar);{$ifdef windows}stdcall;{$else}cdecl;{$endif}
+  glGetAttribLocation : function(_program:GLuint; name:pchar):longint;{$ifdef windows}stdcall;{$else}cdecl;{$endif}
+  glGetBooleanv : procedure(pname:GLenum; params:pGLboolean);{$ifdef windows}stdcall;{$else}cdecl;{$endif}
+  glGetBufferParameteriv : procedure(target:GLenum; pname:GLenum; params:pGLint);{$ifdef windows}stdcall;{$else}cdecl;{$endif}
+  glGetError : function:GLenum;{$ifdef windows}stdcall;{$else}cdecl;{$endif}
+  glGetFloatv : procedure(pname:GLenum; params:pGLfloat);{$ifdef windows}stdcall;{$else}cdecl;{$endif}
+  glGetFramebufferAttachmentParameteriv : procedure(target:GLenum; attachment:GLenum; pname:GLenum; params:pGLint);{$ifdef windows}stdcall;{$else}cdecl;{$endif}
+  glGetIntegerv : procedure(pname:GLenum; params:pGLint);{$ifdef windows}stdcall;{$else}cdecl;{$endif}
+  glGetProgramiv : procedure(_program:GLuint; pname:GLenum; params:pGLint);{$ifdef windows}stdcall;{$else}cdecl;{$endif}
+  glGetProgramInfoLog : procedure(_program:GLuint; bufsize:GLsizei; length:pGLsizei; infolog:pchar);{$ifdef windows}stdcall;{$else}cdecl;{$endif}
+  glGetRenderbufferParameteriv : procedure(target:GLenum; pname:GLenum; params:pGLint);{$ifdef windows}stdcall;{$else}cdecl;{$endif}
+  glGetShaderiv : procedure(shader:GLuint; pname:GLenum; params:pGLint);{$ifdef windows}stdcall;{$else}cdecl;{$endif}
+  glGetShaderInfoLog : procedure(shader:GLuint; bufsize:GLsizei; length:pGLsizei; infolog:pchar);{$ifdef windows}stdcall;{$else}cdecl;{$endif}
+  glGetShaderPrecisionFormat : procedure(shadertype:GLenum; precisiontype:GLenum; range:pGLint; precision:pGLint);{$ifdef windows}stdcall;{$else}cdecl;{$endif}
+  glGetShaderSource : procedure(shader:GLuint; bufsize:GLsizei; length:pGLsizei; source:pchar);{$ifdef windows}stdcall;{$else}cdecl;{$endif}
 (* Const before type ignored *)
-    glGetString : function(name:GLenum):PGLubyte;{$ifdef windows}stdcall;{$else}cdecl;{$endif}
-    glGetTexParameterfv : procedure(target:GLenum; pname:GLenum; params:pGLfloat);{$ifdef windows}stdcall;{$else}cdecl;{$endif}
-    glGetTexParameteriv : procedure(target:GLenum; pname:GLenum; params:pGLint);{$ifdef windows}stdcall;{$else}cdecl;{$endif}
-    glGetUniformfv : procedure(_program:GLuint; location:GLint; params:pGLfloat);{$ifdef windows}stdcall;{$else}cdecl;{$endif}
-    glGetUniformiv : procedure(_program:GLuint; location:GLint; params:pGLint);{$ifdef windows}stdcall;{$else}cdecl;{$endif}
+  glGetString : function(name:GLenum):PGLubyte;{$ifdef windows}stdcall;{$else}cdecl;{$endif}
+  glGetTexParameterfv : procedure(target:GLenum; pname:GLenum; params:pGLfloat);{$ifdef windows}stdcall;{$else}cdecl;{$endif}
+  glGetTexParameteriv : procedure(target:GLenum; pname:GLenum; params:pGLint);{$ifdef windows}stdcall;{$else}cdecl;{$endif}
+  glGetUniformfv : procedure(_program:GLuint; location:GLint; params:pGLfloat);{$ifdef windows}stdcall;{$else}cdecl;{$endif}
+  glGetUniformiv : procedure(_program:GLuint; location:GLint; params:pGLint);{$ifdef windows}stdcall;{$else}cdecl;{$endif}
 (* Const before type ignored *)
-    glGetUniformLocation : function(_program:GLuint; name:pchar):longint;{$ifdef windows}stdcall;{$else}cdecl;{$endif}
-    glGetVertexAttribfv : procedure(index:GLuint; pname:GLenum; params:pGLfloat);{$ifdef windows}stdcall;{$else}cdecl;{$endif}
-    glGetVertexAttribiv : procedure(index:GLuint; pname:GLenum; params:pGLint);{$ifdef windows}stdcall;{$else}cdecl;{$endif}
-    glGetVertexAttribPointerv : procedure(index:GLuint; pname:GLenum; pointer:Ppointer);{$ifdef windows}stdcall;{$else}cdecl;{$endif}
-    glHint : procedure(target:GLenum; mode:GLenum);{$ifdef windows}stdcall;{$else}cdecl;{$endif}
-    glIsBuffer : function(buffer:GLuint):GLboolean;{$ifdef windows}stdcall;{$else}cdecl;{$endif}
-    glIsEnabled : function(cap:GLenum):GLboolean;{$ifdef windows}stdcall;{$else}cdecl;{$endif}
-    glIsFramebuffer : function(framebuffer:GLuint):GLboolean;{$ifdef windows}stdcall;{$else}cdecl;{$endif}
-    glIsProgram : function(_program:GLuint):GLboolean;{$ifdef windows}stdcall;{$else}cdecl;{$endif}
-    glIsRenderbuffer : function(renderbuffer:GLuint):GLboolean;{$ifdef windows}stdcall;{$else}cdecl;{$endif}
-    glIsShader : function(shader:GLuint):GLboolean;{$ifdef windows}stdcall;{$else}cdecl;{$endif}
-    glIsTexture : function(texture:GLuint):GLboolean;{$ifdef windows}stdcall;{$else}cdecl;{$endif}
-    glLineWidth : procedure(width:GLfloat);{$ifdef windows}stdcall;{$else}cdecl;{$endif}
-    glLinkProgram : procedure(_program:GLuint);{$ifdef windows}stdcall;{$else}cdecl;{$endif}
-    glPixelStorei : procedure(pname:GLenum; param:GLint);{$ifdef windows}stdcall;{$else}cdecl;{$endif}
-    glPolygonOffset : procedure(factor:GLfloat; units:GLfloat);{$ifdef windows}stdcall;{$else}cdecl;{$endif}
-    glReadPixels : procedure(x:GLint; y:GLint; width:GLsizei; height:GLsizei; format:GLenum; 
-      _type:GLenum; pixels:pointer);{$ifdef windows}stdcall;{$else}cdecl;{$endif}
-    glReleaseShaderCompiler : procedure;{$ifdef windows}stdcall;{$else}cdecl;{$endif}
-    glRenderbufferStorage : procedure(target:GLenum; internalformat:GLenum; width:GLsizei; height:GLsizei);{$ifdef windows}stdcall;{$else}cdecl;{$endif}
-    glSampleCoverage : procedure(value:GLclampf; invert:GLboolean);{$ifdef windows}stdcall;{$else}cdecl;{$endif}
-    glScissor : procedure(x:GLint; y:GLint; width:GLsizei; height:GLsizei);{$ifdef windows}stdcall;{$else}cdecl;{$endif}
+  glGetUniformLocation : function(_program:GLuint; name:pchar):longint;{$ifdef windows}stdcall;{$else}cdecl;{$endif}
+  glGetVertexAttribfv : procedure(index:GLuint; pname:GLenum; params:pGLfloat);{$ifdef windows}stdcall;{$else}cdecl;{$endif}
+  glGetVertexAttribiv : procedure(index:GLuint; pname:GLenum; params:pGLint);{$ifdef windows}stdcall;{$else}cdecl;{$endif}
+  glGetVertexAttribPointerv : procedure(index:GLuint; pname:GLenum; pointer:Ppointer);{$ifdef windows}stdcall;{$else}cdecl;{$endif}
+  glHint : procedure(target:GLenum; mode:GLenum);{$ifdef windows}stdcall;{$else}cdecl;{$endif}
+  glIsBuffer : function(buffer:GLuint):GLboolean;{$ifdef windows}stdcall;{$else}cdecl;{$endif}
+  glIsEnabled : function(cap:GLenum):GLboolean;{$ifdef windows}stdcall;{$else}cdecl;{$endif}
+  glIsFramebuffer : function(framebuffer:GLuint):GLboolean;{$ifdef windows}stdcall;{$else}cdecl;{$endif}
+  glIsProgram : function(_program:GLuint):GLboolean;{$ifdef windows}stdcall;{$else}cdecl;{$endif}
+  glIsRenderbuffer : function(renderbuffer:GLuint):GLboolean;{$ifdef windows}stdcall;{$else}cdecl;{$endif}
+  glIsShader : function(shader:GLuint):GLboolean;{$ifdef windows}stdcall;{$else}cdecl;{$endif}
+  glIsTexture : function(texture:GLuint):GLboolean;{$ifdef windows}stdcall;{$else}cdecl;{$endif}
+  glLineWidth : procedure(width:GLfloat);{$ifdef windows}stdcall;{$else}cdecl;{$endif}
+  glLinkProgram : procedure(_program:GLuint);{$ifdef windows}stdcall;{$else}cdecl;{$endif}
+  glPixelStorei : procedure(pname:GLenum; param:GLint);{$ifdef windows}stdcall;{$else}cdecl;{$endif}
+  glPolygonOffset : procedure(factor:GLfloat; units:GLfloat);{$ifdef windows}stdcall;{$else}cdecl;{$endif}
+  glReadPixels : procedure(x:GLint; y:GLint; width:GLsizei; height:GLsizei; format:GLenum;
+    _type:GLenum; pixels:pointer);{$ifdef windows}stdcall;{$else}cdecl;{$endif}
+  glReleaseShaderCompiler : procedure;{$ifdef windows}stdcall;{$else}cdecl;{$endif}
+  glRenderbufferStorage : procedure(target:GLenum; internalformat:GLenum; width:GLsizei; height:GLsizei);{$ifdef windows}stdcall;{$else}cdecl;{$endif}
+  glSampleCoverage : procedure(value:GLclampf; invert:GLboolean);{$ifdef windows}stdcall;{$else}cdecl;{$endif}
+  glScissor : procedure(x:GLint; y:GLint; width:GLsizei; height:GLsizei);{$ifdef windows}stdcall;{$else}cdecl;{$endif}
 (* Const before type ignored *)
 (* Const before type ignored *)
-    glShaderBinary : procedure(n:GLsizei; shaders:pGLuint; binaryformat:GLenum; binary:pointer; length:GLsizei);{$ifdef windows}stdcall;{$else}cdecl;{$endif}
+  glShaderBinary : procedure(n:GLsizei; shaders:pGLuint; binaryformat:GLenum; binary:pointer; length:GLsizei);{$ifdef windows}stdcall;{$else}cdecl;{$endif}
 (* Const before type ignored *)
 (* Const before type ignored *)
-    glShaderSource : procedure(shader:GLuint; count:GLsizei; _string:Ppchar; length:pGLint);{$ifdef windows}stdcall;{$else}cdecl;{$endif}
-    glStencilFunc : procedure(func:GLenum; ref:GLint; mask:GLuint);{$ifdef windows}stdcall;{$else}cdecl;{$endif}
-    glStencilFuncSeparate : procedure(face:GLenum; func:GLenum; ref:GLint; mask:GLuint);{$ifdef windows}stdcall;{$else}cdecl;{$endif}
-    glStencilMask : procedure(mask:GLuint);{$ifdef windows}stdcall;{$else}cdecl;{$endif}
-    glStencilMaskSeparate : procedure(face:GLenum; mask:GLuint);{$ifdef windows}stdcall;{$else}cdecl;{$endif}
-    glStencilOp : procedure(fail:GLenum; zfail:GLenum; zpass:GLenum);{$ifdef windows}stdcall;{$else}cdecl;{$endif}
-    glStencilOpSeparate : procedure(face:GLenum; fail:GLenum; zfail:GLenum; zpass:GLenum);{$ifdef windows}stdcall;{$else}cdecl;{$endif}
+  glShaderSource : procedure(shader:GLuint; count:GLsizei; _string:Ppchar; length:pGLint);{$ifdef windows}stdcall;{$else}cdecl;{$endif}
+  glStencilFunc : procedure(func:GLenum; ref:GLint; mask:GLuint);{$ifdef windows}stdcall;{$else}cdecl;{$endif}
+  glStencilFuncSeparate : procedure(face:GLenum; func:GLenum; ref:GLint; mask:GLuint);{$ifdef windows}stdcall;{$else}cdecl;{$endif}
+  glStencilMask : procedure(mask:GLuint);{$ifdef windows}stdcall;{$else}cdecl;{$endif}
+  glStencilMaskSeparate : procedure(face:GLenum; mask:GLuint);{$ifdef windows}stdcall;{$else}cdecl;{$endif}
+  glStencilOp : procedure(fail:GLenum; zfail:GLenum; zpass:GLenum);{$ifdef windows}stdcall;{$else}cdecl;{$endif}
+  glStencilOpSeparate : procedure(face:GLenum; fail:GLenum; zfail:GLenum; zpass:GLenum);{$ifdef windows}stdcall;{$else}cdecl;{$endif}
 (* Const before type ignored *)
-    glTexImage2D : procedure(target:GLenum; level:GLint; internalformat:GLenum; width:GLsizei; height:GLsizei; 
-      border:GLint; format:GLenum; _type:GLenum; pixels:pointer);{$ifdef windows}stdcall;{$else}cdecl;{$endif}
-    glTexParameterf : procedure(target:GLenum; pname:GLenum; param:GLfloat);{$ifdef windows}stdcall;{$else}cdecl;{$endif}
+  glTexImage2D : procedure(target:GLenum; level:GLint; internalformat:GLenum; width:GLsizei; height:GLsizei;
+    border:GLint; format:GLenum; _type:GLenum; pixels:pointer);{$ifdef windows}stdcall;{$else}cdecl;{$endif}
+  glTexParameterf : procedure(target:GLenum; pname:GLenum; param:GLfloat);{$ifdef windows}stdcall;{$else}cdecl;{$endif}
 (* Const before type ignored *)
-    glTexParameterfv : procedure(target:GLenum; pname:GLenum; params:pGLfloat);{$ifdef windows}stdcall;{$else}cdecl;{$endif}
-    glTexParameteri : procedure(target:GLenum; pname:GLenum; param:GLint);{$ifdef windows}stdcall;{$else}cdecl;{$endif}
+  glTexParameterfv : procedure(target:GLenum; pname:GLenum; params:pGLfloat);{$ifdef windows}stdcall;{$else}cdecl;{$endif}
+  glTexParameteri : procedure(target:GLenum; pname:GLenum; param:GLint);{$ifdef windows}stdcall;{$else}cdecl;{$endif}
 (* Const before type ignored *)
-    glTexParameteriv : procedure(target:GLenum; pname:GLenum; params:pGLint);{$ifdef windows}stdcall;{$else}cdecl;{$endif}
+  glTexParameteriv : procedure(target:GLenum; pname:GLenum; params:pGLint);{$ifdef windows}stdcall;{$else}cdecl;{$endif}
 (* Const before type ignored *)
-    glTexSubImage2D : procedure(target:GLenum; level:GLint; xoffset:GLint; yoffset:GLint; width:GLsizei; 
-      height:GLsizei; format:GLenum; _type:GLenum; pixels:pointer);{$ifdef windows}stdcall;{$else}cdecl;{$endif}
-    glUniform1f : procedure(location:GLint; x:GLfloat);{$ifdef windows}stdcall;{$else}cdecl;{$endif}
+  glTexSubImage2D : procedure(target:GLenum; level:GLint; xoffset:GLint; yoffset:GLint; width:GLsizei;
+    height:GLsizei; format:GLenum; _type:GLenum; pixels:pointer);{$ifdef windows}stdcall;{$else}cdecl;{$endif}
+  glUniform1f : procedure(location:GLint; x:GLfloat);{$ifdef windows}stdcall;{$else}cdecl;{$endif}
 (* Const before type ignored *)
-    glUniform1fv : procedure(location:GLint; count:GLsizei; v:pGLfloat);{$ifdef windows}stdcall;{$else}cdecl;{$endif}
-    glUniform1i : procedure(location:GLint; x:GLint);{$ifdef windows}stdcall;{$else}cdecl;{$endif}
+  glUniform1fv : procedure(location:GLint; count:GLsizei; v:pGLfloat);{$ifdef windows}stdcall;{$else}cdecl;{$endif}
+  glUniform1i : procedure(location:GLint; x:GLint);{$ifdef windows}stdcall;{$else}cdecl;{$endif}
 (* Const before type ignored *)
-    glUniform1iv : procedure(location:GLint; count:GLsizei; v:pGLint);{$ifdef windows}stdcall;{$else}cdecl;{$endif}
-    glUniform2f : procedure(location:GLint; x:GLfloat; y:GLfloat);{$ifdef windows}stdcall;{$else}cdecl;{$endif}
+  glUniform1iv : procedure(location:GLint; count:GLsizei; v:pGLint);{$ifdef windows}stdcall;{$else}cdecl;{$endif}
+  glUniform2f : procedure(location:GLint; x:GLfloat; y:GLfloat);{$ifdef windows}stdcall;{$else}cdecl;{$endif}
 (* Const before type ignored *)
-    glUniform2fv : procedure(location:GLint; count:GLsizei; v:pGLfloat);{$ifdef windows}stdcall;{$else}cdecl;{$endif}
-    glUniform2i : procedure(location:GLint; x:GLint; y:GLint);{$ifdef windows}stdcall;{$else}cdecl;{$endif}
+  glUniform2fv : procedure(location:GLint; count:GLsizei; v:pGLfloat);{$ifdef windows}stdcall;{$else}cdecl;{$endif}
+  glUniform2i : procedure(location:GLint; x:GLint; y:GLint);{$ifdef windows}stdcall;{$else}cdecl;{$endif}
 (* Const before type ignored *)
-    glUniform2iv : procedure(location:GLint; count:GLsizei; v:pGLint);{$ifdef windows}stdcall;{$else}cdecl;{$endif}
-    glUniform3f : procedure(location:GLint; x:GLfloat; y:GLfloat; z:GLfloat);{$ifdef windows}stdcall;{$else}cdecl;{$endif}
+  glUniform2iv : procedure(location:GLint; count:GLsizei; v:pGLint);{$ifdef windows}stdcall;{$else}cdecl;{$endif}
+  glUniform3f : procedure(location:GLint; x:GLfloat; y:GLfloat; z:GLfloat);{$ifdef windows}stdcall;{$else}cdecl;{$endif}
 (* Const before type ignored *)
-    glUniform3fv : procedure(location:GLint; count:GLsizei; v:pGLfloat);{$ifdef windows}stdcall;{$else}cdecl;{$endif}
-    glUniform3i : procedure(location:GLint; x:GLint; y:GLint; z:GLint);{$ifdef windows}stdcall;{$else}cdecl;{$endif}
+  glUniform3fv : procedure(location:GLint; count:GLsizei; v:pGLfloat);{$ifdef windows}stdcall;{$else}cdecl;{$endif}
+  glUniform3i : procedure(location:GLint; x:GLint; y:GLint; z:GLint);{$ifdef windows}stdcall;{$else}cdecl;{$endif}
 (* Const before type ignored *)
-    glUniform3iv : procedure(location:GLint; count:GLsizei; v:pGLint);{$ifdef windows}stdcall;{$else}cdecl;{$endif}
-    glUniform4f : procedure(location:GLint; x:GLfloat; y:GLfloat; z:GLfloat; w:GLfloat);{$ifdef windows}stdcall;{$else}cdecl;{$endif}
+  glUniform3iv : procedure(location:GLint; count:GLsizei; v:pGLint);{$ifdef windows}stdcall;{$else}cdecl;{$endif}
+  glUniform4f : procedure(location:GLint; x:GLfloat; y:GLfloat; z:GLfloat; w:GLfloat);{$ifdef windows}stdcall;{$else}cdecl;{$endif}
 (* Const before type ignored *)
-    glUniform4fv : procedure(location:GLint; count:GLsizei; v:pGLfloat);{$ifdef windows}stdcall;{$else}cdecl;{$endif}
-    glUniform4i : procedure(location:GLint; x:GLint; y:GLint; z:GLint; w:GLint);{$ifdef windows}stdcall;{$else}cdecl;{$endif}
+  glUniform4fv : procedure(location:GLint; count:GLsizei; v:pGLfloat);{$ifdef windows}stdcall;{$else}cdecl;{$endif}
+  glUniform4i : procedure(location:GLint; x:GLint; y:GLint; z:GLint; w:GLint);{$ifdef windows}stdcall;{$else}cdecl;{$endif}
 (* Const before type ignored *)
-    glUniform4iv : procedure(location:GLint; count:GLsizei; v:pGLint);{$ifdef windows}stdcall;{$else}cdecl;{$endif}
+  glUniform4iv : procedure(location:GLint; count:GLsizei; v:pGLint);{$ifdef windows}stdcall;{$else}cdecl;{$endif}
 (* Const before type ignored *)
-    glUniformMatrix2fv : procedure(location:GLint; count:GLsizei; transpose:GLboolean; value:pGLfloat);{$ifdef windows}stdcall;{$else}cdecl;{$endif}
+  glUniformMatrix2fv : procedure(location:GLint; count:GLsizei; transpose:GLboolean; value:pGLfloat);{$ifdef windows}stdcall;{$else}cdecl;{$endif}
 (* Const before type ignored *)
-    glUniformMatrix3fv : procedure(location:GLint; count:GLsizei; transpose:GLboolean; value:pGLfloat);{$ifdef windows}stdcall;{$else}cdecl;{$endif}
+  glUniformMatrix3fv : procedure(location:GLint; count:GLsizei; transpose:GLboolean; value:pGLfloat);{$ifdef windows}stdcall;{$else}cdecl;{$endif}
 (* Const before type ignored *)
-    glUniformMatrix4fv : procedure(location:GLint; count:GLsizei; transpose:GLboolean; value:pGLfloat);{$ifdef windows}stdcall;{$else}cdecl;{$endif}
-    glUseProgram : procedure(_program:GLuint);{$ifdef windows}stdcall;{$else}cdecl;{$endif}
-    glValidateProgram : procedure(_program:GLuint);{$ifdef windows}stdcall;{$else}cdecl;{$endif}
-    glVertexAttrib1f : procedure(indx:GLuint; x:GLfloat);{$ifdef windows}stdcall;{$else}cdecl;{$endif}
+  glUniformMatrix4fv : procedure(location:GLint; count:GLsizei; transpose:GLboolean; value:pGLfloat);{$ifdef windows}stdcall;{$else}cdecl;{$endif}
+  glUseProgram : procedure(_program:GLuint);{$ifdef windows}stdcall;{$else}cdecl;{$endif}
+  glValidateProgram : procedure(_program:GLuint);{$ifdef windows}stdcall;{$else}cdecl;{$endif}
+  glVertexAttrib1f : procedure(indx:GLuint; x:GLfloat);{$ifdef windows}stdcall;{$else}cdecl;{$endif}
 (* Const before type ignored *)
-    glVertexAttrib1fv : procedure(indx:GLuint; values:pGLfloat);{$ifdef windows}stdcall;{$else}cdecl;{$endif}
-    glVertexAttrib2f : procedure(indx:GLuint; x:GLfloat; y:GLfloat);{$ifdef windows}stdcall;{$else}cdecl;{$endif}
+  glVertexAttrib1fv : procedure(indx:GLuint; values:pGLfloat);{$ifdef windows}stdcall;{$else}cdecl;{$endif}
+  glVertexAttrib2f : procedure(indx:GLuint; x:GLfloat; y:GLfloat);{$ifdef windows}stdcall;{$else}cdecl;{$endif}
 (* Const before type ignored *)
-    glVertexAttrib2fv : procedure(indx:GLuint; values:pGLfloat);{$ifdef windows}stdcall;{$else}cdecl;{$endif}
-    glVertexAttrib3f : procedure(indx:GLuint; x:GLfloat; y:GLfloat; z:GLfloat);{$ifdef windows}stdcall;{$else}cdecl;{$endif}
+  glVertexAttrib2fv : procedure(indx:GLuint; values:pGLfloat);{$ifdef windows}stdcall;{$else}cdecl;{$endif}
+  glVertexAttrib3f : procedure(indx:GLuint; x:GLfloat; y:GLfloat; z:GLfloat);{$ifdef windows}stdcall;{$else}cdecl;{$endif}
 (* Const before type ignored *)
-    glVertexAttrib3fv : procedure(indx:GLuint; values:pGLfloat);{$ifdef windows}stdcall;{$else}cdecl;{$endif}
-    glVertexAttrib4f : procedure(indx:GLuint; x:GLfloat; y:GLfloat; z:GLfloat; w:GLfloat);{$ifdef windows}stdcall;{$else}cdecl;{$endif}
+  glVertexAttrib3fv : procedure(indx:GLuint; values:pGLfloat);{$ifdef windows}stdcall;{$else}cdecl;{$endif}
+  glVertexAttrib4f : procedure(indx:GLuint; x:GLfloat; y:GLfloat; z:GLfloat; w:GLfloat);{$ifdef windows}stdcall;{$else}cdecl;{$endif}
 (* Const before type ignored *)
-    glVertexAttrib4fv : procedure(indx:GLuint; values:pGLfloat);{$ifdef windows}stdcall;{$else}cdecl;{$endif}
+  glVertexAttrib4fv : procedure(indx:GLuint; values:pGLfloat);{$ifdef windows}stdcall;{$else}cdecl;{$endif}
 (* Const before type ignored *)
-    glVertexAttribPointer : procedure(indx:GLuint; size:GLint; _type:GLenum; normalized:GLboolean; stride:GLsizei; 
-      ptr:pointer);{$ifdef windows}stdcall;{$else}cdecl;{$endif}
-    glViewport : procedure(x:GLint; y:GLint; width:GLsizei; height:GLsizei);{$ifdef windows}stdcall;{$else}cdecl;{$endif}
-  {------------------------------------------------------------------------*
-   * IMG extension tokens
-   *------------------------------------------------------------------------ }
-  { GL_IMG_binary_shader  }
+  glVertexAttribPointer : procedure(indx:GLuint; size:GLint; _type:GLenum; normalized:GLboolean; stride:GLsizei;
+    ptr:pointer);{$ifdef windows}stdcall;{$else}cdecl;{$endif}
+  glViewport : procedure(x:GLint; y:GLint; width:GLsizei; height:GLsizei);{$ifdef windows}stdcall;{$else}cdecl;{$endif}
+{------------------------------------------------------------------------*
+ * IMG extension tokens
+ *------------------------------------------------------------------------ }
+{ GL_IMG_binary_shader  }
 
-  const
-     GL_SGX_BINARY_IMG = $8C0A;     
-  { GL_IMG_texture_compression_pvrtc  }
-     GL_COMPRESSED_RGB_PVRTC_4BPPV1_IMG = $8C00;     
-     GL_COMPRESSED_RGB_PVRTC_2BPPV1_IMG = $8C01;     
-     GL_COMPRESSED_RGBA_PVRTC_4BPPV1_IMG = $8C02;     
-     GL_COMPRESSED_RGBA_PVRTC_2BPPV1_IMG = $8C03;     
-     GL_BGRA = $80E1;     
-  {------------------------------------------------------------------------*
-   * IMG extension functions
-   *------------------------------------------------------------------------ }
-  { GL_IMG_binary_shader  }
-     GL_IMG_binary_shader = 1;     
-  { GL_IMG_texture_compression_pvrtc  }
-     GL_IMG_texture_compression_pvrtc = 1;     
-  {
-   * This document is licensed under the SGI Free Software B License Version
-   * 2.0. For details, see http://oss.sgi.com/projects/FreeB/ .
-    }
-  {------------------------------------------------------------------------*
-   * OES extension tokens
-   *------------------------------------------------------------------------ }
-  { GL_OES_compressed_ETC1_RGB8_texture  }
-     GL_ETC1_RGB8_OES = $8D64;     
-  { GL_OES_compressed_paletted_texture  }
-     GL_PALETTE4_RGB8_OES = $8B90;     
-     GL_PALETTE4_RGBA8_OES = $8B91;     
-     GL_PALETTE4_R5_G6_B5_OES = $8B92;     
-     GL_PALETTE4_RGBA4_OES = $8B93;     
-     GL_PALETTE4_RGB5_A1_OES = $8B94;     
-     GL_PALETTE8_RGB8_OES = $8B95;     
-     GL_PALETTE8_RGBA8_OES = $8B96;     
-     GL_PALETTE8_R5_G6_B5_OES = $8B97;     
-     GL_PALETTE8_RGBA4_OES = $8B98;     
-     GL_PALETTE8_RGB5_A1_OES = $8B99;     
-  { GL_OES_depth24  }
-     GL_DEPTH_COMPONENT24_OES = $81A6;     
-  { GL_OES_depth32  }
-     GL_DEPTH_COMPONENT32_OES = $81A7;     
-  { GL_OES_depth_texture  }
-  { No new tokens introduced by this extension.  }
-  { GL_OES_EGL_image  }
+const
+   GL_SGX_BINARY_IMG = $8C0A;
+{ GL_IMG_texture_compression_pvrtc  }
+   GL_COMPRESSED_RGB_PVRTC_4BPPV1_IMG = $8C00;
+   GL_COMPRESSED_RGB_PVRTC_2BPPV1_IMG = $8C01;
+   GL_COMPRESSED_RGBA_PVRTC_4BPPV1_IMG = $8C02;
+   GL_COMPRESSED_RGBA_PVRTC_2BPPV1_IMG = $8C03;
+   GL_BGRA = $80E1;
+{------------------------------------------------------------------------*
+ * IMG extension functions
+ *------------------------------------------------------------------------ }
+{ GL_IMG_binary_shader  }
+   GL_IMG_binary_shader = 1;
+{ GL_IMG_texture_compression_pvrtc  }
+   GL_IMG_texture_compression_pvrtc = 1;
+{
+ * This document is licensed under the SGI Free Software B License Version
+ * 2.0. For details, see http://oss.sgi.com/projects/FreeB/ .
+  }
+{------------------------------------------------------------------------*
+ * OES extension tokens
+ *------------------------------------------------------------------------ }
+{ GL_OES_compressed_ETC1_RGB8_texture  }
+   GL_ETC1_RGB8_OES = $8D64;
+{ GL_OES_compressed_paletted_texture  }
+   GL_PALETTE4_RGB8_OES = $8B90;
+   GL_PALETTE4_RGBA8_OES = $8B91;
+   GL_PALETTE4_R5_G6_B5_OES = $8B92;
+   GL_PALETTE4_RGBA4_OES = $8B93;
+   GL_PALETTE4_RGB5_A1_OES = $8B94;
+   GL_PALETTE8_RGB8_OES = $8B95;
+   GL_PALETTE8_RGBA8_OES = $8B96;
+   GL_PALETTE8_R5_G6_B5_OES = $8B97;
+   GL_PALETTE8_RGBA4_OES = $8B98;
+   GL_PALETTE8_RGB5_A1_OES = $8B99;
+{ GL_OES_depth24  }
+   GL_DEPTH_COMPONENT24_OES = $81A6;
+{ GL_OES_depth32  }
+   GL_DEPTH_COMPONENT32_OES = $81A7;
+{ GL_OES_depth_texture  }
+{ No new tokens introduced by this extension.  }
+{ GL_OES_EGL_image  }
 
-  type
+type
 
-     GLeglImageOES = pointer;
-  { GL_OES_get_program_binary  }
+   GLeglImageOES = pointer;
+{ GL_OES_get_program_binary  }
 
-  const
-     GL_PROGRAM_BINARY_LENGTH_OES = $8741;     
-     GL_NUM_PROGRAM_BINARY_FORMATS_OES = $87FE;     
-     GL_PROGRAM_BINARY_FORMATS_OES = $87FF;     
-  { GL_OES_mapbuffer  }
-     GL_WRITE_ONLY_OES = $88B9;     
-     GL_BUFFER_ACCESS_OES = $88BB;     
-     GL_BUFFER_MAPPED_OES = $88BC;     
-     GL_BUFFER_MAP_POINTER_OES = $88BD;     
-  { GL_OES_packed_depth_stencil  }
-     GL_DEPTH_STENCIL_OES = $84F9;     
-     GL_UNSIGNED_INT_24_8_OES = $84FA;     
-     GL_DEPTH24_STENCIL8_OES = $88F0;     
-  { GL_OES_rgb8_rgba8  }
-     GL_RGB8_OES = $8051;     
-     GL_RGBA8_OES = $8058;     
-  { GL_OES_standard_derivatives  }
-     GL_FRAGMENT_SHADER_DERIVATIVE_HINT_OES = $8B8B;     
-  { GL_OES_stencil1  }
-     GL_STENCIL_INDEX1_OES = $8D46;     
-  { GL_OES_stencil4  }
-     GL_STENCIL_INDEX4_OES = $8D47;     
-  { GL_OES_texture3D  }
-     GL_TEXTURE_WRAP_R_OES = $8072;     
-     GL_TEXTURE_3D_OES = $806F;     
-     GL_TEXTURE_BINDING_3D_OES = $806A;     
-     GL_MAX_3D_TEXTURE_SIZE_OES = $8073;     
-     GL_SAMPLER_3D_OES = $8B5F;     
-     GL_FRAMEBUFFER_ATTACHMENT_TEXTURE_3D_ZOFFSET_OES = $8CD4;     
-  { GL_OES_texture_half_float  }
-     GL_HALF_FLOAT_OES = $8D61;     
-  { GL_OES_vertex_half_float  }
-  { GL_HALF_FLOAT_OES defined in GL_OES_texture_half_float already.  }
-  { GL_OES_vertex_type_10_10_10_2  }
-     GL_UNSIGNED_INT_10_10_10_2_OES = $8DF6;     
-     GL_INT_10_10_10_2_OES = $8DF7;     
-  {------------------------------------------------------------------------*
-   * AMD extension tokens
-   *------------------------------------------------------------------------ }
-  { GL_AMD_compressed_3DC_texture  }
-     GL_3DC_X_AMD = $87F9;     
-     GL_3DC_XY_AMD = $87FA;     
-  { GL_AMD_compressed_ATC_texture  }
-     GL_ATC_RGB_AMD = $8C92;     
-     GL_ATC_RGBA_EXPLICIT_ALPHA_AMD = $8C93;     
-     GL_ATC_RGBA_INTERPOLATED_ALPHA_AMD = $87EE;     
-  { GL_AMD_program_binary_Z400  }
-     GL_Z400_BINARY_AMD = $8740;     
-  { GL_AMD_performance_monitor  }
+const
+   GL_PROGRAM_BINARY_LENGTH_OES = $8741;
+   GL_NUM_PROGRAM_BINARY_FORMATS_OES = $87FE;
+   GL_PROGRAM_BINARY_FORMATS_OES = $87FF;
+{ GL_OES_mapbuffer  }
+   GL_WRITE_ONLY_OES = $88B9;
+   GL_BUFFER_ACCESS_OES = $88BB;
+   GL_BUFFER_MAPPED_OES = $88BC;
+   GL_BUFFER_MAP_POINTER_OES = $88BD;
+{ GL_OES_packed_depth_stencil  }
+   GL_DEPTH_STENCIL_OES = $84F9;
+   GL_UNSIGNED_INT_24_8_OES = $84FA;
+   GL_DEPTH24_STENCIL8_OES = $88F0;
+{ GL_OES_rgb8_rgba8  }
+   GL_RGB8_OES = $8051;
+   GL_RGBA8_OES = $8058;
+{ GL_OES_standard_derivatives  }
+   GL_FRAGMENT_SHADER_DERIVATIVE_HINT_OES = $8B8B;
+{ GL_OES_stencil1  }
+   GL_STENCIL_INDEX1_OES = $8D46;
+{ GL_OES_stencil4  }
+   GL_STENCIL_INDEX4_OES = $8D47;
+{ GL_OES_texture3D  }
+   GL_TEXTURE_WRAP_R_OES = $8072;
+   GL_TEXTURE_3D_OES = $806F;
+   GL_TEXTURE_BINDING_3D_OES = $806A;
+   GL_MAX_3D_TEXTURE_SIZE_OES = $8073;
+   GL_SAMPLER_3D_OES = $8B5F;
+   GL_FRAMEBUFFER_ATTACHMENT_TEXTURE_3D_ZOFFSET_OES = $8CD4;
+{ GL_OES_texture_half_float  }
+   GL_HALF_FLOAT_OES = $8D61;
+{ GL_OES_vertex_half_float  }
+{ GL_HALF_FLOAT_OES defined in GL_OES_texture_half_float already.  }
+{ GL_OES_vertex_type_10_10_10_2  }
+   GL_UNSIGNED_INT_10_10_10_2_OES = $8DF6;
+   GL_INT_10_10_10_2_OES = $8DF7;
+{------------------------------------------------------------------------*
+ * AMD extension tokens
+ *------------------------------------------------------------------------ }
+{ GL_AMD_compressed_3DC_texture  }
+   GL_3DC_X_AMD = $87F9;
+   GL_3DC_XY_AMD = $87FA;
+{ GL_AMD_compressed_ATC_texture  }
+   GL_ATC_RGB_AMD = $8C92;
+   GL_ATC_RGBA_EXPLICIT_ALPHA_AMD = $8C93;
+   GL_ATC_RGBA_INTERPOLATED_ALPHA_AMD = $87EE;
+{ GL_AMD_program_binary_Z400  }
+   GL_Z400_BINARY_AMD = $8740;
+{ GL_AMD_performance_monitor  }
 {$define GL_AMD_performance_monitor}  
-     GL_COUNTER_TYPE_AMD = $8BC0;     
-     GL_COUNTER_RANGE_AMD = $8BC1;     
-     GL_UNSIGNED_INT64_AMD = $8BC2;     
-     GL_PERCENTAGE_AMD = $8BC3;     
-     GL_PERFMON_RESULT_AVAILABLE_AMD = $8BC4;     
-     GL_PERFMON_RESULT_SIZE_AMD = $8BC5;     
-     GL_PERFMON_RESULT_AMD = $8BC6;     
-  {------------------------------------------------------------------------*
-   * EXT extension tokens
-   *------------------------------------------------------------------------ }
-  { GL_EXT_texture_filter_anisotropic  }
-     GL_TEXTURE_MAX_ANISOTROPY_EXT = $84FE;     
-     GL_MAX_TEXTURE_MAX_ANISOTROPY_EXT = $84FF;     
-  { GL_EXT_texture_type_2_10_10_10_REV  }
-     GL_UNSIGNED_INT_2_10_10_10_REV_EXT = $8368;     
-  {------------------------------------------------------------------------*
-   * OES extension functions
-   *------------------------------------------------------------------------ }
-  { GL_OES_compressed_ETC1_RGB8_texture  }
-     GL_OES_compressed_ETC1_RGB8_texture = 1;     
-  { GL_OES_compressed_paletted_texture  }
-     GL_OES_compressed_paletted_texture = 1;     
-  { GL_OES_EGL_image  }
+   GL_COUNTER_TYPE_AMD = $8BC0;
+   GL_COUNTER_RANGE_AMD = $8BC1;
+   GL_UNSIGNED_INT64_AMD = $8BC2;
+   GL_PERCENTAGE_AMD = $8BC3;
+   GL_PERFMON_RESULT_AVAILABLE_AMD = $8BC4;
+   GL_PERFMON_RESULT_SIZE_AMD = $8BC5;
+   GL_PERFMON_RESULT_AMD = $8BC6;
+{------------------------------------------------------------------------*
+ * EXT extension tokens
+ *------------------------------------------------------------------------ }
+{ GL_EXT_texture_filter_anisotropic  }
+   GL_TEXTURE_MAX_ANISOTROPY_EXT = $84FE;
+   GL_MAX_TEXTURE_MAX_ANISOTROPY_EXT = $84FF;
+{ GL_EXT_texture_type_2_10_10_10_REV  }
+   GL_UNSIGNED_INT_2_10_10_10_REV_EXT = $8368;
+{------------------------------------------------------------------------*
+ * OES extension functions
+ *------------------------------------------------------------------------ }
+{ GL_OES_compressed_ETC1_RGB8_texture  }
+   GL_OES_compressed_ETC1_RGB8_texture = 1;
+{ GL_OES_compressed_paletted_texture  }
+   GL_OES_compressed_paletted_texture = 1;
+{ GL_OES_EGL_image  }
 
-  var
-    glEGLImageTargetTexture2DOES : procedure(target:GLenum; image:GLeglImageOES);{$ifdef windows}stdcall;{$else}cdecl;{$endif}
-    glEGLImageTargetRenderbufferStorageOES : procedure(target:GLenum; image:GLeglImageOES);{$ifdef windows}stdcall;{$else}cdecl;{$endif}
+var
+  glEGLImageTargetTexture2DOES : procedure(target:GLenum; image:GLeglImageOES);{$ifdef windows}stdcall;{$else}cdecl;{$endif}
+  glEGLImageTargetRenderbufferStorageOES : procedure(target:GLenum; image:GLeglImageOES);{$ifdef windows}stdcall;{$else}cdecl;{$endif}
 
-  { GL_OES_depth24  }
+{ GL_OES_depth24  }
 
-  const
-     GL_OES_depth24 = 1;     
-  { GL_OES_depth32  }
-     GL_OES_depth32 = 1;     
-  { GL_OES_depth_texture  }
-     GL_OES_depth_texture = 1;     
-  { GL_OES_element_index_uint  }
-     GL_OES_element_index_uint = 1;     
-  { GL_OES_fbo_render_mipmap  }
-     GL_OES_fbo_render_mipmap = 1;     
-  { GL_OES_fragment_precision_high  }
-     GL_OES_fragment_precision_high = 1;     
-  { GL_OES_get_program_binary  }
+const
+   GL_OES_depth24 = 1;
+{ GL_OES_depth32  }
+   GL_OES_depth32 = 1;
+{ GL_OES_depth_texture  }
+   GL_OES_depth_texture = 1;
+{ GL_OES_element_index_uint  }
+   GL_OES_element_index_uint = 1;
+{ GL_OES_fbo_render_mipmap  }
+   GL_OES_fbo_render_mipmap = 1;
+{ GL_OES_fragment_precision_high  }
+   GL_OES_fragment_precision_high = 1;
+{ GL_OES_get_program_binary  }
 
-  var
-    glGetProgramBinaryOES : procedure(_program:GLuint; bufSize:GLsizei; length:pGLsizei; binaryFormat:pGLenum; binary:pointer);{$ifdef windows}stdcall;{$else}cdecl;{$endif}
+var
+  glGetProgramBinaryOES : procedure(_program:GLuint; bufSize:GLsizei; length:pGLsizei; binaryFormat:pGLenum; binary:pointer);{$ifdef windows}stdcall;{$else}cdecl;{$endif}
 (* Const before type ignored *)
-    glProgramBinaryOES : procedure(_program:GLuint; binaryFormat:GLenum; binary:pointer; length:GLint);{$ifdef windows}stdcall;{$else}cdecl;{$endif}
+  glProgramBinaryOES : procedure(_program:GLuint; binaryFormat:GLenum; binary:pointer; length:GLint);{$ifdef windows}stdcall;{$else}cdecl;{$endif}
 
 (* Const before type ignored *)
-  { GL_OES_mapbuffer  }
+{ GL_OES_mapbuffer  }
 
-  const
-     GL_OES_mapbuffer = 1;     
+const
+   GL_OES_mapbuffer = 1;
 
-  var
-    glMapBufferOES : function(target:GLenum; access:GLenum):pointer;{$ifdef windows}stdcall;{$else}cdecl;{$endif}
-    glUnmapBufferOES : function(target:GLenum):GLboolean;{$ifdef windows}stdcall;{$else}cdecl;{$endif}
-    glGetBufferPointervOES : procedure(target:GLenum; pname:GLenum; params:Ppointer);{$ifdef windows}stdcall;{$else}cdecl;{$endif}
+var
+  glMapBufferOES : function(target:GLenum; access:GLenum):pointer;{$ifdef windows}stdcall;{$else}cdecl;{$endif}
+  glUnmapBufferOES : function(target:GLenum):GLboolean;{$ifdef windows}stdcall;{$else}cdecl;{$endif}
+  glGetBufferPointervOES : procedure(target:GLenum; pname:GLenum; params:Ppointer);{$ifdef windows}stdcall;{$else}cdecl;{$endif}
 
-  type
+type
 
-     PFNGLMAPBUFFEROESPROC = pointer;
-  { GL_OES_packed_depth_stencil  }
+   PFNGLMAPBUFFEROESPROC = pointer;
+{ GL_OES_packed_depth_stencil  }
 
-  const
-     GL_OES_packed_depth_stencil = 1;     
-  { GL_OES_rgb8_rgba8  }
-     GL_OES_rgb8_rgba8 = 1;     
-  { GL_OES_standard_derivatives  }
-     GL_OES_standard_derivatives = 1;     
-  { GL_OES_stencil1  }
-     GL_OES_stencil1 = 1;     
-  { GL_OES_stencil4  }
-     GL_OES_stencil4 = 1;     
-  { GL_OES_texture_3D  }
-     GL_OES_texture_3D = 1;     
+const
+   GL_OES_packed_depth_stencil = 1;
+{ GL_OES_rgb8_rgba8  }
+   GL_OES_rgb8_rgba8 = 1;
+{ GL_OES_standard_derivatives  }
+   GL_OES_standard_derivatives = 1;
+{ GL_OES_stencil1  }
+   GL_OES_stencil1 = 1;
+{ GL_OES_stencil4  }
+   GL_OES_stencil4 = 1;
+{ GL_OES_texture_3D  }
+   GL_OES_texture_3D = 1;
 (* Const before type ignored *)
 
-  var
-    glTexImage3DOES : procedure(target:GLenum; level:GLint; internalformat:GLenum; width:GLsizei; height:GLsizei; 
-      depth:GLsizei; border:GLint; format:GLenum; _type:GLenum; pixels:pointer);{$ifdef windows}stdcall;{$else}cdecl;{$endif}
+var
+  glTexImage3DOES : procedure(target:GLenum; level:GLint; internalformat:GLenum; width:GLsizei; height:GLsizei;
+    depth:GLsizei; border:GLint; format:GLenum; _type:GLenum; pixels:pointer);{$ifdef windows}stdcall;{$else}cdecl;{$endif}
 (* Const before type ignored *)
-    glTexSubImage3DOES : procedure(target:GLenum; level:GLint; xoffset:GLint; yoffset:GLint; zoffset:GLint; 
-      width:GLsizei; height:GLsizei; depth:GLsizei; format:GLenum; _type:GLenum; 
-      pixels:pointer);{$ifdef windows}stdcall;{$else}cdecl;{$endif}
-    glCopyTexSubImage3DOES : procedure(target:GLenum; level:GLint; xoffset:GLint; yoffset:GLint; zoffset:GLint; 
-      x:GLint; y:GLint; width:GLsizei; height:GLsizei);{$ifdef windows}stdcall;{$else}cdecl;{$endif}
+  glTexSubImage3DOES : procedure(target:GLenum; level:GLint; xoffset:GLint; yoffset:GLint; zoffset:GLint;
+    width:GLsizei; height:GLsizei; depth:GLsizei; format:GLenum; _type:GLenum;
+    pixels:pointer);{$ifdef windows}stdcall;{$else}cdecl;{$endif}
+  glCopyTexSubImage3DOES : procedure(target:GLenum; level:GLint; xoffset:GLint; yoffset:GLint; zoffset:GLint;
+    x:GLint; y:GLint; width:GLsizei; height:GLsizei);{$ifdef windows}stdcall;{$else}cdecl;{$endif}
 (* Const before type ignored *)
-    glCompressedTexImage3DOES : procedure(target:GLenum; level:GLint; internalformat:GLenum; width:GLsizei; height:GLsizei; 
-      depth:GLsizei; border:GLint; imageSize:GLsizei; data:pointer);{$ifdef windows}stdcall;{$else}cdecl;{$endif}
+  glCompressedTexImage3DOES : procedure(target:GLenum; level:GLint; internalformat:GLenum; width:GLsizei; height:GLsizei;
+    depth:GLsizei; border:GLint; imageSize:GLsizei; data:pointer);{$ifdef windows}stdcall;{$else}cdecl;{$endif}
 (* Const before type ignored *)
-    glCompressedTexSubImage3DOES : procedure(target:GLenum; level:GLint; xoffset:GLint; yoffset:GLint; zoffset:GLint; 
-      width:GLsizei; height:GLsizei; depth:GLsizei; format:GLenum; imageSize:GLsizei; 
-      data:pointer);{$ifdef windows}stdcall;{$else}cdecl;{$endif}
-    glFramebufferTexture3DOES : procedure(target:GLenum; attachment:GLenum; textarget:GLenum; texture:GLuint; level:GLint; 
-      zoffset:GLint);{$ifdef windows}stdcall;{$else}cdecl;{$endif}
+  glCompressedTexSubImage3DOES : procedure(target:GLenum; level:GLint; xoffset:GLint; yoffset:GLint; zoffset:GLint;
+    width:GLsizei; height:GLsizei; depth:GLsizei; format:GLenum; imageSize:GLsizei;
+    data:pointer);{$ifdef windows}stdcall;{$else}cdecl;{$endif}
+  glFramebufferTexture3DOES : procedure(target:GLenum; attachment:GLenum; textarget:GLenum; texture:GLuint; level:GLint;
+    zoffset:GLint);{$ifdef windows}stdcall;{$else}cdecl;{$endif}
 (* Const before type ignored *)
 
 (* Const before type ignored *)
 (* Const before type ignored *)
 (* Const before type ignored *)
-  { GL_OES_texture_float_linear  }
+{ GL_OES_texture_float_linear  }
 
-  const
-     GL_OES_texture_float_linear = 1;     
-  { GL_OES_texture_half_float_linear  }
-     GL_OES_texture_half_float_linear = 1;     
-  { GL_OES_texture_float  }
-     GL_OES_texture_float = 1;     
-  { GL_OES_texture_half_float  }
-     GL_OES_texture_half_float = 1;     
-  { GL_OES_texture_npot  }
-     GL_OES_texture_npot = 1;     
-  { GL_OES_vertex_half_float  }
-     GL_OES_vertex_half_float = 1;     
-  { GL_OES_vertex_type_10_10_10_2  }
-     GL_OES_vertex_type_10_10_10_2 = 1;     
-  {------------------------------------------------------------------------*
-   * AMD extension functions
-   *------------------------------------------------------------------------ }
-  { GL_AMD_compressed_3DC_texture  }
-     GL_AMD_compressed_3DC_texture = 1;     
-  { GL_AMD_compressed_ATC_texture  }
-     GL_AMD_compressed_ATC_texture = 1;     
-  { GL_AMD_program_binary_Z400  }
-     GL_AMD_program_binary_Z400 = 1;     
-  { AMD_performance_monitor  }
-     GL_AMD_performance_monitor = 1;     
+const
+   GL_OES_texture_float_linear = 1;
+{ GL_OES_texture_half_float_linear  }
+   GL_OES_texture_half_float_linear = 1;
+{ GL_OES_texture_float  }
+   GL_OES_texture_float = 1;
+{ GL_OES_texture_half_float  }
+   GL_OES_texture_half_float = 1;
+{ GL_OES_texture_npot  }
+   GL_OES_texture_npot = 1;
+{ GL_OES_vertex_half_float  }
+   GL_OES_vertex_half_float = 1;
+{ GL_OES_vertex_type_10_10_10_2  }
+   GL_OES_vertex_type_10_10_10_2 = 1;
+{------------------------------------------------------------------------*
+ * AMD extension functions
+ *------------------------------------------------------------------------ }
+{ GL_AMD_compressed_3DC_texture  }
+   GL_AMD_compressed_3DC_texture = 1;
+{ GL_AMD_compressed_ATC_texture  }
+   GL_AMD_compressed_ATC_texture = 1;
+{ GL_AMD_program_binary_Z400  }
+   GL_AMD_program_binary_Z400 = 1;
+{ AMD_performance_monitor  }
+   GL_AMD_performance_monitor = 1;
 
-  var
-    glGetPerfMonitorGroupsAMD : procedure(numGroups:pGLint; groupsSize:GLsizei; groups:pGLuint);{$ifdef windows}stdcall;{$else}cdecl;{$endif}
-    glGetPerfMonitorCountersAMD : procedure(group:GLuint; numCounters:pGLint; maxActiveCounters:pGLint; counterSize:GLsizei; counters:pGLuint);{$ifdef windows}stdcall;{$else}cdecl;{$endif}
-    glGetPerfMonitorGroupStringAMD : procedure(group:GLuint; bufSize:GLsizei; length:pGLsizei; groupString:pchar);{$ifdef windows}stdcall;{$else}cdecl;{$endif}
-    glGetPerfMonitorCounterStringAMD : procedure(group:GLuint; counter:GLuint; bufSize:GLsizei; length:pGLsizei; counterString:pchar);{$ifdef windows}stdcall;{$else}cdecl;{$endif}
-    glGetPerfMonitorCounterInfoAMD : procedure(group:GLuint; counter:GLuint; pname:GLenum; data:pointer);{$ifdef windows}stdcall;{$else}cdecl;{$endif}
-    glGenPerfMonitorsAMD : procedure(n:GLsizei; monitors:pGLuint);{$ifdef windows}stdcall;{$else}cdecl;{$endif}
-    glDeletePerfMonitorsAMD : procedure(n:GLsizei; monitors:pGLuint);{$ifdef windows}stdcall;{$else}cdecl;{$endif}
-    glSelectPerfMonitorCountersAMD : procedure(monitor:GLuint; enable:GLboolean; group:GLuint; numCounters:GLint; countersList:pGLuint);{$ifdef windows}stdcall;{$else}cdecl;{$endif}
-    glBeginPerfMonitorAMD : procedure(monitor:GLuint);{$ifdef windows}stdcall;{$else}cdecl;{$endif}
-    glEndPerfMonitorAMD : procedure(monitor:GLuint);{$ifdef windows}stdcall;{$else}cdecl;{$endif}
-    glGetPerfMonitorCounterDataAMD : procedure(monitor:GLuint; pname:GLenum; dataSize:GLsizei; data:pGLuint; bytesWritten:pGLint);{$ifdef windows}stdcall;{$else}cdecl;{$endif}
+var
+  glGetPerfMonitorGroupsAMD : procedure(numGroups:pGLint; groupsSize:GLsizei; groups:pGLuint);{$ifdef windows}stdcall;{$else}cdecl;{$endif}
+  glGetPerfMonitorCountersAMD : procedure(group:GLuint; numCounters:pGLint; maxActiveCounters:pGLint; counterSize:GLsizei; counters:pGLuint);{$ifdef windows}stdcall;{$else}cdecl;{$endif}
+  glGetPerfMonitorGroupStringAMD : procedure(group:GLuint; bufSize:GLsizei; length:pGLsizei; groupString:pchar);{$ifdef windows}stdcall;{$else}cdecl;{$endif}
+  glGetPerfMonitorCounterStringAMD : procedure(group:GLuint; counter:GLuint; bufSize:GLsizei; length:pGLsizei; counterString:pchar);{$ifdef windows}stdcall;{$else}cdecl;{$endif}
+  glGetPerfMonitorCounterInfoAMD : procedure(group:GLuint; counter:GLuint; pname:GLenum; data:pointer);{$ifdef windows}stdcall;{$else}cdecl;{$endif}
+  glGenPerfMonitorsAMD : procedure(n:GLsizei; monitors:pGLuint);{$ifdef windows}stdcall;{$else}cdecl;{$endif}
+  glDeletePerfMonitorsAMD : procedure(n:GLsizei; monitors:pGLuint);{$ifdef windows}stdcall;{$else}cdecl;{$endif}
+  glSelectPerfMonitorCountersAMD : procedure(monitor:GLuint; enable:GLboolean; group:GLuint; numCounters:GLint; countersList:pGLuint);{$ifdef windows}stdcall;{$else}cdecl;{$endif}
+  glBeginPerfMonitorAMD : procedure(monitor:GLuint);{$ifdef windows}stdcall;{$else}cdecl;{$endif}
+  glEndPerfMonitorAMD : procedure(monitor:GLuint);{$ifdef windows}stdcall;{$else}cdecl;{$endif}
+  glGetPerfMonitorCounterDataAMD : procedure(monitor:GLuint; pname:GLenum; dataSize:GLsizei; data:pGLuint; bytesWritten:pGLint);{$ifdef windows}stdcall;{$else}cdecl;{$endif}
 
-  {------------------------------------------------------------------------*
-   * EXT extension functions
-   *------------------------------------------------------------------------ }
-  { GL_EXT_texture_filter_anisotropic  }
+{------------------------------------------------------------------------*
+ * EXT extension functions
+ *------------------------------------------------------------------------ }
+{ GL_EXT_texture_filter_anisotropic  }
 
-  const
-     GL_EXT_texture_filter_anisotropic = 1;     
-  { GL_EXT_texture_type_2_10_10_10_REV  }
-     GL_EXT_texture_type_2_10_10_10_REV = 1;     
+const
+   GL_EXT_texture_filter_anisotropic = 1;
+{ GL_EXT_texture_type_2_10_10_10_REV  }
+   GL_EXT_texture_type_2_10_10_10_REV = 1;
 
-function glGetProcAddress(ahlib:tlibhandle;ProcName:pchar):pointer;
-
 implementation
 
-  function glGetProcAddress(ahlib:tlibhandle;ProcName:pchar):pointer;
-    begin
-      result:=dynlibs.GetProcAddress(ahlib,ProcName);
-{$ifdef EGL}
-      if assigned(eglGetProcAddress) and not assigned(result) then
-        result:=eglGetProcAddress(ProcName);
-{$endif}
-    end;
+var
+  GLESv2Lib : tlibhandle;
 
-{$ifdef EGL}
-  { was #define dname def_expr }
-  function EGL_DEFAULT_DISPLAY : EGLNativeDisplayType;
-      begin
-         EGL_DEFAULT_DISPLAY:=EGLNativeDisplayType(0);
-      end;
+procedure FreeGLESv2;
+  begin
+    if GLESv2Lib<>0 then
+      FreeLibrary(GLESv2Lib);
 
-  { was #define dname def_expr }
-  function EGL_NO_CONTEXT : EGLContext;
-      begin
-         EGL_NO_CONTEXT:=EGLContext(0);
-      end;
+    glActiveTexture:=nil;
+    glAttachShader:=nil;
+    glBindAttribLocation:=nil;
+    glBindBuffer:=nil;
+    glBindFramebuffer:=nil;
+    glBindRenderbuffer:=nil;
+    glBindTexture:=nil;
+    glBlendColor:=nil;
+    glBlendEquation:=nil;
+    glBlendEquationSeparate:=nil;
+    glBlendFunc:=nil;
+    glBlendFuncSeparate:=nil;
+    glBufferData:=nil;
+    glBufferSubData:=nil;
+    glCheckFramebufferStatus:=nil;
+    glClear:=nil;
+    glClearColor:=nil;
+    glClearDepthf:=nil;
+    glClearStencil:=nil;
+    glColorMask:=nil;
+    glCompileShader:=nil;
+    glCompressedTexImage2D:=nil;
+    glCompressedTexSubImage2D:=nil;
+    glCopyTexImage2D:=nil;
+    glCopyTexSubImage2D:=nil;
+    glCreateProgram:=nil;
+    glCreateShader:=nil;
+    glCullFace:=nil;
+    glDeleteBuffers:=nil;
+    glDeleteFramebuffers:=nil;
+    glDeleteProgram:=nil;
+    glDeleteRenderbuffers:=nil;
+    glDeleteShader:=nil;
+    glDeleteTextures:=nil;
+    glDepthFunc:=nil;
+    glDepthMask:=nil;
+    glDepthRangef:=nil;
+    glDetachShader:=nil;
+    glDisable:=nil;
+    glDisableVertexAttribArray:=nil;
+    glDrawArrays:=nil;
+    glDrawElements:=nil;
+    glEnable:=nil;
+    glEnableVertexAttribArray:=nil;
+    glFinish:=nil;
+    glFlush:=nil;
+    glFramebufferRenderbuffer:=nil;
+    glFramebufferTexture2D:=nil;
+    glFrontFace:=nil;
+    glGenBuffers:=nil;
+    glGenerateMipmap:=nil;
+    glGenFramebuffers:=nil;
+    glGenRenderbuffers:=nil;
+    glGenTextures:=nil;
+    glGetActiveAttrib:=nil;
+    glGetActiveUniform:=nil;
+    glGetAttachedShaders:=nil;
+    glGetAttribLocation:=nil;
+    glGetBooleanv:=nil;
+    glGetBufferParameteriv:=nil;
+    glGetError:=nil;
+    glGetFloatv:=nil;
+    glGetFramebufferAttachmentParameteriv:=nil;
+    glGetIntegerv:=nil;
+    glGetProgramiv:=nil;
+    glGetProgramInfoLog:=nil;
+    glGetRenderbufferParameteriv:=nil;
+    glGetShaderiv:=nil;
+    glGetShaderInfoLog:=nil;
+    glGetShaderPrecisionFormat:=nil;
+    glGetShaderSource:=nil;
+    glGetString:=nil;
+    glGetTexParameterfv:=nil;
+    glGetTexParameteriv:=nil;
+    glGetUniformfv:=nil;
+    glGetUniformiv:=nil;
+    glGetUniformLocation:=nil;
+    glGetVertexAttribfv:=nil;
+    glGetVertexAttribiv:=nil;
+    glGetVertexAttribPointerv:=nil;
+    glHint:=nil;
+    glIsBuffer:=nil;
+    glIsEnabled:=nil;
+    glIsFramebuffer:=nil;
+    glIsProgram:=nil;
+    glIsRenderbuffer:=nil;
+    glIsShader:=nil;
+    glIsTexture:=nil;
+    glLineWidth:=nil;
+    glLinkProgram:=nil;
+    glPixelStorei:=nil;
+    glPolygonOffset:=nil;
+    glReadPixels:=nil;
+    glReleaseShaderCompiler:=nil;
+    glRenderbufferStorage:=nil;
+    glSampleCoverage:=nil;
+    glScissor:=nil;
+    glShaderBinary:=nil;
+    glShaderSource:=nil;
+    glStencilFunc:=nil;
+    glStencilFuncSeparate:=nil;
+    glStencilMask:=nil;
+    glStencilMaskSeparate:=nil;
+    glStencilOp:=nil;
+    glStencilOpSeparate:=nil;
+    glTexImage2D:=nil;
+    glTexParameterf:=nil;
+    glTexParameterfv:=nil;
+    glTexParameteri:=nil;
+    glTexParameteriv:=nil;
+    glTexSubImage2D:=nil;
+    glUniform1f:=nil;
+    glUniform1fv:=nil;
+    glUniform1i:=nil;
+    glUniform1iv:=nil;
+    glUniform2f:=nil;
+    glUniform2fv:=nil;
+    glUniform2i:=nil;
+    glUniform2iv:=nil;
+    glUniform3f:=nil;
+    glUniform3fv:=nil;
+    glUniform3i:=nil;
+    glUniform3iv:=nil;
+    glUniform4f:=nil;
+    glUniform4fv:=nil;
+    glUniform4i:=nil;
+    glUniform4iv:=nil;
+    glUniformMatrix2fv:=nil;
+    glUniformMatrix3fv:=nil;
+    glUniformMatrix4fv:=nil;
+    glUseProgram:=nil;
+    glValidateProgram:=nil;
+    glVertexAttrib1f:=nil;
+    glVertexAttrib1fv:=nil;
+    glVertexAttrib2f:=nil;
+    glVertexAttrib2fv:=nil;
+    glVertexAttrib3f:=nil;
+    glVertexAttrib3fv:=nil;
+    glVertexAttrib4f:=nil;
+    glVertexAttrib4fv:=nil;
+    glVertexAttribPointer:=nil;
+    glViewport:=nil;
+    glEGLImageTargetTexture2DOES:=nil;
+    glEGLImageTargetRenderbufferStorageOES:=nil;
+    glGetProgramBinaryOES:=nil;
+    glProgramBinaryOES:=nil;
+    glMapBufferOES:=nil;
+    glUnmapBufferOES:=nil;
+    glGetBufferPointervOES:=nil;
+    glTexImage3DOES:=nil;
+    glTexSubImage3DOES:=nil;
+    glCopyTexSubImage3DOES:=nil;
+    glCompressedTexImage3DOES:=nil;
+    glCompressedTexSubImage3DOES:=nil;
+    glFramebufferTexture3DOES:=nil;
+    glGetPerfMonitorGroupsAMD:=nil;
+    glGetPerfMonitorCountersAMD:=nil;
+    glGetPerfMonitorGroupStringAMD:=nil;
+    glGetPerfMonitorCounterStringAMD:=nil;
+    glGetPerfMonitorCounterInfoAMD:=nil;
+    glGenPerfMonitorsAMD:=nil;
+    glDeletePerfMonitorsAMD:=nil;
+    glSelectPerfMonitorCountersAMD:=nil;
+    glBeginPerfMonitorAMD:=nil;
+    glEndPerfMonitorAMD:=nil;
+    glGetPerfMonitorCounterDataAMD:=nil;
+  end;
 
-  { was #define dname def_expr }
-  function EGL_NO_DISPLAY : EGLDisplay;
-      begin
-         EGL_NO_DISPLAY:=EGLDisplay(0);
-      end;
+procedure LoadGLESv2(lib : pchar);
+  begin
+    FreeGLESv2;
+    GLESv2Lib:=dynlibs.LoadLibrary(lib);
+    if GLESv2Lib=0 then
+      raise Exception.Create(format('Could not load library: %s',[lib]));
 
-  { was #define dname def_expr }
-  function EGL_NO_SURFACE : EGLSurface;
-      begin
-         EGL_NO_SURFACE:=EGLSurface(0);
-      end;
+    pointer(glActiveTexture):=GetProcAddress(GLESv2Lib,'glActiveTexture');
+    pointer(glAttachShader):=GetProcAddress(GLESv2Lib,'glAttachShader');
+    pointer(glBindAttribLocation):=GetProcAddress(GLESv2Lib,'glBindAttribLocation');
+    pointer(glBindBuffer):=GetProcAddress(GLESv2Lib,'glBindBuffer');
+    pointer(glBindFramebuffer):=GetProcAddress(GLESv2Lib,'glBindFramebuffer');
+    pointer(glBindRenderbuffer):=GetProcAddress(GLESv2Lib,'glBindRenderbuffer');
+    pointer(glBindTexture):=GetProcAddress(GLESv2Lib,'glBindTexture');
+    pointer(glBlendColor):=GetProcAddress(GLESv2Lib,'glBlendColor');
+    pointer(glBlendEquation):=GetProcAddress(GLESv2Lib,'glBlendEquation');
+    pointer(glBlendEquationSeparate):=GetProcAddress(GLESv2Lib,'glBlendEquationSeparate');
+    pointer(glBlendFunc):=GetProcAddress(GLESv2Lib,'glBlendFunc');
+    pointer(glBlendFuncSeparate):=GetProcAddress(GLESv2Lib,'glBlendFuncSeparate');
+    pointer(glBufferData):=GetProcAddress(GLESv2Lib,'glBufferData');
+    pointer(glBufferSubData):=GetProcAddress(GLESv2Lib,'glBufferSubData');
+    pointer(glCheckFramebufferStatus):=GetProcAddress(GLESv2Lib,'glCheckFramebufferStatus');
+    pointer(glClear):=GetProcAddress(GLESv2Lib,'glClear');
+    pointer(glClearColor):=GetProcAddress(GLESv2Lib,'glClearColor');
+    pointer(glClearDepthf):=GetProcAddress(GLESv2Lib,'glClearDepthf');
+    pointer(glClearStencil):=GetProcAddress(GLESv2Lib,'glClearStencil');
+    pointer(glColorMask):=GetProcAddress(GLESv2Lib,'glColorMask');
+    pointer(glCompileShader):=GetProcAddress(GLESv2Lib,'glCompileShader');
+    pointer(glCompressedTexImage2D):=GetProcAddress(GLESv2Lib,'glCompressedTexImage2D');
+    pointer(glCompressedTexSubImage2D):=GetProcAddress(GLESv2Lib,'glCompressedTexSubImage2D');
+    pointer(glCopyTexImage2D):=GetProcAddress(GLESv2Lib,'glCopyTexImage2D');
+    pointer(glCopyTexSubImage2D):=GetProcAddress(GLESv2Lib,'glCopyTexSubImage2D');
+    pointer(glCreateProgram):=GetProcAddress(GLESv2Lib,'glCreateProgram');
+    pointer(glCreateShader):=GetProcAddress(GLESv2Lib,'glCreateShader');
+    pointer(glCullFace):=GetProcAddress(GLESv2Lib,'glCullFace');
+    pointer(glDeleteBuffers):=GetProcAddress(GLESv2Lib,'glDeleteBuffers');
+    pointer(glDeleteFramebuffers):=GetProcAddress(GLESv2Lib,'glDeleteFramebuffers');
+    pointer(glDeleteProgram):=GetProcAddress(GLESv2Lib,'glDeleteProgram');
+    pointer(glDeleteRenderbuffers):=GetProcAddress(GLESv2Lib,'glDeleteRenderbuffers');
+    pointer(glDeleteShader):=GetProcAddress(GLESv2Lib,'glDeleteShader');
+    pointer(glDeleteTextures):=GetProcAddress(GLESv2Lib,'glDeleteTextures');
+    pointer(glDepthFunc):=GetProcAddress(GLESv2Lib,'glDepthFunc');
+    pointer(glDepthMask):=GetProcAddress(GLESv2Lib,'glDepthMask');
+    pointer(glDepthRangef):=GetProcAddress(GLESv2Lib,'glDepthRangef');
+    pointer(glDetachShader):=GetProcAddress(GLESv2Lib,'glDetachShader');
+    pointer(glDisable):=GetProcAddress(GLESv2Lib,'glDisable');
+    pointer(glDisableVertexAttribArray):=GetProcAddress(GLESv2Lib,'glDisableVertexAttribArray');
+    pointer(glDrawArrays):=GetProcAddress(GLESv2Lib,'glDrawArrays');
+    pointer(glDrawElements):=GetProcAddress(GLESv2Lib,'glDrawElements');
+    pointer(glEnable):=GetProcAddress(GLESv2Lib,'glEnable');
+    pointer(glEnableVertexAttribArray):=GetProcAddress(GLESv2Lib,'glEnableVertexAttribArray');
+    pointer(glFinish):=GetProcAddress(GLESv2Lib,'glFinish');
+    pointer(glFlush):=GetProcAddress(GLESv2Lib,'glFlush');
+    pointer(glFramebufferRenderbuffer):=GetProcAddress(GLESv2Lib,'glFramebufferRenderbuffer');
+    pointer(glFramebufferTexture2D):=GetProcAddress(GLESv2Lib,'glFramebufferTexture2D');
+    pointer(glFrontFace):=GetProcAddress(GLESv2Lib,'glFrontFace');
+    pointer(glGenBuffers):=GetProcAddress(GLESv2Lib,'glGenBuffers');
+    pointer(glGenerateMipmap):=GetProcAddress(GLESv2Lib,'glGenerateMipmap');
+    pointer(glGenFramebuffers):=GetProcAddress(GLESv2Lib,'glGenFramebuffers');
+    pointer(glGenRenderbuffers):=GetProcAddress(GLESv2Lib,'glGenRenderbuffers');
+    pointer(glGenTextures):=GetProcAddress(GLESv2Lib,'glGenTextures');
+    pointer(glGetActiveAttrib):=GetProcAddress(GLESv2Lib,'glGetActiveAttrib');
+    pointer(glGetActiveUniform):=GetProcAddress(GLESv2Lib,'glGetActiveUniform');
+    pointer(glGetAttachedShaders):=GetProcAddress(GLESv2Lib,'glGetAttachedShaders');
+    pointer(glGetAttribLocation):=GetProcAddress(GLESv2Lib,'glGetAttribLocation');
+    pointer(glGetBooleanv):=GetProcAddress(GLESv2Lib,'glGetBooleanv');
+    pointer(glGetBufferParameteriv):=GetProcAddress(GLESv2Lib,'glGetBufferParameteriv');
+    pointer(glGetError):=GetProcAddress(GLESv2Lib,'glGetError');
+    pointer(glGetFloatv):=GetProcAddress(GLESv2Lib,'glGetFloatv');
+    pointer(glGetFramebufferAttachmentParameteriv):=GetProcAddress(GLESv2Lib,'glGetFramebufferAttachmentParameteriv');
+    pointer(glGetIntegerv):=GetProcAddress(GLESv2Lib,'glGetIntegerv');
+    pointer(glGetProgramiv):=GetProcAddress(GLESv2Lib,'glGetProgramiv');
+    pointer(glGetProgramInfoLog):=GetProcAddress(GLESv2Lib,'glGetProgramInfoLog');
+    pointer(glGetRenderbufferParameteriv):=GetProcAddress(GLESv2Lib,'glGetRenderbufferParameteriv');
+    pointer(glGetShaderiv):=GetProcAddress(GLESv2Lib,'glGetShaderiv');
+    pointer(glGetShaderInfoLog):=GetProcAddress(GLESv2Lib,'glGetShaderInfoLog');
+    pointer(glGetShaderPrecisionFormat):=GetProcAddress(GLESv2Lib,'glGetShaderPrecisionFormat');
+    pointer(glGetShaderSource):=GetProcAddress(GLESv2Lib,'glGetShaderSource');
+    pointer(glGetString):=GetProcAddress(GLESv2Lib,'glGetString');
+    pointer(glGetTexParameterfv):=GetProcAddress(GLESv2Lib,'glGetTexParameterfv');
+    pointer(glGetTexParameteriv):=GetProcAddress(GLESv2Lib,'glGetTexParameteriv');
+    pointer(glGetUniformfv):=GetProcAddress(GLESv2Lib,'glGetUniformfv');
+    pointer(glGetUniformiv):=GetProcAddress(GLESv2Lib,'glGetUniformiv');
+    pointer(glGetUniformLocation):=GetProcAddress(GLESv2Lib,'glGetUniformLocation');
+    pointer(glGetVertexAttribfv):=GetProcAddress(GLESv2Lib,'glGetVertexAttribfv');
+    pointer(glGetVertexAttribiv):=GetProcAddress(GLESv2Lib,'glGetVertexAttribiv');
+    pointer(glGetVertexAttribPointerv):=GetProcAddress(GLESv2Lib,'glGetVertexAttribPointerv');
+    pointer(glHint):=GetProcAddress(GLESv2Lib,'glHint');
+    pointer(glIsBuffer):=GetProcAddress(GLESv2Lib,'glIsBuffer');
+    pointer(glIsEnabled):=GetProcAddress(GLESv2Lib,'glIsEnabled');
+    pointer(glIsFramebuffer):=GetProcAddress(GLESv2Lib,'glIsFramebuffer');
+    pointer(glIsProgram):=GetProcAddress(GLESv2Lib,'glIsProgram');
+    pointer(glIsRenderbuffer):=GetProcAddress(GLESv2Lib,'glIsRenderbuffer');
+    pointer(glIsShader):=GetProcAddress(GLESv2Lib,'glIsShader');
+    pointer(glIsTexture):=GetProcAddress(GLESv2Lib,'glIsTexture');
+    pointer(glLineWidth):=GetProcAddress(GLESv2Lib,'glLineWidth');
+    pointer(glLinkProgram):=GetProcAddress(GLESv2Lib,'glLinkProgram');
+    pointer(glPixelStorei):=GetProcAddress(GLESv2Lib,'glPixelStorei');
+    pointer(glPolygonOffset):=GetProcAddress(GLESv2Lib,'glPolygonOffset');
+    pointer(glReadPixels):=GetProcAddress(GLESv2Lib,'glReadPixels');
+    pointer(glReleaseShaderCompiler):=GetProcAddress(GLESv2Lib,'glReleaseShaderCompiler');
+    pointer(glRenderbufferStorage):=GetProcAddress(GLESv2Lib,'glRenderbufferStorage');
+    pointer(glSampleCoverage):=GetProcAddress(GLESv2Lib,'glSampleCoverage');
+    pointer(glScissor):=GetProcAddress(GLESv2Lib,'glScissor');
+    pointer(glShaderBinary):=GetProcAddress(GLESv2Lib,'glShaderBinary');
+    pointer(glShaderSource):=GetProcAddress(GLESv2Lib,'glShaderSource');
+    pointer(glStencilFunc):=GetProcAddress(GLESv2Lib,'glStencilFunc');
+    pointer(glStencilFuncSeparate):=GetProcAddress(GLESv2Lib,'glStencilFuncSeparate');
+    pointer(glStencilMask):=GetProcAddress(GLESv2Lib,'glStencilMask');
+    pointer(glStencilMaskSeparate):=GetProcAddress(GLESv2Lib,'glStencilMaskSeparate');
+    pointer(glStencilOp):=GetProcAddress(GLESv2Lib,'glStencilOp');
+    pointer(glStencilOpSeparate):=GetProcAddress(GLESv2Lib,'glStencilOpSeparate');
+    pointer(glTexImage2D):=GetProcAddress(GLESv2Lib,'glTexImage2D');
+    pointer(glTexParameterf):=GetProcAddress(GLESv2Lib,'glTexParameterf');
+    pointer(glTexParameterfv):=GetProcAddress(GLESv2Lib,'glTexParameterfv');
+    pointer(glTexParameteri):=GetProcAddress(GLESv2Lib,'glTexParameteri');
+    pointer(glTexParameteriv):=GetProcAddress(GLESv2Lib,'glTexParameteriv');
+    pointer(glTexSubImage2D):=GetProcAddress(GLESv2Lib,'glTexSubImage2D');
+    pointer(glUniform1f):=GetProcAddress(GLESv2Lib,'glUniform1f');
+    pointer(glUniform1fv):=GetProcAddress(GLESv2Lib,'glUniform1fv');
+    pointer(glUniform1i):=GetProcAddress(GLESv2Lib,'glUniform1i');
+    pointer(glUniform1iv):=GetProcAddress(GLESv2Lib,'glUniform1iv');
+    pointer(glUniform2f):=GetProcAddress(GLESv2Lib,'glUniform2f');
+    pointer(glUniform2fv):=GetProcAddress(GLESv2Lib,'glUniform2fv');
+    pointer(glUniform2i):=GetProcAddress(GLESv2Lib,'glUniform2i');
+    pointer(glUniform2iv):=GetProcAddress(GLESv2Lib,'glUniform2iv');
+    pointer(glUniform3f):=GetProcAddress(GLESv2Lib,'glUniform3f');
+    pointer(glUniform3fv):=GetProcAddress(GLESv2Lib,'glUniform3fv');
+    pointer(glUniform3i):=GetProcAddress(GLESv2Lib,'glUniform3i');
+    pointer(glUniform3iv):=GetProcAddress(GLESv2Lib,'glUniform3iv');
+    pointer(glUniform4f):=GetProcAddress(GLESv2Lib,'glUniform4f');
+    pointer(glUniform4fv):=GetProcAddress(GLESv2Lib,'glUniform4fv');
+    pointer(glUniform4i):=GetProcAddress(GLESv2Lib,'glUniform4i');
+    pointer(glUniform4iv):=GetProcAddress(GLESv2Lib,'glUniform4iv');
+    pointer(glUniformMatrix2fv):=GetProcAddress(GLESv2Lib,'glUniformMatrix2fv');
+    pointer(glUniformMatrix3fv):=GetProcAddress(GLESv2Lib,'glUniformMatrix3fv');
+    pointer(glUniformMatrix4fv):=GetProcAddress(GLESv2Lib,'glUniformMatrix4fv');
+    pointer(glUseProgram):=GetProcAddress(GLESv2Lib,'glUseProgram');
+    pointer(glValidateProgram):=GetProcAddress(GLESv2Lib,'glValidateProgram');
+    pointer(glVertexAttrib1f):=GetProcAddress(GLESv2Lib,'glVertexAttrib1f');
+    pointer(glVertexAttrib1fv):=GetProcAddress(GLESv2Lib,'glVertexAttrib1fv');
+    pointer(glVertexAttrib2f):=GetProcAddress(GLESv2Lib,'glVertexAttrib2f');
+    pointer(glVertexAttrib2fv):=GetProcAddress(GLESv2Lib,'glVertexAttrib2fv');
+    pointer(glVertexAttrib3f):=GetProcAddress(GLESv2Lib,'glVertexAttrib3f');
+    pointer(glVertexAttrib3fv):=GetProcAddress(GLESv2Lib,'glVertexAttrib3fv');
+    pointer(glVertexAttrib4f):=GetProcAddress(GLESv2Lib,'glVertexAttrib4f');
+    pointer(glVertexAttrib4fv):=GetProcAddress(GLESv2Lib,'glVertexAttrib4fv');
+    pointer(glVertexAttribPointer):=GetProcAddress(GLESv2Lib,'glVertexAttribPointer');
+    pointer(glViewport):=GetProcAddress(GLESv2Lib,'glViewport');
+    pointer(glEGLImageTargetTexture2DOES):=GetProcAddress(GLESv2Lib,'glEGLImageTargetTexture2DOES');
+    pointer(glEGLImageTargetRenderbufferStorageOES):=GetProcAddress(GLESv2Lib,'glEGLImageTargetRenderbufferStorageOES');
+    pointer(glGetProgramBinaryOES):=GetProcAddress(GLESv2Lib,'glGetProgramBinaryOES');
+    pointer(glProgramBinaryOES):=GetProcAddress(GLESv2Lib,'glProgramBinaryOES');
+    pointer(glMapBufferOES):=GetProcAddress(GLESv2Lib,'glMapBufferOES');
+    pointer(glUnmapBufferOES):=GetProcAddress(GLESv2Lib,'glUnmapBufferOES');
+    pointer(glGetBufferPointervOES):=GetProcAddress(GLESv2Lib,'glGetBufferPointervOES');
+    pointer(glTexImage3DOES):=GetProcAddress(GLESv2Lib,'glTexImage3DOES');
+    pointer(glTexSubImage3DOES):=GetProcAddress(GLESv2Lib,'glTexSubImage3DOES');
+    pointer(glCopyTexSubImage3DOES):=GetProcAddress(GLESv2Lib,'glCopyTexSubImage3DOES');
+    pointer(glCompressedTexImage3DOES):=GetProcAddress(GLESv2Lib,'glCompressedTexImage3DOES');
+    pointer(glCompressedTexSubImage3DOES):=GetProcAddress(GLESv2Lib,'glCompressedTexSubImage3DOES');
+    pointer(glFramebufferTexture3DOES):=GetProcAddress(GLESv2Lib,'glFramebufferTexture3DOES');
+    pointer(glGetPerfMonitorGroupsAMD):=GetProcAddress(GLESv2Lib,'glGetPerfMonitorGroupsAMD');
+    pointer(glGetPerfMonitorCountersAMD):=GetProcAddress(GLESv2Lib,'glGetPerfMonitorCountersAMD');
+    pointer(glGetPerfMonitorGroupStringAMD):=GetProcAddress(GLESv2Lib,'glGetPerfMonitorGroupStringAMD');
+    pointer(glGetPerfMonitorCounterStringAMD):=GetProcAddress(GLESv2Lib,'glGetPerfMonitorCounterStringAMD');
+    pointer(glGetPerfMonitorCounterInfoAMD):=GetProcAddress(GLESv2Lib,'glGetPerfMonitorCounterInfoAMD');
+    pointer(glGenPerfMonitorsAMD):=GetProcAddress(GLESv2Lib,'glGenPerfMonitorsAMD');
+    pointer(glDeletePerfMonitorsAMD):=GetProcAddress(GLESv2Lib,'glDeletePerfMonitorsAMD');
+    pointer(glSelectPerfMonitorCountersAMD):=GetProcAddress(GLESv2Lib,'glSelectPerfMonitorCountersAMD');
+    pointer(glBeginPerfMonitorAMD):=GetProcAddress(GLESv2Lib,'glBeginPerfMonitorAMD');
+    pointer(glEndPerfMonitorAMD):=GetProcAddress(GLESv2Lib,'glEndPerfMonitorAMD');
+    pointer(glGetPerfMonitorCounterDataAMD):=GetProcAddress(GLESv2Lib,'glGetPerfMonitorCounterDataAMD');
+  end;
 
-  { was #define dname def_expr }
-  function EGL_DONT_CARE : EGLint;
-      begin
-         EGL_DONT_CARE:=EGLint(-(1));
-      end;
-
-  { was #define dname def_expr }
-  function EGL_UNKNOWN : EGLint;
-      begin
-         EGL_UNKNOWN:=EGLint(-(1));
-      end;
-
-  { was #define dname def_expr }
-  function EGL_NO_IMAGE_KHR : EGLImageKHR;
-      begin
-         EGL_NO_IMAGE_KHR:=EGLImageKHR(0);
-      end;
-
-
-  var
-    EGLLib : tlibhandle;
-
-
-  procedure FreeEGL;
-    begin
-      if EGLLib<>0 then
-        FreeLibrary(EGLLib);
-
-      eglGetError:=nil;
-      eglGetDisplay:=nil;
-      eglInitialize:=nil;
-      eglTerminate:=nil;
-      eglQueryString:=nil;
-      eglGetConfigs:=nil;
-      eglChooseConfig:=nil;
-      eglGetConfigAttrib:=nil;
-      eglCreateWindowSurface:=nil;
-      eglCreatePbufferSurface:=nil;
-      eglCreatePixmapSurface:=nil;
-      eglDestroySurface:=nil;
-      eglQuerySurface:=nil;
-      eglBindAPI:=nil;
-      eglQueryAPI:=nil;
-      eglWaitClient:=nil;
-      eglReleaseThread:=nil;
-      eglCreatePbufferFromClientBuffer:=nil;
-      eglSurfaceAttrib:=nil;
-      eglBindTexImage:=nil;
-      eglReleaseTexImage:=nil;
-      eglSwapInterval:=nil;
-      eglCreateContext:=nil;
-      eglDestroyContext:=nil;
-      eglMakeCurrent:=nil;
-      eglGetCurrentContext:=nil;
-      eglGetCurrentSurface:=nil;
-      eglGetCurrentDisplay:=nil;
-      eglQueryContext:=nil;
-      eglWaitGL:=nil;
-      eglWaitNative:=nil;
-      eglSwapBuffers:=nil;
-      eglCopyBuffers:=nil;
-      eglGetProcAddress:=nil;
-    end;
-
-
-  procedure LoadEGL(lib : pchar);
-    begin
-      FreeEGL;
-      EGLLib:=dynlibs.LoadLibrary(lib);
-      if EGLLib=0 then
-        raise Exception.Create(format('Could not load library: %s',[lib]));
-
-      pointer(eglGetProcAddress):=GetProcAddress(EGLLib,'glGetProcAddress');
-      
-      pointer(eglGetError):=glGetProcAddress(EGLLib,'eglGetError');
-      pointer(eglGetDisplay):=glGetProcAddress(EGLLib,'eglGetDisplay');
-      pointer(eglInitialize):=glGetProcAddress(EGLLib,'eglInitialize');
-      pointer(eglTerminate):=glGetProcAddress(EGLLib,'eglTerminate');
-      pointer(eglQueryString):=glGetProcAddress(EGLLib,'eglQueryString');
-      pointer(eglGetConfigs):=glGetProcAddress(EGLLib,'eglGetConfigs');
-      pointer(eglChooseConfig):=glGetProcAddress(EGLLib,'eglChooseConfig');
-      pointer(eglGetConfigAttrib):=glGetProcAddress(EGLLib,'eglGetConfigAttrib');
-      pointer(eglCreateWindowSurface):=glGetProcAddress(EGLLib,'eglCreateWindowSurface');
-      pointer(eglCreatePbufferSurface):=glGetProcAddress(EGLLib,'eglCreatePbufferSurface');
-      pointer(eglCreatePixmapSurface):=glGetProcAddress(EGLLib,'eglCreatePixmapSurface');
-      pointer(eglDestroySurface):=glGetProcAddress(EGLLib,'eglDestroySurface');
-      pointer(eglQuerySurface):=glGetProcAddress(EGLLib,'eglQuerySurface');
-      pointer(eglBindAPI):=glGetProcAddress(EGLLib,'eglBindAPI');
-      pointer(eglQueryAPI):=glGetProcAddress(EGLLib,'eglQueryAPI');
-      pointer(eglWaitClient):=glGetProcAddress(EGLLib,'eglWaitClient');
-      pointer(eglReleaseThread):=glGetProcAddress(EGLLib,'eglReleaseThread');
-      pointer(eglCreatePbufferFromClientBuffer):=glGetProcAddress(EGLLib,'eglCreatePbufferFromClientBuffer');
-      pointer(eglSurfaceAttrib):=glGetProcAddress(EGLLib,'eglSurfaceAttrib');
-      pointer(eglBindTexImage):=glGetProcAddress(EGLLib,'eglBindTexImage');
-      pointer(eglReleaseTexImage):=glGetProcAddress(EGLLib,'eglReleaseTexImage');
-      pointer(eglSwapInterval):=glGetProcAddress(EGLLib,'eglSwapInterval');
-      pointer(eglCreateContext):=glGetProcAddress(EGLLib,'eglCreateContext');
-      pointer(eglDestroyContext):=glGetProcAddress(EGLLib,'eglDestroyContext');
-      pointer(eglMakeCurrent):=glGetProcAddress(EGLLib,'eglMakeCurrent');
-      pointer(eglGetCurrentContext):=glGetProcAddress(EGLLib,'eglGetCurrentContext');
-      pointer(eglGetCurrentSurface):=glGetProcAddress(EGLLib,'eglGetCurrentSurface');
-      pointer(eglGetCurrentDisplay):=glGetProcAddress(EGLLib,'eglGetCurrentDisplay');
-      pointer(eglQueryContext):=glGetProcAddress(EGLLib,'eglQueryContext');
-      pointer(eglWaitGL):=glGetProcAddress(EGLLib,'eglWaitGL');
-      pointer(eglWaitNative):=glGetProcAddress(EGLLib,'eglWaitNative');
-      pointer(eglSwapBuffers):=glGetProcAddress(EGLLib,'eglSwapBuffers');
-      pointer(eglCopyBuffers):=glGetProcAddress(EGLLib,'eglCopyBuffers');
-    end;
-{$endif EGL}
-
-  var
-    GLESv2Lib : tlibhandle;
-
-  procedure FreeGLESv2;
-    begin
-      if GLESv2Lib<>0 then
-        FreeLibrary(GLESv2Lib);
-
-      glActiveTexture:=nil;
-      glAttachShader:=nil;
-      glBindAttribLocation:=nil;
-      glBindBuffer:=nil;
-      glBindFramebuffer:=nil;
-      glBindRenderbuffer:=nil;
-      glBindTexture:=nil;
-      glBlendColor:=nil;
-      glBlendEquation:=nil;
-      glBlendEquationSeparate:=nil;
-      glBlendFunc:=nil;
-      glBlendFuncSeparate:=nil;
-      glBufferData:=nil;
-      glBufferSubData:=nil;
-      glCheckFramebufferStatus:=nil;
-      glClear:=nil;
-      glClearColor:=nil;
-      glClearDepthf:=nil;
-      glClearStencil:=nil;
-      glColorMask:=nil;
-      glCompileShader:=nil;
-      glCompressedTexImage2D:=nil;
-      glCompressedTexSubImage2D:=nil;
-      glCopyTexImage2D:=nil;
-      glCopyTexSubImage2D:=nil;
-      glCreateProgram:=nil;
-      glCreateShader:=nil;
-      glCullFace:=nil;
-      glDeleteBuffers:=nil;
-      glDeleteFramebuffers:=nil;
-      glDeleteProgram:=nil;
-      glDeleteRenderbuffers:=nil;
-      glDeleteShader:=nil;
-      glDeleteTextures:=nil;
-      glDepthFunc:=nil;
-      glDepthMask:=nil;
-      glDepthRangef:=nil;
-      glDetachShader:=nil;
-      glDisable:=nil;
-      glDisableVertexAttribArray:=nil;
-      glDrawArrays:=nil;
-      glDrawElements:=nil;
-      glEnable:=nil;
-      glEnableVertexAttribArray:=nil;
-      glFinish:=nil;
-      glFlush:=nil;
-      glFramebufferRenderbuffer:=nil;
-      glFramebufferTexture2D:=nil;
-      glFrontFace:=nil;
-      glGenBuffers:=nil;
-      glGenerateMipmap:=nil;
-      glGenFramebuffers:=nil;
-      glGenRenderbuffers:=nil;
-      glGenTextures:=nil;
-      glGetActiveAttrib:=nil;
-      glGetActiveUniform:=nil;
-      glGetAttachedShaders:=nil;
-      glGetAttribLocation:=nil;
-      glGetBooleanv:=nil;
-      glGetBufferParameteriv:=nil;
-      glGetError:=nil;
-      glGetFloatv:=nil;
-      glGetFramebufferAttachmentParameteriv:=nil;
-      glGetIntegerv:=nil;
-      glGetProgramiv:=nil;
-      glGetProgramInfoLog:=nil;
-      glGetRenderbufferParameteriv:=nil;
-      glGetShaderiv:=nil;
-      glGetShaderInfoLog:=nil;
-      glGetShaderPrecisionFormat:=nil;
-      glGetShaderSource:=nil;
-      glGetString:=nil;
-      glGetTexParameterfv:=nil;
-      glGetTexParameteriv:=nil;
-      glGetUniformfv:=nil;
-      glGetUniformiv:=nil;
-      glGetUniformLocation:=nil;
-      glGetVertexAttribfv:=nil;
-      glGetVertexAttribiv:=nil;
-      glGetVertexAttribPointerv:=nil;
-      glHint:=nil;
-      glIsBuffer:=nil;
-      glIsEnabled:=nil;
-      glIsFramebuffer:=nil;
-      glIsProgram:=nil;
-      glIsRenderbuffer:=nil;
-      glIsShader:=nil;
-      glIsTexture:=nil;
-      glLineWidth:=nil;
-      glLinkProgram:=nil;
-      glPixelStorei:=nil;
-      glPolygonOffset:=nil;
-      glReadPixels:=nil;
-      glReleaseShaderCompiler:=nil;
-      glRenderbufferStorage:=nil;
-      glSampleCoverage:=nil;
-      glScissor:=nil;
-      glShaderBinary:=nil;
-      glShaderSource:=nil;
-      glStencilFunc:=nil;
-      glStencilFuncSeparate:=nil;
-      glStencilMask:=nil;
-      glStencilMaskSeparate:=nil;
-      glStencilOp:=nil;
-      glStencilOpSeparate:=nil;
-      glTexImage2D:=nil;
-      glTexParameterf:=nil;
-      glTexParameterfv:=nil;
-      glTexParameteri:=nil;
-      glTexParameteriv:=nil;
-      glTexSubImage2D:=nil;
-      glUniform1f:=nil;
-      glUniform1fv:=nil;
-      glUniform1i:=nil;
-      glUniform1iv:=nil;
-      glUniform2f:=nil;
-      glUniform2fv:=nil;
-      glUniform2i:=nil;
-      glUniform2iv:=nil;
-      glUniform3f:=nil;
-      glUniform3fv:=nil;
-      glUniform3i:=nil;
-      glUniform3iv:=nil;
-      glUniform4f:=nil;
-      glUniform4fv:=nil;
-      glUniform4i:=nil;
-      glUniform4iv:=nil;
-      glUniformMatrix2fv:=nil;
-      glUniformMatrix3fv:=nil;
-      glUniformMatrix4fv:=nil;
-      glUseProgram:=nil;
-      glValidateProgram:=nil;
-      glVertexAttrib1f:=nil;
-      glVertexAttrib1fv:=nil;
-      glVertexAttrib2f:=nil;
-      glVertexAttrib2fv:=nil;
-      glVertexAttrib3f:=nil;
-      glVertexAttrib3fv:=nil;
-      glVertexAttrib4f:=nil;
-      glVertexAttrib4fv:=nil;
-      glVertexAttribPointer:=nil;
-      glViewport:=nil;
-      glEGLImageTargetTexture2DOES:=nil;
-      glEGLImageTargetRenderbufferStorageOES:=nil;
-      glGetProgramBinaryOES:=nil;
-      glProgramBinaryOES:=nil;
-      glMapBufferOES:=nil;
-      glUnmapBufferOES:=nil;
-      glGetBufferPointervOES:=nil;
-      glTexImage3DOES:=nil;
-      glTexSubImage3DOES:=nil;
-      glCopyTexSubImage3DOES:=nil;
-      glCompressedTexImage3DOES:=nil;
-      glCompressedTexSubImage3DOES:=nil;
-      glFramebufferTexture3DOES:=nil;
-      glGetPerfMonitorGroupsAMD:=nil;
-      glGetPerfMonitorCountersAMD:=nil;
-      glGetPerfMonitorGroupStringAMD:=nil;
-      glGetPerfMonitorCounterStringAMD:=nil;
-      glGetPerfMonitorCounterInfoAMD:=nil;
-      glGenPerfMonitorsAMD:=nil;
-      glDeletePerfMonitorsAMD:=nil;
-      glSelectPerfMonitorCountersAMD:=nil;
-      glBeginPerfMonitorAMD:=nil;
-      glEndPerfMonitorAMD:=nil;
-      glGetPerfMonitorCounterDataAMD:=nil;
-    end;
-
-
-  procedure LoadGLESv2(lib : pchar);
-    begin
-      FreeGLESv2;
-      GLESv2Lib:=dynlibs.LoadLibrary(lib);
-      if GLESv2Lib=0 then
-        raise Exception.Create(format('Could not load library: %s',[lib]));
-
-      pointer(glActiveTexture):=glGetProcAddress(GLESv2Lib,'glActiveTexture');
-      pointer(glAttachShader):=glGetProcAddress(GLESv2Lib,'glAttachShader');
-      pointer(glBindAttribLocation):=glGetProcAddress(GLESv2Lib,'glBindAttribLocation');
-      pointer(glBindBuffer):=glGetProcAddress(GLESv2Lib,'glBindBuffer');
-      pointer(glBindFramebuffer):=glGetProcAddress(GLESv2Lib,'glBindFramebuffer');
-      pointer(glBindRenderbuffer):=glGetProcAddress(GLESv2Lib,'glBindRenderbuffer');
-      pointer(glBindTexture):=glGetProcAddress(GLESv2Lib,'glBindTexture');
-      pointer(glBlendColor):=glGetProcAddress(GLESv2Lib,'glBlendColor');
-      pointer(glBlendEquation):=glGetProcAddress(GLESv2Lib,'glBlendEquation');
-      pointer(glBlendEquationSeparate):=glGetProcAddress(GLESv2Lib,'glBlendEquationSeparate');
-      pointer(glBlendFunc):=glGetProcAddress(GLESv2Lib,'glBlendFunc');
-      pointer(glBlendFuncSeparate):=glGetProcAddress(GLESv2Lib,'glBlendFuncSeparate');
-      pointer(glBufferData):=glGetProcAddress(GLESv2Lib,'glBufferData');
-      pointer(glBufferSubData):=glGetProcAddress(GLESv2Lib,'glBufferSubData');
-      pointer(glCheckFramebufferStatus):=glGetProcAddress(GLESv2Lib,'glCheckFramebufferStatus');
-      pointer(glClear):=glGetProcAddress(GLESv2Lib,'glClear');
-      pointer(glClearColor):=glGetProcAddress(GLESv2Lib,'glClearColor');
-      pointer(glClearDepthf):=glGetProcAddress(GLESv2Lib,'glClearDepthf');
-      pointer(glClearStencil):=glGetProcAddress(GLESv2Lib,'glClearStencil');
-      pointer(glColorMask):=glGetProcAddress(GLESv2Lib,'glColorMask');
-      pointer(glCompileShader):=glGetProcAddress(GLESv2Lib,'glCompileShader');
-      pointer(glCompressedTexImage2D):=glGetProcAddress(GLESv2Lib,'glCompressedTexImage2D');
-      pointer(glCompressedTexSubImage2D):=glGetProcAddress(GLESv2Lib,'glCompressedTexSubImage2D');
-      pointer(glCopyTexImage2D):=glGetProcAddress(GLESv2Lib,'glCopyTexImage2D');
-      pointer(glCopyTexSubImage2D):=glGetProcAddress(GLESv2Lib,'glCopyTexSubImage2D');
-      pointer(glCreateProgram):=glGetProcAddress(GLESv2Lib,'glCreateProgram');
-      pointer(glCreateShader):=glGetProcAddress(GLESv2Lib,'glCreateShader');
-      pointer(glCullFace):=glGetProcAddress(GLESv2Lib,'glCullFace');
-      pointer(glDeleteBuffers):=glGetProcAddress(GLESv2Lib,'glDeleteBuffers');
-      pointer(glDeleteFramebuffers):=glGetProcAddress(GLESv2Lib,'glDeleteFramebuffers');
-      pointer(glDeleteProgram):=glGetProcAddress(GLESv2Lib,'glDeleteProgram');
-      pointer(glDeleteRenderbuffers):=glGetProcAddress(GLESv2Lib,'glDeleteRenderbuffers');
-      pointer(glDeleteShader):=glGetProcAddress(GLESv2Lib,'glDeleteShader');
-      pointer(glDeleteTextures):=glGetProcAddress(GLESv2Lib,'glDeleteTextures');
-      pointer(glDepthFunc):=glGetProcAddress(GLESv2Lib,'glDepthFunc');
-      pointer(glDepthMask):=glGetProcAddress(GLESv2Lib,'glDepthMask');
-      pointer(glDepthRangef):=glGetProcAddress(GLESv2Lib,'glDepthRangef');
-      pointer(glDetachShader):=glGetProcAddress(GLESv2Lib,'glDetachShader');
-      pointer(glDisable):=glGetProcAddress(GLESv2Lib,'glDisable');
-      pointer(glDisableVertexAttribArray):=glGetProcAddress(GLESv2Lib,'glDisableVertexAttribArray');
-      pointer(glDrawArrays):=glGetProcAddress(GLESv2Lib,'glDrawArrays');
-      pointer(glDrawElements):=glGetProcAddress(GLESv2Lib,'glDrawElements');
-      pointer(glEnable):=glGetProcAddress(GLESv2Lib,'glEnable');
-      pointer(glEnableVertexAttribArray):=glGetProcAddress(GLESv2Lib,'glEnableVertexAttribArray');
-      pointer(glFinish):=glGetProcAddress(GLESv2Lib,'glFinish');
-      pointer(glFlush):=glGetProcAddress(GLESv2Lib,'glFlush');
-      pointer(glFramebufferRenderbuffer):=glGetProcAddress(GLESv2Lib,'glFramebufferRenderbuffer');
-      pointer(glFramebufferTexture2D):=glGetProcAddress(GLESv2Lib,'glFramebufferTexture2D');
-      pointer(glFrontFace):=glGetProcAddress(GLESv2Lib,'glFrontFace');
-      pointer(glGenBuffers):=glGetProcAddress(GLESv2Lib,'glGenBuffers');
-      pointer(glGenerateMipmap):=glGetProcAddress(GLESv2Lib,'glGenerateMipmap');
-      pointer(glGenFramebuffers):=glGetProcAddress(GLESv2Lib,'glGenFramebuffers');
-      pointer(glGenRenderbuffers):=glGetProcAddress(GLESv2Lib,'glGenRenderbuffers');
-      pointer(glGenTextures):=glGetProcAddress(GLESv2Lib,'glGenTextures');
-      pointer(glGetActiveAttrib):=glGetProcAddress(GLESv2Lib,'glGetActiveAttrib');
-      pointer(glGetActiveUniform):=glGetProcAddress(GLESv2Lib,'glGetActiveUniform');
-      pointer(glGetAttachedShaders):=glGetProcAddress(GLESv2Lib,'glGetAttachedShaders');
-      pointer(glGetAttribLocation):=glGetProcAddress(GLESv2Lib,'glGetAttribLocation');
-      pointer(glGetBooleanv):=glGetProcAddress(GLESv2Lib,'glGetBooleanv');
-      pointer(glGetBufferParameteriv):=glGetProcAddress(GLESv2Lib,'glGetBufferParameteriv');
-      pointer(glGetError):=glGetProcAddress(GLESv2Lib,'glGetError');
-      pointer(glGetFloatv):=glGetProcAddress(GLESv2Lib,'glGetFloatv');
-      pointer(glGetFramebufferAttachmentParameteriv):=glGetProcAddress(GLESv2Lib,'glGetFramebufferAttachmentParameteriv');
-      pointer(glGetIntegerv):=glGetProcAddress(GLESv2Lib,'glGetIntegerv');
-      pointer(glGetProgramiv):=glGetProcAddress(GLESv2Lib,'glGetProgramiv');
-      pointer(glGetProgramInfoLog):=glGetProcAddress(GLESv2Lib,'glGetProgramInfoLog');
-      pointer(glGetRenderbufferParameteriv):=glGetProcAddress(GLESv2Lib,'glGetRenderbufferParameteriv');
-      pointer(glGetShaderiv):=glGetProcAddress(GLESv2Lib,'glGetShaderiv');
-      pointer(glGetShaderInfoLog):=glGetProcAddress(GLESv2Lib,'glGetShaderInfoLog');
-      pointer(glGetShaderPrecisionFormat):=glGetProcAddress(GLESv2Lib,'glGetShaderPrecisionFormat');
-      pointer(glGetShaderSource):=glGetProcAddress(GLESv2Lib,'glGetShaderSource');
-      pointer(glGetString):=glGetProcAddress(GLESv2Lib,'glGetString');
-      pointer(glGetTexParameterfv):=glGetProcAddress(GLESv2Lib,'glGetTexParameterfv');
-      pointer(glGetTexParameteriv):=glGetProcAddress(GLESv2Lib,'glGetTexParameteriv');
-      pointer(glGetUniformfv):=glGetProcAddress(GLESv2Lib,'glGetUniformfv');
-      pointer(glGetUniformiv):=glGetProcAddress(GLESv2Lib,'glGetUniformiv');
-      pointer(glGetUniformLocation):=glGetProcAddress(GLESv2Lib,'glGetUniformLocation');
-      pointer(glGetVertexAttribfv):=glGetProcAddress(GLESv2Lib,'glGetVertexAttribfv');
-      pointer(glGetVertexAttribiv):=glGetProcAddress(GLESv2Lib,'glGetVertexAttribiv');
-      pointer(glGetVertexAttribPointerv):=glGetProcAddress(GLESv2Lib,'glGetVertexAttribPointerv');
-      pointer(glHint):=glGetProcAddress(GLESv2Lib,'glHint');
-      pointer(glIsBuffer):=glGetProcAddress(GLESv2Lib,'glIsBuffer');
-      pointer(glIsEnabled):=glGetProcAddress(GLESv2Lib,'glIsEnabled');
-      pointer(glIsFramebuffer):=glGetProcAddress(GLESv2Lib,'glIsFramebuffer');
-      pointer(glIsProgram):=glGetProcAddress(GLESv2Lib,'glIsProgram');
-      pointer(glIsRenderbuffer):=glGetProcAddress(GLESv2Lib,'glIsRenderbuffer');
-      pointer(glIsShader):=glGetProcAddress(GLESv2Lib,'glIsShader');
-      pointer(glIsTexture):=glGetProcAddress(GLESv2Lib,'glIsTexture');
-      pointer(glLineWidth):=glGetProcAddress(GLESv2Lib,'glLineWidth');
-      pointer(glLinkProgram):=glGetProcAddress(GLESv2Lib,'glLinkProgram');
-      pointer(glPixelStorei):=glGetProcAddress(GLESv2Lib,'glPixelStorei');
-      pointer(glPolygonOffset):=glGetProcAddress(GLESv2Lib,'glPolygonOffset');
-      pointer(glReadPixels):=glGetProcAddress(GLESv2Lib,'glReadPixels');
-      pointer(glReleaseShaderCompiler):=glGetProcAddress(GLESv2Lib,'glReleaseShaderCompiler');
-      pointer(glRenderbufferStorage):=glGetProcAddress(GLESv2Lib,'glRenderbufferStorage');
-      pointer(glSampleCoverage):=glGetProcAddress(GLESv2Lib,'glSampleCoverage');
-      pointer(glScissor):=glGetProcAddress(GLESv2Lib,'glScissor');
-      pointer(glShaderBinary):=glGetProcAddress(GLESv2Lib,'glShaderBinary');
-      pointer(glShaderSource):=glGetProcAddress(GLESv2Lib,'glShaderSource');
-      pointer(glStencilFunc):=glGetProcAddress(GLESv2Lib,'glStencilFunc');
-      pointer(glStencilFuncSeparate):=glGetProcAddress(GLESv2Lib,'glStencilFuncSeparate');
-      pointer(glStencilMask):=glGetProcAddress(GLESv2Lib,'glStencilMask');
-      pointer(glStencilMaskSeparate):=glGetProcAddress(GLESv2Lib,'glStencilMaskSeparate');
-      pointer(glStencilOp):=glGetProcAddress(GLESv2Lib,'glStencilOp');
-      pointer(glStencilOpSeparate):=glGetProcAddress(GLESv2Lib,'glStencilOpSeparate');
-      pointer(glTexImage2D):=glGetProcAddress(GLESv2Lib,'glTexImage2D');
-      pointer(glTexParameterf):=glGetProcAddress(GLESv2Lib,'glTexParameterf');
-      pointer(glTexParameterfv):=glGetProcAddress(GLESv2Lib,'glTexParameterfv');
-      pointer(glTexParameteri):=glGetProcAddress(GLESv2Lib,'glTexParameteri');
-      pointer(glTexParameteriv):=glGetProcAddress(GLESv2Lib,'glTexParameteriv');
-      pointer(glTexSubImage2D):=glGetProcAddress(GLESv2Lib,'glTexSubImage2D');
-      pointer(glUniform1f):=glGetProcAddress(GLESv2Lib,'glUniform1f');
-      pointer(glUniform1fv):=glGetProcAddress(GLESv2Lib,'glUniform1fv');
-      pointer(glUniform1i):=glGetProcAddress(GLESv2Lib,'glUniform1i');
-      pointer(glUniform1iv):=glGetProcAddress(GLESv2Lib,'glUniform1iv');
-      pointer(glUniform2f):=glGetProcAddress(GLESv2Lib,'glUniform2f');
-      pointer(glUniform2fv):=glGetProcAddress(GLESv2Lib,'glUniform2fv');
-      pointer(glUniform2i):=glGetProcAddress(GLESv2Lib,'glUniform2i');
-      pointer(glUniform2iv):=glGetProcAddress(GLESv2Lib,'glUniform2iv');
-      pointer(glUniform3f):=glGetProcAddress(GLESv2Lib,'glUniform3f');
-      pointer(glUniform3fv):=glGetProcAddress(GLESv2Lib,'glUniform3fv');
-      pointer(glUniform3i):=glGetProcAddress(GLESv2Lib,'glUniform3i');
-      pointer(glUniform3iv):=glGetProcAddress(GLESv2Lib,'glUniform3iv');
-      pointer(glUniform4f):=glGetProcAddress(GLESv2Lib,'glUniform4f');
-      pointer(glUniform4fv):=glGetProcAddress(GLESv2Lib,'glUniform4fv');
-      pointer(glUniform4i):=glGetProcAddress(GLESv2Lib,'glUniform4i');
-      pointer(glUniform4iv):=glGetProcAddress(GLESv2Lib,'glUniform4iv');
-      pointer(glUniformMatrix2fv):=glGetProcAddress(GLESv2Lib,'glUniformMatrix2fv');
-      pointer(glUniformMatrix3fv):=glGetProcAddress(GLESv2Lib,'glUniformMatrix3fv');
-      pointer(glUniformMatrix4fv):=glGetProcAddress(GLESv2Lib,'glUniformMatrix4fv');
-      pointer(glUseProgram):=glGetProcAddress(GLESv2Lib,'glUseProgram');
-      pointer(glValidateProgram):=glGetProcAddress(GLESv2Lib,'glValidateProgram');
-      pointer(glVertexAttrib1f):=glGetProcAddress(GLESv2Lib,'glVertexAttrib1f');
-      pointer(glVertexAttrib1fv):=glGetProcAddress(GLESv2Lib,'glVertexAttrib1fv');
-      pointer(glVertexAttrib2f):=glGetProcAddress(GLESv2Lib,'glVertexAttrib2f');
-      pointer(glVertexAttrib2fv):=glGetProcAddress(GLESv2Lib,'glVertexAttrib2fv');
-      pointer(glVertexAttrib3f):=glGetProcAddress(GLESv2Lib,'glVertexAttrib3f');
-      pointer(glVertexAttrib3fv):=glGetProcAddress(GLESv2Lib,'glVertexAttrib3fv');
-      pointer(glVertexAttrib4f):=glGetProcAddress(GLESv2Lib,'glVertexAttrib4f');
-      pointer(glVertexAttrib4fv):=glGetProcAddress(GLESv2Lib,'glVertexAttrib4fv');
-      pointer(glVertexAttribPointer):=glGetProcAddress(GLESv2Lib,'glVertexAttribPointer');
-      pointer(glViewport):=glGetProcAddress(GLESv2Lib,'glViewport');
-      pointer(glEGLImageTargetTexture2DOES):=glGetProcAddress(GLESv2Lib,'glEGLImageTargetTexture2DOES');
-      pointer(glEGLImageTargetRenderbufferStorageOES):=glGetProcAddress(GLESv2Lib,'glEGLImageTargetRenderbufferStorageOES');
-      pointer(glGetProgramBinaryOES):=glGetProcAddress(GLESv2Lib,'glGetProgramBinaryOES');
-      pointer(glProgramBinaryOES):=glGetProcAddress(GLESv2Lib,'glProgramBinaryOES');
-      pointer(glMapBufferOES):=glGetProcAddress(GLESv2Lib,'glMapBufferOES');
-      pointer(glUnmapBufferOES):=glGetProcAddress(GLESv2Lib,'glUnmapBufferOES');
-      pointer(glGetBufferPointervOES):=glGetProcAddress(GLESv2Lib,'glGetBufferPointervOES');
-      pointer(glTexImage3DOES):=glGetProcAddress(GLESv2Lib,'glTexImage3DOES');
-      pointer(glTexSubImage3DOES):=glGetProcAddress(GLESv2Lib,'glTexSubImage3DOES');
-      pointer(glCopyTexSubImage3DOES):=glGetProcAddress(GLESv2Lib,'glCopyTexSubImage3DOES');
-      pointer(glCompressedTexImage3DOES):=glGetProcAddress(GLESv2Lib,'glCompressedTexImage3DOES');
-      pointer(glCompressedTexSubImage3DOES):=glGetProcAddress(GLESv2Lib,'glCompressedTexSubImage3DOES');
-      pointer(glFramebufferTexture3DOES):=glGetProcAddress(GLESv2Lib,'glFramebufferTexture3DOES');
-      pointer(glGetPerfMonitorGroupsAMD):=glGetProcAddress(GLESv2Lib,'glGetPerfMonitorGroupsAMD');
-      pointer(glGetPerfMonitorCountersAMD):=glGetProcAddress(GLESv2Lib,'glGetPerfMonitorCountersAMD');
-      pointer(glGetPerfMonitorGroupStringAMD):=glGetProcAddress(GLESv2Lib,'glGetPerfMonitorGroupStringAMD');
-      pointer(glGetPerfMonitorCounterStringAMD):=glGetProcAddress(GLESv2Lib,'glGetPerfMonitorCounterStringAMD');
-      pointer(glGetPerfMonitorCounterInfoAMD):=glGetProcAddress(GLESv2Lib,'glGetPerfMonitorCounterInfoAMD');
-      pointer(glGenPerfMonitorsAMD):=glGetProcAddress(GLESv2Lib,'glGenPerfMonitorsAMD');
-      pointer(glDeletePerfMonitorsAMD):=glGetProcAddress(GLESv2Lib,'glDeletePerfMonitorsAMD');
-      pointer(glSelectPerfMonitorCountersAMD):=glGetProcAddress(GLESv2Lib,'glSelectPerfMonitorCountersAMD');
-      pointer(glBeginPerfMonitorAMD):=glGetProcAddress(GLESv2Lib,'glBeginPerfMonitorAMD');
-      pointer(glEndPerfMonitorAMD):=glGetProcAddress(GLESv2Lib,'glEndPerfMonitorAMD');
-      pointer(glGetPerfMonitorCounterDataAMD):=glGetProcAddress(GLESv2Lib,'glGetPerfMonitorCounterDataAMD');
-    end;
-
-
 initialization
-{$ifdef EGL}
-  EGLLib:=0;
-  LoadEGL({$ifdef windows}'libEGL.dll'{$else}'libEGL.so'{$endif});
-{$endif}
   GLESv2Lib:=0;
   LoadGLESv2({$ifdef darwin}'/System/Library/Frameworks/OpenGLES.framework/OpenGLES'{$else}{$ifdef windows}'libGLESv2.dll'{$else}'libGLESv2.so'{$endif}{$endif});
 finalization
   FreeGLESv2;
-{$ifdef EGL}
-  FreeEGL;
-{$endif}
 end.
egl_opengles_split.diff (252,666 bytes)   

Thaddy de Koning

2014-01-15 05:48

reporter   ~0072452

Last edited: 2014-01-15 05:52

View 2 revisions

I support this patch.
As an aside I am busy preparing a similar patch that also removes the horrible dependency on X. (Android/linux GLES shouldn't depend on X f.e.)
Furthermore, while making some progress, the original code is rather old and incomplete. This is a good first step. If this patch is accepted I will see if I can merge in my patch later. This will break existing code, though. This patch also breaks existing code somewhat. But it is more correct than the current code.

Dennis Fehr

2014-01-15 21:27

reporter  

egl_opengles_split-2.diff (253,742 bytes)   
Index: packages/egl/Makefile
===================================================================
--- packages/egl/Makefile	(revision 0)
+++ packages/egl/Makefile	(working copy)
@@ -0,0 +1,2812 @@
+#
+# Don't edit, this file is generated by FPCMake Version 2.0.0 [2013-11-16 rev 26097]
+#
+default: all
+MAKEFILETARGETS=i386-linux i386-go32v2 i386-win32 i386-os2 i386-freebsd i386-beos i386-haiku i386-netbsd i386-solaris i386-qnx i386-netware i386-openbsd i386-wdosx i386-darwin i386-emx i386-watcom i386-netwlibc i386-wince i386-embedded i386-symbian i386-nativent i386-iphonesim i386-android m68k-linux m68k-freebsd m68k-netbsd m68k-amiga m68k-atari m68k-openbsd m68k-palmos m68k-embedded powerpc-linux powerpc-netbsd powerpc-amiga powerpc-macos powerpc-darwin powerpc-morphos powerpc-embedded powerpc-wii powerpc-aix sparc-linux sparc-netbsd sparc-solaris sparc-embedded x86_64-linux x86_64-freebsd x86_64-netbsd x86_64-solaris x86_64-openbsd x86_64-darwin x86_64-win64 x86_64-embedded arm-linux arm-palmos arm-darwin arm-wince arm-gba arm-nds arm-embedded arm-symbian arm-android powerpc64-linux powerpc64-darwin powerpc64-embedded powerpc64-aix avr-embedded armeb-linux armeb-embedded mips-linux mipsel-linux jvm-java jvm-android i8086-msdos
+BSDs = freebsd netbsd openbsd darwin
+UNIXs = linux $(BSDs) solaris qnx haiku aix
+LIMIT83fs = go32v2 os2 emx watcom
+OSNeedsComspecToRunBatch = go32v2 watcom
+FORCE:
+.PHONY: FORCE
+override PATH:=$(patsubst %/,%,$(subst \,/,$(PATH)))
+ifneq ($(findstring darwin,$(OSTYPE)),)
+inUnix=1 #darwin
+SEARCHPATH:=$(filter-out .,$(subst :, ,$(PATH)))
+else
+ifeq ($(findstring ;,$(PATH)),)
+inUnix=1
+SEARCHPATH:=$(filter-out .,$(subst :, ,$(PATH)))
+else
+SEARCHPATH:=$(subst ;, ,$(PATH))
+endif
+endif
+SEARCHPATH+=$(patsubst %/,%,$(subst \,/,$(dir $(MAKE))))
+PWD:=$(strip $(wildcard $(addsuffix /pwd.exe,$(SEARCHPATH))))
+ifeq ($(PWD),)
+PWD:=$(strip $(wildcard $(addsuffix /pwd,$(SEARCHPATH))))
+ifeq ($(PWD),)
+$(error You need the GNU utils package to use this Makefile)
+else
+PWD:=$(firstword $(PWD))
+SRCEXEEXT=
+endif
+else
+PWD:=$(firstword $(PWD))
+SRCEXEEXT=.exe
+endif
+ifndef inUnix
+ifeq ($(OS),Windows_NT)
+inWinNT=1
+else
+ifdef OS2_SHELL
+inOS2=1
+endif
+endif
+else
+ifneq ($(findstring cygdrive,$(PATH)),)
+inCygWin=1
+endif
+endif
+ifdef inUnix
+SRCBATCHEXT=.sh
+else
+ifdef inOS2
+SRCBATCHEXT=.cmd
+else
+SRCBATCHEXT=.bat
+endif
+endif
+ifdef COMSPEC
+ifneq ($(findstring $(OS_SOURCE),$(OSNeedsComspecToRunBatch)),)
+ifndef RUNBATCH
+RUNBATCH=$(COMSPEC) /C
+endif
+endif
+endif
+ifdef inUnix
+PATHSEP=/
+else
+PATHSEP:=$(subst /,\,/)
+ifdef inCygWin
+PATHSEP=/
+endif
+endif
+ifdef PWD
+BASEDIR:=$(subst \,/,$(shell $(PWD)))
+ifdef inCygWin
+ifneq ($(findstring /cygdrive/,$(BASEDIR)),)
+BASENODIR:=$(patsubst /cygdrive%,%,$(BASEDIR))
+BASEDRIVE:=$(firstword $(subst /, ,$(BASENODIR)))
+BASEDIR:=$(subst /cygdrive/$(BASEDRIVE)/,$(BASEDRIVE):/,$(BASEDIR))
+endif
+endif
+else
+BASEDIR=.
+endif
+ifdef inOS2
+ifndef ECHO
+ECHO:=$(strip $(wildcard $(addsuffix /gecho$(SRCEXEEXT),$(SEARCHPATH))))
+ifeq ($(ECHO),)
+ECHO:=$(strip $(wildcard $(addsuffix /echo$(SRCEXEEXT),$(SEARCHPATH))))
+ifeq ($(ECHO),)
+ECHO=echo
+else
+ECHO:=$(firstword $(ECHO))
+endif
+else
+ECHO:=$(firstword $(ECHO))
+endif
+endif
+export ECHO
+endif
+override DEFAULT_FPCDIR=../..
+ifndef FPC
+ifdef PP
+FPC=$(PP)
+endif
+endif
+ifndef FPC
+FPCPROG:=$(strip $(wildcard $(addsuffix /fpc$(SRCEXEEXT),$(SEARCHPATH))))
+ifneq ($(FPCPROG),)
+FPCPROG:=$(firstword $(FPCPROG))
+ifneq ($(CPU_TARGET),)
+FPC:=$(shell $(FPCPROG) -P$(CPU_TARGET) -PB)
+else
+FPC:=$(shell $(FPCPROG) -PB)
+endif
+ifneq ($(findstring Error,$(FPC)),)
+override FPC=$(firstword $(strip $(wildcard $(addsuffix /ppc386$(SRCEXEEXT),$(SEARCHPATH)))))
+else
+ifeq ($(strip $(wildcard $(FPC))),)
+FPC:=$(firstword $(FPCPROG))
+endif
+endif
+else
+override FPC=$(firstword $(strip $(wildcard $(addsuffix /ppc386$(SRCEXEEXT),$(SEARCHPATH)))))
+endif
+endif
+override FPC:=$(subst $(SRCEXEEXT),,$(FPC))
+override FPC:=$(subst \,/,$(FPC))$(SRCEXEEXT)
+FOUNDFPC:=$(strip $(wildcard $(FPC)))
+ifeq ($(FOUNDFPC),)
+FOUNDFPC=$(strip $(wildcard $(addsuffix /$(FPC),$(SEARCHPATH))))
+ifeq ($(FOUNDFPC),)
+$(error Compiler $(FPC) not found)
+endif
+endif
+ifndef FPC_COMPILERINFO
+FPC_COMPILERINFO:=$(shell $(FPC) -iVSPTPSOTO)
+endif
+ifndef FPC_VERSION
+FPC_VERSION:=$(word 1,$(FPC_COMPILERINFO))
+endif
+export FPC FPC_VERSION FPC_COMPILERINFO
+unexport CHECKDEPEND ALLDEPENDENCIES
+ifndef CPU_TARGET
+ifdef CPU_TARGET_DEFAULT
+CPU_TARGET=$(CPU_TARGET_DEFAULT)
+endif
+endif
+ifndef OS_TARGET
+ifdef OS_TARGET_DEFAULT
+OS_TARGET=$(OS_TARGET_DEFAULT)
+endif
+endif
+ifndef CPU_SOURCE
+CPU_SOURCE:=$(word 2,$(FPC_COMPILERINFO))
+endif
+ifndef CPU_TARGET
+CPU_TARGET:=$(word 3,$(FPC_COMPILERINFO))
+endif
+ifndef OS_SOURCE
+OS_SOURCE:=$(word 4,$(FPC_COMPILERINFO))
+endif
+ifndef OS_TARGET
+OS_TARGET:=$(word 5,$(FPC_COMPILERINFO))
+endif
+FULL_TARGET=$(CPU_TARGET)-$(OS_TARGET)
+FULL_SOURCE=$(CPU_SOURCE)-$(OS_SOURCE)
+ifeq ($(CPU_TARGET),armeb)
+ARCH=arm
+override FPCOPT+=-Cb
+else
+ifeq ($(CPU_TARGET),armel)
+ARCH=arm
+override FPCOPT+=-CaEABI
+else
+ARCH=$(CPU_TARGET)
+endif
+endif
+ifeq ($(FULL_TARGET),arm-embedded)
+ifeq ($(SUBARCH),)
+$(error When compiling for arm-embedded, a sub-architecture (e.g. SUBARCH=armv4t or SUBARCH=armv7m) must be defined)
+endif
+override FPCOPT+=-Cp$(SUBARCH)
+endif
+ifneq ($(findstring $(OS_SOURCE),$(LIMIT83fs)),)
+TARGETSUFFIX=$(OS_TARGET)
+SOURCESUFFIX=$(OS_SOURCE)
+else
+ifneq ($(findstring $(OS_TARGET),$(LIMIT83fs)),)
+TARGETSUFFIX=$(OS_TARGET)
+else
+TARGETSUFFIX=$(FULL_TARGET)
+endif
+SOURCESUFFIX=$(FULL_SOURCE)
+endif
+ifneq ($(FULL_TARGET),$(FULL_SOURCE))
+CROSSCOMPILE=1
+endif
+ifeq ($(findstring makefile,$(MAKECMDGOALS)),)
+ifeq ($(findstring $(FULL_TARGET),$(MAKEFILETARGETS)),)
+$(error The Makefile doesn't support target $(FULL_TARGET), please run fpcmake first)
+endif
+endif
+ifneq ($(findstring $(OS_TARGET),$(BSDs)),)
+BSDhier=1
+endif
+ifeq ($(OS_TARGET),linux)
+linuxHier=1
+endif
+ifndef CROSSCOMPILE
+BUILDFULLNATIVE=1
+export BUILDFULLNATIVE
+endif
+ifdef BUILDFULLNATIVE
+BUILDNATIVE=1
+export BUILDNATIVE
+endif
+export OS_TARGET OS_SOURCE ARCH CPU_TARGET CPU_SOURCE FULL_TARGET FULL_SOURCE TARGETSUFFIX SOURCESUFFIX CROSSCOMPILE
+ifdef FPCDIR
+override FPCDIR:=$(subst \,/,$(FPCDIR))
+ifeq ($(wildcard $(addprefix $(FPCDIR)/,rtl units)),)
+override FPCDIR=wrong
+endif
+else
+override FPCDIR=wrong
+endif
+ifdef DEFAULT_FPCDIR
+ifeq ($(FPCDIR),wrong)
+override FPCDIR:=$(subst \,/,$(DEFAULT_FPCDIR))
+ifeq ($(wildcard $(addprefix $(FPCDIR)/,rtl units)),)
+override FPCDIR=wrong
+endif
+endif
+endif
+ifeq ($(FPCDIR),wrong)
+ifdef inUnix
+override FPCDIR=/usr/local/lib/fpc/$(FPC_VERSION)
+ifeq ($(wildcard $(FPCDIR)/units),)
+override FPCDIR=/usr/lib/fpc/$(FPC_VERSION)
+endif
+else
+override FPCDIR:=$(subst /$(FPC),,$(firstword $(strip $(wildcard $(addsuffix /$(FPC),$(SEARCHPATH))))))
+override FPCDIR:=$(FPCDIR)/..
+ifeq ($(wildcard $(addprefix $(FPCDIR)/,rtl units)),)
+override FPCDIR:=$(FPCDIR)/..
+ifeq ($(wildcard $(addprefix $(FPCDIR)/,rtl units)),)
+override FPCDIR:=$(BASEDIR)
+ifeq ($(wildcard $(addprefix $(FPCDIR)/,rtl units)),)
+override FPCDIR=c:/pp
+endif
+endif
+endif
+endif
+endif
+ifndef CROSSBINDIR
+CROSSBINDIR:=$(wildcard $(FPCDIR)/bin/$(TARGETSUFFIX))
+endif
+ifneq ($(findstring $(OS_TARGET),darwin iphonesim),)
+ifeq ($(OS_SOURCE),darwin)
+DARWIN2DARWIN=1
+endif
+endif
+ifndef BINUTILSPREFIX
+ifndef CROSSBINDIR
+ifdef CROSSCOMPILE
+ifndef DARWIN2DARWIN
+ifneq ($(CPU_TARGET),jvm)
+BINUTILSPREFIX=$(CPU_TARGET)-$(OS_TARGET)-
+ifeq ($(OS_TARGET),android)
+ifeq ($(CPU_TARGET),arm)
+BINUTILSPREFIX=arm-linux-androideabi-
+else
+ifeq ($(CPU_TARGET),i386)
+BINUTILSPREFIX=i686-linux-android-
+else
+ifeq ($(CPU_TARGET),mips)
+BINUTILSPREFIX=mipsel-linux-android-
+endif
+endif
+endif
+endif
+endif
+endif
+endif
+endif
+endif
+UNITSDIR:=$(wildcard $(FPCDIR)/units/$(TARGETSUFFIX))
+ifeq ($(UNITSDIR),)
+UNITSDIR:=$(wildcard $(FPCDIR)/units/$(OS_TARGET))
+endif
+PACKAGESDIR:=$(wildcard $(FPCDIR) $(FPCDIR)/packages $(FPCDIR)/packages/base $(FPCDIR)/packages/extra)
+ifndef FPCFPMAKE
+ifdef CROSSCOMPILE
+ifeq ($(strip $(wildcard $(addsuffix /compiler/ppc$(SRCEXEEXT),$(FPCDIR)))),)
+FPCPROG:=$(strip $(wildcard $(addsuffix /fpc$(SRCEXEEXT),$(SEARCHPATH))))
+ifneq ($(FPCPROG),)
+FPCPROG:=$(firstword $(FPCPROG))
+FPCFPMAKE:=$(shell $(FPCPROG) -PB)
+ifeq ($(strip $(wildcard $(FPCFPMAKE))),)
+FPCFPMAKE:=$(firstword $(FPCPROG))
+endif
+else
+override FPCFPMAKE=$(firstword $(strip $(wildcard $(addsuffix /ppc386$(SRCEXEEXT),$(SEARCHPATH)))))
+endif
+else
+FPCFPMAKE=$(strip $(wildcard $(addsuffix /compiler/ppc$(SRCEXEEXT),$(FPCDIR))))
+FPMAKE_SKIP_CONFIG=-n
+export FPCFPMAKE
+export FPMAKE_SKIP_CONFIG
+endif
+else
+FPMAKE_SKIP_CONFIG=-n
+FPCFPMAKE=$(FPC)
+endif
+endif
+override PACKAGE_NAME=egl
+override PACKAGE_VERSION=2.7.1
+ifeq ($(FULL_TARGET),i386-linux)
+override TARGET_UNITS+=egl
+endif
+ifeq ($(FULL_TARGET),i386-win32)
+override TARGET_UNITS+=egl
+endif
+ifeq ($(FULL_TARGET),i386-darwin)
+override TARGET_UNITS+=egl
+endif
+ifeq ($(FULL_TARGET),i386-wince)
+override TARGET_UNITS+=egl
+endif
+ifeq ($(FULL_TARGET),i386-android)
+override TARGET_UNITS+=egl
+endif
+ifeq ($(FULL_TARGET),m68k-linux)
+override TARGET_UNITS+=egl
+endif
+ifeq ($(FULL_TARGET),powerpc-linux)
+override TARGET_UNITS+=egl
+endif
+ifeq ($(FULL_TARGET),powerpc-darwin)
+override TARGET_UNITS+=egl
+endif
+ifeq ($(FULL_TARGET),sparc-linux)
+override TARGET_UNITS+=egl
+endif
+ifeq ($(FULL_TARGET),x86_64-linux)
+override TARGET_UNITS+=egl
+endif
+ifeq ($(FULL_TARGET),x86_64-darwin)
+override TARGET_UNITS+=egl
+endif
+ifeq ($(FULL_TARGET),x86_64-win64)
+override TARGET_UNITS+=egl
+endif
+ifeq ($(FULL_TARGET),arm-linux)
+override TARGET_UNITS+=egl
+endif
+ifeq ($(FULL_TARGET),arm-darwin)
+override TARGET_UNITS+=egl
+endif
+ifeq ($(FULL_TARGET),arm-wince)
+override TARGET_UNITS+=egl
+endif
+ifeq ($(FULL_TARGET),arm-android)
+override TARGET_UNITS+=egl
+endif
+ifeq ($(FULL_TARGET),powerpc64-linux)
+override TARGET_UNITS+=egl
+endif
+ifeq ($(FULL_TARGET),powerpc64-darwin)
+override TARGET_UNITS+=egl
+endif
+ifeq ($(FULL_TARGET),armeb-linux)
+override TARGET_UNITS+=egl
+endif
+ifeq ($(FULL_TARGET),mips-linux)
+override TARGET_UNITS+=egl
+endif
+ifeq ($(FULL_TARGET),mipsel-linux)
+override TARGET_UNITS+=egl
+endif
+ifeq ($(FULL_TARGET),jvm-android)
+override TARGET_UNITS+=egl
+endif
+ifeq ($(FULL_TARGET),i386-linux)
+override TARGET_EXAMPLEDIRS+=examples
+endif
+ifeq ($(FULL_TARGET),i386-go32v2)
+override TARGET_EXAMPLEDIRS+=examples
+endif
+ifeq ($(FULL_TARGET),i386-win32)
+override TARGET_EXAMPLEDIRS+=examples
+endif
+ifeq ($(FULL_TARGET),i386-os2)
+override TARGET_EXAMPLEDIRS+=examples
+endif
+ifeq ($(FULL_TARGET),i386-freebsd)
+override TARGET_EXAMPLEDIRS+=examples
+endif
+ifeq ($(FULL_TARGET),i386-beos)
+override TARGET_EXAMPLEDIRS+=examples
+endif
+ifeq ($(FULL_TARGET),i386-haiku)
+override TARGET_EXAMPLEDIRS+=examples
+endif
+ifeq ($(FULL_TARGET),i386-netbsd)
+override TARGET_EXAMPLEDIRS+=examples
+endif
+ifeq ($(FULL_TARGET),i386-solaris)
+override TARGET_EXAMPLEDIRS+=examples
+endif
+ifeq ($(FULL_TARGET),i386-qnx)
+override TARGET_EXAMPLEDIRS+=examples
+endif
+ifeq ($(FULL_TARGET),i386-netware)
+override TARGET_EXAMPLEDIRS+=examples
+endif
+ifeq ($(FULL_TARGET),i386-openbsd)
+override TARGET_EXAMPLEDIRS+=examples
+endif
+ifeq ($(FULL_TARGET),i386-wdosx)
+override TARGET_EXAMPLEDIRS+=examples
+endif
+ifeq ($(FULL_TARGET),i386-darwin)
+override TARGET_EXAMPLEDIRS+=examples
+endif
+ifeq ($(FULL_TARGET),i386-emx)
+override TARGET_EXAMPLEDIRS+=examples
+endif
+ifeq ($(FULL_TARGET),i386-watcom)
+override TARGET_EXAMPLEDIRS+=examples
+endif
+ifeq ($(FULL_TARGET),i386-netwlibc)
+override TARGET_EXAMPLEDIRS+=examples
+endif
+ifeq ($(FULL_TARGET),i386-wince)
+override TARGET_EXAMPLEDIRS+=examples
+endif
+ifeq ($(FULL_TARGET),i386-embedded)
+override TARGET_EXAMPLEDIRS+=examples
+endif
+ifeq ($(FULL_TARGET),i386-symbian)
+override TARGET_EXAMPLEDIRS+=examples
+endif
+ifeq ($(FULL_TARGET),i386-nativent)
+override TARGET_EXAMPLEDIRS+=examples
+endif
+ifeq ($(FULL_TARGET),i386-iphonesim)
+override TARGET_EXAMPLEDIRS+=examples
+endif
+ifeq ($(FULL_TARGET),i386-android)
+override TARGET_EXAMPLEDIRS+=examples
+endif
+ifeq ($(FULL_TARGET),m68k-linux)
+override TARGET_EXAMPLEDIRS+=examples
+endif
+ifeq ($(FULL_TARGET),m68k-freebsd)
+override TARGET_EXAMPLEDIRS+=examples
+endif
+ifeq ($(FULL_TARGET),m68k-netbsd)
+override TARGET_EXAMPLEDIRS+=examples
+endif
+ifeq ($(FULL_TARGET),m68k-amiga)
+override TARGET_EXAMPLEDIRS+=examples
+endif
+ifeq ($(FULL_TARGET),m68k-atari)
+override TARGET_EXAMPLEDIRS+=examples
+endif
+ifeq ($(FULL_TARGET),m68k-openbsd)
+override TARGET_EXAMPLEDIRS+=examples
+endif
+ifeq ($(FULL_TARGET),m68k-palmos)
+override TARGET_EXAMPLEDIRS+=examples
+endif
+ifeq ($(FULL_TARGET),m68k-embedded)
+override TARGET_EXAMPLEDIRS+=examples
+endif
+ifeq ($(FULL_TARGET),powerpc-linux)
+override TARGET_EXAMPLEDIRS+=examples
+endif
+ifeq ($(FULL_TARGET),powerpc-netbsd)
+override TARGET_EXAMPLEDIRS+=examples
+endif
+ifeq ($(FULL_TARGET),powerpc-amiga)
+override TARGET_EXAMPLEDIRS+=examples
+endif
+ifeq ($(FULL_TARGET),powerpc-macos)
+override TARGET_EXAMPLEDIRS+=examples
+endif
+ifeq ($(FULL_TARGET),powerpc-darwin)
+override TARGET_EXAMPLEDIRS+=examples
+endif
+ifeq ($(FULL_TARGET),powerpc-morphos)
+override TARGET_EXAMPLEDIRS+=examples
+endif
+ifeq ($(FULL_TARGET),powerpc-embedded)
+override TARGET_EXAMPLEDIRS+=examples
+endif
+ifeq ($(FULL_TARGET),powerpc-wii)
+override TARGET_EXAMPLEDIRS+=examples
+endif
+ifeq ($(FULL_TARGET),powerpc-aix)
+override TARGET_EXAMPLEDIRS+=examples
+endif
+ifeq ($(FULL_TARGET),sparc-linux)
+override TARGET_EXAMPLEDIRS+=examples
+endif
+ifeq ($(FULL_TARGET),sparc-netbsd)
+override TARGET_EXAMPLEDIRS+=examples
+endif
+ifeq ($(FULL_TARGET),sparc-solaris)
+override TARGET_EXAMPLEDIRS+=examples
+endif
+ifeq ($(FULL_TARGET),sparc-embedded)
+override TARGET_EXAMPLEDIRS+=examples
+endif
+ifeq ($(FULL_TARGET),x86_64-linux)
+override TARGET_EXAMPLEDIRS+=examples
+endif
+ifeq ($(FULL_TARGET),x86_64-freebsd)
+override TARGET_EXAMPLEDIRS+=examples
+endif
+ifeq ($(FULL_TARGET),x86_64-netbsd)
+override TARGET_EXAMPLEDIRS+=examples
+endif
+ifeq ($(FULL_TARGET),x86_64-solaris)
+override TARGET_EXAMPLEDIRS+=examples
+endif
+ifeq ($(FULL_TARGET),x86_64-openbsd)
+override TARGET_EXAMPLEDIRS+=examples
+endif
+ifeq ($(FULL_TARGET),x86_64-darwin)
+override TARGET_EXAMPLEDIRS+=examples
+endif
+ifeq ($(FULL_TARGET),x86_64-win64)
+override TARGET_EXAMPLEDIRS+=examples
+endif
+ifeq ($(FULL_TARGET),x86_64-embedded)
+override TARGET_EXAMPLEDIRS+=examples
+endif
+ifeq ($(FULL_TARGET),arm-linux)
+override TARGET_EXAMPLEDIRS+=examples
+endif
+ifeq ($(FULL_TARGET),arm-palmos)
+override TARGET_EXAMPLEDIRS+=examples
+endif
+ifeq ($(FULL_TARGET),arm-darwin)
+override TARGET_EXAMPLEDIRS+=examples
+endif
+ifeq ($(FULL_TARGET),arm-wince)
+override TARGET_EXAMPLEDIRS+=examples
+endif
+ifeq ($(FULL_TARGET),arm-gba)
+override TARGET_EXAMPLEDIRS+=examples
+endif
+ifeq ($(FULL_TARGET),arm-nds)
+override TARGET_EXAMPLEDIRS+=examples
+endif
+ifeq ($(FULL_TARGET),arm-embedded)
+override TARGET_EXAMPLEDIRS+=examples
+endif
+ifeq ($(FULL_TARGET),arm-symbian)
+override TARGET_EXAMPLEDIRS+=examples
+endif
+ifeq ($(FULL_TARGET),arm-android)
+override TARGET_EXAMPLEDIRS+=examples
+endif
+ifeq ($(FULL_TARGET),powerpc64-linux)
+override TARGET_EXAMPLEDIRS+=examples
+endif
+ifeq ($(FULL_TARGET),powerpc64-darwin)
+override TARGET_EXAMPLEDIRS+=examples
+endif
+ifeq ($(FULL_TARGET),powerpc64-embedded)
+override TARGET_EXAMPLEDIRS+=examples
+endif
+ifeq ($(FULL_TARGET),powerpc64-aix)
+override TARGET_EXAMPLEDIRS+=examples
+endif
+ifeq ($(FULL_TARGET),avr-embedded)
+override TARGET_EXAMPLEDIRS+=examples
+endif
+ifeq ($(FULL_TARGET),armeb-linux)
+override TARGET_EXAMPLEDIRS+=examples
+endif
+ifeq ($(FULL_TARGET),armeb-embedded)
+override TARGET_EXAMPLEDIRS+=examples
+endif
+ifeq ($(FULL_TARGET),mips-linux)
+override TARGET_EXAMPLEDIRS+=examples
+endif
+ifeq ($(FULL_TARGET),mipsel-linux)
+override TARGET_EXAMPLEDIRS+=examples
+endif
+ifeq ($(FULL_TARGET),jvm-java)
+override TARGET_EXAMPLEDIRS+=examples
+endif
+ifeq ($(FULL_TARGET),jvm-android)
+override TARGET_EXAMPLEDIRS+=examples
+endif
+ifeq ($(FULL_TARGET),i8086-msdos)
+override TARGET_EXAMPLEDIRS+=examples
+endif
+override INSTALL_FPCPACKAGE=y
+ifeq ($(FULL_TARGET),i386-linux)
+override COMPILER_INCLUDEDIR+=src
+endif
+ifeq ($(FULL_TARGET),i386-go32v2)
+override COMPILER_INCLUDEDIR+=src
+endif
+ifeq ($(FULL_TARGET),i386-win32)
+override COMPILER_INCLUDEDIR+=src
+endif
+ifeq ($(FULL_TARGET),i386-os2)
+override COMPILER_INCLUDEDIR+=src
+endif
+ifeq ($(FULL_TARGET),i386-freebsd)
+override COMPILER_INCLUDEDIR+=src
+endif
+ifeq ($(FULL_TARGET),i386-beos)
+override COMPILER_INCLUDEDIR+=src
+endif
+ifeq ($(FULL_TARGET),i386-haiku)
+override COMPILER_INCLUDEDIR+=src
+endif
+ifeq ($(FULL_TARGET),i386-netbsd)
+override COMPILER_INCLUDEDIR+=src
+endif
+ifeq ($(FULL_TARGET),i386-solaris)
+override COMPILER_INCLUDEDIR+=src
+endif
+ifeq ($(FULL_TARGET),i386-qnx)
+override COMPILER_INCLUDEDIR+=src
+endif
+ifeq ($(FULL_TARGET),i386-netware)
+override COMPILER_INCLUDEDIR+=src
+endif
+ifeq ($(FULL_TARGET),i386-openbsd)
+override COMPILER_INCLUDEDIR+=src
+endif
+ifeq ($(FULL_TARGET),i386-wdosx)
+override COMPILER_INCLUDEDIR+=src
+endif
+ifeq ($(FULL_TARGET),i386-darwin)
+override COMPILER_INCLUDEDIR+=src
+endif
+ifeq ($(FULL_TARGET),i386-emx)
+override COMPILER_INCLUDEDIR+=src
+endif
+ifeq ($(FULL_TARGET),i386-watcom)
+override COMPILER_INCLUDEDIR+=src
+endif
+ifeq ($(FULL_TARGET),i386-netwlibc)
+override COMPILER_INCLUDEDIR+=src
+endif
+ifeq ($(FULL_TARGET),i386-wince)
+override COMPILER_INCLUDEDIR+=src
+endif
+ifeq ($(FULL_TARGET),i386-embedded)
+override COMPILER_INCLUDEDIR+=src
+endif
+ifeq ($(FULL_TARGET),i386-symbian)
+override COMPILER_INCLUDEDIR+=src
+endif
+ifeq ($(FULL_TARGET),i386-nativent)
+override COMPILER_INCLUDEDIR+=src
+endif
+ifeq ($(FULL_TARGET),i386-iphonesim)
+override COMPILER_INCLUDEDIR+=src
+endif
+ifeq ($(FULL_TARGET),i386-android)
+override COMPILER_INCLUDEDIR+=src
+endif
+ifeq ($(FULL_TARGET),m68k-linux)
+override COMPILER_INCLUDEDIR+=src
+endif
+ifeq ($(FULL_TARGET),m68k-freebsd)
+override COMPILER_INCLUDEDIR+=src
+endif
+ifeq ($(FULL_TARGET),m68k-netbsd)
+override COMPILER_INCLUDEDIR+=src
+endif
+ifeq ($(FULL_TARGET),m68k-amiga)
+override COMPILER_INCLUDEDIR+=src
+endif
+ifeq ($(FULL_TARGET),m68k-atari)
+override COMPILER_INCLUDEDIR+=src
+endif
+ifeq ($(FULL_TARGET),m68k-openbsd)
+override COMPILER_INCLUDEDIR+=src
+endif
+ifeq ($(FULL_TARGET),m68k-palmos)
+override COMPILER_INCLUDEDIR+=src
+endif
+ifeq ($(FULL_TARGET),m68k-embedded)
+override COMPILER_INCLUDEDIR+=src
+endif
+ifeq ($(FULL_TARGET),powerpc-linux)
+override COMPILER_INCLUDEDIR+=src
+endif
+ifeq ($(FULL_TARGET),powerpc-netbsd)
+override COMPILER_INCLUDEDIR+=src
+endif
+ifeq ($(FULL_TARGET),powerpc-amiga)
+override COMPILER_INCLUDEDIR+=src
+endif
+ifeq ($(FULL_TARGET),powerpc-macos)
+override COMPILER_INCLUDEDIR+=src
+endif
+ifeq ($(FULL_TARGET),powerpc-darwin)
+override COMPILER_INCLUDEDIR+=src
+endif
+ifeq ($(FULL_TARGET),powerpc-morphos)
+override COMPILER_INCLUDEDIR+=src
+endif
+ifeq ($(FULL_TARGET),powerpc-embedded)
+override COMPILER_INCLUDEDIR+=src
+endif
+ifeq ($(FULL_TARGET),powerpc-wii)
+override COMPILER_INCLUDEDIR+=src
+endif
+ifeq ($(FULL_TARGET),powerpc-aix)
+override COMPILER_INCLUDEDIR+=src
+endif
+ifeq ($(FULL_TARGET),sparc-linux)
+override COMPILER_INCLUDEDIR+=src
+endif
+ifeq ($(FULL_TARGET),sparc-netbsd)
+override COMPILER_INCLUDEDIR+=src
+endif
+ifeq ($(FULL_TARGET),sparc-solaris)
+override COMPILER_INCLUDEDIR+=src
+endif
+ifeq ($(FULL_TARGET),sparc-embedded)
+override COMPILER_INCLUDEDIR+=src
+endif
+ifeq ($(FULL_TARGET),x86_64-linux)
+override COMPILER_INCLUDEDIR+=src
+endif
+ifeq ($(FULL_TARGET),x86_64-freebsd)
+override COMPILER_INCLUDEDIR+=src
+endif
+ifeq ($(FULL_TARGET),x86_64-netbsd)
+override COMPILER_INCLUDEDIR+=src
+endif
+ifeq ($(FULL_TARGET),x86_64-solaris)
+override COMPILER_INCLUDEDIR+=src
+endif
+ifeq ($(FULL_TARGET),x86_64-openbsd)
+override COMPILER_INCLUDEDIR+=src
+endif
+ifeq ($(FULL_TARGET),x86_64-darwin)
+override COMPILER_INCLUDEDIR+=src
+endif
+ifeq ($(FULL_TARGET),x86_64-win64)
+override COMPILER_INCLUDEDIR+=src
+endif
+ifeq ($(FULL_TARGET),x86_64-embedded)
+override COMPILER_INCLUDEDIR+=src
+endif
+ifeq ($(FULL_TARGET),arm-linux)
+override COMPILER_INCLUDEDIR+=src
+endif
+ifeq ($(FULL_TARGET),arm-palmos)
+override COMPILER_INCLUDEDIR+=src
+endif
+ifeq ($(FULL_TARGET),arm-darwin)
+override COMPILER_INCLUDEDIR+=src
+endif
+ifeq ($(FULL_TARGET),arm-wince)
+override COMPILER_INCLUDEDIR+=src
+endif
+ifeq ($(FULL_TARGET),arm-gba)
+override COMPILER_INCLUDEDIR+=src
+endif
+ifeq ($(FULL_TARGET),arm-nds)
+override COMPILER_INCLUDEDIR+=src
+endif
+ifeq ($(FULL_TARGET),arm-embedded)
+override COMPILER_INCLUDEDIR+=src
+endif
+ifeq ($(FULL_TARGET),arm-symbian)
+override COMPILER_INCLUDEDIR+=src
+endif
+ifeq ($(FULL_TARGET),arm-android)
+override COMPILER_INCLUDEDIR+=src
+endif
+ifeq ($(FULL_TARGET),powerpc64-linux)
+override COMPILER_INCLUDEDIR+=src
+endif
+ifeq ($(FULL_TARGET),powerpc64-darwin)
+override COMPILER_INCLUDEDIR+=src
+endif
+ifeq ($(FULL_TARGET),powerpc64-embedded)
+override COMPILER_INCLUDEDIR+=src
+endif
+ifeq ($(FULL_TARGET),powerpc64-aix)
+override COMPILER_INCLUDEDIR+=src
+endif
+ifeq ($(FULL_TARGET),avr-embedded)
+override COMPILER_INCLUDEDIR+=src
+endif
+ifeq ($(FULL_TARGET),armeb-linux)
+override COMPILER_INCLUDEDIR+=src
+endif
+ifeq ($(FULL_TARGET),armeb-embedded)
+override COMPILER_INCLUDEDIR+=src
+endif
+ifeq ($(FULL_TARGET),mips-linux)
+override COMPILER_INCLUDEDIR+=src
+endif
+ifeq ($(FULL_TARGET),mipsel-linux)
+override COMPILER_INCLUDEDIR+=src
+endif
+ifeq ($(FULL_TARGET),jvm-java)
+override COMPILER_INCLUDEDIR+=src
+endif
+ifeq ($(FULL_TARGET),jvm-android)
+override COMPILER_INCLUDEDIR+=src
+endif
+ifeq ($(FULL_TARGET),i8086-msdos)
+override COMPILER_INCLUDEDIR+=src
+endif
+ifeq ($(FULL_TARGET),i386-linux)
+override COMPILER_SOURCEDIR+=src examples
+endif
+ifeq ($(FULL_TARGET),i386-go32v2)
+override COMPILER_SOURCEDIR+=src examples
+endif
+ifeq ($(FULL_TARGET),i386-win32)
+override COMPILER_SOURCEDIR+=src examples
+endif
+ifeq ($(FULL_TARGET),i386-os2)
+override COMPILER_SOURCEDIR+=src examples
+endif
+ifeq ($(FULL_TARGET),i386-freebsd)
+override COMPILER_SOURCEDIR+=src examples
+endif
+ifeq ($(FULL_TARGET),i386-beos)
+override COMPILER_SOURCEDIR+=src examples
+endif
+ifeq ($(FULL_TARGET),i386-haiku)
+override COMPILER_SOURCEDIR+=src examples
+endif
+ifeq ($(FULL_TARGET),i386-netbsd)
+override COMPILER_SOURCEDIR+=src examples
+endif
+ifeq ($(FULL_TARGET),i386-solaris)
+override COMPILER_SOURCEDIR+=src examples
+endif
+ifeq ($(FULL_TARGET),i386-qnx)
+override COMPILER_SOURCEDIR+=src examples
+endif
+ifeq ($(FULL_TARGET),i386-netware)
+override COMPILER_SOURCEDIR+=src examples
+endif
+ifeq ($(FULL_TARGET),i386-openbsd)
+override COMPILER_SOURCEDIR+=src examples
+endif
+ifeq ($(FULL_TARGET),i386-wdosx)
+override COMPILER_SOURCEDIR+=src examples
+endif
+ifeq ($(FULL_TARGET),i386-darwin)
+override COMPILER_SOURCEDIR+=src examples
+endif
+ifeq ($(FULL_TARGET),i386-emx)
+override COMPILER_SOURCEDIR+=src examples
+endif
+ifeq ($(FULL_TARGET),i386-watcom)
+override COMPILER_SOURCEDIR+=src examples
+endif
+ifeq ($(FULL_TARGET),i386-netwlibc)
+override COMPILER_SOURCEDIR+=src examples
+endif
+ifeq ($(FULL_TARGET),i386-wince)
+override COMPILER_SOURCEDIR+=src examples
+endif
+ifeq ($(FULL_TARGET),i386-embedded)
+override COMPILER_SOURCEDIR+=src examples
+endif
+ifeq ($(FULL_TARGET),i386-symbian)
+override COMPILER_SOURCEDIR+=src examples
+endif
+ifeq ($(FULL_TARGET),i386-nativent)
+override COMPILER_SOURCEDIR+=src examples
+endif
+ifeq ($(FULL_TARGET),i386-iphonesim)
+override COMPILER_SOURCEDIR+=src examples
+endif
+ifeq ($(FULL_TARGET),i386-android)
+override COMPILER_SOURCEDIR+=src examples
+endif
+ifeq ($(FULL_TARGET),m68k-linux)
+override COMPILER_SOURCEDIR+=src examples
+endif
+ifeq ($(FULL_TARGET),m68k-freebsd)
+override COMPILER_SOURCEDIR+=src examples
+endif
+ifeq ($(FULL_TARGET),m68k-netbsd)
+override COMPILER_SOURCEDIR+=src examples
+endif
+ifeq ($(FULL_TARGET),m68k-amiga)
+override COMPILER_SOURCEDIR+=src examples
+endif
+ifeq ($(FULL_TARGET),m68k-atari)
+override COMPILER_SOURCEDIR+=src examples
+endif
+ifeq ($(FULL_TARGET),m68k-openbsd)
+override COMPILER_SOURCEDIR+=src examples
+endif
+ifeq ($(FULL_TARGET),m68k-palmos)
+override COMPILER_SOURCEDIR+=src examples
+endif
+ifeq ($(FULL_TARGET),m68k-embedded)
+override COMPILER_SOURCEDIR+=src examples
+endif
+ifeq ($(FULL_TARGET),powerpc-linux)
+override COMPILER_SOURCEDIR+=src examples
+endif
+ifeq ($(FULL_TARGET),powerpc-netbsd)
+override COMPILER_SOURCEDIR+=src examples
+endif
+ifeq ($(FULL_TARGET),powerpc-amiga)
+override COMPILER_SOURCEDIR+=src examples
+endif
+ifeq ($(FULL_TARGET),powerpc-macos)
+override COMPILER_SOURCEDIR+=src examples
+endif
+ifeq ($(FULL_TARGET),powerpc-darwin)
+override COMPILER_SOURCEDIR+=src examples
+endif
+ifeq ($(FULL_TARGET),powerpc-morphos)
+override COMPILER_SOURCEDIR+=src examples
+endif
+ifeq ($(FULL_TARGET),powerpc-embedded)
+override COMPILER_SOURCEDIR+=src examples
+endif
+ifeq ($(FULL_TARGET),powerpc-wii)
+override COMPILER_SOURCEDIR+=src examples
+endif
+ifeq ($(FULL_TARGET),powerpc-aix)
+override COMPILER_SOURCEDIR+=src examples
+endif
+ifeq ($(FULL_TARGET),sparc-linux)
+override COMPILER_SOURCEDIR+=src examples
+endif
+ifeq ($(FULL_TARGET),sparc-netbsd)
+override COMPILER_SOURCEDIR+=src examples
+endif
+ifeq ($(FULL_TARGET),sparc-solaris)
+override COMPILER_SOURCEDIR+=src examples
+endif
+ifeq ($(FULL_TARGET),sparc-embedded)
+override COMPILER_SOURCEDIR+=src examples
+endif
+ifeq ($(FULL_TARGET),x86_64-linux)
+override COMPILER_SOURCEDIR+=src examples
+endif
+ifeq ($(FULL_TARGET),x86_64-freebsd)
+override COMPILER_SOURCEDIR+=src examples
+endif
+ifeq ($(FULL_TARGET),x86_64-netbsd)
+override COMPILER_SOURCEDIR+=src examples
+endif
+ifeq ($(FULL_TARGET),x86_64-solaris)
+override COMPILER_SOURCEDIR+=src examples
+endif
+ifeq ($(FULL_TARGET),x86_64-openbsd)
+override COMPILER_SOURCEDIR+=src examples
+endif
+ifeq ($(FULL_TARGET),x86_64-darwin)
+override COMPILER_SOURCEDIR+=src examples
+endif
+ifeq ($(FULL_TARGET),x86_64-win64)
+override COMPILER_SOURCEDIR+=src examples
+endif
+ifeq ($(FULL_TARGET),x86_64-embedded)
+override COMPILER_SOURCEDIR+=src examples
+endif
+ifeq ($(FULL_TARGET),arm-linux)
+override COMPILER_SOURCEDIR+=src examples
+endif
+ifeq ($(FULL_TARGET),arm-palmos)
+override COMPILER_SOURCEDIR+=src examples
+endif
+ifeq ($(FULL_TARGET),arm-darwin)
+override COMPILER_SOURCEDIR+=src examples
+endif
+ifeq ($(FULL_TARGET),arm-wince)
+override COMPILER_SOURCEDIR+=src examples
+endif
+ifeq ($(FULL_TARGET),arm-gba)
+override COMPILER_SOURCEDIR+=src examples
+endif
+ifeq ($(FULL_TARGET),arm-nds)
+override COMPILER_SOURCEDIR+=src examples
+endif
+ifeq ($(FULL_TARGET),arm-embedded)
+override COMPILER_SOURCEDIR+=src examples
+endif
+ifeq ($(FULL_TARGET),arm-symbian)
+override COMPILER_SOURCEDIR+=src examples
+endif
+ifeq ($(FULL_TARGET),arm-android)
+override COMPILER_SOURCEDIR+=src examples
+endif
+ifeq ($(FULL_TARGET),powerpc64-linux)
+override COMPILER_SOURCEDIR+=src examples
+endif
+ifeq ($(FULL_TARGET),powerpc64-darwin)
+override COMPILER_SOURCEDIR+=src examples
+endif
+ifeq ($(FULL_TARGET),powerpc64-embedded)
+override COMPILER_SOURCEDIR+=src examples
+endif
+ifeq ($(FULL_TARGET),powerpc64-aix)
+override COMPILER_SOURCEDIR+=src examples
+endif
+ifeq ($(FULL_TARGET),avr-embedded)
+override COMPILER_SOURCEDIR+=src examples
+endif
+ifeq ($(FULL_TARGET),armeb-linux)
+override COMPILER_SOURCEDIR+=src examples
+endif
+ifeq ($(FULL_TARGET),armeb-embedded)
+override COMPILER_SOURCEDIR+=src examples
+endif
+ifeq ($(FULL_TARGET),mips-linux)
+override COMPILER_SOURCEDIR+=src examples
+endif
+ifeq ($(FULL_TARGET),mipsel-linux)
+override COMPILER_SOURCEDIR+=src examples
+endif
+ifeq ($(FULL_TARGET),jvm-java)
+override COMPILER_SOURCEDIR+=src examples
+endif
+ifeq ($(FULL_TARGET),jvm-android)
+override COMPILER_SOURCEDIR+=src examples
+endif
+ifeq ($(FULL_TARGET),i8086-msdos)
+override COMPILER_SOURCEDIR+=src examples
+endif
+ifdef REQUIRE_UNITSDIR
+override UNITSDIR+=$(REQUIRE_UNITSDIR)
+endif
+ifdef REQUIRE_PACKAGESDIR
+override PACKAGESDIR+=$(REQUIRE_PACKAGESDIR)
+endif
+ifdef ZIPINSTALL
+ifneq ($(findstring $(OS_TARGET),$(UNIXs)),)
+UNIXHier=1
+endif
+else
+ifneq ($(findstring $(OS_SOURCE),$(UNIXs)),)
+UNIXHier=1
+endif
+endif
+ifndef INSTALL_PREFIX
+ifdef PREFIX
+INSTALL_PREFIX=$(PREFIX)
+endif
+endif
+ifndef INSTALL_PREFIX
+ifdef UNIXHier
+INSTALL_PREFIX=/usr/local
+else
+ifdef INSTALL_FPCPACKAGE
+INSTALL_BASEDIR:=/pp
+else
+INSTALL_BASEDIR:=/$(PACKAGE_NAME)
+endif
+endif
+endif
+export INSTALL_PREFIX
+ifdef INSTALL_FPCSUBDIR
+export INSTALL_FPCSUBDIR
+endif
+ifndef DIST_DESTDIR
+DIST_DESTDIR:=$(BASEDIR)
+endif
+export DIST_DESTDIR
+ifndef COMPILER_UNITTARGETDIR
+ifdef PACKAGEDIR_MAIN
+COMPILER_UNITTARGETDIR=$(PACKAGEDIR_MAIN)/units/$(TARGETSUFFIX)
+else
+COMPILER_UNITTARGETDIR=units/$(TARGETSUFFIX)
+endif
+endif
+ifndef COMPILER_TARGETDIR
+COMPILER_TARGETDIR=.
+endif
+ifndef INSTALL_BASEDIR
+ifdef UNIXHier
+ifdef INSTALL_FPCPACKAGE
+INSTALL_BASEDIR:=$(INSTALL_PREFIX)/lib/fpc/$(FPC_VERSION)
+else
+INSTALL_BASEDIR:=$(INSTALL_PREFIX)/lib/$(PACKAGE_NAME)
+endif
+else
+INSTALL_BASEDIR:=$(INSTALL_PREFIX)
+endif
+endif
+ifndef INSTALL_BINDIR
+ifdef UNIXHier
+INSTALL_BINDIR:=$(INSTALL_PREFIX)/bin
+else
+INSTALL_BINDIR:=$(INSTALL_BASEDIR)/bin
+ifdef INSTALL_FPCPACKAGE
+ifdef CROSSCOMPILE
+ifdef CROSSINSTALL
+INSTALL_BINDIR:=$(INSTALL_BINDIR)/$(SOURCESUFFIX)
+else
+INSTALL_BINDIR:=$(INSTALL_BINDIR)/$(TARGETSUFFIX)
+endif
+else
+INSTALL_BINDIR:=$(INSTALL_BINDIR)/$(TARGETSUFFIX)
+endif
+endif
+endif
+endif
+ifndef INSTALL_UNITDIR
+INSTALL_UNITDIR:=$(INSTALL_BASEDIR)/units/$(TARGETSUFFIX)
+ifdef INSTALL_FPCPACKAGE
+ifdef PACKAGE_NAME
+INSTALL_UNITDIR:=$(INSTALL_UNITDIR)/$(PACKAGE_NAME)
+endif
+endif
+endif
+ifndef INSTALL_LIBDIR
+ifdef UNIXHier
+INSTALL_LIBDIR:=$(INSTALL_PREFIX)/lib
+else
+INSTALL_LIBDIR:=$(INSTALL_UNITDIR)
+endif
+endif
+ifndef INSTALL_SOURCEDIR
+ifdef UNIXHier
+ifdef BSDhier
+SRCPREFIXDIR=share/src
+else
+ifdef linuxHier
+SRCPREFIXDIR=share/src
+else
+SRCPREFIXDIR=src
+endif
+endif
+ifdef INSTALL_FPCPACKAGE
+ifdef INSTALL_FPCSUBDIR
+INSTALL_SOURCEDIR:=$(INSTALL_PREFIX)/$(SRCPREFIXDIR)/fpc-$(FPC_VERSION)/$(INSTALL_FPCSUBDIR)/$(PACKAGE_NAME)
+else
+INSTALL_SOURCEDIR:=$(INSTALL_PREFIX)/$(SRCPREFIXDIR)/fpc-$(FPC_VERSION)/$(PACKAGE_NAME)
+endif
+else
+INSTALL_SOURCEDIR:=$(INSTALL_PREFIX)/$(SRCPREFIXDIR)/$(PACKAGE_NAME)-$(PACKAGE_VERSION)
+endif
+else
+ifdef INSTALL_FPCPACKAGE
+ifdef INSTALL_FPCSUBDIR
+INSTALL_SOURCEDIR:=$(INSTALL_BASEDIR)/source/$(INSTALL_FPCSUBDIR)/$(PACKAGE_NAME)
+else
+INSTALL_SOURCEDIR:=$(INSTALL_BASEDIR)/source/$(PACKAGE_NAME)
+endif
+else
+INSTALL_SOURCEDIR:=$(INSTALL_BASEDIR)/source
+endif
+endif
+endif
+ifndef INSTALL_DOCDIR
+ifdef UNIXHier
+ifdef BSDhier
+DOCPREFIXDIR=share/doc
+else
+ifdef linuxHier
+DOCPREFIXDIR=share/doc
+else
+DOCPREFIXDIR=doc
+endif
+endif
+ifdef INSTALL_FPCPACKAGE
+INSTALL_DOCDIR:=$(INSTALL_PREFIX)/$(DOCPREFIXDIR)/fpc-$(FPC_VERSION)/$(PACKAGE_NAME)
+else
+INSTALL_DOCDIR:=$(INSTALL_PREFIX)/$(DOCPREFIXDIR)/$(PACKAGE_NAME)-$(PACKAGE_VERSION)
+endif
+else
+ifdef INSTALL_FPCPACKAGE
+INSTALL_DOCDIR:=$(INSTALL_BASEDIR)/doc/$(PACKAGE_NAME)
+else
+INSTALL_DOCDIR:=$(INSTALL_BASEDIR)/doc
+endif
+endif
+endif
+ifndef INSTALL_EXAMPLEDIR
+ifdef UNIXHier
+ifdef INSTALL_FPCPACKAGE
+ifdef BSDhier
+INSTALL_EXAMPLEDIR:=$(INSTALL_PREFIX)/share/examples/fpc-$(FPC_VERSION)/$(PACKAGE_NAME)
+else
+ifdef linuxHier
+INSTALL_EXAMPLEDIR:=$(INSTALL_DOCDIR)/examples
+else
+INSTALL_EXAMPLEDIR:=$(INSTALL_PREFIX)/doc/fpc-$(FPC_VERSION)/examples/$(PACKAGE_NAME)
+endif
+endif
+else
+ifdef BSDhier
+INSTALL_EXAMPLEDIR:=$(INSTALL_PREFIX)/share/examples/$(PACKAGE_NAME)-$(PACKAGE_VERSION)
+else
+ifdef linuxHier
+INSTALL_EXAMPLEDIR:=$(INSTALL_DOCDIR)/examples/$(PACKAGE_NAME)-$(PACKAGE_VERSION)
+else
+INSTALL_EXAMPLEDIR:=$(INSTALL_PREFIX)/doc/$(PACKAGE_NAME)-$(PACKAGE_VERSION)
+endif
+endif
+endif
+else
+ifdef INSTALL_FPCPACKAGE
+INSTALL_EXAMPLEDIR:=$(INSTALL_BASEDIR)/examples/$(PACKAGE_NAME)
+else
+INSTALL_EXAMPLEDIR:=$(INSTALL_BASEDIR)/examples
+endif
+endif
+endif
+ifndef INSTALL_DATADIR
+INSTALL_DATADIR=$(INSTALL_BASEDIR)
+endif
+ifndef INSTALL_SHAREDDIR
+INSTALL_SHAREDDIR=$(INSTALL_PREFIX)/lib
+endif
+ifdef CROSSCOMPILE
+ifndef CROSSBINDIR
+CROSSBINDIR:=$(wildcard $(CROSSTARGETDIR)/bin/$(SOURCESUFFIX))
+ifeq ($(CROSSBINDIR),)
+CROSSBINDIR:=$(wildcard $(INSTALL_BASEDIR)/cross/$(TARGETSUFFIX)/bin/$(FULL_SOURCE))
+endif
+endif
+else
+CROSSBINDIR=
+endif
+BATCHEXT=.bat
+LOADEREXT=.as
+EXEEXT=.exe
+PPLEXT=.ppl
+PPUEXT=.ppu
+OEXT=.o
+ASMEXT=.s
+SMARTEXT=.sl
+STATICLIBEXT=.a
+SHAREDLIBEXT=.so
+SHAREDLIBPREFIX=libfp
+STATICLIBPREFIX=libp
+IMPORTLIBPREFIX=libimp
+RSTEXT=.rst
+EXEDBGEXT=.dbg
+ifeq ($(OS_TARGET),go32v1)
+STATICLIBPREFIX=
+SHORTSUFFIX=v1
+endif
+ifeq ($(OS_TARGET),go32v2)
+STATICLIBPREFIX=
+SHORTSUFFIX=dos
+IMPORTLIBPREFIX=
+endif
+ifeq ($(OS_TARGET),watcom)
+STATICLIBPREFIX=
+OEXT=.obj
+ASMEXT=.asm
+SHAREDLIBEXT=.dll
+SHORTSUFFIX=wat
+IMPORTLIBPREFIX=
+endif
+ifneq ($(CPU_TARGET),jvm)
+ifeq ($(OS_TARGET),android)
+BATCHEXT=.sh
+EXEEXT=
+HASSHAREDLIB=1
+SHORTSUFFIX=lnx
+endif
+endif
+ifeq ($(OS_TARGET),linux)
+BATCHEXT=.sh
+EXEEXT=
+HASSHAREDLIB=1
+SHORTSUFFIX=lnx
+endif
+ifeq ($(OS_TARGET),freebsd)
+BATCHEXT=.sh
+EXEEXT=
+HASSHAREDLIB=1
+SHORTSUFFIX=fbs
+endif
+ifeq ($(OS_TARGET),netbsd)
+BATCHEXT=.sh
+EXEEXT=
+HASSHAREDLIB=1
+SHORTSUFFIX=nbs
+endif
+ifeq ($(OS_TARGET),openbsd)
+BATCHEXT=.sh
+EXEEXT=
+HASSHAREDLIB=1
+SHORTSUFFIX=obs
+endif
+ifeq ($(OS_TARGET),win32)
+SHAREDLIBEXT=.dll
+SHORTSUFFIX=w32
+endif
+ifeq ($(OS_TARGET),os2)
+BATCHEXT=.cmd
+AOUTEXT=.out
+STATICLIBPREFIX=
+SHAREDLIBEXT=.dll
+SHORTSUFFIX=os2
+ECHO=echo
+IMPORTLIBPREFIX=
+endif
+ifeq ($(OS_TARGET),emx)
+BATCHEXT=.cmd
+AOUTEXT=.out
+STATICLIBPREFIX=
+SHAREDLIBEXT=.dll
+SHORTSUFFIX=emx
+ECHO=echo
+IMPORTLIBPREFIX=
+endif
+ifeq ($(OS_TARGET),amiga)
+EXEEXT=
+SHAREDLIBEXT=.library
+SHORTSUFFIX=amg
+endif
+ifeq ($(OS_TARGET),morphos)
+EXEEXT=
+SHAREDLIBEXT=.library
+SHORTSUFFIX=mos
+endif
+ifeq ($(OS_TARGET),atari)
+EXEEXT=.ttp
+SHORTSUFFIX=ata
+endif
+ifeq ($(OS_TARGET),beos)
+BATCHEXT=.sh
+EXEEXT=
+SHORTSUFFIX=be
+endif
+ifeq ($(OS_TARGET),haiku)
+BATCHEXT=.sh
+EXEEXT=
+SHORTSUFFIX=hai
+endif
+ifeq ($(OS_TARGET),solaris)
+BATCHEXT=.sh
+EXEEXT=
+SHORTSUFFIX=sun
+endif
+ifeq ($(OS_TARGET),qnx)
+BATCHEXT=.sh
+EXEEXT=
+SHORTSUFFIX=qnx
+endif
+ifeq ($(OS_TARGET),netware)
+EXEEXT=.nlm
+STATICLIBPREFIX=
+SHORTSUFFIX=nw
+IMPORTLIBPREFIX=imp
+endif
+ifeq ($(OS_TARGET),netwlibc)
+EXEEXT=.nlm
+STATICLIBPREFIX=
+SHORTSUFFIX=nwl
+IMPORTLIBPREFIX=imp
+endif
+ifeq ($(OS_TARGET),macos)
+BATCHEXT=
+EXEEXT=
+DEBUGSYMEXT=.xcoff
+SHORTSUFFIX=mac
+IMPORTLIBPREFIX=imp
+endif
+ifneq ($(findstring $(OS_TARGET),darwin iphonesim),)
+BATCHEXT=.sh
+EXEEXT=
+HASSHAREDLIB=1
+SHORTSUFFIX=dwn
+EXEDBGEXT=.dSYM
+endif
+ifeq ($(OS_TARGET),gba)
+EXEEXT=.gba
+SHAREDLIBEXT=.so
+SHORTSUFFIX=gba
+endif
+ifeq ($(OS_TARGET),symbian)
+SHAREDLIBEXT=.dll
+SHORTSUFFIX=symbian
+endif
+ifeq ($(OS_TARGET),NativeNT)
+SHAREDLIBEXT=.dll
+SHORTSUFFIX=nativent
+endif
+ifeq ($(OS_TARGET),wii)
+EXEEXT=.dol
+SHAREDLIBEXT=.so
+SHORTSUFFIX=wii
+endif
+ifeq ($(OS_TARGET),aix)
+BATCHEXT=.sh
+EXEEXT=
+SHORTSUFFIX=aix
+endif
+ifeq ($(OS_TARGET),java)
+OEXT=.class
+ASMEXT=.j
+SHAREDLIBEXT=.jar
+SHORTSUFFIX=java
+endif
+ifeq ($(CPU_TARGET),jvm)
+ifeq ($(OS_TARGET),android)
+OEXT=.class
+ASMEXT=.j
+SHAREDLIBEXT=.jar
+SHORTSUFFIX=android
+endif
+endif
+ifneq ($(findstring $(OS_SOURCE),$(LIMIT83fs)),)
+FPCMADE=fpcmade.$(SHORTSUFFIX)
+ZIPSUFFIX=$(SHORTSUFFIX)
+ZIPCROSSPREFIX=
+ZIPSOURCESUFFIX=src
+ZIPEXAMPLESUFFIX=exm
+else
+FPCMADE=fpcmade.$(TARGETSUFFIX)
+ZIPSOURCESUFFIX=.source
+ZIPEXAMPLESUFFIX=.examples
+ifdef CROSSCOMPILE
+ZIPSUFFIX=.$(SOURCESUFFIX)
+ZIPCROSSPREFIX=$(TARGETSUFFIX)-
+else
+ZIPSUFFIX=.$(TARGETSUFFIX)
+ZIPCROSSPREFIX=
+endif
+endif
+ifndef ECHO
+ECHO:=$(strip $(wildcard $(addsuffix /gecho$(SRCEXEEXT),$(SEARCHPATH))))
+ifeq ($(ECHO),)
+ECHO:=$(strip $(wildcard $(addsuffix /echo$(SRCEXEEXT),$(SEARCHPATH))))
+ifeq ($(ECHO),)
+ECHO= __missing_command_ECHO
+else
+ECHO:=$(firstword $(ECHO))
+endif
+else
+ECHO:=$(firstword $(ECHO))
+endif
+endif
+export ECHO
+ifndef DATE
+DATE:=$(strip $(wildcard $(addsuffix /gdate$(SRCEXEEXT),$(SEARCHPATH))))
+ifeq ($(DATE),)
+DATE:=$(strip $(wildcard $(addsuffix /date$(SRCEXEEXT),$(SEARCHPATH))))
+ifeq ($(DATE),)
+DATE= __missing_command_DATE
+else
+DATE:=$(firstword $(DATE))
+endif
+else
+DATE:=$(firstword $(DATE))
+endif
+endif
+export DATE
+ifndef GINSTALL
+GINSTALL:=$(strip $(wildcard $(addsuffix /ginstall$(SRCEXEEXT),$(SEARCHPATH))))
+ifeq ($(GINSTALL),)
+GINSTALL:=$(strip $(wildcard $(addsuffix /install$(SRCEXEEXT),$(SEARCHPATH))))
+ifeq ($(GINSTALL),)
+GINSTALL= __missing_command_GINSTALL
+else
+GINSTALL:=$(firstword $(GINSTALL))
+endif
+else
+GINSTALL:=$(firstword $(GINSTALL))
+endif
+endif
+export GINSTALL
+ifndef CPPROG
+CPPROG:=$(strip $(wildcard $(addsuffix /cp$(SRCEXEEXT),$(SEARCHPATH))))
+ifeq ($(CPPROG),)
+CPPROG= __missing_command_CPPROG
+else
+CPPROG:=$(firstword $(CPPROG))
+endif
+endif
+export CPPROG
+ifndef RMPROG
+RMPROG:=$(strip $(wildcard $(addsuffix /rm$(SRCEXEEXT),$(SEARCHPATH))))
+ifeq ($(RMPROG),)
+RMPROG= __missing_command_RMPROG
+else
+RMPROG:=$(firstword $(RMPROG))
+endif
+endif
+export RMPROG
+ifndef MVPROG
+MVPROG:=$(strip $(wildcard $(addsuffix /mv$(SRCEXEEXT),$(SEARCHPATH))))
+ifeq ($(MVPROG),)
+MVPROG= __missing_command_MVPROG
+else
+MVPROG:=$(firstword $(MVPROG))
+endif
+endif
+export MVPROG
+ifndef MKDIRPROG
+MKDIRPROG:=$(strip $(wildcard $(addsuffix /gmkdir$(SRCEXEEXT),$(SEARCHPATH))))
+ifeq ($(MKDIRPROG),)
+MKDIRPROG:=$(strip $(wildcard $(addsuffix /mkdir$(SRCEXEEXT),$(SEARCHPATH))))
+ifeq ($(MKDIRPROG),)
+MKDIRPROG= __missing_command_MKDIRPROG
+else
+MKDIRPROG:=$(firstword $(MKDIRPROG))
+endif
+else
+MKDIRPROG:=$(firstword $(MKDIRPROG))
+endif
+endif
+export MKDIRPROG
+ifndef ECHOREDIR
+ifndef inUnix
+ECHOREDIR=echo
+else
+ECHOREDIR=$(ECHO)
+endif
+endif
+ifndef COPY
+COPY:=$(CPPROG) -fp
+endif
+ifndef COPYTREE
+COPYTREE:=$(CPPROG) -Rfp
+endif
+ifndef MKDIRTREE
+MKDIRTREE:=$(MKDIRPROG) -p
+endif
+ifndef MOVE
+MOVE:=$(MVPROG) -f
+endif
+ifndef DEL
+DEL:=$(RMPROG) -f
+endif
+ifndef DELTREE
+DELTREE:=$(RMPROG) -rf
+endif
+ifndef INSTALL
+ifdef inUnix
+INSTALL:=$(GINSTALL) -c -m 644
+else
+INSTALL:=$(COPY)
+endif
+endif
+ifndef INSTALLEXE
+ifdef inUnix
+INSTALLEXE:=$(GINSTALL) -c -m 755
+else
+INSTALLEXE:=$(COPY)
+endif
+endif
+ifndef MKDIR
+MKDIR:=$(GINSTALL) -m 755 -d
+endif
+export ECHOREDIR COPY COPYTREE MOVE DEL DELTREE INSTALL INSTALLEXE MKDIR
+ifndef PPUMOVE
+PPUMOVE:=$(strip $(wildcard $(addsuffix /ppumove$(SRCEXEEXT),$(SEARCHPATH))))
+ifeq ($(PPUMOVE),)
+PPUMOVE= __missing_command_PPUMOVE
+else
+PPUMOVE:=$(firstword $(PPUMOVE))
+endif
+endif
+export PPUMOVE
+ifndef FPCMAKE
+FPCMAKE:=$(strip $(wildcard $(addsuffix /fpcmake$(SRCEXEEXT),$(SEARCHPATH))))
+ifeq ($(FPCMAKE),)
+FPCMAKE= __missing_command_FPCMAKE
+else
+FPCMAKE:=$(firstword $(FPCMAKE))
+endif
+endif
+export FPCMAKE
+ifndef ZIPPROG
+ZIPPROG:=$(strip $(wildcard $(addsuffix /zip$(SRCEXEEXT),$(SEARCHPATH))))
+ifeq ($(ZIPPROG),)
+ZIPPROG= __missing_command_ZIPPROG
+else
+ZIPPROG:=$(firstword $(ZIPPROG))
+endif
+endif
+export ZIPPROG
+ifndef TARPROG
+TARPROG:=$(strip $(wildcard $(addsuffix /gtar$(SRCEXEEXT),$(SEARCHPATH))))
+ifeq ($(TARPROG),)
+TARPROG:=$(strip $(wildcard $(addsuffix /tar$(SRCEXEEXT),$(SEARCHPATH))))
+ifeq ($(TARPROG),)
+TARPROG= __missing_command_TARPROG
+else
+TARPROG:=$(firstword $(TARPROG))
+endif
+else
+TARPROG:=$(firstword $(TARPROG))
+endif
+endif
+export TARPROG
+ASNAME=$(BINUTILSPREFIX)as
+LDNAME=$(BINUTILSPREFIX)ld
+ARNAME=$(BINUTILSPREFIX)ar
+RCNAME=$(BINUTILSPREFIX)rc
+ifndef ASPROG
+ifdef CROSSBINDIR
+ASPROG=$(CROSSBINDIR)/$(ASNAME)$(SRCEXEEXT)
+else
+ASPROG=$(ASNAME)
+endif
+endif
+ifndef LDPROG
+ifdef CROSSBINDIR
+LDPROG=$(CROSSBINDIR)/$(LDNAME)$(SRCEXEEXT)
+else
+LDPROG=$(LDNAME)
+endif
+endif
+ifndef RCPROG
+ifdef CROSSBINDIR
+RCPROG=$(CROSSBINDIR)/$(RCNAME)$(SRCEXEEXT)
+else
+RCPROG=$(RCNAME)
+endif
+endif
+ifndef ARPROG
+ifdef CROSSBINDIR
+ARPROG=$(CROSSBINDIR)/$(ARNAME)$(SRCEXEEXT)
+else
+ARPROG=$(ARNAME)
+endif
+endif
+AS=$(ASPROG)
+LD=$(LDPROG)
+RC=$(RCPROG)
+AR=$(ARPROG)
+ifdef inUnix
+PPAS=./ppas$(SRCBATCHEXT)
+else
+PPAS=ppas$(SRCBATCHEXT)
+endif
+ifdef inUnix
+LDCONFIG=ldconfig
+else
+LDCONFIG=
+endif
+ifdef DATE
+DATESTR:=$(shell $(DATE) +%Y%m%d)
+else
+DATESTR=
+endif
+ZIPOPT=-9
+ZIPEXT=.zip
+ifeq ($(USETAR),bz2)
+TAROPT=vj
+TAREXT=.tar.bz2
+else
+TAROPT=vz
+TAREXT=.tar.gz
+endif
+override REQUIRE_PACKAGES=rtl 
+ifeq ($(FULL_TARGET),i386-linux)
+REQUIRE_PACKAGES_RTL=1
+endif
+ifeq ($(FULL_TARGET),i386-go32v2)
+REQUIRE_PACKAGES_RTL=1
+endif
+ifeq ($(FULL_TARGET),i386-win32)
+REQUIRE_PACKAGES_RTL=1
+endif
+ifeq ($(FULL_TARGET),i386-os2)
+REQUIRE_PACKAGES_RTL=1
+endif
+ifeq ($(FULL_TARGET),i386-freebsd)
+REQUIRE_PACKAGES_RTL=1
+endif
+ifeq ($(FULL_TARGET),i386-beos)
+REQUIRE_PACKAGES_RTL=1
+endif
+ifeq ($(FULL_TARGET),i386-haiku)
+REQUIRE_PACKAGES_RTL=1
+endif
+ifeq ($(FULL_TARGET),i386-netbsd)
+REQUIRE_PACKAGES_RTL=1
+endif
+ifeq ($(FULL_TARGET),i386-solaris)
+REQUIRE_PACKAGES_RTL=1
+endif
+ifeq ($(FULL_TARGET),i386-qnx)
+REQUIRE_PACKAGES_RTL=1
+endif
+ifeq ($(FULL_TARGET),i386-netware)
+REQUIRE_PACKAGES_RTL=1
+endif
+ifeq ($(FULL_TARGET),i386-openbsd)
+REQUIRE_PACKAGES_RTL=1
+endif
+ifeq ($(FULL_TARGET),i386-wdosx)
+REQUIRE_PACKAGES_RTL=1
+endif
+ifeq ($(FULL_TARGET),i386-darwin)
+REQUIRE_PACKAGES_RTL=1
+endif
+ifeq ($(FULL_TARGET),i386-emx)
+REQUIRE_PACKAGES_RTL=1
+endif
+ifeq ($(FULL_TARGET),i386-watcom)
+REQUIRE_PACKAGES_RTL=1
+endif
+ifeq ($(FULL_TARGET),i386-netwlibc)
+REQUIRE_PACKAGES_RTL=1
+endif
+ifeq ($(FULL_TARGET),i386-wince)
+REQUIRE_PACKAGES_RTL=1
+endif
+ifeq ($(FULL_TARGET),i386-embedded)
+REQUIRE_PACKAGES_RTL=1
+endif
+ifeq ($(FULL_TARGET),i386-symbian)
+REQUIRE_PACKAGES_RTL=1
+endif
+ifeq ($(FULL_TARGET),i386-nativent)
+REQUIRE_PACKAGES_RTL=1
+endif
+ifeq ($(FULL_TARGET),i386-iphonesim)
+REQUIRE_PACKAGES_RTL=1
+endif
+ifeq ($(FULL_TARGET),i386-android)
+REQUIRE_PACKAGES_RTL=1
+endif
+ifeq ($(FULL_TARGET),m68k-linux)
+REQUIRE_PACKAGES_RTL=1
+endif
+ifeq ($(FULL_TARGET),m68k-freebsd)
+REQUIRE_PACKAGES_RTL=1
+endif
+ifeq ($(FULL_TARGET),m68k-netbsd)
+REQUIRE_PACKAGES_RTL=1
+endif
+ifeq ($(FULL_TARGET),m68k-amiga)
+REQUIRE_PACKAGES_RTL=1
+endif
+ifeq ($(FULL_TARGET),m68k-atari)
+REQUIRE_PACKAGES_RTL=1
+endif
+ifeq ($(FULL_TARGET),m68k-openbsd)
+REQUIRE_PACKAGES_RTL=1
+endif
+ifeq ($(FULL_TARGET),m68k-palmos)
+REQUIRE_PACKAGES_RTL=1
+endif
+ifeq ($(FULL_TARGET),m68k-embedded)
+REQUIRE_PACKAGES_RTL=1
+endif
+ifeq ($(FULL_TARGET),powerpc-linux)
+REQUIRE_PACKAGES_RTL=1
+endif
+ifeq ($(FULL_TARGET),powerpc-netbsd)
+REQUIRE_PACKAGES_RTL=1
+endif
+ifeq ($(FULL_TARGET),powerpc-amiga)
+REQUIRE_PACKAGES_RTL=1
+endif
+ifeq ($(FULL_TARGET),powerpc-macos)
+REQUIRE_PACKAGES_RTL=1
+endif
+ifeq ($(FULL_TARGET),powerpc-darwin)
+REQUIRE_PACKAGES_RTL=1
+endif
+ifeq ($(FULL_TARGET),powerpc-morphos)
+REQUIRE_PACKAGES_RTL=1
+endif
+ifeq ($(FULL_TARGET),powerpc-embedded)
+REQUIRE_PACKAGES_RTL=1
+endif
+ifeq ($(FULL_TARGET),powerpc-wii)
+REQUIRE_PACKAGES_RTL=1
+endif
+ifeq ($(FULL_TARGET),powerpc-aix)
+REQUIRE_PACKAGES_RTL=1
+endif
+ifeq ($(FULL_TARGET),sparc-linux)
+REQUIRE_PACKAGES_RTL=1
+endif
+ifeq ($(FULL_TARGET),sparc-netbsd)
+REQUIRE_PACKAGES_RTL=1
+endif
+ifeq ($(FULL_TARGET),sparc-solaris)
+REQUIRE_PACKAGES_RTL=1
+endif
+ifeq ($(FULL_TARGET),sparc-embedded)
+REQUIRE_PACKAGES_RTL=1
+endif
+ifeq ($(FULL_TARGET),x86_64-linux)
+REQUIRE_PACKAGES_RTL=1
+endif
+ifeq ($(FULL_TARGET),x86_64-freebsd)
+REQUIRE_PACKAGES_RTL=1
+endif
+ifeq ($(FULL_TARGET),x86_64-netbsd)
+REQUIRE_PACKAGES_RTL=1
+endif
+ifeq ($(FULL_TARGET),x86_64-solaris)
+REQUIRE_PACKAGES_RTL=1
+endif
+ifeq ($(FULL_TARGET),x86_64-openbsd)
+REQUIRE_PACKAGES_RTL=1
+endif
+ifeq ($(FULL_TARGET),x86_64-darwin)
+REQUIRE_PACKAGES_RTL=1
+endif
+ifeq ($(FULL_TARGET),x86_64-win64)
+REQUIRE_PACKAGES_RTL=1
+endif
+ifeq ($(FULL_TARGET),x86_64-embedded)
+REQUIRE_PACKAGES_RTL=1
+endif
+ifeq ($(FULL_TARGET),arm-linux)
+REQUIRE_PACKAGES_RTL=1
+endif
+ifeq ($(FULL_TARGET),arm-palmos)
+REQUIRE_PACKAGES_RTL=1
+endif
+ifeq ($(FULL_TARGET),arm-darwin)
+REQUIRE_PACKAGES_RTL=1
+endif
+ifeq ($(FULL_TARGET),arm-wince)
+REQUIRE_PACKAGES_RTL=1
+endif
+ifeq ($(FULL_TARGET),arm-gba)
+REQUIRE_PACKAGES_RTL=1
+endif
+ifeq ($(FULL_TARGET),arm-nds)
+REQUIRE_PACKAGES_RTL=1
+endif
+ifeq ($(FULL_TARGET),arm-embedded)
+REQUIRE_PACKAGES_RTL=1
+endif
+ifeq ($(FULL_TARGET),arm-symbian)
+REQUIRE_PACKAGES_RTL=1
+endif
+ifeq ($(FULL_TARGET),arm-android)
+REQUIRE_PACKAGES_RTL=1
+endif
+ifeq ($(FULL_TARGET),powerpc64-linux)
+REQUIRE_PACKAGES_RTL=1
+endif
+ifeq ($(FULL_TARGET),powerpc64-darwin)
+REQUIRE_PACKAGES_RTL=1
+endif
+ifeq ($(FULL_TARGET),powerpc64-embedded)
+REQUIRE_PACKAGES_RTL=1
+endif
+ifeq ($(FULL_TARGET),powerpc64-aix)
+REQUIRE_PACKAGES_RTL=1
+endif
+ifeq ($(FULL_TARGET),avr-embedded)
+REQUIRE_PACKAGES_RTL=1
+endif
+ifeq ($(FULL_TARGET),armeb-linux)
+REQUIRE_PACKAGES_RTL=1
+endif
+ifeq ($(FULL_TARGET),armeb-embedded)
+REQUIRE_PACKAGES_RTL=1
+endif
+ifeq ($(FULL_TARGET),mips-linux)
+REQUIRE_PACKAGES_RTL=1
+endif
+ifeq ($(FULL_TARGET),mipsel-linux)
+REQUIRE_PACKAGES_RTL=1
+endif
+ifeq ($(FULL_TARGET),jvm-java)
+REQUIRE_PACKAGES_RTL=1
+endif
+ifeq ($(FULL_TARGET),jvm-android)
+REQUIRE_PACKAGES_RTL=1
+endif
+ifeq ($(FULL_TARGET),i8086-msdos)
+REQUIRE_PACKAGES_RTL=1
+endif
+ifdef REQUIRE_PACKAGES_RTL
+PACKAGEDIR_RTL:=$(firstword $(subst /Makefile.fpc,,$(strip $(wildcard $(addsuffix /rtl/Makefile.fpc,$(PACKAGESDIR))))))
+ifneq ($(PACKAGEDIR_RTL),)
+ifneq ($(wildcard $(PACKAGEDIR_RTL)/units/$(TARGETSUFFIX)),)
+UNITDIR_RTL=$(PACKAGEDIR_RTL)/units/$(TARGETSUFFIX)
+else
+UNITDIR_RTL=$(PACKAGEDIR_RTL)
+endif
+ifneq ($(wildcard $(PACKAGEDIR_RTL)/units/$(SOURCESUFFIX)),)
+UNITDIR_FPMAKE_RTL=$(PACKAGEDIR_RTL)/units/$(SOURCESUFFIX)
+else
+ifneq ($(wildcard $(PACKAGEDIR_RTL)/units_bs/$(SOURCESUFFIX)),)
+UNITDIR_FPMAKE_RTL=$(PACKAGEDIR_RTL)/units_bs/$(SOURCESUFFIX)
+else
+UNITDIR_FPMAKE_RTL=$(PACKAGEDIR_RTL)
+endif
+endif
+ifdef CHECKDEPEND
+$(PACKAGEDIR_RTL)/$(OS_TARGET)/$(FPCMADE):
+	$(MAKE) -C $(PACKAGEDIR_RTL)/$(OS_TARGET) $(FPCMADE)
+override ALLDEPENDENCIES+=$(PACKAGEDIR_RTL)/$(OS_TARGET)/$(FPCMADE)
+endif
+else
+PACKAGEDIR_RTL=
+UNITDIR_RTL:=$(subst /Package.fpc,,$(strip $(wildcard $(addsuffix /rtl/Package.fpc,$(UNITSDIR)))))
+ifneq ($(UNITDIR_RTL),)
+UNITDIR_RTL:=$(firstword $(UNITDIR_RTL))
+else
+UNITDIR_RTL=
+endif
+endif
+ifdef UNITDIR_RTL
+override COMPILER_UNITDIR+=$(UNITDIR_RTL)
+endif
+ifdef UNITDIR_FPMAKE_RTL
+override COMPILER_FPMAKE_UNITDIR+=$(UNITDIR_FPMAKE_RTL)
+endif
+endif
+ifndef NOCPUDEF
+override FPCOPTDEF=$(ARCH)
+endif
+ifneq ($(OS_TARGET),$(OS_SOURCE))
+override FPCOPT+=-T$(OS_TARGET)
+endif
+ifneq ($(CPU_TARGET),$(CPU_SOURCE))
+override FPCOPT+=-P$(ARCH)
+endif
+ifeq ($(OS_SOURCE),openbsd)
+override FPCOPT+=-FD$(NEW_BINUTILS_PATH)
+override FPCMAKEOPT+=-FD$(NEW_BINUTILS_PATH)
+endif
+ifndef CROSSBOOTSTRAP
+ifneq ($(BINUTILSPREFIX),)
+override FPCOPT+=-XP$(BINUTILSPREFIX)
+endif
+ifneq ($(BINUTILSPREFIX),)
+override FPCOPT+=-Xr$(RLINKPATH)
+endif
+endif
+ifndef CROSSCOMPILE
+ifneq ($(BINUTILSPREFIX),)
+override FPCMAKEOPT+=-XP$(BINUTILSPREFIX)
+endif
+endif
+ifdef UNITDIR
+override FPCOPT+=$(addprefix -Fu,$(UNITDIR))
+endif
+ifdef LIBDIR
+override FPCOPT+=$(addprefix -Fl,$(LIBDIR))
+endif
+ifdef OBJDIR
+override FPCOPT+=$(addprefix -Fo,$(OBJDIR))
+endif
+ifdef INCDIR
+override FPCOPT+=$(addprefix -Fi,$(INCDIR))
+endif
+ifdef LINKSMART
+override FPCOPT+=-XX
+endif
+ifdef CREATESMART
+override FPCOPT+=-CX
+endif
+ifdef DEBUG
+override FPCOPT+=-gl
+override FPCOPTDEF+=DEBUG
+endif
+ifdef RELEASE
+ifneq ($(findstring 2.0.,$(FPC_VERSION)),)
+ifeq ($(CPU_TARGET),i386)
+FPCCPUOPT:=-OG2p3
+endif
+ifeq ($(CPU_TARGET),powerpc)
+FPCCPUOPT:=-O1r
+endif
+else
+FPCCPUOPT:=-O2
+endif
+override FPCOPT+=-Ur -Xs $(FPCCPUOPT) -n
+override FPCOPTDEF+=RELEASE
+endif
+ifdef STRIP
+override FPCOPT+=-Xs
+endif
+ifdef OPTIMIZE
+override FPCOPT+=-O2
+endif
+ifdef VERBOSE
+override FPCOPT+=-vwni
+endif
+ifdef COMPILER_OPTIONS
+override FPCOPT+=$(COMPILER_OPTIONS)
+endif
+ifdef COMPILER_UNITDIR
+override FPCOPT+=$(addprefix -Fu,$(COMPILER_UNITDIR))
+endif
+ifdef COMPILER_LIBRARYDIR
+override FPCOPT+=$(addprefix -Fl,$(COMPILER_LIBRARYDIR))
+endif
+ifdef COMPILER_OBJECTDIR
+override FPCOPT+=$(addprefix -Fo,$(COMPILER_OBJECTDIR))
+endif
+ifdef COMPILER_INCLUDEDIR
+override FPCOPT+=$(addprefix -Fi,$(COMPILER_INCLUDEDIR))
+endif
+ifdef CROSSBINDIR
+override FPCOPT+=-FD$(CROSSBINDIR)
+endif
+ifdef COMPILER_TARGETDIR
+override FPCOPT+=-FE$(COMPILER_TARGETDIR)
+ifeq ($(COMPILER_TARGETDIR),.)
+override TARGETDIRPREFIX=
+else
+override TARGETDIRPREFIX=$(COMPILER_TARGETDIR)/
+endif
+endif
+ifdef COMPILER_UNITTARGETDIR
+override FPCOPT+=-FU$(COMPILER_UNITTARGETDIR)
+ifeq ($(COMPILER_UNITTARGETDIR),.)
+override UNITTARGETDIRPREFIX=
+else
+override UNITTARGETDIRPREFIX=$(COMPILER_UNITTARGETDIR)/
+endif
+else
+ifdef COMPILER_TARGETDIR
+override COMPILER_UNITTARGETDIR=$(COMPILER_TARGETDIR)
+override UNITTARGETDIRPREFIX=$(TARGETDIRPREFIX)
+endif
+endif
+ifdef CREATESHARED
+override FPCOPT+=-Cg
+endif
+ifneq ($(findstring $(OS_TARGET),freebsd openbsd netbsd linux solaris),)
+ifeq ($(CPU_TARGET),x86_64)
+override FPCOPT+=-Cg
+endif
+endif
+ifdef LINKSHARED
+endif
+ifdef OPT
+override FPCOPT+=$(OPT)
+endif
+ifdef FPCOPTDEF
+override FPCOPT+=$(addprefix -d,$(FPCOPTDEF))
+endif
+ifdef CFGFILE
+override FPCOPT+=@$(CFGFILE)
+endif
+ifdef USEENV
+override FPCEXTCMD:=$(FPCOPT)
+override FPCOPT:=!FPCEXTCMD
+export FPCEXTCMD
+endif
+override AFULL_TARGET=$(CPU_TARGET)-$(OS_TARGET)
+override AFULL_SOURCE=$(CPU_SOURCE)-$(OS_SOURCE)
+ifneq ($(AFULL_TARGET),$(AFULL_SOURCE))
+override ACROSSCOMPILE=1
+endif
+ifdef ACROSSCOMPILE
+override FPCOPT+=$(CROSSOPT)
+endif
+override COMPILER:=$(FPC) $(FPCOPT)
+ifeq (,$(findstring -s ,$(COMPILER)))
+EXECPPAS=
+else
+ifeq ($(FULL_SOURCE),$(FULL_TARGET))
+ifdef RUNBATCH
+EXECPPAS:=@$(RUNBATCH) $(PPAS)
+else
+EXECPPAS:=@$(PPAS)
+endif
+endif
+endif
+.PHONY: fpc_units
+ifneq ($(TARGET_UNITS)$(TARGET_IMPLICITUNITS),)
+override ALLTARGET+=fpc_units
+override UNITPPUFILES=$(addsuffix $(PPUEXT),$(TARGET_UNITS))
+override IMPLICITUNITPPUFILES=$(addsuffix $(PPUEXT),$(TARGET_IMPLICITUNITS))
+override INSTALLPPUFILES+=$(UNITPPUFILES) $(IMPLICITUNITPPUFILES)
+override CLEANPPUFILES+=$(UNITPPUFILES) $(IMPLICITUNITPPUFILES)
+endif
+fpc_units: $(COMPILER_UNITTARGETDIR) $(UNITPPUFILES)
+ifdef TARGET_RSTS
+override RSTFILES=$(addsuffix $(RSTEXT),$(TARGET_RSTS))
+override CLEANRSTFILES+=$(RSTFILES)
+endif
+.PHONY: fpc_examples
+ifneq ($(TARGET_EXAMPLES),)
+HASEXAMPLES=1
+override EXAMPLESOURCEFILES:=$(wildcard $(addsuffix .pp,$(TARGET_EXAMPLES)) $(addsuffix .pas,$(TARGET_EXAMPLES)) $(addsuffix .lpr,$(TARGET_EXAMPLES)) $(addsuffix .dpr,$(TARGET_EXAMPLES)))
+override EXAMPLEFILES:=$(addsuffix $(EXEEXT),$(TARGET_EXAMPLES))
+override EXAMPLEOFILES:=$(addsuffix $(OEXT),$(TARGET_EXAMPLES)) $(addprefix $(STATICLIBPREFIX),$(addsuffix $(STATICLIBEXT),$(TARGET_EXAMPLES))) $(addprefix $(IMPORTLIBPREFIX),$(addsuffix $(STATICLIBEXT),$(TARGET_EXAMPLES)))
+override EXAMPLEDBGFILES:=$(addsuffix $(EXEDBGEXT),$(TARGET_EXAMPLES))
+override CLEANEXEFILES+=$(EXAMPLEFILES) $(EXAMPLEOFILES)
+override CLEANEXEDBGFILES+=$(EXAMPLEDBGFILES)
+ifeq ($(OS_TARGET),os2)
+override CLEANEXEFILES+=$(addsuffix $(AOUTEXT),$(TARGET_EXAMPLES))
+endif
+ifeq ($(OS_TARGET),emx)
+override CLEANEXEFILES+=$(addsuffix $(AOUTEXT),$(TARGET_EXAMPLES))
+endif
+endif
+ifneq ($(TARGET_EXAMPLEDIRS),)
+HASEXAMPLES=1
+endif
+fpc_examples: all $(EXAMPLEFILES) $(addsuffix _all,$(TARGET_EXAMPLEDIRS))
+.PHONY: fpc_all fpc_smart fpc_debug fpc_release fpc_shared
+$(FPCMADE): $(ALLDEPENDENCIES) $(ALLTARGET)
+	@$(ECHOREDIR) Compiled > $(FPCMADE)
+fpc_all: $(FPCMADE)
+fpc_smart:
+	$(MAKE) all LINKSMART=1 CREATESMART=1
+fpc_debug:
+	$(MAKE) all DEBUG=1
+fpc_release:
+	$(MAKE) all RELEASE=1
+.SUFFIXES: $(EXEEXT) $(PPUEXT) $(OEXT) .pas .lpr .dpr .pp .rc .res
+$(COMPILER_UNITTARGETDIR):
+	$(MKDIRTREE) $(COMPILER_UNITTARGETDIR)
+$(COMPILER_TARGETDIR):
+	$(MKDIRTREE) $(COMPILER_TARGETDIR)
+%$(PPUEXT): %.pp
+	$(COMPILER) $<
+	$(EXECPPAS)
+%$(PPUEXT): %.pas
+	$(COMPILER) $<
+	$(EXECPPAS)
+%$(EXEEXT): %.pp
+	$(COMPILER) $<
+	$(EXECPPAS)
+%$(EXEEXT): %.pas
+	$(COMPILER) $<
+	$(EXECPPAS)
+%$(EXEEXT): %.lpr
+	$(COMPILER) $<
+	$(EXECPPAS)
+%$(EXEEXT): %.dpr
+	$(COMPILER) $<
+	$(EXECPPAS)
+%.res: %.rc
+	windres -i $< -o $@
+vpath %.pp $(COMPILER_SOURCEDIR) $(COMPILER_INCLUDEDIR)
+vpath %.pas $(COMPILER_SOURCEDIR) $(COMPILER_INCLUDEDIR)
+vpath %.lpr $(COMPILER_SOURCEDIR) $(COMPILER_INCLUDEDIR)
+vpath %.dpr $(COMPILER_SOURCEDIR) $(COMPILER_INCLUDEDIR)
+vpath %.inc $(COMPILER_INCLUDEDIR)
+vpath %$(OEXT) $(COMPILER_UNITTARGETDIR)
+vpath %$(PPUEXT) $(COMPILER_UNITTARGETDIR)
+.PHONY: fpc_shared
+override INSTALLTARGET+=fpc_shared_install
+ifndef SHARED_LIBVERSION
+SHARED_LIBVERSION=$(FPC_VERSION)
+endif
+ifndef SHARED_LIBNAME
+SHARED_LIBNAME=$(PACKAGE_NAME)
+endif
+ifndef SHARED_FULLNAME
+SHARED_FULLNAME=$(SHAREDLIBPREFIX)$(SHARED_LIBNAME)-$(SHARED_LIBVERSION)$(SHAREDLIBEXT)
+endif
+ifndef SHARED_LIBUNITS
+SHARED_LIBUNITS:=$(TARGET_UNITS) $(TARGET_IMPLICITUNITS)
+override SHARED_LIBUNITS:=$(filter-out $(INSTALL_BUILDUNIT),$(SHARED_LIBUNITS))
+endif
+fpc_shared:
+ifdef HASSHAREDLIB
+	$(MAKE) all CREATESHARED=1 LINKSHARED=1 CREATESMART=1
+ifneq ($(SHARED_BUILD),n)
+	$(PPUMOVE) -q $(SHARED_LIBUNITS) -i$(COMPILER_UNITTARGETDIR) -o$(SHARED_FULLNAME) -d$(COMPILER_UNITTARGETDIR)
+endif
+else
+	@$(ECHO) Shared Libraries not supported
+endif
+fpc_shared_install:
+ifneq ($(SHARED_BUILD),n)
+ifneq ($(SHARED_LIBUNITS),)
+ifneq ($(wildcard $(COMPILER_UNITTARGETDIR)/$(SHARED_FULLNAME)),)
+	$(INSTALL) $(COMPILER_UNITTARGETDIR)/$(SHARED_FULLNAME) $(INSTALL_SHAREDDIR)
+endif
+endif
+endif
+.PHONY: fpc_install fpc_sourceinstall fpc_exampleinstall
+ifdef INSTALL_UNITS
+override INSTALLPPUFILES+=$(addsuffix $(PPUEXT),$(INSTALL_UNITS))
+endif
+ifdef INSTALL_BUILDUNIT
+override INSTALLPPUFILES:=$(filter-out $(INSTALL_BUILDUNIT)$(PPUEXT),$(INSTALLPPUFILES))
+endif
+ifdef INSTALLPPUFILES
+override INSTALLPPULINKFILES:=$(subst $(PPUEXT),$(OEXT),$(INSTALLPPUFILES)) $(addprefix $(STATICLIBPREFIX),$(subst $(PPUEXT),$(STATICLIBEXT),$(INSTALLPPUFILES))) $(addprefix $(IMPORTLIBPREFIX),$(subst $(PPUEXT),$(STATICLIBEXT),$(INSTALLPPUFILES)))
+ifneq ($(UNITTARGETDIRPREFIX),)
+override INSTALLPPUFILES:=$(addprefix $(UNITTARGETDIRPREFIX),$(notdir $(INSTALLPPUFILES)))
+override INSTALLPPULINKFILES:=$(wildcard $(addprefix $(UNITTARGETDIRPREFIX),$(notdir $(INSTALLPPULINKFILES))))
+endif
+override INSTALL_CREATEPACKAGEFPC=1
+endif
+ifdef INSTALLEXEFILES
+ifneq ($(TARGETDIRPREFIX),)
+override INSTALLEXEFILES:=$(addprefix $(TARGETDIRPREFIX),$(notdir $(INSTALLEXEFILES)))
+endif
+endif
+fpc_install: all $(INSTALLTARGET)
+ifdef INSTALLEXEFILES
+	$(MKDIR) $(INSTALL_BINDIR)
+	$(INSTALLEXE) $(INSTALLEXEFILES) $(INSTALL_BINDIR)
+endif
+ifdef INSTALL_CREATEPACKAGEFPC
+ifdef FPCMAKE
+ifdef PACKAGE_VERSION
+ifneq ($(wildcard Makefile.fpc),)
+	$(FPCMAKE) -p -T$(CPU_TARGET)-$(OS_TARGET) Makefile.fpc
+	$(MKDIR) $(INSTALL_UNITDIR)
+	$(INSTALL) Package.fpc $(INSTALL_UNITDIR)
+endif
+endif
+endif
+endif
+ifdef INSTALLPPUFILES
+	$(MKDIR) $(INSTALL_UNITDIR)
+	$(INSTALL) $(INSTALLPPUFILES) $(INSTALL_UNITDIR)
+ifneq ($(INSTALLPPULINKFILES),)
+	$(INSTALL) $(INSTALLPPULINKFILES) $(INSTALL_UNITDIR)
+endif
+ifneq ($(wildcard $(LIB_FULLNAME)),)
+	$(MKDIR) $(INSTALL_LIBDIR)
+	$(INSTALL) $(LIB_FULLNAME) $(INSTALL_LIBDIR)
+ifdef inUnix
+	ln -sf $(LIB_FULLNAME) $(INSTALL_LIBDIR)/$(LIB_NAME)
+endif
+endif
+endif
+ifdef INSTALL_FILES
+	$(MKDIR) $(INSTALL_DATADIR)
+	$(INSTALL) $(INSTALL_FILES) $(INSTALL_DATADIR)
+endif
+fpc_sourceinstall: distclean
+	$(MKDIR) $(INSTALL_SOURCEDIR)
+	$(COPYTREE) $(BASEDIR)/* $(INSTALL_SOURCEDIR)
+fpc_exampleinstall: $(addsuffix _distclean,$(TARGET_EXAMPLEDIRS))
+ifdef HASEXAMPLES
+	$(MKDIR) $(INSTALL_EXAMPLEDIR)
+endif
+ifdef EXAMPLESOURCEFILES
+	$(COPY) $(EXAMPLESOURCEFILES) $(INSTALL_EXAMPLEDIR)
+endif
+ifdef TARGET_EXAMPLEDIRS
+	$(COPYTREE) $(addsuffix /*,$(TARGET_EXAMPLEDIRS)) $(INSTALL_EXAMPLEDIR)
+endif
+.PHONY: fpc_distinstall
+fpc_distinstall: install exampleinstall
+.PHONY: fpc_zipinstall fpc_zipsourceinstall fpc_zipexampleinstall
+ifndef PACKDIR
+ifndef inUnix
+PACKDIR=$(BASEDIR)/../fpc-pack
+else
+PACKDIR=/tmp/fpc-pack
+endif
+endif
+ifndef ZIPNAME
+ifdef DIST_ZIPNAME
+ZIPNAME=$(DIST_ZIPNAME)
+else
+ZIPNAME=$(PACKAGE_NAME)
+endif
+endif
+ifndef FULLZIPNAME
+FULLZIPNAME=$(ZIPCROSSPREFIX)$(ZIPPREFIX)$(ZIPNAME)$(ZIPSUFFIX)
+endif
+ifndef ZIPTARGET
+ifdef DIST_ZIPTARGET
+ZIPTARGET=DIST_ZIPTARGET
+else
+ZIPTARGET=install
+endif
+endif
+ifndef USEZIP
+ifdef inUnix
+USETAR=1
+endif
+endif
+ifndef inUnix
+USEZIPWRAPPER=1
+endif
+ifdef USEZIPWRAPPER
+ZIPPATHSEP=$(PATHSEP)
+ZIPWRAPPER=$(subst /,$(PATHSEP),$(DIST_DESTDIR)/fpczip$(SRCBATCHEXT))
+else
+ZIPPATHSEP=/
+endif
+ZIPCMD_CDPACK:=cd $(subst /,$(ZIPPATHSEP),$(PACKDIR))
+ZIPCMD_CDBASE:=cd $(subst /,$(ZIPPATHSEP),$(BASEDIR))
+ifdef USETAR
+ZIPDESTFILE:=$(DIST_DESTDIR)/$(FULLZIPNAME)$(TAREXT)
+ZIPCMD_ZIP:=$(TARPROG) c$(TAROPT)f $(ZIPDESTFILE) *
+else
+ZIPDESTFILE:=$(DIST_DESTDIR)/$(FULLZIPNAME)$(ZIPEXT)
+ZIPCMD_ZIP:=$(subst /,$(ZIPPATHSEP),$(ZIPPROG)) -Dr $(ZIPOPT) $(ZIPDESTFILE) *
+endif
+fpc_zipinstall:
+	$(MAKE) $(ZIPTARGET) INSTALL_PREFIX=$(PACKDIR) ZIPINSTALL=1
+	$(MKDIR) $(DIST_DESTDIR)
+	$(DEL) $(ZIPDESTFILE)
+ifdef USEZIPWRAPPER
+ifneq ($(ECHOREDIR),echo)
+	$(ECHOREDIR) -e "$(subst \,\\,$(ZIPCMD_CDPACK))" > $(ZIPWRAPPER)
+	$(ECHOREDIR) -e "$(subst \,\\,$(ZIPCMD_ZIP))" >> $(ZIPWRAPPER)
+	$(ECHOREDIR) -e "$(subst \,\\,$(ZIPCMD_CDBASE))" >> $(ZIPWRAPPER)
+else
+	echo $(ZIPCMD_CDPACK) > $(ZIPWRAPPER)
+	echo $(ZIPCMD_ZIP) >> $(ZIPWRAPPER)
+	echo $(ZIPCMD_CDBASE) >> $(ZIPWRAPPER)
+endif
+ifdef inUnix
+	/bin/sh $(ZIPWRAPPER)
+else
+ifdef RUNBATCH
+	$(RUNBATCH) $(ZIPWRAPPER)
+else
+	$(ZIPWRAPPER)
+endif
+endif
+	$(DEL) $(ZIPWRAPPER)
+else
+	$(ZIPCMD_CDPACK) ; $(ZIPCMD_ZIP) ; $(ZIPCMD_CDBASE)
+endif
+	$(DELTREE) $(PACKDIR)
+fpc_zipsourceinstall:
+	$(MAKE) fpc_zipinstall ZIPTARGET=sourceinstall ZIPSUFFIX=$(ZIPSOURCESUFFIX)
+fpc_zipexampleinstall:
+ifdef HASEXAMPLES
+	$(MAKE) fpc_zipinstall ZIPTARGET=exampleinstall ZIPSUFFIX=$(ZIPEXAMPLESUFFIX)
+endif
+fpc_zipdistinstall:
+	$(MAKE) fpc_zipinstall ZIPTARGET=distinstall
+.PHONY: fpc_clean fpc_cleanall fpc_distclean
+ifdef EXEFILES
+override CLEANEXEFILES:=$(addprefix $(TARGETDIRPREFIX),$(CLEANEXEFILES))
+override CLEANEXEDBGFILES:=$(addprefix $(TARGETDIRPREFIX),$(CLEANEXEDBGFILES))
+endif
+ifdef CLEAN_PROGRAMS
+override CLEANEXEFILES+=$(addprefix $(TARGETDIRPREFIX),$(addsuffix $(EXEEXT), $(CLEAN_PROGRAMS)))
+override CLEANEXEDBGFILES+=$(addprefix $(TARGETDIRPREFIX),$(addsuffix $(EXEDBGEXT), $(CLEAN_PROGRAMS)))
+endif
+ifdef CLEAN_UNITS
+override CLEANPPUFILES+=$(addsuffix $(PPUEXT),$(CLEAN_UNITS))
+endif
+ifdef CLEANPPUFILES
+override CLEANPPULINKFILES:=$(subst $(PPUEXT),$(OEXT),$(CLEANPPUFILES)) $(addprefix $(STATICLIBPREFIX),$(subst $(PPUEXT),$(STATICLIBEXT),$(CLEANPPUFILES))) $(addprefix $(IMPORTLIBPREFIX),$(subst $(PPUEXT),$(STATICLIBEXT),$(CLEANPPUFILES)))
+ifdef DEBUGSYMEXT
+override CLEANPPULINKFILES+=$(subst $(PPUEXT),$(DEBUGSYMEXT),$(CLEANPPUFILES))
+endif
+override CLEANPPUFILES:=$(addprefix $(UNITTARGETDIRPREFIX),$(CLEANPPUFILES))
+override CLEANPPULINKFILES:=$(wildcard $(addprefix $(UNITTARGETDIRPREFIX),$(CLEANPPULINKFILES)))
+endif
+fpc_clean: $(CLEANTARGET)
+ifdef CLEANEXEFILES
+	-$(DEL) $(CLEANEXEFILES)
+endif
+ifdef CLEANEXEDBGFILES
+	-$(DELTREE) $(CLEANEXEDBGFILES)
+endif
+ifdef CLEANPPUFILES
+	-$(DEL) $(CLEANPPUFILES)
+endif
+ifneq ($(CLEANPPULINKFILES),)
+	-$(DEL) $(CLEANPPULINKFILES)
+endif
+ifdef CLEANRSTFILES
+	-$(DEL) $(addprefix $(UNITTARGETDIRPREFIX),$(CLEANRSTFILES))
+endif
+ifdef CLEAN_FILES
+	-$(DEL) $(CLEAN_FILES)
+endif
+ifdef LIB_NAME
+	-$(DEL) $(LIB_NAME) $(LIB_FULLNAME)
+endif
+	-$(DEL) $(FPCMADE) Package.fpc $(PPAS) script.res link.res $(FPCEXTFILE) $(REDIRFILE)
+	-$(DEL) *$(ASMEXT) *_ppas$(BATCHEXT)
+fpc_cleanall: $(CLEANTARGET)
+ifdef CLEANEXEFILES
+	-$(DEL) $(CLEANEXEFILES)
+endif
+ifdef COMPILER_UNITTARGETDIR
+ifdef CLEANPPUFILES
+	-$(DEL) $(CLEANPPUFILES)
+endif
+ifneq ($(CLEANPPULINKFILES),)
+	-$(DEL) $(CLEANPPULINKFILES)
+endif
+ifdef CLEANRSTFILES
+	-$(DEL) $(addprefix $(UNITTARGETDIRPREFIX),$(CLEANRSTFILES))
+endif
+endif
+ifdef CLEAN_FILES
+	-$(DEL) $(CLEAN_FILES)
+endif
+	-$(DELTREE) units
+	-$(DEL) *$(OEXT) *$(PPUEXT) *$(RSTEXT) *$(ASMEXT) *$(STATICLIBEXT) *$(SHAREDLIBEXT) *$(PPLEXT)
+ifneq ($(PPUEXT),.ppu)
+	-$(DEL) *.o *.ppu *.a
+endif
+	-$(DELTREE) *$(SMARTEXT)
+	-$(DEL) fpcmade.* Package.fpc $(PPAS) script.res link.res $(FPCEXTFILE) $(REDIRFILE)
+	-$(DEL) *_ppas$(BATCHEXT)
+ifdef AOUTEXT
+	-$(DEL) *$(AOUTEXT)
+endif
+ifdef DEBUGSYMEXT
+	-$(DEL) *$(DEBUGSYMEXT)
+endif
+fpc_distclean: cleanall
+.PHONY: fpc_baseinfo
+override INFORULES+=fpc_baseinfo
+fpc_baseinfo:
+	@$(ECHO)
+	@$(ECHO)  == Package info ==
+	@$(ECHO)  Package Name..... $(PACKAGE_NAME)
+	@$(ECHO)  Package Version.. $(PACKAGE_VERSION)
+	@$(ECHO)
+	@$(ECHO)  == Configuration info ==
+	@$(ECHO)
+	@$(ECHO)  FPC.......... $(FPC)
+	@$(ECHO)  FPC Version.. $(FPC_VERSION)
+	@$(ECHO)  Source CPU... $(CPU_SOURCE)
+	@$(ECHO)  Target CPU... $(CPU_TARGET)
+	@$(ECHO)  Source OS.... $(OS_SOURCE)
+	@$(ECHO)  Target OS.... $(OS_TARGET)
+	@$(ECHO)  Full Source.. $(FULL_SOURCE)
+	@$(ECHO)  Full Target.. $(FULL_TARGET)
+	@$(ECHO)  SourceSuffix. $(SOURCESUFFIX)
+	@$(ECHO)  TargetSuffix. $(TARGETSUFFIX)
+	@$(ECHO)  FPC fpmake... $(FPCFPMAKE)
+	@$(ECHO)
+	@$(ECHO)  == Directory info ==
+	@$(ECHO)
+	@$(ECHO)  Required pkgs... $(REQUIRE_PACKAGES)
+	@$(ECHO)
+	@$(ECHO)  Basedir......... $(BASEDIR)
+	@$(ECHO)  FPCDir.......... $(FPCDIR)
+	@$(ECHO)  CrossBinDir..... $(CROSSBINDIR)
+	@$(ECHO)  UnitsDir........ $(UNITSDIR)
+	@$(ECHO)  PackagesDir..... $(PACKAGESDIR)
+	@$(ECHO)
+	@$(ECHO)  GCC library..... $(GCCLIBDIR)
+	@$(ECHO)  Other library... $(OTHERLIBDIR)
+	@$(ECHO)
+	@$(ECHO)  == Tools info ==
+	@$(ECHO)
+	@$(ECHO)  As........ $(AS)
+	@$(ECHO)  Ld........ $(LD)
+	@$(ECHO)  Ar........ $(AR)
+	@$(ECHO)  Rc........ $(RC)
+	@$(ECHO)
+	@$(ECHO)  Mv........ $(MVPROG)
+	@$(ECHO)  Cp........ $(CPPROG)
+	@$(ECHO)  Rm........ $(RMPROG)
+	@$(ECHO)  GInstall.. $(GINSTALL)
+	@$(ECHO)  Echo...... $(ECHO)
+	@$(ECHO)  Shell..... $(SHELL)
+	@$(ECHO)  Date...... $(DATE)
+	@$(ECHO)  FPCMake... $(FPCMAKE)
+	@$(ECHO)  PPUMove... $(PPUMOVE)
+	@$(ECHO)  Zip....... $(ZIPPROG)
+	@$(ECHO)
+	@$(ECHO)  == Object info ==
+	@$(ECHO)
+	@$(ECHO)  Target Loaders........ $(TARGET_LOADERS)
+	@$(ECHO)  Target Units.......... $(TARGET_UNITS)
+	@$(ECHO)  Target Implicit Units. $(TARGET_IMPLICITUNITS)
+	@$(ECHO)  Target Programs....... $(TARGET_PROGRAMS)
+	@$(ECHO)  Target Dirs........... $(TARGET_DIRS)
+	@$(ECHO)  Target Examples....... $(TARGET_EXAMPLES)
+	@$(ECHO)  Target ExampleDirs.... $(TARGET_EXAMPLEDIRS)
+	@$(ECHO)
+	@$(ECHO)  Clean Units......... $(CLEAN_UNITS)
+	@$(ECHO)  Clean Files......... $(CLEAN_FILES)
+	@$(ECHO)
+	@$(ECHO)  Install Units....... $(INSTALL_UNITS)
+	@$(ECHO)  Install Files....... $(INSTALL_FILES)
+	@$(ECHO)
+	@$(ECHO)  == Install info ==
+	@$(ECHO)
+	@$(ECHO)  DateStr.............. $(DATESTR)
+	@$(ECHO)  ZipName.............. $(ZIPNAME)
+	@$(ECHO)  ZipPrefix............ $(ZIPPREFIX)
+	@$(ECHO)  ZipCrossPrefix....... $(ZIPCROSSPREFIX)
+	@$(ECHO)  ZipSuffix............ $(ZIPSUFFIX)
+	@$(ECHO)  FullZipName.......... $(FULLZIPNAME)
+	@$(ECHO)  Install FPC Package.. $(INSTALL_FPCPACKAGE)
+	@$(ECHO)
+	@$(ECHO)  Install base dir..... $(INSTALL_BASEDIR)
+	@$(ECHO)  Install binary dir... $(INSTALL_BINDIR)
+	@$(ECHO)  Install library dir.. $(INSTALL_LIBDIR)
+	@$(ECHO)  Install units dir.... $(INSTALL_UNITDIR)
+	@$(ECHO)  Install source dir... $(INSTALL_SOURCEDIR)
+	@$(ECHO)  Install doc dir...... $(INSTALL_DOCDIR)
+	@$(ECHO)  Install example dir.. $(INSTALL_EXAMPLEDIR)
+	@$(ECHO)  Install data dir..... $(INSTALL_DATADIR)
+	@$(ECHO)
+	@$(ECHO)  Dist destination dir. $(DIST_DESTDIR)
+	@$(ECHO)  Dist zip name........ $(DIST_ZIPNAME)
+	@$(ECHO)
+.PHONY: fpc_info
+fpc_info: $(INFORULES)
+.PHONY: fpc_makefile fpc_makefiles fpc_makefile_sub1 fpc_makefile_sub2 \
+	fpc_makefile_dirs
+fpc_makefile:
+	$(FPCMAKE) -w -T$(OS_TARGET) Makefile.fpc
+fpc_makefile_sub1:
+ifdef TARGET_DIRS
+	$(FPCMAKE) -w -T$(OS_TARGET) $(addsuffix /Makefile.fpc,$(TARGET_DIRS))
+endif
+ifdef TARGET_EXAMPLEDIRS
+	$(FPCMAKE) -w -T$(OS_TARGET) $(addsuffix /Makefile.fpc,$(TARGET_EXAMPLEDIRS))
+endif
+fpc_makefile_sub2: $(addsuffix _makefile_dirs,$(TARGET_DIRS) $(TARGET_EXAMPLEDIRS))
+fpc_makefile_dirs: fpc_makefile_sub1 fpc_makefile_sub2
+fpc_makefiles: fpc_makefile fpc_makefile_dirs
+ifeq ($(FULL_TARGET),i386-linux)
+TARGET_EXAMPLEDIRS_EXAMPLES=1
+endif
+ifeq ($(FULL_TARGET),i386-go32v2)
+TARGET_EXAMPLEDIRS_EXAMPLES=1
+endif
+ifeq ($(FULL_TARGET),i386-win32)
+TARGET_EXAMPLEDIRS_EXAMPLES=1
+endif
+ifeq ($(FULL_TARGET),i386-os2)
+TARGET_EXAMPLEDIRS_EXAMPLES=1
+endif
+ifeq ($(FULL_TARGET),i386-freebsd)
+TARGET_EXAMPLEDIRS_EXAMPLES=1
+endif
+ifeq ($(FULL_TARGET),i386-beos)
+TARGET_EXAMPLEDIRS_EXAMPLES=1
+endif
+ifeq ($(FULL_TARGET),i386-haiku)
+TARGET_EXAMPLEDIRS_EXAMPLES=1
+endif
+ifeq ($(FULL_TARGET),i386-netbsd)
+TARGET_EXAMPLEDIRS_EXAMPLES=1
+endif
+ifeq ($(FULL_TARGET),i386-solaris)
+TARGET_EXAMPLEDIRS_EXAMPLES=1
+endif
+ifeq ($(FULL_TARGET),i386-qnx)
+TARGET_EXAMPLEDIRS_EXAMPLES=1
+endif
+ifeq ($(FULL_TARGET),i386-netware)
+TARGET_EXAMPLEDIRS_EXAMPLES=1
+endif
+ifeq ($(FULL_TARGET),i386-openbsd)
+TARGET_EXAMPLEDIRS_EXAMPLES=1
+endif
+ifeq ($(FULL_TARGET),i386-wdosx)
+TARGET_EXAMPLEDIRS_EXAMPLES=1
+endif
+ifeq ($(FULL_TARGET),i386-darwin)
+TARGET_EXAMPLEDIRS_EXAMPLES=1
+endif
+ifeq ($(FULL_TARGET),i386-emx)
+TARGET_EXAMPLEDIRS_EXAMPLES=1
+endif
+ifeq ($(FULL_TARGET),i386-watcom)
+TARGET_EXAMPLEDIRS_EXAMPLES=1
+endif
+ifeq ($(FULL_TARGET),i386-netwlibc)
+TARGET_EXAMPLEDIRS_EXAMPLES=1
+endif
+ifeq ($(FULL_TARGET),i386-wince)
+TARGET_EXAMPLEDIRS_EXAMPLES=1
+endif
+ifeq ($(FULL_TARGET),i386-embedded)
+TARGET_EXAMPLEDIRS_EXAMPLES=1
+endif
+ifeq ($(FULL_TARGET),i386-symbian)
+TARGET_EXAMPLEDIRS_EXAMPLES=1
+endif
+ifeq ($(FULL_TARGET),i386-nativent)
+TARGET_EXAMPLEDIRS_EXAMPLES=1
+endif
+ifeq ($(FULL_TARGET),i386-iphonesim)
+TARGET_EXAMPLEDIRS_EXAMPLES=1
+endif
+ifeq ($(FULL_TARGET),i386-android)
+TARGET_EXAMPLEDIRS_EXAMPLES=1
+endif
+ifeq ($(FULL_TARGET),m68k-linux)
+TARGET_EXAMPLEDIRS_EXAMPLES=1
+endif
+ifeq ($(FULL_TARGET),m68k-freebsd)
+TARGET_EXAMPLEDIRS_EXAMPLES=1
+endif
+ifeq ($(FULL_TARGET),m68k-netbsd)
+TARGET_EXAMPLEDIRS_EXAMPLES=1
+endif
+ifeq ($(FULL_TARGET),m68k-amiga)
+TARGET_EXAMPLEDIRS_EXAMPLES=1
+endif
+ifeq ($(FULL_TARGET),m68k-atari)
+TARGET_EXAMPLEDIRS_EXAMPLES=1
+endif
+ifeq ($(FULL_TARGET),m68k-openbsd)
+TARGET_EXAMPLEDIRS_EXAMPLES=1
+endif
+ifeq ($(FULL_TARGET),m68k-palmos)
+TARGET_EXAMPLEDIRS_EXAMPLES=1
+endif
+ifeq ($(FULL_TARGET),m68k-embedded)
+TARGET_EXAMPLEDIRS_EXAMPLES=1
+endif
+ifeq ($(FULL_TARGET),powerpc-linux)
+TARGET_EXAMPLEDIRS_EXAMPLES=1
+endif
+ifeq ($(FULL_TARGET),powerpc-netbsd)
+TARGET_EXAMPLEDIRS_EXAMPLES=1
+endif
+ifeq ($(FULL_TARGET),powerpc-amiga)
+TARGET_EXAMPLEDIRS_EXAMPLES=1
+endif
+ifeq ($(FULL_TARGET),powerpc-macos)
+TARGET_EXAMPLEDIRS_EXAMPLES=1
+endif
+ifeq ($(FULL_TARGET),powerpc-darwin)
+TARGET_EXAMPLEDIRS_EXAMPLES=1
+endif
+ifeq ($(FULL_TARGET),powerpc-morphos)
+TARGET_EXAMPLEDIRS_EXAMPLES=1
+endif
+ifeq ($(FULL_TARGET),powerpc-embedded)
+TARGET_EXAMPLEDIRS_EXAMPLES=1
+endif
+ifeq ($(FULL_TARGET),powerpc-wii)
+TARGET_EXAMPLEDIRS_EXAMPLES=1
+endif
+ifeq ($(FULL_TARGET),powerpc-aix)
+TARGET_EXAMPLEDIRS_EXAMPLES=1
+endif
+ifeq ($(FULL_TARGET),sparc-linux)
+TARGET_EXAMPLEDIRS_EXAMPLES=1
+endif
+ifeq ($(FULL_TARGET),sparc-netbsd)
+TARGET_EXAMPLEDIRS_EXAMPLES=1
+endif
+ifeq ($(FULL_TARGET),sparc-solaris)
+TARGET_EXAMPLEDIRS_EXAMPLES=1
+endif
+ifeq ($(FULL_TARGET),sparc-embedded)
+TARGET_EXAMPLEDIRS_EXAMPLES=1
+endif
+ifeq ($(FULL_TARGET),x86_64-linux)
+TARGET_EXAMPLEDIRS_EXAMPLES=1
+endif
+ifeq ($(FULL_TARGET),x86_64-freebsd)
+TARGET_EXAMPLEDIRS_EXAMPLES=1
+endif
+ifeq ($(FULL_TARGET),x86_64-netbsd)
+TARGET_EXAMPLEDIRS_EXAMPLES=1
+endif
+ifeq ($(FULL_TARGET),x86_64-solaris)
+TARGET_EXAMPLEDIRS_EXAMPLES=1
+endif
+ifeq ($(FULL_TARGET),x86_64-openbsd)
+TARGET_EXAMPLEDIRS_EXAMPLES=1
+endif
+ifeq ($(FULL_TARGET),x86_64-darwin)
+TARGET_EXAMPLEDIRS_EXAMPLES=1
+endif
+ifeq ($(FULL_TARGET),x86_64-win64)
+TARGET_EXAMPLEDIRS_EXAMPLES=1
+endif
+ifeq ($(FULL_TARGET),x86_64-embedded)
+TARGET_EXAMPLEDIRS_EXAMPLES=1
+endif
+ifeq ($(FULL_TARGET),arm-linux)
+TARGET_EXAMPLEDIRS_EXAMPLES=1
+endif
+ifeq ($(FULL_TARGET),arm-palmos)
+TARGET_EXAMPLEDIRS_EXAMPLES=1
+endif
+ifeq ($(FULL_TARGET),arm-darwin)
+TARGET_EXAMPLEDIRS_EXAMPLES=1
+endif
+ifeq ($(FULL_TARGET),arm-wince)
+TARGET_EXAMPLEDIRS_EXAMPLES=1
+endif
+ifeq ($(FULL_TARGET),arm-gba)
+TARGET_EXAMPLEDIRS_EXAMPLES=1
+endif
+ifeq ($(FULL_TARGET),arm-nds)
+TARGET_EXAMPLEDIRS_EXAMPLES=1
+endif
+ifeq ($(FULL_TARGET),arm-embedded)
+TARGET_EXAMPLEDIRS_EXAMPLES=1
+endif
+ifeq ($(FULL_TARGET),arm-symbian)
+TARGET_EXAMPLEDIRS_EXAMPLES=1
+endif
+ifeq ($(FULL_TARGET),arm-android)
+TARGET_EXAMPLEDIRS_EXAMPLES=1
+endif
+ifeq ($(FULL_TARGET),powerpc64-linux)
+TARGET_EXAMPLEDIRS_EXAMPLES=1
+endif
+ifeq ($(FULL_TARGET),powerpc64-darwin)
+TARGET_EXAMPLEDIRS_EXAMPLES=1
+endif
+ifeq ($(FULL_TARGET),powerpc64-embedded)
+TARGET_EXAMPLEDIRS_EXAMPLES=1
+endif
+ifeq ($(FULL_TARGET),powerpc64-aix)
+TARGET_EXAMPLEDIRS_EXAMPLES=1
+endif
+ifeq ($(FULL_TARGET),avr-embedded)
+TARGET_EXAMPLEDIRS_EXAMPLES=1
+endif
+ifeq ($(FULL_TARGET),armeb-linux)
+TARGET_EXAMPLEDIRS_EXAMPLES=1
+endif
+ifeq ($(FULL_TARGET),armeb-embedded)
+TARGET_EXAMPLEDIRS_EXAMPLES=1
+endif
+ifeq ($(FULL_TARGET),mips-linux)
+TARGET_EXAMPLEDIRS_EXAMPLES=1
+endif
+ifeq ($(FULL_TARGET),mipsel-linux)
+TARGET_EXAMPLEDIRS_EXAMPLES=1
+endif
+ifeq ($(FULL_TARGET),jvm-java)
+TARGET_EXAMPLEDIRS_EXAMPLES=1
+endif
+ifeq ($(FULL_TARGET),jvm-android)
+TARGET_EXAMPLEDIRS_EXAMPLES=1
+endif
+ifeq ($(FULL_TARGET),i8086-msdos)
+TARGET_EXAMPLEDIRS_EXAMPLES=1
+endif
+ifdef TARGET_EXAMPLEDIRS_EXAMPLES
+examples_all:
+	$(MAKE) -C examples all
+examples_debug:
+	$(MAKE) -C examples debug
+examples_smart:
+	$(MAKE) -C examples smart
+examples_release:
+	$(MAKE) -C examples release
+examples_units:
+	$(MAKE) -C examples units
+examples_examples:
+	$(MAKE) -C examples examples
+examples_shared:
+	$(MAKE) -C examples shared
+examples_install:
+	$(MAKE) -C examples install
+examples_sourceinstall:
+	$(MAKE) -C examples sourceinstall
+examples_exampleinstall:
+	$(MAKE) -C examples exampleinstall
+examples_distinstall:
+	$(MAKE) -C examples distinstall
+examples_zipinstall:
+	$(MAKE) -C examples zipinstall
+examples_zipsourceinstall:
+	$(MAKE) -C examples zipsourceinstall
+examples_zipexampleinstall:
+	$(MAKE) -C examples zipexampleinstall
+examples_zipdistinstall:
+	$(MAKE) -C examples zipdistinstall
+examples_clean:
+	$(MAKE) -C examples clean
+examples_distclean:
+	$(MAKE) -C examples distclean
+examples_cleanall:
+	$(MAKE) -C examples cleanall
+examples_info:
+	$(MAKE) -C examples info
+examples_makefiles:
+	$(MAKE) -C examples makefiles
+examples:
+	$(MAKE) -C examples all
+.PHONY: examples_all examples_debug examples_smart examples_release examples_units examples_examples examples_shared examples_install examples_sourceinstall examples_exampleinstall examples_distinstall examples_zipinstall examples_zipsourceinstall examples_zipexampleinstall examples_zipdistinstall examples_clean examples_distclean examples_cleanall examples_info examples_makefiles examples
+endif
+all: fpc_all
+debug: fpc_debug
+smart: fpc_smart
+release: fpc_release
+units: fpc_units
+examples: fpc_examples
+shared: fpc_shared
+install: fpc_install
+sourceinstall: fpc_sourceinstall
+exampleinstall: fpc_exampleinstall
+distinstall: fpc_distinstall
+zipinstall: fpc_zipinstall
+zipsourceinstall: fpc_zipsourceinstall
+zipexampleinstall: fpc_zipexampleinstall
+zipdistinstall: fpc_zipdistinstall
+clean: fpc_clean $(addsuffix _clean,$(TARGET_EXAMPLEDIRS))
+distclean: fpc_distclean
+cleanall: fpc_cleanall
+info: fpc_info
+makefiles: fpc_makefiles
+.PHONY: all debug smart release units examples shared install sourceinstall exampleinstall distinstall zipinstall zipsourceinstall zipexampleinstall zipdistinstall clean distclean cleanall info makefiles
+ifneq ($(wildcard fpcmake.loc),)
+include fpcmake.loc
+endif
+.NOTPARALLEL:
Index: packages/egl/Makefile.fpc
===================================================================
--- packages/egl/Makefile.fpc	(revision 0)
+++ packages/egl/Makefile.fpc	(working copy)
@@ -0,0 +1,91 @@
+#
+#   Makefile.fpc for running fpmake
+#
+
+[package]
+name=egl
+version=2.7.1
+
+[require]
+packages=rtl fpmkunit
+
+[install]
+fpcpackage=y
+
+[default]
+fpcdir=../..
+
+[prerules]
+FPMAKE_BIN_CLEAN=$(wildcard .$(PATHSEP)fpmake$(SRCEXEEXT))
+ifdef OS_TARGET
+FPC_TARGETOPT+=--os=$(OS_TARGET)
+endif
+ifdef CPU_TARGET
+FPC_TARGETOPT+=--cpu=$(CPU_TARGET)
+endif
+LOCALFPMAKE=.$(PATHSEP)fpmake$(SRCEXEEXT)
+
+[rules]
+# Do not pass the Makefile's unit and binary target locations. fpmake uses it's own.
+override FPCOPT:=$(filter-out -FU%,$(FPCOPT))
+override FPCOPT:=$(filter-out -FE%,$(FPCOPT))
+# Compose general fpmake-parameters
+ifdef FPMAKEOPT
+FPMAKE_OPT+=$(FPMAKEOPT)
+endif
+FPMAKE_OPT+=--localunitdir=../..
+FPMAKE_OPT+=--globalunitdir=..
+FPMAKE_OPT+=$(FPC_TARGETOPT)
+FPMAKE_OPT+=$(addprefix -o ,$(FPCOPT))
+FPMAKE_OPT+=--compiler=$(FPC)
+FPMAKE_OPT+=-bu
+.NOTPARALLEL:
+
+fpmake: fpmake.pp
+	$(FPCFPMAKE) fpmake.pp $(FPMAKE_SKIP_CONFIG) $(addprefix -Fu,$(COMPILER_FPMAKE_UNITDIR)) $(FPCMAKEOPT) $(OPT)
+all:	fpmake
+	$(LOCALFPMAKE) compile $(FPMAKE_OPT)
+smart:	fpmake
+	$(LOCALFPMAKE) compile $(FPMAKE_OPT) -o -XX -o -CX
+release:	fpmake
+	$(LOCALFPMAKE) compile $(FPMAKE_OPT) -o -dRELEASE
+debug:	fpmake
+	$(LOCALFPMAKE) compile $(FPMAKE_OPT) -o -dDEBUG
+# If no fpmake exists and (dist)clean is called, do not try to build fpmake, it will
+# most often fail because the dependencies are cleared.
+# In case of a clean, simply do nothing
+ifeq ($(FPMAKE_BIN_CLEAN),)
+clean:
+else
+clean:
+	$(FPMAKE_BIN_CLEAN) clean $(FPMAKE_OPT)
+endif
+# In case of a distclean, perform an 'old'-style distclean. This to avoid problems
+# when the package is compiled using fpcmake prior to running this clean using fpmake
+ifeq ($(FPMAKE_BIN_CLEAN),)
+distclean:	$(addsuffix _distclean,$(TARGET_DIRS)) fpc_cleanall
+else
+distclean:
+ifdef inUnix
+        { $(FPMAKE_BIN_CLEAN) distclean $(FPMAKE_OPT); if [ $$? != "0" ]; then { echo Something wrong with fpmake exectable. Remove the executable and call make recursively to recover.; $(DEL) $(FPMAKE_BIN_CLEAN); $(MAKE) fpc_cleanall; }; fi;  }
+else
+        $(FPMAKE_BIN_CLEAN) distclean $(FPMAKE_OPT)
+endif
+	-$(DEL) $(LOCALFPMAKE)
+endif
+cleanall: distclean
+install:	fpmake
+ifdef UNIXHier
+	$(LOCALFPMAKE) install $(FPMAKE_OPT) --prefix=$(INSTALL_PREFIX) --baseinstalldir=$(INSTALL_LIBDIR)/fpc/$(FPC_VERSION) --unitinstalldir=$(INSTALL_UNITDIR)
+else
+	$(LOCALFPMAKE) install $(FPMAKE_OPT) --prefix=$(INSTALL_BASEDIR) --unitinstalldir=$(INSTALL_UNITDIR)
+endif
+# distinstall also installs the example-sources
+distinstall:	fpmake
+ifdef UNIXHier
+	$(LOCALFPMAKE) install $(FPMAKE_OPT) --prefix=$(INSTALL_PREFIX) --baseinstalldir=$(INSTALL_LIBDIR)/fpc/$(FPC_VERSION) --unitinstalldir=$(INSTALL_UNITDIR) -ie
+else
+	$(LOCALFPMAKE) install $(FPMAKE_OPT) --prefix=$(INSTALL_BASEDIR)  --unitinstalldir=$(INSTALL_UNITDIR) -ie
+endif
+zipinstall:	fpmake
+	$(LOCALFPMAKE) zipinstall $(FPMAKE_OPT)
Index: packages/egl/Makefile.fpc.fpcmake
===================================================================
--- packages/egl/Makefile.fpc.fpcmake	(revision 0)
+++ packages/egl/Makefile.fpc.fpcmake	(working copy)
@@ -0,0 +1,29 @@
+#
+#   Makefile.fpc for EGL for FPC
+#
+
+[package]
+name=egl
+version=2.7.1
+
+[target]
+units_linux=egl
+units_wince=egl
+units_win32=egl
+units_win64=egl
+units_darwin=egl
+units_android=egl
+exampledirs=examples
+
+[install]
+fpcpackage=y
+
+[compiler]
+includedir=src
+sourcedir=src examples
+
+[default]
+fpcdir=../..
+
+[rules]
+.NOTPARALLEL:
Index: packages/egl/fpmake.pp
===================================================================
--- packages/egl/fpmake.pp	(revision 0)
+++ packages/egl/fpmake.pp	(working copy)
@@ -0,0 +1,36 @@
+{$ifndef ALLPACKAGES}
+{$mode objfpc}{$H+}
+program fpmake;
+
+uses fpmkunit;
+
+Var
+  P : TPackage;
+  T : TTarget;
+
+begin
+  With Installer do 
+    begin
+{$endif ALLPACKAGES}
+
+    P:=AddPackage('egl');
+{$ifdef ALLPACKAGES}
+    P.Directory:=ADirectory;
+{$endif ALLPACKAGES}
+    P.Version:='2.7.1';
+    P.Author := 'Free Pascal Development team';
+    P.License := 'LGPL with modification';
+    P.HomepageURL := 'www.freepascal.org';
+    P.OSes := [android,darwin,iphonesim,linux,win32,win64,wince];
+
+    P.SourcePath.Add('src');
+
+    T:=P.Targets.AddUnit('egl.pas',[linux,win32,win64,wince,darwin,android]);
+
+    P.Sources.AddExampleFiles('examples/*',false,'.');
+
+{$ifndef ALLPACKAGES}
+    Run;
+    end;
+end.
+{$endif ALLPACKAGES}
Index: packages/egl/src/egl.pas
===================================================================
--- packages/egl/src/egl.pas	(revision 0)
+++ packages/egl/src/egl.pas	(working copy)
@@ -0,0 +1,573 @@
+{** Separated from GLES/EGL by Dennis Fehr
+ **
+ ** Copyright (c) 2007-2009 The Khronos Group Inc.
+ **
+ ** Permission is hereby granted, free of charge, to any person obtaining a
+ ** copy of this software and/or associated documentation files (the
+ ** "Materials"), to deal in the Materials without restriction, including
+ ** without limitation the rights to use, copy, modify, merge, publish,
+ ** distribute, sublicense, and/or sell copies of the Materials, and to
+ ** permit persons to whom the Materials are furnished to do so, subject to
+ ** the following conditions:
+ **
+ ** The above copyright notice and this permission notice shall be included
+ ** in all copies or substantial portions of the Materials.
+ **
+ ** THE MATERIALS ARE PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
+ ** EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
+ ** MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.
+ ** IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY
+ ** CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT,
+ ** TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE 
+ ** MATERIALS OR THE USE OR OTHER DEALINGS IN THE MATERIALS.
+ **}
+unit egl;
+
+interface
+
+{$MODE objfpc}
+
+uses SysUtils,dynlibs{$ifdef windows},Windows{$endif};
+
+{$IFDEF FPC}
+  {$PACKRECORDS C}
+{$ENDIF}
+
+{ EGL Types  }
+{ EGLint is defined in eglplatform.h  }
+
+type
+
+  PEGLConfig  = ^EGLConfig;
+  PEGLInt     = ^EGLInt;
+  EGLInt      = {$IFDEF CPU64}int64{$ELSE}longint{$ENDIF};
+  EGLConfig   = pointer;
+  
+  EGLImageKHREGLConfig = pointer;
+
+  {$IF DEFINED(LINUX) }
+    EGLNativeDisplayType = ptrint;
+    EGLNativeWindowType  = cardinal;
+    EGLNativePixmapType  = cardinal;
+  {$ELSEIF DEFINED(WINDOWS) }
+    EGLNativeDisplayType = HDC;
+    EGLNativeWindowType  = HWND;
+    EGLNativePixmapType  = HBITMAP;
+  {$ELSE}
+    EGLNativeDisplayType = ptrint;
+    EGLNativeWindowType  = pointer;
+    EGLNativePixmapType  = pointer;
+  {$ENDIF}
+
+  EGLBoolean      = dword;
+  EGLenum         = dword;
+  EGLContext      = pointer;
+  EGLDisplay      = pointer;
+  EGLSurface      = pointer;
+  EGLClientBuffer = pointer;
+
+  { EGL Versioning  }
+
+const
+   EGL_VERSION_1_0 = 1;     
+   EGL_VERSION_1_1 = 1;     
+   EGL_VERSION_1_2 = 1;     
+   EGL_VERSION_1_3 = 1;     
+   EGL_VERSION_1_4 = 1;     
+
+{ EGL Enumerants. Bitmasks and other exceptional cases aside, most
+ * enums are assigned unique values starting at 0x3000.
+  }
+{ EGL aliases  }
+   EGL_FALSE = 0;
+   EGL_TRUE  = 1;
+{ Out-of-band handle values  }
+{ was #define dname def_expr }
+function EGL_DEFAULT_DISPLAY : EGLNativeDisplayType;    
+
+{ was #define dname def_expr }
+function EGL_NO_CONTEXT : EGLContext;    
+
+{ was #define dname def_expr }
+function EGL_NO_DISPLAY : EGLDisplay;    
+
+{ was #define dname def_expr }
+function EGL_NO_SURFACE : EGLSurface;    
+
+{ Out-of-band attribute value  }
+{ was #define dname def_expr }
+function EGL_DONT_CARE : EGLint;    
+
+{ Errors / GetError return values  }
+
+const
+   EGL_SUCCESS = $3000;     
+   EGL_NOT_INITIALIZED = $3001;     
+   EGL_BAD_ACCESS = $3002;     
+   EGL_BAD_ALLOC = $3003;     
+   EGL_BAD_ATTRIBUTE = $3004;     
+   EGL_BAD_CONFIG = $3005;     
+   EGL_BAD_CONTEXT = $3006;     
+   EGL_BAD_CURRENT_SURFACE = $3007;     
+   EGL_BAD_DISPLAY = $3008;     
+   EGL_BAD_MATCH = $3009;     
+   EGL_BAD_NATIVE_PIXMAP = $300A;     
+   EGL_BAD_NATIVE_WINDOW = $300B;     
+   EGL_BAD_PARAMETER = $300C;     
+   EGL_BAD_SURFACE = $300D;     
+{ EGL 1.1 - IMG_power_management  }
+   EGL_CONTEXT_LOST = $300E;     
+{ Reserved 0x300F-0x301F for additional errors  }
+{ Config attributes  }
+   EGL_BUFFER_SIZE = $3020;     
+   EGL_ALPHA_SIZE = $3021;     
+   EGL_BLUE_SIZE = $3022;     
+   EGL_GREEN_SIZE = $3023;     
+   EGL_RED_SIZE = $3024;     
+   EGL_DEPTH_SIZE = $3025;     
+   EGL_STENCIL_SIZE = $3026;     
+   EGL_CONFIG_CAVEAT = $3027;     
+   EGL_CONFIG_ID = $3028;     
+   EGL_LEVEL = $3029;     
+   EGL_MAX_PBUFFER_HEIGHT = $302A;     
+   EGL_MAX_PBUFFER_PIXELS = $302B;     
+   EGL_MAX_PBUFFER_WIDTH = $302C;     
+   EGL_NATIVE_RENDERABLE = $302D;     
+   EGL_NATIVE_VISUAL_ID = $302E;     
+   EGL_NATIVE_VISUAL_TYPE = $302F;     
+   EGL_PRESERVED_RESOURCES = $3030;     
+   EGL_SAMPLES = $3031;     
+   EGL_SAMPLE_BUFFERS = $3032;     
+   EGL_SURFACE_TYPE = $3033;     
+   EGL_TRANSPARENT_TYPE = $3034;     
+   EGL_TRANSPARENT_BLUE_VALUE = $3035;     
+   EGL_TRANSPARENT_GREEN_VALUE = $3036;     
+   EGL_TRANSPARENT_RED_VALUE = $3037;     
+{ Attrib list terminator  }
+   EGL_NONE = $3038;     
+   EGL_BIND_TO_TEXTURE_RGB = $3039;     
+   EGL_BIND_TO_TEXTURE_RGBA = $303A;     
+   EGL_MIN_SWAP_INTERVAL = $303B;     
+   EGL_MAX_SWAP_INTERVAL = $303C;     
+   EGL_LUMINANCE_SIZE = $303D;     
+   EGL_ALPHA_MASK_SIZE = $303E;     
+   EGL_COLOR_BUFFER_TYPE = $303F;     
+   EGL_RENDERABLE_TYPE = $3040;     
+{ Pseudo-attribute (not queryable)  }
+   EGL_MATCH_NATIVE_PIXMAP = $3041;     
+   EGL_CONFORMANT = $3042;     
+{ Reserved 0x3041-0x304F for additional config attributes  }
+{ Config attribute values  }
+{ EGL_CONFIG_CAVEAT value  }
+   EGL_SLOW_CONFIG = $3050;     
+{ EGL_CONFIG_CAVEAT value  }
+   EGL_NON_CONFORMANT_CONFIG = $3051;     
+{ EGL_TRANSPARENT_TYPE value  }
+   EGL_TRANSPARENT_RGB = $3052;     
+{ EGL_COLOR_BUFFER_TYPE value  }
+   EGL_RGB_BUFFER = $308E;     
+{ EGL_COLOR_BUFFER_TYPE value  }
+   EGL_LUMINANCE_BUFFER = $308F;     
+{ More config attribute values, for EGL_TEXTURE_FORMAT  }
+   EGL_NO_TEXTURE = $305C;     
+   EGL_TEXTURE_RGB = $305D;     
+   EGL_TEXTURE_RGBA = $305E;     
+   EGL_TEXTURE_2D = $305F;     
+{ Config attribute mask bits  }
+{ EGL_SURFACE_TYPE mask bits  }
+   EGL_PBUFFER_BIT = $0001;     
+{ EGL_SURFACE_TYPE mask bits  }
+   EGL_PIXMAP_BIT = $0002;     
+{ EGL_SURFACE_TYPE mask bits  }
+   EGL_WINDOW_BIT = $0004;     
+{ EGL_SURFACE_TYPE mask bits  }
+   EGL_VG_COLORSPACE_LINEAR_BIT = $0020;     
+{ EGL_SURFACE_TYPE mask bits  }
+   EGL_VG_ALPHA_FORMAT_PRE_BIT = $0040;     
+{ EGL_SURFACE_TYPE mask bits  }
+   EGL_MULTISAMPLE_RESOLVE_BOX_BIT = $0200;     
+{ EGL_SURFACE_TYPE mask bits  }
+   EGL_SWAP_BEHAVIOR_PRESERVED_BIT = $0400;     
+{ EGL_RENDERABLE_TYPE mask bits  }
+   EGL_OPENGL_ES_BIT = $0001;     
+{ EGL_RENDERABLE_TYPE mask bits  }
+   EGL_OPENVG_BIT = $0002;     
+{ EGL_RENDERABLE_TYPE mask bits  }
+   EGL_OPENGL_ES2_BIT = $0004;     
+{ EGL_RENDERABLE_TYPE mask bits  }
+   EGL_OPENGL_BIT = $0008;     
+{ QueryString targets  }
+   EGL_VENDOR = $3053;     
+   EGL_VERSION = $3054;     
+   EGL_EXTENSIONS = $3055;     
+   EGL_CLIENT_APIS = $308D;     
+{ QuerySurface / SurfaceAttrib / CreatePbufferSurface targets  }
+   EGL_HEIGHT = $3056;     
+   EGL_WIDTH = $3057;     
+   EGL_LARGEST_PBUFFER = $3058;     
+   EGL_TEXTURE_FORMAT = $3080;     
+   EGL_TEXTURE_TARGET = $3081;     
+   EGL_MIPMAP_TEXTURE = $3082;     
+   EGL_MIPMAP_LEVEL = $3083;     
+   EGL_RENDER_BUFFER = $3086;     
+   EGL_VG_COLORSPACE = $3087;     
+   EGL_VG_ALPHA_FORMAT = $3088;     
+   EGL_HORIZONTAL_RESOLUTION = $3090;     
+   EGL_VERTICAL_RESOLUTION = $3091;     
+   EGL_PIXEL_ASPECT_RATIO = $3092;     
+   EGL_SWAP_BEHAVIOR = $3093;     
+   EGL_MULTISAMPLE_RESOLVE = $3099;     
+{ EGL_RENDER_BUFFER values / BindTexImage / ReleaseTexImage buffer targets  }
+   EGL_BACK_BUFFER = $3084;     
+   EGL_SINGLE_BUFFER = $3085;     
+{ OpenVG color spaces  }
+{ EGL_VG_COLORSPACE value  }
+   EGL_VG_COLORSPACE_sRGB = $3089;     
+{ EGL_VG_COLORSPACE value  }
+   EGL_VG_COLORSPACE_LINEAR = $308A;     
+{ OpenVG alpha formats  }
+{ EGL_ALPHA_FORMAT value  }
+   EGL_VG_ALPHA_FORMAT_NONPRE = $308B;     
+{ EGL_ALPHA_FORMAT value  }
+   EGL_VG_ALPHA_FORMAT_PRE = $308C;     
+{ Constant scale factor by which fractional display resolutions &
+ * aspect ratio are scaled when queried as integer values.
+  }
+   EGL_DISPLAY_SCALING = 10000;     
+{ Unknown display resolution/aspect ratio  }
+{ was #define dname def_expr }
+function EGL_UNKNOWN : EGLint;    
+
+{ Back buffer swap behaviors  }
+{ EGL_SWAP_BEHAVIOR value  }
+
+const
+   EGL_BUFFER_PRESERVED = $3094;     
+{ EGL_SWAP_BEHAVIOR value  }
+   EGL_BUFFER_DESTROYED = $3095;     
+{ CreatePbufferFromClientBuffer buffer types  }
+   EGL_OPENVG_IMAGE = $3096;     
+{ QueryContext targets  }
+   EGL_CONTEXT_CLIENT_TYPE = $3097;     
+{ CreateContext attributes  }
+   EGL_CONTEXT_CLIENT_VERSION = $3098;     
+{ Multisample resolution behaviors  }
+{ EGL_MULTISAMPLE_RESOLVE value  }
+   EGL_MULTISAMPLE_RESOLVE_DEFAULT = $309A;     
+{ EGL_MULTISAMPLE_RESOLVE value  }
+   EGL_MULTISAMPLE_RESOLVE_BOX = $309B;     
+{ BindAPI/QueryAPI targets  }
+   EGL_OPENGL_ES_API = $30A0;     
+   EGL_OPENVG_API = $30A1;     
+   EGL_OPENGL_API = $30A2;     
+{ GetCurrentSurface targets  }
+   EGL_DRAW = $3059;     
+   EGL_READ = $305A;     
+{ WaitNative engines  }
+   EGL_CORE_NATIVE_ENGINE = $305B;     
+{ EGL 1.2 tokens renamed for consistency in EGL 1.3  }
+   EGL_COLORSPACE = EGL_VG_COLORSPACE;     
+   EGL_ALPHA_FORMAT = EGL_VG_ALPHA_FORMAT;     
+   EGL_COLORSPACE_sRGB = EGL_VG_COLORSPACE_sRGB;     
+   EGL_COLORSPACE_LINEAR = EGL_VG_COLORSPACE_LINEAR;     
+   EGL_ALPHA_FORMAT_NONPRE = EGL_VG_ALPHA_FORMAT_NONPRE;     
+   EGL_ALPHA_FORMAT_PRE = EGL_VG_ALPHA_FORMAT_PRE;     
+{ EGL extensions must request enum blocks from the Khronos
+ * API Registrar, who maintains the enumerant registry. Submit
+ * a bug in Khronos Bugzilla against task "Registry".
+  }
+{ EGL Functions  }
+
+var
+  eglGetError : function:EGLint;{$ifdef windows}stdcall;{$else}cdecl;{$endif}
+  eglGetDisplay : function(display_id:EGLNativeDisplayType):EGLDisplay;{$ifdef windows}stdcall;{$else}cdecl;{$endif}
+  eglInitialize : function(dpy:EGLDisplay; major:pEGLint; minor:pEGLint):EGLBoolean;{$ifdef windows}stdcall;{$else}cdecl;{$endif}
+  eglTerminate : function(dpy:EGLDisplay):EGLBoolean;{$ifdef windows}stdcall;{$else}cdecl;{$endif}
+(* Const before type ignored *)
+  eglQueryString : function(dpy:EGLDisplay; name:EGLint):pchar;{$ifdef windows}stdcall;{$else}cdecl;{$endif}
+  eglGetConfigs : function(dpy:EGLDisplay; configs:pEGLConfig; config_size:EGLint; num_config:pEGLint):EGLBoolean;{$ifdef windows}stdcall;{$else}cdecl;{$endif}
+(* Const before type ignored *)
+  eglChooseConfig : function(dpy:EGLDisplay; attrib_list:pEGLint; configs:pEGLConfig; config_size:EGLint; num_config:pEGLint):EGLBoolean;{$ifdef windows}stdcall;{$else}cdecl;{$endif}
+  eglGetConfigAttrib : function(dpy:EGLDisplay; config:EGLConfig; attribute:EGLint; value:pEGLint):EGLBoolean;{$ifdef windows}stdcall;{$else}cdecl;{$endif}
+(* Const before type ignored *)
+  eglCreateWindowSurface : function(dpy:EGLDisplay; config:EGLConfig; win:EGLNativeWindowType; attrib_list:pEGLint):EGLSurface;{$ifdef windows}stdcall;{$else}cdecl;{$endif}
+(* Const before type ignored *)
+  eglCreatePbufferSurface : function(dpy:EGLDisplay; config:EGLConfig; attrib_list:pEGLint):EGLSurface;{$ifdef windows}stdcall;{$else}cdecl;{$endif}
+(* Const before type ignored *)
+  eglCreatePixmapSurface : function(dpy:EGLDisplay; config:EGLConfig; pixmap:EGLNativePixmapType; attrib_list:pEGLint):EGLSurface;{$ifdef windows}stdcall;{$else}cdecl;{$endif}
+  eglDestroySurface : function(dpy:EGLDisplay; surface:EGLSurface):EGLBoolean;{$ifdef windows}stdcall;{$else}cdecl;{$endif}
+  eglQuerySurface : function(dpy:EGLDisplay; surface:EGLSurface; attribute:EGLint; value:pEGLint):EGLBoolean;{$ifdef windows}stdcall;{$else}cdecl;{$endif}
+  eglBindAPI : function(api:EGLenum):EGLBoolean;{$ifdef windows}stdcall;{$else}cdecl;{$endif}
+  eglQueryAPI : function:EGLenum;{$ifdef windows}stdcall;{$else}cdecl;{$endif}
+  eglWaitClient : function:EGLBoolean;{$ifdef windows}stdcall;{$else}cdecl;{$endif}
+  eglReleaseThread : function:EGLBoolean;{$ifdef windows}stdcall;{$else}cdecl;{$endif}
+(* Const before type ignored *)
+  eglCreatePbufferFromClientBuffer : function(dpy:EGLDisplay; buftype:EGLenum; buffer:EGLClientBuffer; config:EGLConfig; attrib_list:pEGLint):EGLSurface;{$ifdef windows}stdcall;{$else}cdecl;{$endif}
+  eglSurfaceAttrib : function(dpy:EGLDisplay; surface:EGLSurface; attribute:EGLint; value:EGLint):EGLBoolean;{$ifdef windows}stdcall;{$else}cdecl;{$endif}
+  eglBindTexImage : function(dpy:EGLDisplay; surface:EGLSurface; buffer:EGLint):EGLBoolean;{$ifdef windows}stdcall;{$else}cdecl;{$endif}
+  eglReleaseTexImage : function(dpy:EGLDisplay; surface:EGLSurface; buffer:EGLint):EGLBoolean;{$ifdef windows}stdcall;{$else}cdecl;{$endif}
+  eglSwapInterval : function(dpy:EGLDisplay; interval:EGLint):EGLBoolean;{$ifdef windows}stdcall;{$else}cdecl;{$endif}
+(* Const before type ignored *)
+  eglCreateContext : function(dpy:EGLDisplay; config:EGLConfig; share_context:EGLContext; attrib_list:pEGLint):EGLContext;{$ifdef windows}stdcall;{$else}cdecl;{$endif}
+  eglDestroyContext : function(dpy:EGLDisplay; ctx:EGLContext):EGLBoolean;{$ifdef windows}stdcall;{$else}cdecl;{$endif}
+  eglMakeCurrent : function(dpy:EGLDisplay; draw:EGLSurface; read:EGLSurface; ctx:EGLContext):EGLBoolean;{$ifdef windows}stdcall;{$else}cdecl;{$endif}
+  eglGetCurrentContext : function:EGLContext;{$ifdef windows}stdcall;{$else}cdecl;{$endif}
+  eglGetCurrentSurface : function(readdraw:EGLint):EGLSurface;{$ifdef windows}stdcall;{$else}cdecl;{$endif}
+  eglGetCurrentDisplay : function:EGLDisplay;{$ifdef windows}stdcall;{$else}cdecl;{$endif}
+  eglQueryContext : function(dpy:EGLDisplay; ctx:EGLContext; attribute:EGLint; value:pEGLint):EGLBoolean;{$ifdef windows}stdcall;{$else}cdecl;{$endif}
+  eglWaitGL : function:EGLBoolean;{$ifdef windows}stdcall;{$else}cdecl;{$endif}
+  eglWaitNative : function(engine:EGLint):EGLBoolean;{$ifdef windows}stdcall;{$else}cdecl;{$endif}
+  eglSwapBuffers : function(dpy:EGLDisplay; surface:EGLSurface):EGLBoolean;{$ifdef windows}stdcall;{$else}cdecl;{$endif}
+  eglCopyBuffers : function(dpy:EGLDisplay; surface:EGLSurface; target:EGLNativePixmapType):EGLBoolean;{$ifdef windows}stdcall;{$else}cdecl;{$endif}
+{ This is a generic function pointer type, whose name indicates it must
+ * be cast to the proper type *and calling convention* before use.
+  }
+
+var
+  eglGetProcAddress : function(procname:pchar):pointer;{$ifdef windows}stdcall;{$else}CDecl;{$endif}
+{ Header file version number  }
+{ Current version at http://www.khronos.org/registry/egl/  }
+
+const
+   EGL_EGLEXT_VERSION = 3;     
+   EGL_KHR_config_attribs = 1;     
+{ EGLConfig attribute  }
+   EGL_CONFORMANT_KHR = $3042;     
+{ EGL_SURFACE_TYPE bitfield  }
+   EGL_VG_COLORSPACE_LINEAR_BIT_KHR = $0020;     
+{ EGL_SURFACE_TYPE bitfield  }
+   EGL_VG_ALPHA_FORMAT_PRE_BIT_KHR = $0040;     
+   EGL_KHR_lock_surface = 1;     
+{ EGL_LOCK_USAGE_HINT_KHR bitfield  }
+   EGL_READ_SURFACE_BIT_KHR = $0001;     
+{ EGL_LOCK_USAGE_HINT_KHR bitfield  }
+   EGL_WRITE_SURFACE_BIT_KHR = $0002;     
+{ EGL_SURFACE_TYPE bitfield  }
+   EGL_LOCK_SURFACE_BIT_KHR = $0080;     
+{ EGL_SURFACE_TYPE bitfield  }
+   EGL_OPTIMAL_FORMAT_BIT_KHR = $0100;     
+{ EGLConfig attribute  }
+   EGL_MATCH_FORMAT_KHR = $3043;     
+{ EGL_MATCH_FORMAT_KHR value  }
+   EGL_FORMAT_RGB_565_EXACT_KHR = $30C0;     
+{ EGL_MATCH_FORMAT_KHR value  }
+   EGL_FORMAT_RGB_565_KHR = $30C1;     
+{ EGL_MATCH_FORMAT_KHR value  }
+   EGL_FORMAT_RGBA_8888_EXACT_KHR = $30C2;     
+{ EGL_MATCH_FORMAT_KHR value  }
+   EGL_FORMAT_RGBA_8888_KHR = $30C3;     
+{ eglLockSurfaceKHR attribute  }
+   EGL_MAP_PRESERVE_PIXELS_KHR = $30C4;     
+{ eglLockSurfaceKHR attribute  }
+   EGL_LOCK_USAGE_HINT_KHR = $30C5;     
+{ eglQuerySurface attribute  }
+   EGL_BITMAP_POINTER_KHR = $30C6;     
+{ eglQuerySurface attribute  }
+   EGL_BITMAP_PITCH_KHR = $30C7;     
+{ eglQuerySurface attribute  }
+   EGL_BITMAP_ORIGIN_KHR = $30C8;     
+{ eglQuerySurface attribute  }
+   EGL_BITMAP_PIXEL_RED_OFFSET_KHR = $30C9;     
+{ eglQuerySurface attribute  }
+   EGL_BITMAP_PIXEL_GREEN_OFFSET_KHR = $30CA;     
+{ eglQuerySurface attribute  }
+   EGL_BITMAP_PIXEL_BLUE_OFFSET_KHR = $30CB;     
+{ eglQuerySurface attribute  }
+   EGL_BITMAP_PIXEL_ALPHA_OFFSET_KHR = $30CC;     
+{ eglQuerySurface attribute  }
+   EGL_BITMAP_PIXEL_LUMINANCE_OFFSET_KHR = $30CD;     
+{ EGL_BITMAP_ORIGIN_KHR value  }
+   EGL_LOWER_LEFT_KHR = $30CE;     
+{ EGL_BITMAP_ORIGIN_KHR value  }
+   EGL_UPPER_LEFT_KHR = $30CF;     
+(* Const before type ignored *)
+
+const
+   EGL_KHR_image = 1;     
+{ eglCreateImageKHR target  }
+   EGL_NATIVE_PIXMAP_KHR = $30B0;     
+
+type
+  EGLImageKHR = pointer;
+  { was #define dname def_expr }
+
+function EGL_NO_IMAGE_KHR : EGLImageKHR;    
+
+(* Const before type ignored *)
+
+const
+   EGL_KHR_vg_parent_image = 1;     
+{ eglCreateImageKHR target  }
+   EGL_VG_PARENT_IMAGE_KHR = $30BA;     
+   EGL_KHR_gl_texture_2D_image = 1;     
+{ eglCreateImageKHR target  }
+   EGL_GL_TEXTURE_2D_KHR = $30B1;     
+{ eglCreateImageKHR attribute  }
+   EGL_GL_TEXTURE_LEVEL_KHR = $30BC;     
+   EGL_KHR_gl_texture_cubemap_image = 1;     
+{ eglCreateImageKHR target  }
+   EGL_GL_TEXTURE_CUBE_MAP_POSITIVE_X_KHR = $30B3;     
+{ eglCreateImageKHR target  }
+   EGL_GL_TEXTURE_CUBE_MAP_NEGATIVE_X_KHR = $30B4;     
+{ eglCreateImageKHR target  }
+   EGL_GL_TEXTURE_CUBE_MAP_POSITIVE_Y_KHR = $30B5;     
+{ eglCreateImageKHR target  }
+   EGL_GL_TEXTURE_CUBE_MAP_NEGATIVE_Y_KHR = $30B6;     
+{ eglCreateImageKHR target  }
+   EGL_GL_TEXTURE_CUBE_MAP_POSITIVE_Z_KHR = $30B7;     
+{ eglCreateImageKHR target  }
+   EGL_GL_TEXTURE_CUBE_MAP_NEGATIVE_Z_KHR = $30B8;     
+   EGL_KHR_gl_texture_3D_image = 1;     
+{ eglCreateImageKHR target  }
+   EGL_GL_TEXTURE_3D_KHR = $30B2;     
+{ eglCreateImageKHR attribute  }
+   EGL_GL_TEXTURE_ZOFFSET_KHR = $30BD;     
+   EGL_KHR_gl_renderbuffer_image = 1;     
+{ eglCreateImageKHR target  }
+   EGL_GL_RENDERBUFFER_KHR = $30B9;     
+   EGL_KHR_image_base = 1;     
+{ Most interfaces defined by EGL_KHR_image_pixmap above  }
+{ eglCreateImageKHR attribute  }
+   EGL_IMAGE_PRESERVED_KHR = $30D2;     
+   EGL_KHR_image_pixmap = 1;     
+{ Interfaces defined by EGL_KHR_image above  }
+
+implementation
+
+{ was #define dname def_expr }
+function EGL_DEFAULT_DISPLAY : EGLNativeDisplayType; inline;
+  begin
+     EGL_DEFAULT_DISPLAY:=EGLNativeDisplayType(0);
+  end;
+
+{ was #define dname def_expr }
+function EGL_NO_CONTEXT : EGLContext; inline;
+  begin
+     EGL_NO_CONTEXT:=EGLContext(0);
+  end;
+
+{ was #define dname def_expr }
+function EGL_NO_DISPLAY : EGLDisplay; inline;
+  begin
+     EGL_NO_DISPLAY:=EGLDisplay(0);
+  end;
+
+{ was #define dname def_expr }
+function EGL_NO_SURFACE : EGLSurface; inline;
+  begin
+     EGL_NO_SURFACE:=EGLSurface(0);
+  end;
+
+{ was #define dname def_expr }
+function EGL_DONT_CARE : EGLint; inline;
+  begin
+     EGL_DONT_CARE:=EGLint(-(1));
+  end;
+
+{ was #define dname def_expr }
+function EGL_UNKNOWN : EGLint; inline;
+  begin
+     EGL_UNKNOWN:=EGLint(-(1));
+  end;
+
+{ was #define dname def_expr }
+function EGL_NO_IMAGE_KHR : EGLImageKHR; inline;
+  begin
+     EGL_NO_IMAGE_KHR:=EGLImageKHR(0);
+  end;
+
+
+var
+  EGLLib : tlibhandle;
+
+procedure FreeEGL;
+  begin
+    if EGLLib<>0 then
+      FreeLibrary(EGLLib);
+
+    eglGetError:=nil;
+    eglGetDisplay:=nil;
+    eglInitialize:=nil;
+    eglTerminate:=nil;
+    eglQueryString:=nil;
+    eglGetConfigs:=nil;
+    eglChooseConfig:=nil;
+    eglGetConfigAttrib:=nil;
+    eglCreateWindowSurface:=nil;
+    eglCreatePbufferSurface:=nil;
+    eglCreatePixmapSurface:=nil;
+    eglDestroySurface:=nil;
+    eglQuerySurface:=nil;
+    eglBindAPI:=nil;
+    eglQueryAPI:=nil;
+    eglWaitClient:=nil;
+    eglReleaseThread:=nil;
+    eglCreatePbufferFromClientBuffer:=nil;
+    eglSurfaceAttrib:=nil;
+    eglBindTexImage:=nil;
+    eglReleaseTexImage:=nil;
+    eglSwapInterval:=nil;
+    eglCreateContext:=nil;
+    eglDestroyContext:=nil;
+    eglMakeCurrent:=nil;
+    eglGetCurrentContext:=nil;
+    eglGetCurrentSurface:=nil;
+    eglGetCurrentDisplay:=nil;
+    eglQueryContext:=nil;
+    eglWaitGL:=nil;
+    eglWaitNative:=nil;
+    eglSwapBuffers:=nil;
+    eglCopyBuffers:=nil;
+    eglGetProcAddress:=nil;
+  end;
+
+procedure LoadEGL(lib : pchar);
+  begin
+    FreeEGL;
+    EGLLib:=dynlibs.LoadLibrary(lib);
+    if EGLLib=0 then
+      raise Exception.Create(format('Could not load library: %s',[lib]));
+
+    pointer(eglGetProcAddress):=GetProcAddress(EGLLib,'eglGetProcAddress');
+
+    pointer(eglGetError):=GetProcAddress(EGLLib,'eglGetError');
+    pointer(eglGetDisplay):=GetProcAddress(EGLLib,'eglGetDisplay');
+    pointer(eglInitialize):=GetProcAddress(EGLLib,'eglInitialize');
+    pointer(eglTerminate):=GetProcAddress(EGLLib,'eglTerminate');
+    pointer(eglQueryString):=GetProcAddress(EGLLib,'eglQueryString');
+    pointer(eglGetConfigs):=GetProcAddress(EGLLib,'eglGetConfigs');
+    pointer(eglChooseConfig):=GetProcAddress(EGLLib,'eglChooseConfig');
+    pointer(eglGetConfigAttrib):=GetProcAddress(EGLLib,'eglGetConfigAttrib');
+    pointer(eglCreateWindowSurface):=GetProcAddress(EGLLib,'eglCreateWindowSurface');
+    pointer(eglCreatePbufferSurface):=GetProcAddress(EGLLib,'eglCreatePbufferSurface');
+    pointer(eglCreatePixmapSurface):=GetProcAddress(EGLLib,'eglCreatePixmapSurface');
+    pointer(eglDestroySurface):=GetProcAddress(EGLLib,'eglDestroySurface');
+    pointer(eglQuerySurface):=GetProcAddress(EGLLib,'eglQuerySurface');
+    pointer(eglBindAPI):=GetProcAddress(EGLLib,'eglBindAPI');
+    pointer(eglQueryAPI):=GetProcAddress(EGLLib,'eglQueryAPI');
+    pointer(eglWaitClient):=GetProcAddress(EGLLib,'eglWaitClient');
+    pointer(eglReleaseThread):=GetProcAddress(EGLLib,'eglReleaseThread');
+    pointer(eglCreatePbufferFromClientBuffer):=GetProcAddress(EGLLib,'eglCreatePbufferFromClientBuffer');
+    pointer(eglSurfaceAttrib):=GetProcAddress(EGLLib,'eglSurfaceAttrib');
+    pointer(eglBindTexImage):=GetProcAddress(EGLLib,'eglBindTexImage');
+    pointer(eglReleaseTexImage):=GetProcAddress(EGLLib,'eglReleaseTexImage');
+    pointer(eglSwapInterval):=GetProcAddress(EGLLib,'eglSwapInterval');
+    pointer(eglCreateContext):=GetProcAddress(EGLLib,'eglCreateContext');
+    pointer(eglDestroyContext):=GetProcAddress(EGLLib,'eglDestroyContext');
+    pointer(eglMakeCurrent):=GetProcAddress(EGLLib,'eglMakeCurrent');
+    pointer(eglGetCurrentContext):=GetProcAddress(EGLLib,'eglGetCurrentContext');
+    pointer(eglGetCurrentSurface):=GetProcAddress(EGLLib,'eglGetCurrentSurface');
+    pointer(eglGetCurrentDisplay):=GetProcAddress(EGLLib,'eglGetCurrentDisplay');
+    pointer(eglQueryContext):=GetProcAddress(EGLLib,'eglQueryContext');
+    pointer(eglWaitGL):=GetProcAddress(EGLLib,'eglWaitGL');
+    pointer(eglWaitNative):=GetProcAddress(EGLLib,'eglWaitNative');
+    pointer(eglSwapBuffers):=GetProcAddress(EGLLib,'eglSwapBuffers');
+    pointer(eglCopyBuffers):=GetProcAddress(EGLLib,'eglCopyBuffers');
+  end;
+
+initialization
+  EGLLib:=0;
+  LoadEGL({$ifdef windows}'libEGL.dll'{$else}'libEGL.so'{$endif});
+finalization
+  FreeEGL;
+end.
Index: packages/opengles/Makefile.fpc.fpcmake
===================================================================
--- packages/opengles/Makefile.fpc.fpcmake	(revision 26460)
+++ packages/opengles/Makefile.fpc.fpcmake	(working copy)
@@ -13,11 +13,13 @@
 [target]
 units_arm_darwin=gles11
 units_i386_iphonesim=gles11
+units_android=gles11
 units_linux=gles20
 units_wince=gles20
 units_win32=gles20
 units_win64=gles20
 units_darwin=gles20
+units_android=gles20
 exampledirs=examples
 
 [install]
Index: packages/opengles/examples/Makefile.fpc
===================================================================
--- packages/opengles/examples/Makefile.fpc	(revision 26460)
+++ packages/opengles/examples/Makefile.fpc	(working copy)
@@ -6,7 +6,7 @@
 programs=glutdemoes
 
 [require]
-packages=opengles
+packages=opengles egl
 
 [install]
 fpcpackage=y
Index: packages/opengles/examples/es2example1.pas
===================================================================
--- packages/opengles/examples/es2example1.pas	(revision 26460)
+++ packages/opengles/examples/es2example1.pas	(working copy)
@@ -14,7 +14,7 @@
  {$endif}
 {$endif}
 
-uses SysUtils,Classes,BaseUnix,Unix,UnixType,X,XLib,XUtil,XAtom{$ifdef ogles},gles20{$else},xf86vmode,GL,GLX,GLExt{$endif};
+uses SysUtils,Classes,BaseUnix,Unix,UnixType,X,XLib,XUtil,XAtom{$ifdef ogles},egl,gles20{$else},xf86vmode,GL,GLX,GLExt{$endif};
 
 const VertexArray:array[0..11] of single=(0,-1,0,1,
                                           1,1,0,1,
Index: packages/opengles/fpmake.pp
===================================================================
--- packages/opengles/fpmake.pp	(revision 26460)
+++ packages/opengles/fpmake.pp	(working copy)
@@ -21,18 +21,18 @@
     P.Author := 'Free Pascal Development team';
     P.License := 'LGPL with modification';
     P.HomepageURL := 'www.freepascal.org';
-    P.OSes := [darwin,iphonesim,linux,win32,win64,wince];
+    P.OSes := [android,darwin,iphonesim,linux,win32,win64,wince];
 
-    P.Dependencies.Add('x11',AllUnixOSes-[darwin,iphonesim]);
+    P.Dependencies.Add('egl',[linux,win32,win64,wince,darwin,android]);
+
     P.SourcePath.Add('src');
 
-    T:=P.Targets.AddUnit('gles11.pp',[darwin,iphonesim]);
-    T:=P.Targets.AddUnit('gles20.pas',[linux,win32,win64,wince,darwin]);
+    T:=P.Targets.AddUnit('gles11.pp',[darwin,iphonesim,android]);
+    T:=P.Targets.AddUnit('gles20.pas',[linux,win32,win64,wince,darwin,android]);
 
     P.Targets.AddExampleProgram('examples/es2example1.pas');
     P.Sources.AddExampleFiles('examples/*',false,'.');
 
-
 {$ifndef ALLPACKAGES}
     Run;
     end;
Index: packages/opengles/src/gles20.pas
===================================================================
--- packages/opengles/src/gles20.pas	(revision 26460)
+++ packages/opengles/src/gles20.pas	(working copy)
@@ -1,477 +1,26 @@
 {** OpenGL ES 2.0 headers 
  **
+ ** Separated from GLES/EGL by Dennis Fehr
+ **
  ** Ported/Translated for FreePascal by Benjamin 'BeRo' Rosseaux
  ** benjamin@rosseaux.com - http://www.rosseaux.com
  ** 
- ** EGL part:
- **
- ** Copyright (c) 2007-2009 The Khronos Group Inc.
- **
- ** Permission is hereby granted, free of charge, to any person obtaining a
- ** copy of this software and/or associated documentation files (the
- ** "Materials"), to deal in the Materials without restriction, including
- ** without limitation the rights to use, copy, modify, merge, publish,
- ** distribute, sublicense, and/or sell copies of the Materials, and to
- ** permit persons to whom the Materials are furnished to do so, subject to
- ** the following conditions:
- **
- ** The above copyright notice and this permission notice shall be included
- ** in all copies or substantial portions of the Materials.
- **
- ** THE MATERIALS ARE PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
- ** EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
- ** MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.
- ** IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY
- ** CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT,
- ** TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE 
- ** MATERIALS OR THE USE OR OTHER DEALINGS IN THE MATERIALS.
- **
- ** GLESv2 part:
- **
  ** This document is licensed under the SGI Free Software B License Version
  ** 2.0. For details, see http://oss.sgi.com/projects/FreeB/ 
  **}
 unit gles20;
+
 {$mode objfpc}
-{$ifdef linux}
-  {$define EGL}
-{$endif}
-{$ifdef windows}
-  {$define EGL}
-{$endif}
 
 interface
 
-uses SysUtils,dynlibs{$ifdef linux},x,xlib{$endif}{$ifdef windows},Windows{$endif};
+uses SysUtils,dynlibs{$ifdef windows},Windows{$endif};
 
 {$IFDEF FPC}
-{$PACKRECORDS C}
+  {$PACKRECORDS C}
 {$ENDIF}
 
-Type
-  Pchar  = ^char;
-  
-{$ifdef EGL}
 type
-  PEGLConfig  = ^EGLConfig;
-  PEGLint  = ^EGLint;
-     EGLint = {$ifdef win64}int64{$else}longint{$endif}; // Why int64 only on win64 and not even on 64-bit linux???
-
-     EGLConfig = pointer;
-
-  { EGL Types  }
-  { EGLint is defined in eglplatform.h  }
-
-  type
-
-{$ifdef linux}
-     EGLNativeDisplayType = PDisplay;
-
-     EGLNativeWindowType = TWindow;
-
-     EGLNativePixmapType = TPixmap;
-{$else linux}
-{$ifdef windows}
-     EGLNativeDisplayType = HDC;
-
-     EGLNativeWindowType = HWND;
-
-     EGLNativePixmapType = HBITMAP;
-{$else windows}
-     EGLNativeDisplayType = ptrint;
-
-     EGLNativeWindowType = pointer;
-
-     EGLNativePixmapType = pointer;
-{$endif windows}
-{$endif linux}
-
-     EGLBoolean = dword;
-
-     EGLenum = dword;
-
-
-     EGLContext = pointer;
-
-     EGLDisplay = pointer;
-
-     EGLSurface = pointer;
-
-     EGLClientBuffer = pointer;
-  { EGL Versioning  }
-
-  const
-     EGL_VERSION_1_0 = 1;     
-     EGL_VERSION_1_1 = 1;     
-     EGL_VERSION_1_2 = 1;     
-     EGL_VERSION_1_3 = 1;     
-     EGL_VERSION_1_4 = 1;     
-  { EGL Enumerants. Bitmasks and other exceptional cases aside, most
-   * enums are assigned unique values starting at 0x3000.
-    }
-  { EGL aliases  }
-     EGL_FALSE = 0;     
-     EGL_TRUE = 1;     
-  { Out-of-band handle values  }
-  { was #define dname def_expr }
-  function EGL_DEFAULT_DISPLAY : EGLNativeDisplayType;    
-
-  { was #define dname def_expr }
-  function EGL_NO_CONTEXT : EGLContext;    
-
-  { was #define dname def_expr }
-  function EGL_NO_DISPLAY : EGLDisplay;    
-
-  { was #define dname def_expr }
-  function EGL_NO_SURFACE : EGLSurface;    
-
-  { Out-of-band attribute value  }
-  { was #define dname def_expr }
-  function EGL_DONT_CARE : EGLint;    
-
-  { Errors / GetError return values  }
-
-  const
-     EGL_SUCCESS = $3000;     
-     EGL_NOT_INITIALIZED = $3001;     
-     EGL_BAD_ACCESS = $3002;     
-     EGL_BAD_ALLOC = $3003;     
-     EGL_BAD_ATTRIBUTE = $3004;     
-     EGL_BAD_CONFIG = $3005;     
-     EGL_BAD_CONTEXT = $3006;     
-     EGL_BAD_CURRENT_SURFACE = $3007;     
-     EGL_BAD_DISPLAY = $3008;     
-     EGL_BAD_MATCH = $3009;     
-     EGL_BAD_NATIVE_PIXMAP = $300A;     
-     EGL_BAD_NATIVE_WINDOW = $300B;     
-     EGL_BAD_PARAMETER = $300C;     
-     EGL_BAD_SURFACE = $300D;     
-  { EGL 1.1 - IMG_power_management  }
-     EGL_CONTEXT_LOST = $300E;     
-  { Reserved 0x300F-0x301F for additional errors  }
-  { Config attributes  }
-     EGL_BUFFER_SIZE = $3020;     
-     EGL_ALPHA_SIZE = $3021;     
-     EGL_BLUE_SIZE = $3022;     
-     EGL_GREEN_SIZE = $3023;     
-     EGL_RED_SIZE = $3024;     
-     EGL_DEPTH_SIZE = $3025;     
-     EGL_STENCIL_SIZE = $3026;     
-     EGL_CONFIG_CAVEAT = $3027;     
-     EGL_CONFIG_ID = $3028;     
-     EGL_LEVEL = $3029;     
-     EGL_MAX_PBUFFER_HEIGHT = $302A;     
-     EGL_MAX_PBUFFER_PIXELS = $302B;     
-     EGL_MAX_PBUFFER_WIDTH = $302C;     
-     EGL_NATIVE_RENDERABLE = $302D;     
-     EGL_NATIVE_VISUAL_ID = $302E;     
-     EGL_NATIVE_VISUAL_TYPE = $302F;     
-     EGL_PRESERVED_RESOURCES = $3030;     
-     EGL_SAMPLES = $3031;     
-     EGL_SAMPLE_BUFFERS = $3032;     
-     EGL_SURFACE_TYPE = $3033;     
-     EGL_TRANSPARENT_TYPE = $3034;     
-     EGL_TRANSPARENT_BLUE_VALUE = $3035;     
-     EGL_TRANSPARENT_GREEN_VALUE = $3036;     
-     EGL_TRANSPARENT_RED_VALUE = $3037;     
-  { Attrib list terminator  }
-     EGL_NONE = $3038;     
-     EGL_BIND_TO_TEXTURE_RGB = $3039;     
-     EGL_BIND_TO_TEXTURE_RGBA = $303A;     
-     EGL_MIN_SWAP_INTERVAL = $303B;     
-     EGL_MAX_SWAP_INTERVAL = $303C;     
-     EGL_LUMINANCE_SIZE = $303D;     
-     EGL_ALPHA_MASK_SIZE = $303E;     
-     EGL_COLOR_BUFFER_TYPE = $303F;     
-     EGL_RENDERABLE_TYPE = $3040;     
-  { Pseudo-attribute (not queryable)  }
-     EGL_MATCH_NATIVE_PIXMAP = $3041;     
-     EGL_CONFORMANT = $3042;     
-  { Reserved 0x3041-0x304F for additional config attributes  }
-  { Config attribute values  }
-  { EGL_CONFIG_CAVEAT value  }
-     EGL_SLOW_CONFIG = $3050;     
-  { EGL_CONFIG_CAVEAT value  }
-     EGL_NON_CONFORMANT_CONFIG = $3051;     
-  { EGL_TRANSPARENT_TYPE value  }
-     EGL_TRANSPARENT_RGB = $3052;     
-  { EGL_COLOR_BUFFER_TYPE value  }
-     EGL_RGB_BUFFER = $308E;     
-  { EGL_COLOR_BUFFER_TYPE value  }
-     EGL_LUMINANCE_BUFFER = $308F;     
-  { More config attribute values, for EGL_TEXTURE_FORMAT  }
-     EGL_NO_TEXTURE = $305C;     
-     EGL_TEXTURE_RGB = $305D;     
-     EGL_TEXTURE_RGBA = $305E;     
-     EGL_TEXTURE_2D = $305F;     
-  { Config attribute mask bits  }
-  { EGL_SURFACE_TYPE mask bits  }
-     EGL_PBUFFER_BIT = $0001;     
-  { EGL_SURFACE_TYPE mask bits  }
-     EGL_PIXMAP_BIT = $0002;     
-  { EGL_SURFACE_TYPE mask bits  }
-     EGL_WINDOW_BIT = $0004;     
-  { EGL_SURFACE_TYPE mask bits  }
-     EGL_VG_COLORSPACE_LINEAR_BIT = $0020;     
-  { EGL_SURFACE_TYPE mask bits  }
-     EGL_VG_ALPHA_FORMAT_PRE_BIT = $0040;     
-  { EGL_SURFACE_TYPE mask bits  }
-     EGL_MULTISAMPLE_RESOLVE_BOX_BIT = $0200;     
-  { EGL_SURFACE_TYPE mask bits  }
-     EGL_SWAP_BEHAVIOR_PRESERVED_BIT = $0400;     
-  { EGL_RENDERABLE_TYPE mask bits  }
-     EGL_OPENGL_ES_BIT = $0001;     
-  { EGL_RENDERABLE_TYPE mask bits  }
-     EGL_OPENVG_BIT = $0002;     
-  { EGL_RENDERABLE_TYPE mask bits  }
-     EGL_OPENGL_ES2_BIT = $0004;     
-  { EGL_RENDERABLE_TYPE mask bits  }
-     EGL_OPENGL_BIT = $0008;     
-  { QueryString targets  }
-     EGL_VENDOR = $3053;     
-     EGL_VERSION = $3054;     
-     EGL_EXTENSIONS = $3055;     
-     EGL_CLIENT_APIS = $308D;     
-  { QuerySurface / SurfaceAttrib / CreatePbufferSurface targets  }
-     EGL_HEIGHT = $3056;     
-     EGL_WIDTH = $3057;     
-     EGL_LARGEST_PBUFFER = $3058;     
-     EGL_TEXTURE_FORMAT = $3080;     
-     EGL_TEXTURE_TARGET = $3081;     
-     EGL_MIPMAP_TEXTURE = $3082;     
-     EGL_MIPMAP_LEVEL = $3083;     
-     EGL_RENDER_BUFFER = $3086;     
-     EGL_VG_COLORSPACE = $3087;     
-     EGL_VG_ALPHA_FORMAT = $3088;     
-     EGL_HORIZONTAL_RESOLUTION = $3090;     
-     EGL_VERTICAL_RESOLUTION = $3091;     
-     EGL_PIXEL_ASPECT_RATIO = $3092;     
-     EGL_SWAP_BEHAVIOR = $3093;     
-     EGL_MULTISAMPLE_RESOLVE = $3099;     
-  { EGL_RENDER_BUFFER values / BindTexImage / ReleaseTexImage buffer targets  }
-     EGL_BACK_BUFFER = $3084;     
-     EGL_SINGLE_BUFFER = $3085;     
-  { OpenVG color spaces  }
-  { EGL_VG_COLORSPACE value  }
-     EGL_VG_COLORSPACE_sRGB = $3089;     
-  { EGL_VG_COLORSPACE value  }
-     EGL_VG_COLORSPACE_LINEAR = $308A;     
-  { OpenVG alpha formats  }
-  { EGL_ALPHA_FORMAT value  }
-     EGL_VG_ALPHA_FORMAT_NONPRE = $308B;     
-  { EGL_ALPHA_FORMAT value  }
-     EGL_VG_ALPHA_FORMAT_PRE = $308C;     
-  { Constant scale factor by which fractional display resolutions &
-   * aspect ratio are scaled when queried as integer values.
-    }
-     EGL_DISPLAY_SCALING = 10000;     
-  { Unknown display resolution/aspect ratio  }
-  { was #define dname def_expr }
-  function EGL_UNKNOWN : EGLint;    
-
-  { Back buffer swap behaviors  }
-  { EGL_SWAP_BEHAVIOR value  }
-
-  const
-     EGL_BUFFER_PRESERVED = $3094;     
-  { EGL_SWAP_BEHAVIOR value  }
-     EGL_BUFFER_DESTROYED = $3095;     
-  { CreatePbufferFromClientBuffer buffer types  }
-     EGL_OPENVG_IMAGE = $3096;     
-  { QueryContext targets  }
-     EGL_CONTEXT_CLIENT_TYPE = $3097;     
-  { CreateContext attributes  }
-     EGL_CONTEXT_CLIENT_VERSION = $3098;     
-  { Multisample resolution behaviors  }
-  { EGL_MULTISAMPLE_RESOLVE value  }
-     EGL_MULTISAMPLE_RESOLVE_DEFAULT = $309A;     
-  { EGL_MULTISAMPLE_RESOLVE value  }
-     EGL_MULTISAMPLE_RESOLVE_BOX = $309B;     
-  { BindAPI/QueryAPI targets  }
-     EGL_OPENGL_ES_API = $30A0;     
-     EGL_OPENVG_API = $30A1;     
-     EGL_OPENGL_API = $30A2;     
-  { GetCurrentSurface targets  }
-     EGL_DRAW = $3059;     
-     EGL_READ = $305A;     
-  { WaitNative engines  }
-     EGL_CORE_NATIVE_ENGINE = $305B;     
-  { EGL 1.2 tokens renamed for consistency in EGL 1.3  }
-     EGL_COLORSPACE = EGL_VG_COLORSPACE;     
-     EGL_ALPHA_FORMAT = EGL_VG_ALPHA_FORMAT;     
-     EGL_COLORSPACE_sRGB = EGL_VG_COLORSPACE_sRGB;     
-     EGL_COLORSPACE_LINEAR = EGL_VG_COLORSPACE_LINEAR;     
-     EGL_ALPHA_FORMAT_NONPRE = EGL_VG_ALPHA_FORMAT_NONPRE;     
-     EGL_ALPHA_FORMAT_PRE = EGL_VG_ALPHA_FORMAT_PRE;     
-  { EGL extensions must request enum blocks from the Khronos
-   * API Registrar, who maintains the enumerant registry. Submit
-   * a bug in Khronos Bugzilla against task "Registry".
-    }
-  { EGL Functions  }
-
-  var
-    eglGetError : function:EGLint;{$ifdef windows}stdcall;{$else}cdecl;{$endif}
-    eglGetDisplay : function(display_id:EGLNativeDisplayType):EGLDisplay;{$ifdef windows}stdcall;{$else}cdecl;{$endif}
-    eglInitialize : function(dpy:EGLDisplay; major:pEGLint; minor:pEGLint):EGLBoolean;{$ifdef windows}stdcall;{$else}cdecl;{$endif}
-    eglTerminate : function(dpy:EGLDisplay):EGLBoolean;{$ifdef windows}stdcall;{$else}cdecl;{$endif}
-(* Const before type ignored *)
-    eglQueryString : function(dpy:EGLDisplay; name:EGLint):pchar;{$ifdef windows}stdcall;{$else}cdecl;{$endif}
-    eglGetConfigs : function(dpy:EGLDisplay; configs:pEGLConfig; config_size:EGLint; num_config:pEGLint):EGLBoolean;{$ifdef windows}stdcall;{$else}cdecl;{$endif}
-(* Const before type ignored *)
-    eglChooseConfig : function(dpy:EGLDisplay; attrib_list:pEGLint; configs:pEGLConfig; config_size:EGLint; num_config:pEGLint):EGLBoolean;{$ifdef windows}stdcall;{$else}cdecl;{$endif}
-    eglGetConfigAttrib : function(dpy:EGLDisplay; config:EGLConfig; attribute:EGLint; value:pEGLint):EGLBoolean;{$ifdef windows}stdcall;{$else}cdecl;{$endif}
-(* Const before type ignored *)
-    eglCreateWindowSurface : function(dpy:EGLDisplay; config:EGLConfig; win:EGLNativeWindowType; attrib_list:pEGLint):EGLSurface;{$ifdef windows}stdcall;{$else}cdecl;{$endif}
-(* Const before type ignored *)
-    eglCreatePbufferSurface : function(dpy:EGLDisplay; config:EGLConfig; attrib_list:pEGLint):EGLSurface;{$ifdef windows}stdcall;{$else}cdecl;{$endif}
-(* Const before type ignored *)
-    eglCreatePixmapSurface : function(dpy:EGLDisplay; config:EGLConfig; pixmap:EGLNativePixmapType; attrib_list:pEGLint):EGLSurface;{$ifdef windows}stdcall;{$else}cdecl;{$endif}
-    eglDestroySurface : function(dpy:EGLDisplay; surface:EGLSurface):EGLBoolean;{$ifdef windows}stdcall;{$else}cdecl;{$endif}
-    eglQuerySurface : function(dpy:EGLDisplay; surface:EGLSurface; attribute:EGLint; value:pEGLint):EGLBoolean;{$ifdef windows}stdcall;{$else}cdecl;{$endif}
-    eglBindAPI : function(api:EGLenum):EGLBoolean;{$ifdef windows}stdcall;{$else}cdecl;{$endif}
-    eglQueryAPI : function:EGLenum;{$ifdef windows}stdcall;{$else}cdecl;{$endif}
-    eglWaitClient : function:EGLBoolean;{$ifdef windows}stdcall;{$else}cdecl;{$endif}
-    eglReleaseThread : function:EGLBoolean;{$ifdef windows}stdcall;{$else}cdecl;{$endif}
-(* Const before type ignored *)
-    eglCreatePbufferFromClientBuffer : function(dpy:EGLDisplay; buftype:EGLenum; buffer:EGLClientBuffer; config:EGLConfig; attrib_list:pEGLint):EGLSurface;{$ifdef windows}stdcall;{$else}cdecl;{$endif}
-    eglSurfaceAttrib : function(dpy:EGLDisplay; surface:EGLSurface; attribute:EGLint; value:EGLint):EGLBoolean;{$ifdef windows}stdcall;{$else}cdecl;{$endif}
-    eglBindTexImage : function(dpy:EGLDisplay; surface:EGLSurface; buffer:EGLint):EGLBoolean;{$ifdef windows}stdcall;{$else}cdecl;{$endif}
-    eglReleaseTexImage : function(dpy:EGLDisplay; surface:EGLSurface; buffer:EGLint):EGLBoolean;{$ifdef windows}stdcall;{$else}cdecl;{$endif}
-    eglSwapInterval : function(dpy:EGLDisplay; interval:EGLint):EGLBoolean;{$ifdef windows}stdcall;{$else}cdecl;{$endif}
-(* Const before type ignored *)
-    eglCreateContext : function(dpy:EGLDisplay; config:EGLConfig; share_context:EGLContext; attrib_list:pEGLint):EGLContext;{$ifdef windows}stdcall;{$else}cdecl;{$endif}
-    eglDestroyContext : function(dpy:EGLDisplay; ctx:EGLContext):EGLBoolean;{$ifdef windows}stdcall;{$else}cdecl;{$endif}
-    eglMakeCurrent : function(dpy:EGLDisplay; draw:EGLSurface; read:EGLSurface; ctx:EGLContext):EGLBoolean;{$ifdef windows}stdcall;{$else}cdecl;{$endif}
-    eglGetCurrentContext : function:EGLContext;{$ifdef windows}stdcall;{$else}cdecl;{$endif}
-    eglGetCurrentSurface : function(readdraw:EGLint):EGLSurface;{$ifdef windows}stdcall;{$else}cdecl;{$endif}
-    eglGetCurrentDisplay : function:EGLDisplay;{$ifdef windows}stdcall;{$else}cdecl;{$endif}
-    eglQueryContext : function(dpy:EGLDisplay; ctx:EGLContext; attribute:EGLint; value:pEGLint):EGLBoolean;{$ifdef windows}stdcall;{$else}cdecl;{$endif}
-    eglWaitGL : function:EGLBoolean;{$ifdef windows}stdcall;{$else}cdecl;{$endif}
-    eglWaitNative : function(engine:EGLint):EGLBoolean;{$ifdef windows}stdcall;{$else}cdecl;{$endif}
-    eglSwapBuffers : function(dpy:EGLDisplay; surface:EGLSurface):EGLBoolean;{$ifdef windows}stdcall;{$else}cdecl;{$endif}
-    eglCopyBuffers : function(dpy:EGLDisplay; surface:EGLSurface; target:EGLNativePixmapType):EGLBoolean;{$ifdef windows}stdcall;{$else}cdecl;{$endif}
-  { This is a generic function pointer type, whose name indicates it must
-   * be cast to the proper type *and calling convention* before use.
-    }
-
-  type
-
-     __eglMustCastToProperFunctionPointerType = procedure (_para1:pointer);{$ifdef windows}stdcall;{$else}cdecl;{$endif}
-  { Now, define eglGetProcAddress using the generic function ptr. type  }
-(* Const before type ignored *)
-
-  var
-    eglGetProcAddress : function(procname:pchar):__eglMustCastToProperFunctionPointerType;{$ifdef windows}stdcall;{$else}cdecl;{$endif}
-  { Header file version number  }
-  { Current version at http://www.khronos.org/registry/egl/  }
-
-  const
-     EGL_EGLEXT_VERSION = 3;     
-     EGL_KHR_config_attribs = 1;     
-  { EGLConfig attribute  }
-     EGL_CONFORMANT_KHR = $3042;     
-  { EGL_SURFACE_TYPE bitfield  }
-     EGL_VG_COLORSPACE_LINEAR_BIT_KHR = $0020;     
-  { EGL_SURFACE_TYPE bitfield  }
-     EGL_VG_ALPHA_FORMAT_PRE_BIT_KHR = $0040;     
-     EGL_KHR_lock_surface = 1;     
-  { EGL_LOCK_USAGE_HINT_KHR bitfield  }
-     EGL_READ_SURFACE_BIT_KHR = $0001;     
-  { EGL_LOCK_USAGE_HINT_KHR bitfield  }
-     EGL_WRITE_SURFACE_BIT_KHR = $0002;     
-  { EGL_SURFACE_TYPE bitfield  }
-     EGL_LOCK_SURFACE_BIT_KHR = $0080;     
-  { EGL_SURFACE_TYPE bitfield  }
-     EGL_OPTIMAL_FORMAT_BIT_KHR = $0100;     
-  { EGLConfig attribute  }
-     EGL_MATCH_FORMAT_KHR = $3043;     
-  { EGL_MATCH_FORMAT_KHR value  }
-     EGL_FORMAT_RGB_565_EXACT_KHR = $30C0;     
-  { EGL_MATCH_FORMAT_KHR value  }
-     EGL_FORMAT_RGB_565_KHR = $30C1;     
-  { EGL_MATCH_FORMAT_KHR value  }
-     EGL_FORMAT_RGBA_8888_EXACT_KHR = $30C2;     
-  { EGL_MATCH_FORMAT_KHR value  }
-     EGL_FORMAT_RGBA_8888_KHR = $30C3;     
-  { eglLockSurfaceKHR attribute  }
-     EGL_MAP_PRESERVE_PIXELS_KHR = $30C4;     
-  { eglLockSurfaceKHR attribute  }
-     EGL_LOCK_USAGE_HINT_KHR = $30C5;     
-  { eglQuerySurface attribute  }
-     EGL_BITMAP_POINTER_KHR = $30C6;     
-  { eglQuerySurface attribute  }
-     EGL_BITMAP_PITCH_KHR = $30C7;     
-  { eglQuerySurface attribute  }
-     EGL_BITMAP_ORIGIN_KHR = $30C8;     
-  { eglQuerySurface attribute  }
-     EGL_BITMAP_PIXEL_RED_OFFSET_KHR = $30C9;     
-  { eglQuerySurface attribute  }
-     EGL_BITMAP_PIXEL_GREEN_OFFSET_KHR = $30CA;     
-  { eglQuerySurface attribute  }
-     EGL_BITMAP_PIXEL_BLUE_OFFSET_KHR = $30CB;     
-  { eglQuerySurface attribute  }
-     EGL_BITMAP_PIXEL_ALPHA_OFFSET_KHR = $30CC;     
-  { eglQuerySurface attribute  }
-     EGL_BITMAP_PIXEL_LUMINANCE_OFFSET_KHR = $30CD;     
-  { EGL_BITMAP_ORIGIN_KHR value  }
-     EGL_LOWER_LEFT_KHR = $30CE;     
-  { EGL_BITMAP_ORIGIN_KHR value  }
-     EGL_UPPER_LEFT_KHR = $30CF;     
-(* Const before type ignored *)
-
-  const
-     EGL_KHR_image = 1;     
-  { eglCreateImageKHR target  }
-     EGL_NATIVE_PIXMAP_KHR = $30B0;     
-
-type
-     EGLImageKHR = pointer;
-  { was #define dname def_expr }
-  function EGL_NO_IMAGE_KHR : EGLImageKHR;    
-
-(* Const before type ignored *)
-
-  const
-     EGL_KHR_vg_parent_image = 1;     
-  { eglCreateImageKHR target  }
-     EGL_VG_PARENT_IMAGE_KHR = $30BA;     
-     EGL_KHR_gl_texture_2D_image = 1;     
-  { eglCreateImageKHR target  }
-     EGL_GL_TEXTURE_2D_KHR = $30B1;     
-  { eglCreateImageKHR attribute  }
-     EGL_GL_TEXTURE_LEVEL_KHR = $30BC;     
-     EGL_KHR_gl_texture_cubemap_image = 1;     
-  { eglCreateImageKHR target  }
-     EGL_GL_TEXTURE_CUBE_MAP_POSITIVE_X_KHR = $30B3;     
-  { eglCreateImageKHR target  }
-     EGL_GL_TEXTURE_CUBE_MAP_NEGATIVE_X_KHR = $30B4;     
-  { eglCreateImageKHR target  }
-     EGL_GL_TEXTURE_CUBE_MAP_POSITIVE_Y_KHR = $30B5;     
-  { eglCreateImageKHR target  }
-     EGL_GL_TEXTURE_CUBE_MAP_NEGATIVE_Y_KHR = $30B6;     
-  { eglCreateImageKHR target  }
-     EGL_GL_TEXTURE_CUBE_MAP_POSITIVE_Z_KHR = $30B7;     
-  { eglCreateImageKHR target  }
-     EGL_GL_TEXTURE_CUBE_MAP_NEGATIVE_Z_KHR = $30B8;     
-     EGL_KHR_gl_texture_3D_image = 1;     
-  { eglCreateImageKHR target  }
-     EGL_GL_TEXTURE_3D_KHR = $30B2;     
-  { eglCreateImageKHR attribute  }
-     EGL_GL_TEXTURE_ZOFFSET_KHR = $30BD;     
-     EGL_KHR_gl_renderbuffer_image = 1;     
-  { eglCreateImageKHR target  }
-     EGL_GL_RENDERBUFFER_KHR = $30B9;     
-     EGL_KHR_image_base = 1;     
-  { Most interfaces defined by EGL_KHR_image_pixmap above  }
-  { eglCreateImageKHR attribute  }
-     EGL_IMAGE_PRESERVED_KHR = $30D2;     
-     EGL_KHR_image_pixmap = 1;     
-  { Interfaces defined by EGL_KHR_image above  }
-
-{$endif EGL}
-
-  
-type
   PGLubyte = ^GLubyte;
   PGLboolean  = ^GLboolean;
   PGLenum  = ^GLenum;
@@ -480,1396 +29,1241 @@
   PGLsizei  = ^GLsizei;
   PGLuint  = ^GLuint;
 
-  {-------------------------------------------------------------------------
-   * Data type definitions
-   *----------------------------------------------------------------------- }
+{-------------------------------------------------------------------------
+ * Data type definitions
+ *----------------------------------------------------------------------- }
 
-     GLvoid = pointer;
-     TGLvoid = GLvoid;
+   GLvoid = pointer;
+   TGLvoid = GLvoid;
 
-     GLenum = dword;
-     TGLenum = GLenum;
+   GLenum = dword;
+   TGLenum = GLenum;
 
-     GLboolean = byte;
-     TGLboolean = GLboolean;
+   GLboolean = byte;
+   TGLboolean = GLboolean;
 
-     GLbitfield = dword;
-     TGLbitfield = GLbitfield;
+   GLbitfield = dword;
+   TGLbitfield = GLbitfield;
 
-     GLbyte = shortint;
-     TGLbyte = GLbyte;
+   GLbyte = shortint;
+   TGLbyte = GLbyte;
 
-     GLshort = smallint;
-     TGLshort = GLshort;
+   GLshort = smallint;
+   TGLshort = GLshort;
 
-     GLint = longint;
-     TGLint = GLint;
+   GLint = longint;
+   TGLint = GLint;
 
-     GLsizei = longint;
-     TGLsizei = GLsizei;
+   GLsizei = longint;
+   TGLsizei = GLsizei;
 
-     GLubyte = byte;
-     TGLubyte = GLubyte;
+   GLubyte = byte;
+   TGLubyte = GLubyte;
 
-     GLushort = word;
-     TGLushort = GLushort;
+   GLushort = word;
+   TGLushort = GLushort;
 
-     GLuint = longword;
-     TGLuint = GLuint;
+   GLuint = longword;
+   TGLuint = GLuint;
 
-     GLfloat = single;
-     TGLfloat = GLfloat;
+   GLfloat = single;
+   TGLfloat = GLfloat;
 
-     GLclampf = single;
-     TGLclampf = GLclampf;
+   GLclampf = single;
+   TGLclampf = GLclampf;
 
-     GLfixed = longint;
-     TGLfixed = GLfixed;
-  { GL types for handling large vertex buffer objects  }
+   GLfixed = longint;
+   TGLfixed = GLfixed;
+{ GL types for handling large vertex buffer objects  }
 
-     GLintptr = ptrint;
+   GLintptr = ptrint;
 
-     GLsizeiptr = ptrint;
-  { OpenGL ES core versions  }
+   GLsizeiptr = ptrint;
+{ OpenGL ES core versions  }
 
-  const
-     GL_ES_VERSION_2_0 = 1;     
-  { ClearBufferMask  }
-     GL_DEPTH_BUFFER_BIT = $00000100;     
-     GL_STENCIL_BUFFER_BIT = $00000400;     
-     GL_COLOR_BUFFER_BIT = $00004000;     
-  { Boolean  }
-     GL_FALSE = 0;     
-     GL_TRUE = 1;     
-  { BeginMode  }
-     GL_POINTS = $0000;     
-     GL_LINES = $0001;     
-     GL_LINE_LOOP = $0002;     
-     GL_LINE_STRIP = $0003;     
-     GL_TRIANGLES = $0004;     
-     GL_TRIANGLE_STRIP = $0005;     
-     GL_TRIANGLE_FAN = $0006;     
-  { AlphaFunction (not supported in ES20)  }
-  {      GL_NEVER  }
-  {      GL_LESS  }
-  {      GL_EQUAL  }
-  {      GL_LEQUAL  }
-  {      GL_GREATER  }
-  {      GL_NOTEQUAL  }
-  {      GL_GEQUAL  }
-  {      GL_ALWAYS  }
-  { BlendingFactorDest  }
-     GL_ZERO = 0;     
-     GL_ONE = 1;     
-     GL_SRC_COLOR = $0300;     
-     GL_ONE_MINUS_SRC_COLOR = $0301;     
-     GL_SRC_ALPHA = $0302;     
-     GL_ONE_MINUS_SRC_ALPHA = $0303;     
-     GL_DST_ALPHA = $0304;     
-     GL_ONE_MINUS_DST_ALPHA = $0305;     
-  { BlendingFactorSrc  }
-  {      GL_ZERO  }
-  {      GL_ONE  }
-     GL_DST_COLOR = $0306;     
-     GL_ONE_MINUS_DST_COLOR = $0307;     
-     GL_SRC_ALPHA_SATURATE = $0308;     
-  {      GL_SRC_ALPHA  }
-  {      GL_ONE_MINUS_SRC_ALPHA  }
-  {      GL_DST_ALPHA  }
-  {      GL_ONE_MINUS_DST_ALPHA  }
-  { BlendEquationSeparate  }
-     GL_FUNC_ADD = $8006;     
-     GL_BLEND_EQUATION = $8009;     
-  { same as BLEND_EQUATION  }
-     GL_BLEND_EQUATION_RGB = $8009;     
-     GL_BLEND_EQUATION_ALPHA = $883D;     
-  { BlendSubtract  }
-     GL_FUNC_SUBTRACT = $800A;     
-     GL_FUNC_REVERSE_SUBTRACT = $800B;     
-  { Separate Blend Functions  }
-     GL_BLEND_DST_RGB = $80C8;     
-     GL_BLEND_SRC_RGB = $80C9;     
-     GL_BLEND_DST_ALPHA = $80CA;     
-     GL_BLEND_SRC_ALPHA = $80CB;     
-     GL_CONSTANT_COLOR = $8001;     
-     GL_ONE_MINUS_CONSTANT_COLOR = $8002;     
-     GL_CONSTANT_ALPHA = $8003;     
-     GL_ONE_MINUS_CONSTANT_ALPHA = $8004;     
-     GL_BLEND_COLOR = $8005;     
-  { Buffer Objects  }
-     GL_ARRAY_BUFFER = $8892;     
-     GL_ELEMENT_ARRAY_BUFFER = $8893;     
-     GL_ARRAY_BUFFER_BINDING = $8894;     
-     GL_ELEMENT_ARRAY_BUFFER_BINDING = $8895;     
-     GL_STREAM_DRAW = $88E0;     
-     GL_STATIC_DRAW = $88E4;     
-     GL_DYNAMIC_DRAW = $88E8;     
-     GL_BUFFER_SIZE = $8764;     
-     GL_BUFFER_USAGE = $8765;     
-     GL_CURRENT_VERTEX_ATTRIB = $8626;     
-  { CullFaceMode  }
-     GL_FRONT = $0404;     
-     GL_BACK = $0405;     
-     GL_FRONT_AND_BACK = $0408;     
-  { DepthFunction  }
-  {      GL_NEVER  }
-  {      GL_LESS  }
-  {      GL_EQUAL  }
-  {      GL_LEQUAL  }
-  {      GL_GREATER  }
-  {      GL_NOTEQUAL  }
-  {      GL_GEQUAL  }
-  {      GL_ALWAYS  }
-  { EnableCap  }
-     GL_TEXTURE_2D = $0DE1;     
-     GL_CULL_FACE = $0B44;     
-     GL_BLEND = $0BE2;     
-     GL_DITHER = $0BD0;     
-     GL_STENCIL_TEST = $0B90;     
-     GL_DEPTH_TEST = $0B71;     
-     GL_SCISSOR_TEST = $0C11;     
-     GL_POLYGON_OFFSET_FILL = $8037;     
-     GL_SAMPLE_ALPHA_TO_COVERAGE = $809E;     
-     GL_SAMPLE_COVERAGE = $80A0;     
-  { ErrorCode  }
-     GL_NO_ERROR = 0;     
-     GL_INVALID_ENUM = $0500;     
-     GL_INVALID_VALUE = $0501;     
-     GL_INVALID_OPERATION = $0502;     
-     GL_OUT_OF_MEMORY = $0505;     
-  { FrontFaceDirection  }
-     GL_CW = $0900;     
-     GL_CCW = $0901;     
-  { GetPName  }
-     GL_LINE_WIDTH = $0B21;     
-     GL_ALIASED_POINT_SIZE_RANGE = $846D;     
-     GL_ALIASED_LINE_WIDTH_RANGE = $846E;     
-     GL_CULL_FACE_MODE = $0B45;     
-     GL_FRONT_FACE = $0B46;     
-     GL_DEPTH_RANGE = $0B70;     
-     GL_DEPTH_WRITEMASK = $0B72;     
-     GL_DEPTH_CLEAR_VALUE = $0B73;     
-     GL_DEPTH_FUNC = $0B74;     
-     GL_STENCIL_CLEAR_VALUE = $0B91;     
-     GL_STENCIL_FUNC = $0B92;     
-     GL_STENCIL_FAIL = $0B94;     
-     GL_STENCIL_PASS_DEPTH_FAIL = $0B95;     
-     GL_STENCIL_PASS_DEPTH_PASS = $0B96;     
-     GL_STENCIL_REF = $0B97;     
-     GL_STENCIL_VALUE_MASK = $0B93;     
-     GL_STENCIL_WRITEMASK = $0B98;     
-     GL_STENCIL_BACK_FUNC = $8800;     
-     GL_STENCIL_BACK_FAIL = $8801;     
-     GL_STENCIL_BACK_PASS_DEPTH_FAIL = $8802;     
-     GL_STENCIL_BACK_PASS_DEPTH_PASS = $8803;     
-     GL_STENCIL_BACK_REF = $8CA3;     
-     GL_STENCIL_BACK_VALUE_MASK = $8CA4;     
-     GL_STENCIL_BACK_WRITEMASK = $8CA5;     
-     GL_VIEWPORT = $0BA2;     
-     GL_SCISSOR_BOX = $0C10;     
-  {      GL_SCISSOR_TEST  }
-     GL_COLOR_CLEAR_VALUE = $0C22;     
-     GL_COLOR_WRITEMASK = $0C23;     
-     GL_UNPACK_ALIGNMENT = $0CF5;     
-     GL_PACK_ALIGNMENT = $0D05;     
-     GL_MAX_TEXTURE_SIZE = $0D33;     
-     GL_MAX_VIEWPORT_DIMS = $0D3A;     
-     GL_SUBPIXEL_BITS = $0D50;     
-     GL_RED_BITS = $0D52;     
-     GL_GREEN_BITS = $0D53;     
-     GL_BLUE_BITS = $0D54;     
-     GL_ALPHA_BITS = $0D55;     
-     GL_DEPTH_BITS = $0D56;     
-     GL_STENCIL_BITS = $0D57;     
-     GL_POLYGON_OFFSET_UNITS = $2A00;     
-  {      GL_POLYGON_OFFSET_FILL  }
-     GL_POLYGON_OFFSET_FACTOR = $8038;     
-     GL_TEXTURE_BINDING_2D = $8069;     
-     GL_SAMPLE_BUFFERS = $80A8;     
-     GL_SAMPLES = $80A9;     
-     GL_SAMPLE_COVERAGE_VALUE = $80AA;     
-     GL_SAMPLE_COVERAGE_INVERT = $80AB;     
-  { GetTextureParameter  }
-  {      GL_TEXTURE_MAG_FILTER  }
-  {      GL_TEXTURE_MIN_FILTER  }
-  {      GL_TEXTURE_WRAP_S  }
-  {      GL_TEXTURE_WRAP_T  }
-     GL_NUM_COMPRESSED_TEXTURE_FORMATS = $86A2;     
-     GL_COMPRESSED_TEXTURE_FORMATS = $86A3;     
-  { HintMode  }
-     GL_DONT_CARE = $1100;     
-     GL_FASTEST = $1101;     
-     GL_NICEST = $1102;     
-  { HintTarget  }
-     GL_GENERATE_MIPMAP_HINT = $8192;     
-  { DataType  }
-     GL_BYTE = $1400;     
-     GL_UNSIGNED_BYTE = $1401;     
-     GL_SHORT = $1402;     
-     GL_UNSIGNED_SHORT = $1403;     
-     GL_INT = $1404;     
-     GL_UNSIGNED_INT = $1405;     
-     GL_FLOAT = $1406;     
-     GL_FIXED = $140C;     
-  { PixelFormat  }
-     GL_DEPTH_COMPONENT = $1902;     
-     GL_ALPHA = $1906;     
-     GL_RGB = $1907;     
-     GL_RGBA = $1908;     
-     GL_LUMINANCE = $1909;     
-     GL_LUMINANCE_ALPHA = $190A;     
-  { PixelType  }
-  {      GL_UNSIGNED_BYTE  }
-     GL_UNSIGNED_SHORT_4_4_4_4 = $8033;     
-     GL_UNSIGNED_SHORT_5_5_5_1 = $8034;     
-     GL_UNSIGNED_SHORT_5_6_5 = $8363;     
-  { Shaders  }
-     GL_FRAGMENT_SHADER = $8B30;     
-     GL_VERTEX_SHADER = $8B31;     
-     GL_MAX_VERTEX_ATTRIBS = $8869;     
-     GL_MAX_VERTEX_UNIFORM_VECTORS = $8DFB;     
-     GL_MAX_VARYING_VECTORS = $8DFC;     
-     GL_MAX_COMBINED_TEXTURE_IMAGE_UNITS = $8B4D;     
-     GL_MAX_VERTEX_TEXTURE_IMAGE_UNITS = $8B4C;     
-     GL_MAX_TEXTURE_IMAGE_UNITS = $8872;     
-     GL_MAX_FRAGMENT_UNIFORM_VECTORS = $8DFD;     
-     GL_SHADER_TYPE = $8B4F;     
-     GL_DELETE_STATUS = $8B80;     
-     GL_LINK_STATUS = $8B82;     
-     GL_VALIDATE_STATUS = $8B83;     
-     GL_ATTACHED_SHADERS = $8B85;     
-     GL_ACTIVE_UNIFORMS = $8B86;     
-     GL_ACTIVE_UNIFORM_MAX_LENGTH = $8B87;     
-     GL_ACTIVE_ATTRIBUTES = $8B89;     
-     GL_ACTIVE_ATTRIBUTE_MAX_LENGTH = $8B8A;     
-     GL_SHADING_LANGUAGE_VERSION = $8B8C;     
-     GL_CURRENT_PROGRAM = $8B8D;     
-  { StencilFunction  }
-     GL_NEVER = $0200;     
-     GL_LESS = $0201;     
-     GL_EQUAL = $0202;     
-     GL_LEQUAL = $0203;     
-     GL_GREATER = $0204;     
-     GL_NOTEQUAL = $0205;     
-     GL_GEQUAL = $0206;     
-     GL_ALWAYS = $0207;     
-  { StencilOp  }
-  {      GL_ZERO  }
-     GL_KEEP = $1E00;     
-     GL_REPLACE = $1E01;     
-     GL_INCR = $1E02;     
-     GL_DECR = $1E03;     
-     GL_INVERT = $150A;     
-     GL_INCR_WRAP = $8507;     
-     GL_DECR_WRAP = $8508;     
-  { StringName  }
-     GL_VENDOR = $1F00;     
-     GL_RENDERER = $1F01;     
-     GL_VERSION = $1F02;     
-     GL_EXTENSIONS = $1F03;     
-  { TextureMagFilter  }
-     GL_NEAREST = $2600;     
-     GL_LINEAR = $2601;     
-  { TextureMinFilter  }
-  {      GL_NEAREST  }
-  {      GL_LINEAR  }
-     GL_NEAREST_MIPMAP_NEAREST = $2700;     
-     GL_LINEAR_MIPMAP_NEAREST = $2701;     
-     GL_NEAREST_MIPMAP_LINEAR = $2702;     
-     GL_LINEAR_MIPMAP_LINEAR = $2703;     
-  { TextureParameterName  }
-     GL_TEXTURE_MAG_FILTER = $2800;     
-     GL_TEXTURE_MIN_FILTER = $2801;     
-     GL_TEXTURE_WRAP_S = $2802;     
-     GL_TEXTURE_WRAP_T = $2803;     
-  { TextureTarget  }
-  {      GL_TEXTURE_2D  }
-     GL_TEXTURE = $1702;     
-     GL_TEXTURE_CUBE_MAP = $8513;     
-     GL_TEXTURE_BINDING_CUBE_MAP = $8514;     
-     GL_TEXTURE_CUBE_MAP_POSITIVE_X = $8515;     
-     GL_TEXTURE_CUBE_MAP_NEGATIVE_X = $8516;     
-     GL_TEXTURE_CUBE_MAP_POSITIVE_Y = $8517;     
-     GL_TEXTURE_CUBE_MAP_NEGATIVE_Y = $8518;     
-     GL_TEXTURE_CUBE_MAP_POSITIVE_Z = $8519;     
-     GL_TEXTURE_CUBE_MAP_NEGATIVE_Z = $851A;     
-     GL_MAX_CUBE_MAP_TEXTURE_SIZE = $851C;     
-  { TextureUnit  }
-     GL_TEXTURE0 = $84C0;     
-     GL_TEXTURE1 = $84C1;     
-     GL_TEXTURE2 = $84C2;     
-     GL_TEXTURE3 = $84C3;     
-     GL_TEXTURE4 = $84C4;     
-     GL_TEXTURE5 = $84C5;     
-     GL_TEXTURE6 = $84C6;     
-     GL_TEXTURE7 = $84C7;     
-     GL_TEXTURE8 = $84C8;     
-     GL_TEXTURE9 = $84C9;     
-     GL_TEXTURE10 = $84CA;     
-     GL_TEXTURE11 = $84CB;     
-     GL_TEXTURE12 = $84CC;     
-     GL_TEXTURE13 = $84CD;     
-     GL_TEXTURE14 = $84CE;     
-     GL_TEXTURE15 = $84CF;     
-     GL_TEXTURE16 = $84D0;     
-     GL_TEXTURE17 = $84D1;     
-     GL_TEXTURE18 = $84D2;     
-     GL_TEXTURE19 = $84D3;     
-     GL_TEXTURE20 = $84D4;     
-     GL_TEXTURE21 = $84D5;     
-     GL_TEXTURE22 = $84D6;     
-     GL_TEXTURE23 = $84D7;     
-     GL_TEXTURE24 = $84D8;     
-     GL_TEXTURE25 = $84D9;     
-     GL_TEXTURE26 = $84DA;     
-     GL_TEXTURE27 = $84DB;     
-     GL_TEXTURE28 = $84DC;     
-     GL_TEXTURE29 = $84DD;     
-     GL_TEXTURE30 = $84DE;     
-     GL_TEXTURE31 = $84DF;     
-     GL_ACTIVE_TEXTURE = $84E0;     
-  { TextureWrapMode  }
-     GL_REPEAT = $2901;     
-     GL_CLAMP_TO_EDGE = $812F;     
-     GL_MIRRORED_REPEAT = $8370;     
-  { Uniform Types  }
-     GL_FLOAT_VEC2 = $8B50;     
-     GL_FLOAT_VEC3 = $8B51;     
-     GL_FLOAT_VEC4 = $8B52;     
-     GL_INT_VEC2 = $8B53;     
-     GL_INT_VEC3 = $8B54;     
-     GL_INT_VEC4 = $8B55;     
-     GL_BOOL = $8B56;     
-     GL_BOOL_VEC2 = $8B57;     
-     GL_BOOL_VEC3 = $8B58;     
-     GL_BOOL_VEC4 = $8B59;     
-     GL_FLOAT_MAT2 = $8B5A;     
-     GL_FLOAT_MAT3 = $8B5B;     
-     GL_FLOAT_MAT4 = $8B5C;     
-     GL_SAMPLER_2D = $8B5E;     
-     GL_SAMPLER_CUBE = $8B60;     
-  { Vertex Arrays  }
-     GL_VERTEX_ATTRIB_ARRAY_ENABLED = $8622;     
-     GL_VERTEX_ATTRIB_ARRAY_SIZE = $8623;     
-     GL_VERTEX_ATTRIB_ARRAY_STRIDE = $8624;     
-     GL_VERTEX_ATTRIB_ARRAY_TYPE = $8625;     
-     GL_VERTEX_ATTRIB_ARRAY_NORMALIZED = $886A;     
-     GL_VERTEX_ATTRIB_ARRAY_POINTER = $8645;     
-     GL_VERTEX_ATTRIB_ARRAY_BUFFER_BINDING = $889F;     
-  { Read Format  }
-     GL_IMPLEMENTATION_COLOR_READ_TYPE = $8B9A;     
-     GL_IMPLEMENTATION_COLOR_READ_FORMAT = $8B9B;     
-  { Shader Source  }
-     GL_COMPILE_STATUS = $8B81;     
-     GL_INFO_LOG_LENGTH = $8B84;     
-     GL_SHADER_SOURCE_LENGTH = $8B88;     
-     GL_SHADER_COMPILER = $8DFA;     
-  { Shader Binary  }
-     GL_SHADER_BINARY_FORMATS = $8DF8;     
-     GL_NUM_SHADER_BINARY_FORMATS = $8DF9;     
-  { Shader Precision-Specified Types  }
-     GL_LOW_FLOAT = $8DF0;     
-     GL_MEDIUM_FLOAT = $8DF1;     
-     GL_HIGH_FLOAT = $8DF2;     
-     GL_LOW_INT = $8DF3;     
-     GL_MEDIUM_INT = $8DF4;     
-     GL_HIGH_INT = $8DF5;     
-  { Framebuffer Object.  }
-     GL_FRAMEBUFFER = $8D40;     
-     GL_RENDERBUFFER = $8D41;     
-     GL_RGBA4 = $8056;     
-     GL_RGB5_A1 = $8057;     
-     GL_RGB565 = $8D62;     
-     GL_DEPTH_COMPONENT16 = $81A5;     
-     GL_STENCIL_INDEX = $1901;     
-     GL_STENCIL_INDEX8 = $8D48;     
-     GL_RENDERBUFFER_WIDTH = $8D42;     
-     GL_RENDERBUFFER_HEIGHT = $8D43;     
-     GL_RENDERBUFFER_INTERNAL_FORMAT = $8D44;     
-     GL_RENDERBUFFER_RED_SIZE = $8D50;     
-     GL_RENDERBUFFER_GREEN_SIZE = $8D51;     
-     GL_RENDERBUFFER_BLUE_SIZE = $8D52;     
-     GL_RENDERBUFFER_ALPHA_SIZE = $8D53;     
-     GL_RENDERBUFFER_DEPTH_SIZE = $8D54;     
-     GL_RENDERBUFFER_STENCIL_SIZE = $8D55;     
-     GL_FRAMEBUFFER_ATTACHMENT_OBJECT_TYPE = $8CD0;     
-     GL_FRAMEBUFFER_ATTACHMENT_OBJECT_NAME = $8CD1;     
-     GL_FRAMEBUFFER_ATTACHMENT_TEXTURE_LEVEL = $8CD2;     
-     GL_FRAMEBUFFER_ATTACHMENT_TEXTURE_CUBE_MAP_FACE = $8CD3;     
-     GL_COLOR_ATTACHMENT0 = $8CE0;     
-     GL_DEPTH_ATTACHMENT = $8D00;     
-     GL_STENCIL_ATTACHMENT = $8D20;     
-     GL_NONE = 0;     
-     GL_FRAMEBUFFER_COMPLETE = $8CD5;     
-     GL_FRAMEBUFFER_INCOMPLETE_ATTACHMENT = $8CD6;     
-     GL_FRAMEBUFFER_INCOMPLETE_MISSING_ATTACHMENT = $8CD7;     
-     GL_FRAMEBUFFER_INCOMPLETE_DIMENSIONS = $8CD9;     
-     GL_FRAMEBUFFER_UNSUPPORTED = $8CDD;     
-     GL_FRAMEBUFFER_BINDING = $8CA6;     
-     GL_RENDERBUFFER_BINDING = $8CA7;     
-     GL_MAX_RENDERBUFFER_SIZE = $84E8;     
-     GL_INVALID_FRAMEBUFFER_OPERATION = $0506;     
-  {-------------------------------------------------------------------------
-   * GL core functions.
-   *----------------------------------------------------------------------- }
+const
+   GL_ES_VERSION_2_0 = 1;
+{ ClearBufferMask  }
+   GL_DEPTH_BUFFER_BIT = $00000100;
+   GL_STENCIL_BUFFER_BIT = $00000400;
+   GL_COLOR_BUFFER_BIT = $00004000;
+{ Boolean  }
+   GL_FALSE = 0;
+   GL_TRUE = 1;
+{ BeginMode  }
+   GL_POINTS = $0000;
+   GL_LINES = $0001;
+   GL_LINE_LOOP = $0002;
+   GL_LINE_STRIP = $0003;
+   GL_TRIANGLES = $0004;
+   GL_TRIANGLE_STRIP = $0005;
+   GL_TRIANGLE_FAN = $0006;
+{ AlphaFunction (not supported in ES20)  }
+{      GL_NEVER  }
+{      GL_LESS  }
+{      GL_EQUAL  }
+{      GL_LEQUAL  }
+{      GL_GREATER  }
+{      GL_NOTEQUAL  }
+{      GL_GEQUAL  }
+{      GL_ALWAYS  }
+{ BlendingFactorDest  }
+   GL_ZERO = 0;
+   GL_ONE = 1;
+   GL_SRC_COLOR = $0300;
+   GL_ONE_MINUS_SRC_COLOR = $0301;
+   GL_SRC_ALPHA = $0302;
+   GL_ONE_MINUS_SRC_ALPHA = $0303;
+   GL_DST_ALPHA = $0304;
+   GL_ONE_MINUS_DST_ALPHA = $0305;
+{ BlendingFactorSrc  }
+{      GL_ZERO  }
+{      GL_ONE  }
+   GL_DST_COLOR = $0306;
+   GL_ONE_MINUS_DST_COLOR = $0307;
+   GL_SRC_ALPHA_SATURATE = $0308;
+{      GL_SRC_ALPHA  }
+{      GL_ONE_MINUS_SRC_ALPHA  }
+{      GL_DST_ALPHA  }
+{      GL_ONE_MINUS_DST_ALPHA  }
+{ BlendEquationSeparate  }
+   GL_FUNC_ADD = $8006;
+   GL_BLEND_EQUATION = $8009;
+{ same as BLEND_EQUATION  }
+   GL_BLEND_EQUATION_RGB = $8009;
+   GL_BLEND_EQUATION_ALPHA = $883D;
+{ BlendSubtract  }
+   GL_FUNC_SUBTRACT = $800A;
+   GL_FUNC_REVERSE_SUBTRACT = $800B;
+{ Separate Blend Functions  }
+   GL_BLEND_DST_RGB = $80C8;
+   GL_BLEND_SRC_RGB = $80C9;
+   GL_BLEND_DST_ALPHA = $80CA;
+   GL_BLEND_SRC_ALPHA = $80CB;
+   GL_CONSTANT_COLOR = $8001;
+   GL_ONE_MINUS_CONSTANT_COLOR = $8002;
+   GL_CONSTANT_ALPHA = $8003;
+   GL_ONE_MINUS_CONSTANT_ALPHA = $8004;
+   GL_BLEND_COLOR = $8005;
+{ Buffer Objects  }
+   GL_ARRAY_BUFFER = $8892;
+   GL_ELEMENT_ARRAY_BUFFER = $8893;
+   GL_ARRAY_BUFFER_BINDING = $8894;
+   GL_ELEMENT_ARRAY_BUFFER_BINDING = $8895;
+   GL_STREAM_DRAW = $88E0;
+   GL_STATIC_DRAW = $88E4;
+   GL_DYNAMIC_DRAW = $88E8;
+   GL_BUFFER_SIZE = $8764;
+   GL_BUFFER_USAGE = $8765;
+   GL_CURRENT_VERTEX_ATTRIB = $8626;
+{ CullFaceMode  }
+   GL_FRONT = $0404;
+   GL_BACK = $0405;
+   GL_FRONT_AND_BACK = $0408;
+{ DepthFunction  }
+{      GL_NEVER  }
+{      GL_LESS  }
+{      GL_EQUAL  }
+{      GL_LEQUAL  }
+{      GL_GREATER  }
+{      GL_NOTEQUAL  }
+{      GL_GEQUAL  }
+{      GL_ALWAYS  }
+{ EnableCap  }
+   GL_TEXTURE_2D = $0DE1;
+   GL_CULL_FACE = $0B44;
+   GL_BLEND = $0BE2;
+   GL_DITHER = $0BD0;
+   GL_STENCIL_TEST = $0B90;
+   GL_DEPTH_TEST = $0B71;
+   GL_SCISSOR_TEST = $0C11;
+   GL_POLYGON_OFFSET_FILL = $8037;
+   GL_SAMPLE_ALPHA_TO_COVERAGE = $809E;
+   GL_SAMPLE_COVERAGE = $80A0;
+{ ErrorCode  }
+   GL_NO_ERROR = 0;
+   GL_INVALID_ENUM = $0500;
+   GL_INVALID_VALUE = $0501;
+   GL_INVALID_OPERATION = $0502;
+   GL_OUT_OF_MEMORY = $0505;
+{ FrontFaceDirection  }
+   GL_CW = $0900;
+   GL_CCW = $0901;
+{ GetPName  }
+   GL_LINE_WIDTH = $0B21;
+   GL_ALIASED_POINT_SIZE_RANGE = $846D;
+   GL_ALIASED_LINE_WIDTH_RANGE = $846E;
+   GL_CULL_FACE_MODE = $0B45;
+   GL_FRONT_FACE = $0B46;
+   GL_DEPTH_RANGE = $0B70;
+   GL_DEPTH_WRITEMASK = $0B72;
+   GL_DEPTH_CLEAR_VALUE = $0B73;
+   GL_DEPTH_FUNC = $0B74;
+   GL_STENCIL_CLEAR_VALUE = $0B91;
+   GL_STENCIL_FUNC = $0B92;
+   GL_STENCIL_FAIL = $0B94;
+   GL_STENCIL_PASS_DEPTH_FAIL = $0B95;
+   GL_STENCIL_PASS_DEPTH_PASS = $0B96;
+   GL_STENCIL_REF = $0B97;
+   GL_STENCIL_VALUE_MASK = $0B93;
+   GL_STENCIL_WRITEMASK = $0B98;
+   GL_STENCIL_BACK_FUNC = $8800;
+   GL_STENCIL_BACK_FAIL = $8801;
+   GL_STENCIL_BACK_PASS_DEPTH_FAIL = $8802;
+   GL_STENCIL_BACK_PASS_DEPTH_PASS = $8803;
+   GL_STENCIL_BACK_REF = $8CA3;
+   GL_STENCIL_BACK_VALUE_MASK = $8CA4;
+   GL_STENCIL_BACK_WRITEMASK = $8CA5;
+   GL_VIEWPORT = $0BA2;
+   GL_SCISSOR_BOX = $0C10;
+{      GL_SCISSOR_TEST  }
+   GL_COLOR_CLEAR_VALUE = $0C22;
+   GL_COLOR_WRITEMASK = $0C23;
+   GL_UNPACK_ALIGNMENT = $0CF5;
+   GL_PACK_ALIGNMENT = $0D05;
+   GL_MAX_TEXTURE_SIZE = $0D33;
+   GL_MAX_VIEWPORT_DIMS = $0D3A;
+   GL_SUBPIXEL_BITS = $0D50;
+   GL_RED_BITS = $0D52;
+   GL_GREEN_BITS = $0D53;
+   GL_BLUE_BITS = $0D54;
+   GL_ALPHA_BITS = $0D55;
+   GL_DEPTH_BITS = $0D56;
+   GL_STENCIL_BITS = $0D57;
+   GL_POLYGON_OFFSET_UNITS = $2A00;
+{      GL_POLYGON_OFFSET_FILL  }
+   GL_POLYGON_OFFSET_FACTOR = $8038;
+   GL_TEXTURE_BINDING_2D = $8069;
+   GL_SAMPLE_BUFFERS = $80A8;
+   GL_SAMPLES = $80A9;
+   GL_SAMPLE_COVERAGE_VALUE = $80AA;
+   GL_SAMPLE_COVERAGE_INVERT = $80AB;
+{ GetTextureParameter  }
+{      GL_TEXTURE_MAG_FILTER  }
+{      GL_TEXTURE_MIN_FILTER  }
+{      GL_TEXTURE_WRAP_S  }
+{      GL_TEXTURE_WRAP_T  }
+   GL_NUM_COMPRESSED_TEXTURE_FORMATS = $86A2;
+   GL_COMPRESSED_TEXTURE_FORMATS = $86A3;
+{ HintMode  }
+   GL_DONT_CARE = $1100;
+   GL_FASTEST = $1101;
+   GL_NICEST = $1102;
+{ HintTarget  }
+   GL_GENERATE_MIPMAP_HINT = $8192;
+{ DataType  }
+   GL_BYTE = $1400;
+   GL_UNSIGNED_BYTE = $1401;
+   GL_SHORT = $1402;
+   GL_UNSIGNED_SHORT = $1403;
+   GL_INT = $1404;
+   GL_UNSIGNED_INT = $1405;
+   GL_FLOAT = $1406;
+   GL_FIXED = $140C;
+{ PixelFormat  }
+   GL_DEPTH_COMPONENT = $1902;
+   GL_ALPHA = $1906;
+   GL_RGB = $1907;
+   GL_RGBA = $1908;
+   GL_LUMINANCE = $1909;
+   GL_LUMINANCE_ALPHA = $190A;
+{ PixelType  }
+{      GL_UNSIGNED_BYTE  }
+   GL_UNSIGNED_SHORT_4_4_4_4 = $8033;
+   GL_UNSIGNED_SHORT_5_5_5_1 = $8034;
+   GL_UNSIGNED_SHORT_5_6_5 = $8363;
+{ Shaders  }
+   GL_FRAGMENT_SHADER = $8B30;
+   GL_VERTEX_SHADER = $8B31;
+   GL_MAX_VERTEX_ATTRIBS = $8869;
+   GL_MAX_VERTEX_UNIFORM_VECTORS = $8DFB;
+   GL_MAX_VARYING_VECTORS = $8DFC;
+   GL_MAX_COMBINED_TEXTURE_IMAGE_UNITS = $8B4D;
+   GL_MAX_VERTEX_TEXTURE_IMAGE_UNITS = $8B4C;
+   GL_MAX_TEXTURE_IMAGE_UNITS = $8872;
+   GL_MAX_FRAGMENT_UNIFORM_VECTORS = $8DFD;
+   GL_SHADER_TYPE = $8B4F;
+   GL_DELETE_STATUS = $8B80;
+   GL_LINK_STATUS = $8B82;
+   GL_VALIDATE_STATUS = $8B83;
+   GL_ATTACHED_SHADERS = $8B85;
+   GL_ACTIVE_UNIFORMS = $8B86;
+   GL_ACTIVE_UNIFORM_MAX_LENGTH = $8B87;
+   GL_ACTIVE_ATTRIBUTES = $8B89;
+   GL_ACTIVE_ATTRIBUTE_MAX_LENGTH = $8B8A;
+   GL_SHADING_LANGUAGE_VERSION = $8B8C;
+   GL_CURRENT_PROGRAM = $8B8D;
+{ StencilFunction  }
+   GL_NEVER = $0200;
+   GL_LESS = $0201;
+   GL_EQUAL = $0202;
+   GL_LEQUAL = $0203;
+   GL_GREATER = $0204;
+   GL_NOTEQUAL = $0205;
+   GL_GEQUAL = $0206;
+   GL_ALWAYS = $0207;
+{ StencilOp  }
+{      GL_ZERO  }
+   GL_KEEP = $1E00;
+   GL_REPLACE = $1E01;
+   GL_INCR = $1E02;
+   GL_DECR = $1E03;
+   GL_INVERT = $150A;
+   GL_INCR_WRAP = $8507;
+   GL_DECR_WRAP = $8508;
+{ StringName  }
+   GL_VENDOR = $1F00;
+   GL_RENDERER = $1F01;
+   GL_VERSION = $1F02;
+   GL_EXTENSIONS = $1F03;
+{ TextureMagFilter  }
+   GL_NEAREST = $2600;
+   GL_LINEAR = $2601;
+{ TextureMinFilter  }
+{      GL_NEAREST  }
+{      GL_LINEAR  }
+   GL_NEAREST_MIPMAP_NEAREST = $2700;
+   GL_LINEAR_MIPMAP_NEAREST = $2701;
+   GL_NEAREST_MIPMAP_LINEAR = $2702;
+   GL_LINEAR_MIPMAP_LINEAR = $2703;
+{ TextureParameterName  }
+   GL_TEXTURE_MAG_FILTER = $2800;
+   GL_TEXTURE_MIN_FILTER = $2801;
+   GL_TEXTURE_WRAP_S = $2802;
+   GL_TEXTURE_WRAP_T = $2803;
+{ TextureTarget  }
+{      GL_TEXTURE_2D  }
+   GL_TEXTURE = $1702;
+   GL_TEXTURE_CUBE_MAP = $8513;
+   GL_TEXTURE_BINDING_CUBE_MAP = $8514;
+   GL_TEXTURE_CUBE_MAP_POSITIVE_X = $8515;
+   GL_TEXTURE_CUBE_MAP_NEGATIVE_X = $8516;
+   GL_TEXTURE_CUBE_MAP_POSITIVE_Y = $8517;
+   GL_TEXTURE_CUBE_MAP_NEGATIVE_Y = $8518;
+   GL_TEXTURE_CUBE_MAP_POSITIVE_Z = $8519;
+   GL_TEXTURE_CUBE_MAP_NEGATIVE_Z = $851A;
+   GL_MAX_CUBE_MAP_TEXTURE_SIZE = $851C;
+{ TextureUnit  }
+   GL_TEXTURE0 = $84C0;
+   GL_TEXTURE1 = $84C1;
+   GL_TEXTURE2 = $84C2;
+   GL_TEXTURE3 = $84C3;
+   GL_TEXTURE4 = $84C4;
+   GL_TEXTURE5 = $84C5;
+   GL_TEXTURE6 = $84C6;
+   GL_TEXTURE7 = $84C7;
+   GL_TEXTURE8 = $84C8;
+   GL_TEXTURE9 = $84C9;
+   GL_TEXTURE10 = $84CA;
+   GL_TEXTURE11 = $84CB;
+   GL_TEXTURE12 = $84CC;
+   GL_TEXTURE13 = $84CD;
+   GL_TEXTURE14 = $84CE;
+   GL_TEXTURE15 = $84CF;
+   GL_TEXTURE16 = $84D0;
+   GL_TEXTURE17 = $84D1;
+   GL_TEXTURE18 = $84D2;
+   GL_TEXTURE19 = $84D3;
+   GL_TEXTURE20 = $84D4;
+   GL_TEXTURE21 = $84D5;
+   GL_TEXTURE22 = $84D6;
+   GL_TEXTURE23 = $84D7;
+   GL_TEXTURE24 = $84D8;
+   GL_TEXTURE25 = $84D9;
+   GL_TEXTURE26 = $84DA;
+   GL_TEXTURE27 = $84DB;
+   GL_TEXTURE28 = $84DC;
+   GL_TEXTURE29 = $84DD;
+   GL_TEXTURE30 = $84DE;
+   GL_TEXTURE31 = $84DF;
+   GL_ACTIVE_TEXTURE = $84E0;
+{ TextureWrapMode  }
+   GL_REPEAT = $2901;
+   GL_CLAMP_TO_EDGE = $812F;
+   GL_MIRRORED_REPEAT = $8370;
+{ Uniform Types  }
+   GL_FLOAT_VEC2 = $8B50;
+   GL_FLOAT_VEC3 = $8B51;
+   GL_FLOAT_VEC4 = $8B52;
+   GL_INT_VEC2 = $8B53;
+   GL_INT_VEC3 = $8B54;
+   GL_INT_VEC4 = $8B55;
+   GL_BOOL = $8B56;
+   GL_BOOL_VEC2 = $8B57;
+   GL_BOOL_VEC3 = $8B58;
+   GL_BOOL_VEC4 = $8B59;
+   GL_FLOAT_MAT2 = $8B5A;
+   GL_FLOAT_MAT3 = $8B5B;
+   GL_FLOAT_MAT4 = $8B5C;
+   GL_SAMPLER_2D = $8B5E;
+   GL_SAMPLER_CUBE = $8B60;
+{ Vertex Arrays  }
+   GL_VERTEX_ATTRIB_ARRAY_ENABLED = $8622;
+   GL_VERTEX_ATTRIB_ARRAY_SIZE = $8623;
+   GL_VERTEX_ATTRIB_ARRAY_STRIDE = $8624;
+   GL_VERTEX_ATTRIB_ARRAY_TYPE = $8625;
+   GL_VERTEX_ATTRIB_ARRAY_NORMALIZED = $886A;
+   GL_VERTEX_ATTRIB_ARRAY_POINTER = $8645;
+   GL_VERTEX_ATTRIB_ARRAY_BUFFER_BINDING = $889F;
+{ Read Format  }
+   GL_IMPLEMENTATION_COLOR_READ_TYPE = $8B9A;
+   GL_IMPLEMENTATION_COLOR_READ_FORMAT = $8B9B;
+{ Shader Source  }
+   GL_COMPILE_STATUS = $8B81;
+   GL_INFO_LOG_LENGTH = $8B84;
+   GL_SHADER_SOURCE_LENGTH = $8B88;
+   GL_SHADER_COMPILER = $8DFA;
+{ Shader Binary  }
+   GL_SHADER_BINARY_FORMATS = $8DF8;
+   GL_NUM_SHADER_BINARY_FORMATS = $8DF9;
+{ Shader Precision-Specified Types  }
+   GL_LOW_FLOAT = $8DF0;
+   GL_MEDIUM_FLOAT = $8DF1;
+   GL_HIGH_FLOAT = $8DF2;
+   GL_LOW_INT = $8DF3;
+   GL_MEDIUM_INT = $8DF4;
+   GL_HIGH_INT = $8DF5;
+{ Framebuffer Object.  }
+   GL_FRAMEBUFFER = $8D40;
+   GL_RENDERBUFFER = $8D41;
+   GL_RGBA4 = $8056;
+   GL_RGB5_A1 = $8057;
+   GL_RGB565 = $8D62;
+   GL_DEPTH_COMPONENT16 = $81A5;
+   GL_STENCIL_INDEX = $1901;
+   GL_STENCIL_INDEX8 = $8D48;
+   GL_RENDERBUFFER_WIDTH = $8D42;
+   GL_RENDERBUFFER_HEIGHT = $8D43;
+   GL_RENDERBUFFER_INTERNAL_FORMAT = $8D44;
+   GL_RENDERBUFFER_RED_SIZE = $8D50;
+   GL_RENDERBUFFER_GREEN_SIZE = $8D51;
+   GL_RENDERBUFFER_BLUE_SIZE = $8D52;
+   GL_RENDERBUFFER_ALPHA_SIZE = $8D53;
+   GL_RENDERBUFFER_DEPTH_SIZE = $8D54;
+   GL_RENDERBUFFER_STENCIL_SIZE = $8D55;
+   GL_FRAMEBUFFER_ATTACHMENT_OBJECT_TYPE = $8CD0;
+   GL_FRAMEBUFFER_ATTACHMENT_OBJECT_NAME = $8CD1;
+   GL_FRAMEBUFFER_ATTACHMENT_TEXTURE_LEVEL = $8CD2;
+   GL_FRAMEBUFFER_ATTACHMENT_TEXTURE_CUBE_MAP_FACE = $8CD3;
+   GL_COLOR_ATTACHMENT0 = $8CE0;
+   GL_DEPTH_ATTACHMENT = $8D00;
+   GL_STENCIL_ATTACHMENT = $8D20;
+   GL_NONE = 0;
+   GL_FRAMEBUFFER_COMPLETE = $8CD5;
+   GL_FRAMEBUFFER_INCOMPLETE_ATTACHMENT = $8CD6;
+   GL_FRAMEBUFFER_INCOMPLETE_MISSING_ATTACHMENT = $8CD7;
+   GL_FRAMEBUFFER_INCOMPLETE_DIMENSIONS = $8CD9;
+   GL_FRAMEBUFFER_UNSUPPORTED = $8CDD;
+   GL_FRAMEBUFFER_BINDING = $8CA6;
+   GL_RENDERBUFFER_BINDING = $8CA7;
+   GL_MAX_RENDERBUFFER_SIZE = $84E8;
+   GL_INVALID_FRAMEBUFFER_OPERATION = $0506;
+{-------------------------------------------------------------------------
+ * GL core functions.
+ *----------------------------------------------------------------------- }
 
-  var
-    glActiveTexture : procedure(texture:GLenum);{$ifdef windows}stdcall;{$else}cdecl;{$endif}
-    glAttachShader : procedure(_program:GLuint; shader:GLuint);{$ifdef windows}stdcall;{$else}cdecl;{$endif}
+var
+  glActiveTexture : procedure(texture:GLenum);{$ifdef windows}stdcall;{$else}cdecl;{$endif}
+  glAttachShader : procedure(_program:GLuint; shader:GLuint);{$ifdef windows}stdcall;{$else}cdecl;{$endif}
 (* Const before type ignored *)
-    glBindAttribLocation : procedure(_program:GLuint; index:GLuint; name:pchar);{$ifdef windows}stdcall;{$else}cdecl;{$endif}
-    glBindBuffer : procedure(target:GLenum; buffer:GLuint);{$ifdef windows}stdcall;{$else}cdecl;{$endif}
-    glBindFramebuffer : procedure(target:GLenum; framebuffer:GLuint);{$ifdef windows}stdcall;{$else}cdecl;{$endif}
-    glBindRenderbuffer : procedure(target:GLenum; renderbuffer:GLuint);{$ifdef windows}stdcall;{$else}cdecl;{$endif}
-    glBindTexture : procedure(target:GLenum; texture:GLuint);{$ifdef windows}stdcall;{$else}cdecl;{$endif}
-    glBlendColor : procedure(red:GLclampf; green:GLclampf; blue:GLclampf; alpha:GLclampf);{$ifdef windows}stdcall;{$else}cdecl;{$endif}
-    glBlendEquation : procedure(mode:GLenum);{$ifdef windows}stdcall;{$else}cdecl;{$endif}
-    glBlendEquationSeparate : procedure(modeRGB:GLenum; modeAlpha:GLenum);{$ifdef windows}stdcall;{$else}cdecl;{$endif}
-    glBlendFunc : procedure(sfactor:GLenum; dfactor:GLenum);{$ifdef windows}stdcall;{$else}cdecl;{$endif}
-    glBlendFuncSeparate : procedure(srcRGB:GLenum; dstRGB:GLenum; srcAlpha:GLenum; dstAlpha:GLenum);{$ifdef windows}stdcall;{$else}cdecl;{$endif}
+  glBindAttribLocation : procedure(_program:GLuint; index:GLuint; name:pchar);{$ifdef windows}stdcall;{$else}cdecl;{$endif}
+  glBindBuffer : procedure(target:GLenum; buffer:GLuint);{$ifdef windows}stdcall;{$else}cdecl;{$endif}
+  glBindFramebuffer : procedure(target:GLenum; framebuffer:GLuint);{$ifdef windows}stdcall;{$else}cdecl;{$endif}
+  glBindRenderbuffer : procedure(target:GLenum; renderbuffer:GLuint);{$ifdef windows}stdcall;{$else}cdecl;{$endif}
+  glBindTexture : procedure(target:GLenum; texture:GLuint);{$ifdef windows}stdcall;{$else}cdecl;{$endif}
+  glBlendColor : procedure(red:GLclampf; green:GLclampf; blue:GLclampf; alpha:GLclampf);{$ifdef windows}stdcall;{$else}cdecl;{$endif}
+  glBlendEquation : procedure(mode:GLenum);{$ifdef windows}stdcall;{$else}cdecl;{$endif}
+  glBlendEquationSeparate : procedure(modeRGB:GLenum; modeAlpha:GLenum);{$ifdef windows}stdcall;{$else}cdecl;{$endif}
+  glBlendFunc : procedure(sfactor:GLenum; dfactor:GLenum);{$ifdef windows}stdcall;{$else}cdecl;{$endif}
+  glBlendFuncSeparate : procedure(srcRGB:GLenum; dstRGB:GLenum; srcAlpha:GLenum; dstAlpha:GLenum);{$ifdef windows}stdcall;{$else}cdecl;{$endif}
 (* Const before type ignored *)
-    glBufferData : procedure(target:GLenum; size:GLsizeiptr; data:pointer; usage:GLenum);{$ifdef windows}stdcall;{$else}cdecl;{$endif}
+  glBufferData : procedure(target:GLenum; size:GLsizeiptr; data:pointer; usage:GLenum);{$ifdef windows}stdcall;{$else}cdecl;{$endif}
 (* Const before type ignored *)
-    glBufferSubData : procedure(target:GLenum; offset:GLintptr; size:GLsizeiptr; data:pointer);{$ifdef windows}stdcall;{$else}cdecl;{$endif}
-    glCheckFramebufferStatus : function(target:GLenum):GLenum;{$ifdef windows}stdcall;{$else}cdecl;{$endif}
-    glClear : procedure(mask:GLbitfield);{$ifdef windows}stdcall;{$else}cdecl;{$endif}
-    glClearColor : procedure(red:GLclampf; green:GLclampf; blue:GLclampf; alpha:GLclampf);{$ifdef windows}stdcall;{$else}cdecl;{$endif}
-    glClearDepthf : procedure(depth:GLclampf);{$ifdef windows}stdcall;{$else}cdecl;{$endif}
-    glClearStencil : procedure(s:GLint);{$ifdef windows}stdcall;{$else}cdecl;{$endif}
-    glColorMask : procedure(red:GLboolean; green:GLboolean; blue:GLboolean; alpha:GLboolean);{$ifdef windows}stdcall;{$else}cdecl;{$endif}
-    glCompileShader : procedure(shader:GLuint);{$ifdef windows}stdcall;{$else}cdecl;{$endif}
+  glBufferSubData : procedure(target:GLenum; offset:GLintptr; size:GLsizeiptr; data:pointer);{$ifdef windows}stdcall;{$else}cdecl;{$endif}
+  glCheckFramebufferStatus : function(target:GLenum):GLenum;{$ifdef windows}stdcall;{$else}cdecl;{$endif}
+  glClear : procedure(mask:GLbitfield);{$ifdef windows}stdcall;{$else}cdecl;{$endif}
+  glClearColor : procedure(red:GLclampf; green:GLclampf; blue:GLclampf; alpha:GLclampf);{$ifdef windows}stdcall;{$else}cdecl;{$endif}
+  glClearDepthf : procedure(depth:GLclampf);{$ifdef windows}stdcall;{$else}cdecl;{$endif}
+  glClearStencil : procedure(s:GLint);{$ifdef windows}stdcall;{$else}cdecl;{$endif}
+  glColorMask : procedure(red:GLboolean; green:GLboolean; blue:GLboolean; alpha:GLboolean);{$ifdef windows}stdcall;{$else}cdecl;{$endif}
+  glCompileShader : procedure(shader:GLuint);{$ifdef windows}stdcall;{$else}cdecl;{$endif}
 (* Const before type ignored *)
-    glCompressedTexImage2D : procedure(target:GLenum; level:GLint; internalformat:GLenum; width:GLsizei; height:GLsizei; 
-      border:GLint; imageSize:GLsizei; data:pointer);{$ifdef windows}stdcall;{$else}cdecl;{$endif}
+  glCompressedTexImage2D : procedure(target:GLenum; level:GLint; internalformat:GLenum; width:GLsizei; height:GLsizei;
+    border:GLint; imageSize:GLsizei; data:pointer);{$ifdef windows}stdcall;{$else}cdecl;{$endif}
 (* Const before type ignored *)
-    glCompressedTexSubImage2D : procedure(target:GLenum; level:GLint; xoffset:GLint; yoffset:GLint; width:GLsizei; 
-      height:GLsizei; format:GLenum; imageSize:GLsizei; data:pointer);{$ifdef windows}stdcall;{$else}cdecl;{$endif}
-    glCopyTexImage2D : procedure(target:GLenum; level:GLint; internalformat:GLenum; x:GLint; y:GLint; 
-      width:GLsizei; height:GLsizei; border:GLint);{$ifdef windows}stdcall;{$else}cdecl;{$endif}
-    glCopyTexSubImage2D : procedure(target:GLenum; level:GLint; xoffset:GLint; yoffset:GLint; x:GLint; 
-      y:GLint; width:GLsizei; height:GLsizei);{$ifdef windows}stdcall;{$else}cdecl;{$endif}
-    glCreateProgram : function:GLuint;{$ifdef windows}stdcall;{$else}cdecl;{$endif}
-    glCreateShader : function(_type:GLenum):GLuint;{$ifdef windows}stdcall;{$else}cdecl;{$endif}
-    glCullFace : procedure(mode:GLenum);{$ifdef windows}stdcall;{$else}cdecl;{$endif}
+  glCompressedTexSubImage2D : procedure(target:GLenum; level:GLint; xoffset:GLint; yoffset:GLint; width:GLsizei;
+    height:GLsizei; format:GLenum; imageSize:GLsizei; data:pointer);{$ifdef windows}stdcall;{$else}cdecl;{$endif}
+  glCopyTexImage2D : procedure(target:GLenum; level:GLint; internalformat:GLenum; x:GLint; y:GLint;
+    width:GLsizei; height:GLsizei; border:GLint);{$ifdef windows}stdcall;{$else}cdecl;{$endif}
+  glCopyTexSubImage2D : procedure(target:GLenum; level:GLint; xoffset:GLint; yoffset:GLint; x:GLint;
+    y:GLint; width:GLsizei; height:GLsizei);{$ifdef windows}stdcall;{$else}cdecl;{$endif}
+  glCreateProgram : function:GLuint;{$ifdef windows}stdcall;{$else}cdecl;{$endif}
+  glCreateShader : function(_type:GLenum):GLuint;{$ifdef windows}stdcall;{$else}cdecl;{$endif}
+  glCullFace : procedure(mode:GLenum);{$ifdef windows}stdcall;{$else}cdecl;{$endif}
 (* Const before type ignored *)
-    glDeleteBuffers : procedure(n:GLsizei; buffers:pGLuint);{$ifdef windows}stdcall;{$else}cdecl;{$endif}
+  glDeleteBuffers : procedure(n:GLsizei; buffers:pGLuint);{$ifdef windows}stdcall;{$else}cdecl;{$endif}
 (* Const before type ignored *)
-    glDeleteFramebuffers : procedure(n:GLsizei; framebuffers:pGLuint);{$ifdef windows}stdcall;{$else}cdecl;{$endif}
-    glDeleteProgram : procedure(_program:GLuint);{$ifdef windows}stdcall;{$else}cdecl;{$endif}
+  glDeleteFramebuffers : procedure(n:GLsizei; framebuffers:pGLuint);{$ifdef windows}stdcall;{$else}cdecl;{$endif}
+  glDeleteProgram : procedure(_program:GLuint);{$ifdef windows}stdcall;{$else}cdecl;{$endif}
 (* Const before type ignored *)
-    glDeleteRenderbuffers : procedure(n:GLsizei; renderbuffers:pGLuint);{$ifdef windows}stdcall;{$else}cdecl;{$endif}
-    glDeleteShader : procedure(shader:GLuint);{$ifdef windows}stdcall;{$else}cdecl;{$endif}
+  glDeleteRenderbuffers : procedure(n:GLsizei; renderbuffers:pGLuint);{$ifdef windows}stdcall;{$else}cdecl;{$endif}
+  glDeleteShader : procedure(shader:GLuint);{$ifdef windows}stdcall;{$else}cdecl;{$endif}
 (* Const before type ignored *)
-    glDeleteTextures : procedure(n:GLsizei; textures:pGLuint);{$ifdef windows}stdcall;{$else}cdecl;{$endif}
-    glDepthFunc : procedure(func:GLenum);{$ifdef windows}stdcall;{$else}cdecl;{$endif}
-    glDepthMask : procedure(flag:GLboolean);{$ifdef windows}stdcall;{$else}cdecl;{$endif}
-    glDepthRangef : procedure(zNear:GLclampf; zFar:GLclampf);{$ifdef windows}stdcall;{$else}cdecl;{$endif}
-    glDetachShader : procedure(_program:GLuint; shader:GLuint);{$ifdef windows}stdcall;{$else}cdecl;{$endif}
-    glDisable : procedure(cap:GLenum);{$ifdef windows}stdcall;{$else}cdecl;{$endif}
-    glDisableVertexAttribArray : procedure(index:GLuint);{$ifdef windows}stdcall;{$else}cdecl;{$endif}
-    glDrawArrays : procedure(mode:GLenum; first:GLint; count:GLsizei);{$ifdef windows}stdcall;{$else}cdecl;{$endif}
+  glDeleteTextures : procedure(n:GLsizei; textures:pGLuint);{$ifdef windows}stdcall;{$else}cdecl;{$endif}
+  glDepthFunc : procedure(func:GLenum);{$ifdef windows}stdcall;{$else}cdecl;{$endif}
+  glDepthMask : procedure(flag:GLboolean);{$ifdef windows}stdcall;{$else}cdecl;{$endif}
+  glDepthRangef : procedure(zNear:GLclampf; zFar:GLclampf);{$ifdef windows}stdcall;{$else}cdecl;{$endif}
+  glDetachShader : procedure(_program:GLuint; shader:GLuint);{$ifdef windows}stdcall;{$else}cdecl;{$endif}
+  glDisable : procedure(cap:GLenum);{$ifdef windows}stdcall;{$else}cdecl;{$endif}
+  glDisableVertexAttribArray : procedure(index:GLuint);{$ifdef windows}stdcall;{$else}cdecl;{$endif}
+  glDrawArrays : procedure(mode:GLenum; first:GLint; count:GLsizei);{$ifdef windows}stdcall;{$else}cdecl;{$endif}
 (* Const before type ignored *)
-    glDrawElements : procedure(mode:GLenum; count:GLsizei; _type:GLenum; indices:pointer);{$ifdef windows}stdcall;{$else}cdecl;{$endif}
-    glEnable : procedure(cap:GLenum);{$ifdef windows}stdcall;{$else}cdecl;{$endif}
-    glEnableVertexAttribArray : procedure(index:GLuint);{$ifdef windows}stdcall;{$else}cdecl;{$endif}
-    glFinish : procedure;{$ifdef windows}stdcall;{$else}cdecl;{$endif}
-    glFlush : procedure;{$ifdef windows}stdcall;{$else}cdecl;{$endif}
-    glFramebufferRenderbuffer : procedure(target:GLenum; attachment:GLenum; renderbuffertarget:GLenum; renderbuffer:GLuint);{$ifdef windows}stdcall;{$else}cdecl;{$endif}
-    glFramebufferTexture2D : procedure(target:GLenum; attachment:GLenum; textarget:GLenum; texture:GLuint; level:GLint);{$ifdef windows}stdcall;{$else}cdecl;{$endif}
-    glFrontFace : procedure(mode:GLenum);{$ifdef windows}stdcall;{$else}cdecl;{$endif}
-    glGenBuffers : procedure(n:GLsizei; buffers:pGLuint);{$ifdef windows}stdcall;{$else}cdecl;{$endif}
-    glGenerateMipmap : procedure(target:GLenum);{$ifdef windows}stdcall;{$else}cdecl;{$endif}
-    glGenFramebuffers : procedure(n:GLsizei; framebuffers:pGLuint);{$ifdef windows}stdcall;{$else}cdecl;{$endif}
-    glGenRenderbuffers : procedure(n:GLsizei; renderbuffers:pGLuint);{$ifdef windows}stdcall;{$else}cdecl;{$endif}
-    glGenTextures : procedure(n:GLsizei; textures:pGLuint);{$ifdef windows}stdcall;{$else}cdecl;{$endif}
-    glGetActiveAttrib : procedure(_program:GLuint; index:GLuint; bufsize:GLsizei; length:pGLsizei; size:pGLint; 
-      _type:pGLenum; name:pchar);{$ifdef windows}stdcall;{$else}cdecl;{$endif}
-    glGetActiveUniform : procedure(_program:GLuint; index:GLuint; bufsize:GLsizei; length:pGLsizei; size:pGLint; 
-      _type:pGLenum; name:pchar);{$ifdef windows}stdcall;{$else}cdecl;{$endif}
-    glGetAttachedShaders : procedure(_program:GLuint; maxcount:GLsizei; count:pGLsizei; shaders:pGLuint);{$ifdef windows}stdcall;{$else}cdecl;{$endif}
+  glDrawElements : procedure(mode:GLenum; count:GLsizei; _type:GLenum; indices:pointer);{$ifdef windows}stdcall;{$else}cdecl;{$endif}
+  glEnable : procedure(cap:GLenum);{$ifdef windows}stdcall;{$else}cdecl;{$endif}
+  glEnableVertexAttribArray : procedure(index:GLuint);{$ifdef windows}stdcall;{$else}cdecl;{$endif}
+  glFinish : procedure;{$ifdef windows}stdcall;{$else}cdecl;{$endif}
+  glFlush : procedure;{$ifdef windows}stdcall;{$else}cdecl;{$endif}
+  glFramebufferRenderbuffer : procedure(target:GLenum; attachment:GLenum; renderbuffertarget:GLenum; renderbuffer:GLuint);{$ifdef windows}stdcall;{$else}cdecl;{$endif}
+  glFramebufferTexture2D : procedure(target:GLenum; attachment:GLenum; textarget:GLenum; texture:GLuint; level:GLint);{$ifdef windows}stdcall;{$else}cdecl;{$endif}
+  glFrontFace : procedure(mode:GLenum);{$ifdef windows}stdcall;{$else}cdecl;{$endif}
+  glGenBuffers : procedure(n:GLsizei; buffers:pGLuint);{$ifdef windows}stdcall;{$else}cdecl;{$endif}
+  glGenerateMipmap : procedure(target:GLenum);{$ifdef windows}stdcall;{$else}cdecl;{$endif}
+  glGenFramebuffers : procedure(n:GLsizei; framebuffers:pGLuint);{$ifdef windows}stdcall;{$else}cdecl;{$endif}
+  glGenRenderbuffers : procedure(n:GLsizei; renderbuffers:pGLuint);{$ifdef windows}stdcall;{$else}cdecl;{$endif}
+  glGenTextures : procedure(n:GLsizei; textures:pGLuint);{$ifdef windows}stdcall;{$else}cdecl;{$endif}
+  glGetActiveAttrib : procedure(_program:GLuint; index:GLuint; bufsize:GLsizei; length:pGLsizei; size:pGLint;
+    _type:pGLenum; name:pchar);{$ifdef windows}stdcall;{$else}cdecl;{$endif}
+  glGetActiveUniform : procedure(_program:GLuint; index:GLuint; bufsize:GLsizei; length:pGLsizei; size:pGLint;
+    _type:pGLenum; name:pchar);{$ifdef windows}stdcall;{$else}cdecl;{$endif}
+  glGetAttachedShaders : procedure(_program:GLuint; maxcount:GLsizei; count:pGLsizei; shaders:pGLuint);{$ifdef windows}stdcall;{$else}cdecl;{$endif}
 (* Const before type ignored *)
-    glGetAttribLocation : function(_program:GLuint; name:pchar):longint;{$ifdef windows}stdcall;{$else}cdecl;{$endif}
-    glGetBooleanv : procedure(pname:GLenum; params:pGLboolean);{$ifdef windows}stdcall;{$else}cdecl;{$endif}
-    glGetBufferParameteriv : procedure(target:GLenum; pname:GLenum; params:pGLint);{$ifdef windows}stdcall;{$else}cdecl;{$endif}
-    glGetError : function:GLenum;{$ifdef windows}stdcall;{$else}cdecl;{$endif}
-    glGetFloatv : procedure(pname:GLenum; params:pGLfloat);{$ifdef windows}stdcall;{$else}cdecl;{$endif}
-    glGetFramebufferAttachmentParameteriv : procedure(target:GLenum; attachment:GLenum; pname:GLenum; params:pGLint);{$ifdef windows}stdcall;{$else}cdecl;{$endif}
-    glGetIntegerv : procedure(pname:GLenum; params:pGLint);{$ifdef windows}stdcall;{$else}cdecl;{$endif}
-    glGetProgramiv : procedure(_program:GLuint; pname:GLenum; params:pGLint);{$ifdef windows}stdcall;{$else}cdecl;{$endif}
-    glGetProgramInfoLog : procedure(_program:GLuint; bufsize:GLsizei; length:pGLsizei; infolog:pchar);{$ifdef windows}stdcall;{$else}cdecl;{$endif}
-    glGetRenderbufferParameteriv : procedure(target:GLenum; pname:GLenum; params:pGLint);{$ifdef windows}stdcall;{$else}cdecl;{$endif}
-    glGetShaderiv : procedure(shader:GLuint; pname:GLenum; params:pGLint);{$ifdef windows}stdcall;{$else}cdecl;{$endif}
-    glGetShaderInfoLog : procedure(shader:GLuint; bufsize:GLsizei; length:pGLsizei; infolog:pchar);{$ifdef windows}stdcall;{$else}cdecl;{$endif}
-    glGetShaderPrecisionFormat : procedure(shadertype:GLenum; precisiontype:GLenum; range:pGLint; precision:pGLint);{$ifdef windows}stdcall;{$else}cdecl;{$endif}
-    glGetShaderSource : procedure(shader:GLuint; bufsize:GLsizei; length:pGLsizei; source:pchar);{$ifdef windows}stdcall;{$else}cdecl;{$endif}
+  glGetAttribLocation : function(_program:GLuint; name:pchar):longint;{$ifdef windows}stdcall;{$else}cdecl;{$endif}
+  glGetBooleanv : procedure(pname:GLenum; params:pGLboolean);{$ifdef windows}stdcall;{$else}cdecl;{$endif}
+  glGetBufferParameteriv : procedure(target:GLenum; pname:GLenum; params:pGLint);{$ifdef windows}stdcall;{$else}cdecl;{$endif}
+  glGetError : function:GLenum;{$ifdef windows}stdcall;{$else}cdecl;{$endif}
+  glGetFloatv : procedure(pname:GLenum; params:pGLfloat);{$ifdef windows}stdcall;{$else}cdecl;{$endif}
+  glGetFramebufferAttachmentParameteriv : procedure(target:GLenum; attachment:GLenum; pname:GLenum; params:pGLint);{$ifdef windows}stdcall;{$else}cdecl;{$endif}
+  glGetIntegerv : procedure(pname:GLenum; params:pGLint);{$ifdef windows}stdcall;{$else}cdecl;{$endif}
+  glGetProgramiv : procedure(_program:GLuint; pname:GLenum; params:pGLint);{$ifdef windows}stdcall;{$else}cdecl;{$endif}
+  glGetProgramInfoLog : procedure(_program:GLuint; bufsize:GLsizei; length:pGLsizei; infolog:pchar);{$ifdef windows}stdcall;{$else}cdecl;{$endif}
+  glGetRenderbufferParameteriv : procedure(target:GLenum; pname:GLenum; params:pGLint);{$ifdef windows}stdcall;{$else}cdecl;{$endif}
+  glGetShaderiv : procedure(shader:GLuint; pname:GLenum; params:pGLint);{$ifdef windows}stdcall;{$else}cdecl;{$endif}
+  glGetShaderInfoLog : procedure(shader:GLuint; bufsize:GLsizei; length:pGLsizei; infolog:pchar);{$ifdef windows}stdcall;{$else}cdecl;{$endif}
+  glGetShaderPrecisionFormat : procedure(shadertype:GLenum; precisiontype:GLenum; range:pGLint; precision:pGLint);{$ifdef windows}stdcall;{$else}cdecl;{$endif}
+  glGetShaderSource : procedure(shader:GLuint; bufsize:GLsizei; length:pGLsizei; source:pchar);{$ifdef windows}stdcall;{$else}cdecl;{$endif}
 (* Const before type ignored *)
-    glGetString : function(name:GLenum):PGLubyte;{$ifdef windows}stdcall;{$else}cdecl;{$endif}
-    glGetTexParameterfv : procedure(target:GLenum; pname:GLenum; params:pGLfloat);{$ifdef windows}stdcall;{$else}cdecl;{$endif}
-    glGetTexParameteriv : procedure(target:GLenum; pname:GLenum; params:pGLint);{$ifdef windows}stdcall;{$else}cdecl;{$endif}
-    glGetUniformfv : procedure(_program:GLuint; location:GLint; params:pGLfloat);{$ifdef windows}stdcall;{$else}cdecl;{$endif}
-    glGetUniformiv : procedure(_program:GLuint; location:GLint; params:pGLint);{$ifdef windows}stdcall;{$else}cdecl;{$endif}
+  glGetString : function(name:GLenum):PGLubyte;{$ifdef windows}stdcall;{$else}cdecl;{$endif}
+  glGetTexParameterfv : procedure(target:GLenum; pname:GLenum; params:pGLfloat);{$ifdef windows}stdcall;{$else}cdecl;{$endif}
+  glGetTexParameteriv : procedure(target:GLenum; pname:GLenum; params:pGLint);{$ifdef windows}stdcall;{$else}cdecl;{$endif}
+  glGetUniformfv : procedure(_program:GLuint; location:GLint; params:pGLfloat);{$ifdef windows}stdcall;{$else}cdecl;{$endif}
+  glGetUniformiv : procedure(_program:GLuint; location:GLint; params:pGLint);{$ifdef windows}stdcall;{$else}cdecl;{$endif}
 (* Const before type ignored *)
-    glGetUniformLocation : function(_program:GLuint; name:pchar):longint;{$ifdef windows}stdcall;{$else}cdecl;{$endif}
-    glGetVertexAttribfv : procedure(index:GLuint; pname:GLenum; params:pGLfloat);{$ifdef windows}stdcall;{$else}cdecl;{$endif}
-    glGetVertexAttribiv : procedure(index:GLuint; pname:GLenum; params:pGLint);{$ifdef windows}stdcall;{$else}cdecl;{$endif}
-    glGetVertexAttribPointerv : procedure(index:GLuint; pname:GLenum; pointer:Ppointer);{$ifdef windows}stdcall;{$else}cdecl;{$endif}
-    glHint : procedure(target:GLenum; mode:GLenum);{$ifdef windows}stdcall;{$else}cdecl;{$endif}
-    glIsBuffer : function(buffer:GLuint):GLboolean;{$ifdef windows}stdcall;{$else}cdecl;{$endif}
-    glIsEnabled : function(cap:GLenum):GLboolean;{$ifdef windows}stdcall;{$else}cdecl;{$endif}
-    glIsFramebuffer : function(framebuffer:GLuint):GLboolean;{$ifdef windows}stdcall;{$else}cdecl;{$endif}
-    glIsProgram : function(_program:GLuint):GLboolean;{$ifdef windows}stdcall;{$else}cdecl;{$endif}
-    glIsRenderbuffer : function(renderbuffer:GLuint):GLboolean;{$ifdef windows}stdcall;{$else}cdecl;{$endif}
-    glIsShader : function(shader:GLuint):GLboolean;{$ifdef windows}stdcall;{$else}cdecl;{$endif}
-    glIsTexture : function(texture:GLuint):GLboolean;{$ifdef windows}stdcall;{$else}cdecl;{$endif}
-    glLineWidth : procedure(width:GLfloat);{$ifdef windows}stdcall;{$else}cdecl;{$endif}
-    glLinkProgram : procedure(_program:GLuint);{$ifdef windows}stdcall;{$else}cdecl;{$endif}
-    glPixelStorei : procedure(pname:GLenum; param:GLint);{$ifdef windows}stdcall;{$else}cdecl;{$endif}
-    glPolygonOffset : procedure(factor:GLfloat; units:GLfloat);{$ifdef windows}stdcall;{$else}cdecl;{$endif}
-    glReadPixels : procedure(x:GLint; y:GLint; width:GLsizei; height:GLsizei; format:GLenum; 
-      _type:GLenum; pixels:pointer);{$ifdef windows}stdcall;{$else}cdecl;{$endif}
-    glReleaseShaderCompiler : procedure;{$ifdef windows}stdcall;{$else}cdecl;{$endif}
-    glRenderbufferStorage : procedure(target:GLenum; internalformat:GLenum; width:GLsizei; height:GLsizei);{$ifdef windows}stdcall;{$else}cdecl;{$endif}
-    glSampleCoverage : procedure(value:GLclampf; invert:GLboolean);{$ifdef windows}stdcall;{$else}cdecl;{$endif}
-    glScissor : procedure(x:GLint; y:GLint; width:GLsizei; height:GLsizei);{$ifdef windows}stdcall;{$else}cdecl;{$endif}
+  glGetUniformLocation : function(_program:GLuint; name:pchar):longint;{$ifdef windows}stdcall;{$else}cdecl;{$endif}
+  glGetVertexAttribfv : procedure(index:GLuint; pname:GLenum; params:pGLfloat);{$ifdef windows}stdcall;{$else}cdecl;{$endif}
+  glGetVertexAttribiv : procedure(index:GLuint; pname:GLenum; params:pGLint);{$ifdef windows}stdcall;{$else}cdecl;{$endif}
+  glGetVertexAttribPointerv : procedure(index:GLuint; pname:GLenum; pointer:Ppointer);{$ifdef windows}stdcall;{$else}cdecl;{$endif}
+  glHint : procedure(target:GLenum; mode:GLenum);{$ifdef windows}stdcall;{$else}cdecl;{$endif}
+  glIsBuffer : function(buffer:GLuint):GLboolean;{$ifdef windows}stdcall;{$else}cdecl;{$endif}
+  glIsEnabled : function(cap:GLenum):GLboolean;{$ifdef windows}stdcall;{$else}cdecl;{$endif}
+  glIsFramebuffer : function(framebuffer:GLuint):GLboolean;{$ifdef windows}stdcall;{$else}cdecl;{$endif}
+  glIsProgram : function(_program:GLuint):GLboolean;{$ifdef windows}stdcall;{$else}cdecl;{$endif}
+  glIsRenderbuffer : function(renderbuffer:GLuint):GLboolean;{$ifdef windows}stdcall;{$else}cdecl;{$endif}
+  glIsShader : function(shader:GLuint):GLboolean;{$ifdef windows}stdcall;{$else}cdecl;{$endif}
+  glIsTexture : function(texture:GLuint):GLboolean;{$ifdef windows}stdcall;{$else}cdecl;{$endif}
+  glLineWidth : procedure(width:GLfloat);{$ifdef windows}stdcall;{$else}cdecl;{$endif}
+  glLinkProgram : procedure(_program:GLuint);{$ifdef windows}stdcall;{$else}cdecl;{$endif}
+  glPixelStorei : procedure(pname:GLenum; param:GLint);{$ifdef windows}stdcall;{$else}cdecl;{$endif}
+  glPolygonOffset : procedure(factor:GLfloat; units:GLfloat);{$ifdef windows}stdcall;{$else}cdecl;{$endif}
+  glReadPixels : procedure(x:GLint; y:GLint; width:GLsizei; height:GLsizei; format:GLenum;
+    _type:GLenum; pixels:pointer);{$ifdef windows}stdcall;{$else}cdecl;{$endif}
+  glReleaseShaderCompiler : procedure;{$ifdef windows}stdcall;{$else}cdecl;{$endif}
+  glRenderbufferStorage : procedure(target:GLenum; internalformat:GLenum; width:GLsizei; height:GLsizei);{$ifdef windows}stdcall;{$else}cdecl;{$endif}
+  glSampleCoverage : procedure(value:GLclampf; invert:GLboolean);{$ifdef windows}stdcall;{$else}cdecl;{$endif}
+  glScissor : procedure(x:GLint; y:GLint; width:GLsizei; height:GLsizei);{$ifdef windows}stdcall;{$else}cdecl;{$endif}
 (* Const before type ignored *)
 (* Const before type ignored *)
-    glShaderBinary : procedure(n:GLsizei; shaders:pGLuint; binaryformat:GLenum; binary:pointer; length:GLsizei);{$ifdef windows}stdcall;{$else}cdecl;{$endif}
+  glShaderBinary : procedure(n:GLsizei; shaders:pGLuint; binaryformat:GLenum; binary:pointer; length:GLsizei);{$ifdef windows}stdcall;{$else}cdecl;{$endif}
 (* Const before type ignored *)
 (* Const before type ignored *)
-    glShaderSource : procedure(shader:GLuint; count:GLsizei; _string:Ppchar; length:pGLint);{$ifdef windows}stdcall;{$else}cdecl;{$endif}
-    glStencilFunc : procedure(func:GLenum; ref:GLint; mask:GLuint);{$ifdef windows}stdcall;{$else}cdecl;{$endif}
-    glStencilFuncSeparate : procedure(face:GLenum; func:GLenum; ref:GLint; mask:GLuint);{$ifdef windows}stdcall;{$else}cdecl;{$endif}
-    glStencilMask : procedure(mask:GLuint);{$ifdef windows}stdcall;{$else}cdecl;{$endif}
-    glStencilMaskSeparate : procedure(face:GLenum; mask:GLuint);{$ifdef windows}stdcall;{$else}cdecl;{$endif}
-    glStencilOp : procedure(fail:GLenum; zfail:GLenum; zpass:GLenum);{$ifdef windows}stdcall;{$else}cdecl;{$endif}
-    glStencilOpSeparate : procedure(face:GLenum; fail:GLenum; zfail:GLenum; zpass:GLenum);{$ifdef windows}stdcall;{$else}cdecl;{$endif}
+  glShaderSource : procedure(shader:GLuint; count:GLsizei; _string:Ppchar; length:pGLint);{$ifdef windows}stdcall;{$else}cdecl;{$endif}
+  glStencilFunc : procedure(func:GLenum; ref:GLint; mask:GLuint);{$ifdef windows}stdcall;{$else}cdecl;{$endif}
+  glStencilFuncSeparate : procedure(face:GLenum; func:GLenum; ref:GLint; mask:GLuint);{$ifdef windows}stdcall;{$else}cdecl;{$endif}
+  glStencilMask : procedure(mask:GLuint);{$ifdef windows}stdcall;{$else}cdecl;{$endif}
+  glStencilMaskSeparate : procedure(face:GLenum; mask:GLuint);{$ifdef windows}stdcall;{$else}cdecl;{$endif}
+  glStencilOp : procedure(fail:GLenum; zfail:GLenum; zpass:GLenum);{$ifdef windows}stdcall;{$else}cdecl;{$endif}
+  glStencilOpSeparate : procedure(face:GLenum; fail:GLenum; zfail:GLenum; zpass:GLenum);{$ifdef windows}stdcall;{$else}cdecl;{$endif}
 (* Const before type ignored *)
-    glTexImage2D : procedure(target:GLenum; level:GLint; internalformat:GLenum; width:GLsizei; height:GLsizei; 
-      border:GLint; format:GLenum; _type:GLenum; pixels:pointer);{$ifdef windows}stdcall;{$else}cdecl;{$endif}
-    glTexParameterf : procedure(target:GLenum; pname:GLenum; param:GLfloat);{$ifdef windows}stdcall;{$else}cdecl;{$endif}
+  glTexImage2D : procedure(target:GLenum; level:GLint; internalformat:GLenum; width:GLsizei; height:GLsizei;
+    border:GLint; format:GLenum; _type:GLenum; pixels:pointer);{$ifdef windows}stdcall;{$else}cdecl;{$endif}
+  glTexParameterf : procedure(target:GLenum; pname:GLenum; param:GLfloat);{$ifdef windows}stdcall;{$else}cdecl;{$endif}
 (* Const before type ignored *)
-    glTexParameterfv : procedure(target:GLenum; pname:GLenum; params:pGLfloat);{$ifdef windows}stdcall;{$else}cdecl;{$endif}
-    glTexParameteri : procedure(target:GLenum; pname:GLenum; param:GLint);{$ifdef windows}stdcall;{$else}cdecl;{$endif}
+  glTexParameterfv : procedure(target:GLenum; pname:GLenum; params:pGLfloat);{$ifdef windows}stdcall;{$else}cdecl;{$endif}
+  glTexParameteri : procedure(target:GLenum; pname:GLenum; param:GLint);{$ifdef windows}stdcall;{$else}cdecl;{$endif}
 (* Const before type ignored *)
-    glTexParameteriv : procedure(target:GLenum; pname:GLenum; params:pGLint);{$ifdef windows}stdcall;{$else}cdecl;{$endif}
+  glTexParameteriv : procedure(target:GLenum; pname:GLenum; params:pGLint);{$ifdef windows}stdcall;{$else}cdecl;{$endif}
 (* Const before type ignored *)
-    glTexSubImage2D : procedure(target:GLenum; level:GLint; xoffset:GLint; yoffset:GLint; width:GLsizei; 
-      height:GLsizei; format:GLenum; _type:GLenum; pixels:pointer);{$ifdef windows}stdcall;{$else}cdecl;{$endif}
-    glUniform1f : procedure(location:GLint; x:GLfloat);{$ifdef windows}stdcall;{$else}cdecl;{$endif}
+  glTexSubImage2D : procedure(target:GLenum; level:GLint; xoffset:GLint; yoffset:GLint; width:GLsizei;
+    height:GLsizei; format:GLenum; _type:GLenum; pixels:pointer);{$ifdef windows}stdcall;{$else}cdecl;{$endif}
+  glUniform1f : procedure(location:GLint; x:GLfloat);{$ifdef windows}stdcall;{$else}cdecl;{$endif}
 (* Const before type ignored *)
-    glUniform1fv : procedure(location:GLint; count:GLsizei; v:pGLfloat);{$ifdef windows}stdcall;{$else}cdecl;{$endif}
-    glUniform1i : procedure(location:GLint; x:GLint);{$ifdef windows}stdcall;{$else}cdecl;{$endif}
+  glUniform1fv : procedure(location:GLint; count:GLsizei; v:pGLfloat);{$ifdef windows}stdcall;{$else}cdecl;{$endif}
+  glUniform1i : procedure(location:GLint; x:GLint);{$ifdef windows}stdcall;{$else}cdecl;{$endif}
 (* Const before type ignored *)
-    glUniform1iv : procedure(location:GLint; count:GLsizei; v:pGLint);{$ifdef windows}stdcall;{$else}cdecl;{$endif}
-    glUniform2f : procedure(location:GLint; x:GLfloat; y:GLfloat);{$ifdef windows}stdcall;{$else}cdecl;{$endif}
+  glUniform1iv : procedure(location:GLint; count:GLsizei; v:pGLint);{$ifdef windows}stdcall;{$else}cdecl;{$endif}
+  glUniform2f : procedure(location:GLint; x:GLfloat; y:GLfloat);{$ifdef windows}stdcall;{$else}cdecl;{$endif}
 (* Const before type ignored *)
-    glUniform2fv : procedure(location:GLint; count:GLsizei; v:pGLfloat);{$ifdef windows}stdcall;{$else}cdecl;{$endif}
-    glUniform2i : procedure(location:GLint; x:GLint; y:GLint);{$ifdef windows}stdcall;{$else}cdecl;{$endif}
+  glUniform2fv : procedure(location:GLint; count:GLsizei; v:pGLfloat);{$ifdef windows}stdcall;{$else}cdecl;{$endif}
+  glUniform2i : procedure(location:GLint; x:GLint; y:GLint);{$ifdef windows}stdcall;{$else}cdecl;{$endif}
 (* Const before type ignored *)
-    glUniform2iv : procedure(location:GLint; count:GLsizei; v:pGLint);{$ifdef windows}stdcall;{$else}cdecl;{$endif}
-    glUniform3f : procedure(location:GLint; x:GLfloat; y:GLfloat; z:GLfloat);{$ifdef windows}stdcall;{$else}cdecl;{$endif}
+  glUniform2iv : procedure(location:GLint; count:GLsizei; v:pGLint);{$ifdef windows}stdcall;{$else}cdecl;{$endif}
+  glUniform3f : procedure(location:GLint; x:GLfloat; y:GLfloat; z:GLfloat);{$ifdef windows}stdcall;{$else}cdecl;{$endif}
 (* Const before type ignored *)
-    glUniform3fv : procedure(location:GLint; count:GLsizei; v:pGLfloat);{$ifdef windows}stdcall;{$else}cdecl;{$endif}
-    glUniform3i : procedure(location:GLint; x:GLint; y:GLint; z:GLint);{$ifdef windows}stdcall;{$else}cdecl;{$endif}
+  glUniform3fv : procedure(location:GLint; count:GLsizei; v:pGLfloat);{$ifdef windows}stdcall;{$else}cdecl;{$endif}
+  glUniform3i : procedure(location:GLint; x:GLint; y:GLint; z:GLint);{$ifdef windows}stdcall;{$else}cdecl;{$endif}
 (* Const before type ignored *)
-    glUniform3iv : procedure(location:GLint; count:GLsizei; v:pGLint);{$ifdef windows}stdcall;{$else}cdecl;{$endif}
-    glUniform4f : procedure(location:GLint; x:GLfloat; y:GLfloat; z:GLfloat; w:GLfloat);{$ifdef windows}stdcall;{$else}cdecl;{$endif}
+  glUniform3iv : procedure(location:GLint; count:GLsizei; v:pGLint);{$ifdef windows}stdcall;{$else}cdecl;{$endif}
+  glUniform4f : procedure(location:GLint; x:GLfloat; y:GLfloat; z:GLfloat; w:GLfloat);{$ifdef windows}stdcall;{$else}cdecl;{$endif}
 (* Const before type ignored *)
-    glUniform4fv : procedure(location:GLint; count:GLsizei; v:pGLfloat);{$ifdef windows}stdcall;{$else}cdecl;{$endif}
-    glUniform4i : procedure(location:GLint; x:GLint; y:GLint; z:GLint; w:GLint);{$ifdef windows}stdcall;{$else}cdecl;{$endif}
+  glUniform4fv : procedure(location:GLint; count:GLsizei; v:pGLfloat);{$ifdef windows}stdcall;{$else}cdecl;{$endif}
+  glUniform4i : procedure(location:GLint; x:GLint; y:GLint; z:GLint; w:GLint);{$ifdef windows}stdcall;{$else}cdecl;{$endif}
 (* Const before type ignored *)
-    glUniform4iv : procedure(location:GLint; count:GLsizei; v:pGLint);{$ifdef windows}stdcall;{$else}cdecl;{$endif}
+  glUniform4iv : procedure(location:GLint; count:GLsizei; v:pGLint);{$ifdef windows}stdcall;{$else}cdecl;{$endif}
 (* Const before type ignored *)
-    glUniformMatrix2fv : procedure(location:GLint; count:GLsizei; transpose:GLboolean; value:pGLfloat);{$ifdef windows}stdcall;{$else}cdecl;{$endif}
+  glUniformMatrix2fv : procedure(location:GLint; count:GLsizei; transpose:GLboolean; value:pGLfloat);{$ifdef windows}stdcall;{$else}cdecl;{$endif}
 (* Const before type ignored *)
-    glUniformMatrix3fv : procedure(location:GLint; count:GLsizei; transpose:GLboolean; value:pGLfloat);{$ifdef windows}stdcall;{$else}cdecl;{$endif}
+  glUniformMatrix3fv : procedure(location:GLint; count:GLsizei; transpose:GLboolean; value:pGLfloat);{$ifdef windows}stdcall;{$else}cdecl;{$endif}
 (* Const before type ignored *)
-    glUniformMatrix4fv : procedure(location:GLint; count:GLsizei; transpose:GLboolean; value:pGLfloat);{$ifdef windows}stdcall;{$else}cdecl;{$endif}
-    glUseProgram : procedure(_program:GLuint);{$ifdef windows}stdcall;{$else}cdecl;{$endif}
-    glValidateProgram : procedure(_program:GLuint);{$ifdef windows}stdcall;{$else}cdecl;{$endif}
-    glVertexAttrib1f : procedure(indx:GLuint; x:GLfloat);{$ifdef windows}stdcall;{$else}cdecl;{$endif}
+  glUniformMatrix4fv : procedure(location:GLint; count:GLsizei; transpose:GLboolean; value:pGLfloat);{$ifdef windows}stdcall;{$else}cdecl;{$endif}
+  glUseProgram : procedure(_program:GLuint);{$ifdef windows}stdcall;{$else}cdecl;{$endif}
+  glValidateProgram : procedure(_program:GLuint);{$ifdef windows}stdcall;{$else}cdecl;{$endif}
+  glVertexAttrib1f : procedure(indx:GLuint; x:GLfloat);{$ifdef windows}stdcall;{$else}cdecl;{$endif}
 (* Const before type ignored *)
-    glVertexAttrib1fv : procedure(indx:GLuint; values:pGLfloat);{$ifdef windows}stdcall;{$else}cdecl;{$endif}
-    glVertexAttrib2f : procedure(indx:GLuint; x:GLfloat; y:GLfloat);{$ifdef windows}stdcall;{$else}cdecl;{$endif}
+  glVertexAttrib1fv : procedure(indx:GLuint; values:pGLfloat);{$ifdef windows}stdcall;{$else}cdecl;{$endif}
+  glVertexAttrib2f : procedure(indx:GLuint; x:GLfloat; y:GLfloat);{$ifdef windows}stdcall;{$else}cdecl;{$endif}
 (* Const before type ignored *)
-    glVertexAttrib2fv : procedure(indx:GLuint; values:pGLfloat);{$ifdef windows}stdcall;{$else}cdecl;{$endif}
-    glVertexAttrib3f : procedure(indx:GLuint; x:GLfloat; y:GLfloat; z:GLfloat);{$ifdef windows}stdcall;{$else}cdecl;{$endif}
+  glVertexAttrib2fv : procedure(indx:GLuint; values:pGLfloat);{$ifdef windows}stdcall;{$else}cdecl;{$endif}
+  glVertexAttrib3f : procedure(indx:GLuint; x:GLfloat; y:GLfloat; z:GLfloat);{$ifdef windows}stdcall;{$else}cdecl;{$endif}
 (* Const before type ignored *)
-    glVertexAttrib3fv : procedure(indx:GLuint; values:pGLfloat);{$ifdef windows}stdcall;{$else}cdecl;{$endif}
-    glVertexAttrib4f : procedure(indx:GLuint; x:GLfloat; y:GLfloat; z:GLfloat; w:GLfloat);{$ifdef windows}stdcall;{$else}cdecl;{$endif}
+  glVertexAttrib3fv : procedure(indx:GLuint; values:pGLfloat);{$ifdef windows}stdcall;{$else}cdecl;{$endif}
+  glVertexAttrib4f : procedure(indx:GLuint; x:GLfloat; y:GLfloat; z:GLfloat; w:GLfloat);{$ifdef windows}stdcall;{$else}cdecl;{$endif}
 (* Const before type ignored *)
-    glVertexAttrib4fv : procedure(indx:GLuint; values:pGLfloat);{$ifdef windows}stdcall;{$else}cdecl;{$endif}
+  glVertexAttrib4fv : procedure(indx:GLuint; values:pGLfloat);{$ifdef windows}stdcall;{$else}cdecl;{$endif}
 (* Const before type ignored *)
-    glVertexAttribPointer : procedure(indx:GLuint; size:GLint; _type:GLenum; normalized:GLboolean; stride:GLsizei; 
-      ptr:pointer);{$ifdef windows}stdcall;{$else}cdecl;{$endif}
-    glViewport : procedure(x:GLint; y:GLint; width:GLsizei; height:GLsizei);{$ifdef windows}stdcall;{$else}cdecl;{$endif}
-  {------------------------------------------------------------------------*
-   * IMG extension tokens
-   *------------------------------------------------------------------------ }
-  { GL_IMG_binary_shader  }
+  glVertexAttribPointer : procedure(indx:GLuint; size:GLint; _type:GLenum; normalized:GLboolean; stride:GLsizei;
+    ptr:pointer);{$ifdef windows}stdcall;{$else}cdecl;{$endif}
+  glViewport : procedure(x:GLint; y:GLint; width:GLsizei; height:GLsizei);{$ifdef windows}stdcall;{$else}cdecl;{$endif}
+{------------------------------------------------------------------------*
+ * IMG extension tokens
+ *------------------------------------------------------------------------ }
+{ GL_IMG_binary_shader  }
 
-  const
-     GL_SGX_BINARY_IMG = $8C0A;     
-  { GL_IMG_texture_compression_pvrtc  }
-     GL_COMPRESSED_RGB_PVRTC_4BPPV1_IMG = $8C00;     
-     GL_COMPRESSED_RGB_PVRTC_2BPPV1_IMG = $8C01;     
-     GL_COMPRESSED_RGBA_PVRTC_4BPPV1_IMG = $8C02;     
-     GL_COMPRESSED_RGBA_PVRTC_2BPPV1_IMG = $8C03;     
-     GL_BGRA = $80E1;     
-  {------------------------------------------------------------------------*
-   * IMG extension functions
-   *------------------------------------------------------------------------ }
-  { GL_IMG_binary_shader  }
-     GL_IMG_binary_shader = 1;     
-  { GL_IMG_texture_compression_pvrtc  }
-     GL_IMG_texture_compression_pvrtc = 1;     
-  {
-   * This document is licensed under the SGI Free Software B License Version
-   * 2.0. For details, see http://oss.sgi.com/projects/FreeB/ .
-    }
-  {------------------------------------------------------------------------*
-   * OES extension tokens
-   *------------------------------------------------------------------------ }
-  { GL_OES_compressed_ETC1_RGB8_texture  }
-     GL_ETC1_RGB8_OES = $8D64;     
-  { GL_OES_compressed_paletted_texture  }
-     GL_PALETTE4_RGB8_OES = $8B90;     
-     GL_PALETTE4_RGBA8_OES = $8B91;     
-     GL_PALETTE4_R5_G6_B5_OES = $8B92;     
-     GL_PALETTE4_RGBA4_OES = $8B93;     
-     GL_PALETTE4_RGB5_A1_OES = $8B94;     
-     GL_PALETTE8_RGB8_OES = $8B95;     
-     GL_PALETTE8_RGBA8_OES = $8B96;     
-     GL_PALETTE8_R5_G6_B5_OES = $8B97;     
-     GL_PALETTE8_RGBA4_OES = $8B98;     
-     GL_PALETTE8_RGB5_A1_OES = $8B99;     
-  { GL_OES_depth24  }
-     GL_DEPTH_COMPONENT24_OES = $81A6;     
-  { GL_OES_depth32  }
-     GL_DEPTH_COMPONENT32_OES = $81A7;     
-  { GL_OES_depth_texture  }
-  { No new tokens introduced by this extension.  }
-  { GL_OES_EGL_image  }
+const
+   GL_SGX_BINARY_IMG = $8C0A;
+{ GL_IMG_texture_compression_pvrtc  }
+   GL_COMPRESSED_RGB_PVRTC_4BPPV1_IMG = $8C00;
+   GL_COMPRESSED_RGB_PVRTC_2BPPV1_IMG = $8C01;
+   GL_COMPRESSED_RGBA_PVRTC_4BPPV1_IMG = $8C02;
+   GL_COMPRESSED_RGBA_PVRTC_2BPPV1_IMG = $8C03;
+   GL_BGRA = $80E1;
+{------------------------------------------------------------------------*
+ * IMG extension functions
+ *------------------------------------------------------------------------ }
+{ GL_IMG_binary_shader  }
+   GL_IMG_binary_shader = 1;
+{ GL_IMG_texture_compression_pvrtc  }
+   GL_IMG_texture_compression_pvrtc = 1;
+{
+ * This document is licensed under the SGI Free Software B License Version
+ * 2.0. For details, see http://oss.sgi.com/projects/FreeB/ .
+  }
+{------------------------------------------------------------------------*
+ * OES extension tokens
+ *------------------------------------------------------------------------ }
+{ GL_OES_compressed_ETC1_RGB8_texture  }
+   GL_ETC1_RGB8_OES = $8D64;
+{ GL_OES_compressed_paletted_texture  }
+   GL_PALETTE4_RGB8_OES = $8B90;
+   GL_PALETTE4_RGBA8_OES = $8B91;
+   GL_PALETTE4_R5_G6_B5_OES = $8B92;
+   GL_PALETTE4_RGBA4_OES = $8B93;
+   GL_PALETTE4_RGB5_A1_OES = $8B94;
+   GL_PALETTE8_RGB8_OES = $8B95;
+   GL_PALETTE8_RGBA8_OES = $8B96;
+   GL_PALETTE8_R5_G6_B5_OES = $8B97;
+   GL_PALETTE8_RGBA4_OES = $8B98;
+   GL_PALETTE8_RGB5_A1_OES = $8B99;
+{ GL_OES_depth24  }
+   GL_DEPTH_COMPONENT24_OES = $81A6;
+{ GL_OES_depth32  }
+   GL_DEPTH_COMPONENT32_OES = $81A7;
+{ GL_OES_depth_texture  }
+{ No new tokens introduced by this extension.  }
+{ GL_OES_EGL_image  }
 
-  type
+type
 
-     GLeglImageOES = pointer;
-  { GL_OES_get_program_binary  }
+   GLeglImageOES = pointer;
+{ GL_OES_get_program_binary  }
 
-  const
-     GL_PROGRAM_BINARY_LENGTH_OES = $8741;     
-     GL_NUM_PROGRAM_BINARY_FORMATS_OES = $87FE;     
-     GL_PROGRAM_BINARY_FORMATS_OES = $87FF;     
-  { GL_OES_mapbuffer  }
-     GL_WRITE_ONLY_OES = $88B9;     
-     GL_BUFFER_ACCESS_OES = $88BB;     
-     GL_BUFFER_MAPPED_OES = $88BC;     
-     GL_BUFFER_MAP_POINTER_OES = $88BD;     
-  { GL_OES_packed_depth_stencil  }
-     GL_DEPTH_STENCIL_OES = $84F9;     
-     GL_UNSIGNED_INT_24_8_OES = $84FA;     
-     GL_DEPTH24_STENCIL8_OES = $88F0;     
-  { GL_OES_rgb8_rgba8  }
-     GL_RGB8_OES = $8051;     
-     GL_RGBA8_OES = $8058;     
-  { GL_OES_standard_derivatives  }
-     GL_FRAGMENT_SHADER_DERIVATIVE_HINT_OES = $8B8B;     
-  { GL_OES_stencil1  }
-     GL_STENCIL_INDEX1_OES = $8D46;     
-  { GL_OES_stencil4  }
-     GL_STENCIL_INDEX4_OES = $8D47;     
-  { GL_OES_texture3D  }
-     GL_TEXTURE_WRAP_R_OES = $8072;     
-     GL_TEXTURE_3D_OES = $806F;     
-     GL_TEXTURE_BINDING_3D_OES = $806A;     
-     GL_MAX_3D_TEXTURE_SIZE_OES = $8073;     
-     GL_SAMPLER_3D_OES = $8B5F;     
-     GL_FRAMEBUFFER_ATTACHMENT_TEXTURE_3D_ZOFFSET_OES = $8CD4;     
-  { GL_OES_texture_half_float  }
-     GL_HALF_FLOAT_OES = $8D61;     
-  { GL_OES_vertex_half_float  }
-  { GL_HALF_FLOAT_OES defined in GL_OES_texture_half_float already.  }
-  { GL_OES_vertex_type_10_10_10_2  }
-     GL_UNSIGNED_INT_10_10_10_2_OES = $8DF6;     
-     GL_INT_10_10_10_2_OES = $8DF7;     
-  {------------------------------------------------------------------------*
-   * AMD extension tokens
-   *------------------------------------------------------------------------ }
-  { GL_AMD_compressed_3DC_texture  }
-     GL_3DC_X_AMD = $87F9;     
-     GL_3DC_XY_AMD = $87FA;     
-  { GL_AMD_compressed_ATC_texture  }
-     GL_ATC_RGB_AMD = $8C92;     
-     GL_ATC_RGBA_EXPLICIT_ALPHA_AMD = $8C93;     
-     GL_ATC_RGBA_INTERPOLATED_ALPHA_AMD = $87EE;     
-  { GL_AMD_program_binary_Z400  }
-     GL_Z400_BINARY_AMD = $8740;     
-  { GL_AMD_performance_monitor  }
+const
+   GL_PROGRAM_BINARY_LENGTH_OES = $8741;
+   GL_NUM_PROGRAM_BINARY_FORMATS_OES = $87FE;
+   GL_PROGRAM_BINARY_FORMATS_OES = $87FF;
+{ GL_OES_mapbuffer  }
+   GL_WRITE_ONLY_OES = $88B9;
+   GL_BUFFER_ACCESS_OES = $88BB;
+   GL_BUFFER_MAPPED_OES = $88BC;
+   GL_BUFFER_MAP_POINTER_OES = $88BD;
+{ GL_OES_packed_depth_stencil  }
+   GL_DEPTH_STENCIL_OES = $84F9;
+   GL_UNSIGNED_INT_24_8_OES = $84FA;
+   GL_DEPTH24_STENCIL8_OES = $88F0;
+{ GL_OES_rgb8_rgba8  }
+   GL_RGB8_OES = $8051;
+   GL_RGBA8_OES = $8058;
+{ GL_OES_standard_derivatives  }
+   GL_FRAGMENT_SHADER_DERIVATIVE_HINT_OES = $8B8B;
+{ GL_OES_stencil1  }
+   GL_STENCIL_INDEX1_OES = $8D46;
+{ GL_OES_stencil4  }
+   GL_STENCIL_INDEX4_OES = $8D47;
+{ GL_OES_texture3D  }
+   GL_TEXTURE_WRAP_R_OES = $8072;
+   GL_TEXTURE_3D_OES = $806F;
+   GL_TEXTURE_BINDING_3D_OES = $806A;
+   GL_MAX_3D_TEXTURE_SIZE_OES = $8073;
+   GL_SAMPLER_3D_OES = $8B5F;
+   GL_FRAMEBUFFER_ATTACHMENT_TEXTURE_3D_ZOFFSET_OES = $8CD4;
+{ GL_OES_texture_half_float  }
+   GL_HALF_FLOAT_OES = $8D61;
+{ GL_OES_vertex_half_float  }
+{ GL_HALF_FLOAT_OES defined in GL_OES_texture_half_float already.  }
+{ GL_OES_vertex_type_10_10_10_2  }
+   GL_UNSIGNED_INT_10_10_10_2_OES = $8DF6;
+   GL_INT_10_10_10_2_OES = $8DF7;
+{------------------------------------------------------------------------*
+ * AMD extension tokens
+ *------------------------------------------------------------------------ }
+{ GL_AMD_compressed_3DC_texture  }
+   GL_3DC_X_AMD = $87F9;
+   GL_3DC_XY_AMD = $87FA;
+{ GL_AMD_compressed_ATC_texture  }
+   GL_ATC_RGB_AMD = $8C92;
+   GL_ATC_RGBA_EXPLICIT_ALPHA_AMD = $8C93;
+   GL_ATC_RGBA_INTERPOLATED_ALPHA_AMD = $87EE;
+{ GL_AMD_program_binary_Z400  }
+   GL_Z400_BINARY_AMD = $8740;
+{ GL_AMD_performance_monitor  }
 {$define GL_AMD_performance_monitor}  
-     GL_COUNTER_TYPE_AMD = $8BC0;     
-     GL_COUNTER_RANGE_AMD = $8BC1;     
-     GL_UNSIGNED_INT64_AMD = $8BC2;     
-     GL_PERCENTAGE_AMD = $8BC3;     
-     GL_PERFMON_RESULT_AVAILABLE_AMD = $8BC4;     
-     GL_PERFMON_RESULT_SIZE_AMD = $8BC5;     
-     GL_PERFMON_RESULT_AMD = $8BC6;     
-  {------------------------------------------------------------------------*
-   * EXT extension tokens
-   *------------------------------------------------------------------------ }
-  { GL_EXT_texture_filter_anisotropic  }
-     GL_TEXTURE_MAX_ANISOTROPY_EXT = $84FE;     
-     GL_MAX_TEXTURE_MAX_ANISOTROPY_EXT = $84FF;     
-  { GL_EXT_texture_type_2_10_10_10_REV  }
-     GL_UNSIGNED_INT_2_10_10_10_REV_EXT = $8368;     
-  {------------------------------------------------------------------------*
-   * OES extension functions
-   *------------------------------------------------------------------------ }
-  { GL_OES_compressed_ETC1_RGB8_texture  }
-     GL_OES_compressed_ETC1_RGB8_texture = 1;     
-  { GL_OES_compressed_paletted_texture  }
-     GL_OES_compressed_paletted_texture = 1;     
-  { GL_OES_EGL_image  }
+   GL_COUNTER_TYPE_AMD = $8BC0;
+   GL_COUNTER_RANGE_AMD = $8BC1;
+   GL_UNSIGNED_INT64_AMD = $8BC2;
+   GL_PERCENTAGE_AMD = $8BC3;
+   GL_PERFMON_RESULT_AVAILABLE_AMD = $8BC4;
+   GL_PERFMON_RESULT_SIZE_AMD = $8BC5;
+   GL_PERFMON_RESULT_AMD = $8BC6;
+{------------------------------------------------------------------------*
+ * EXT extension tokens
+ *------------------------------------------------------------------------ }
+{ GL_EXT_texture_filter_anisotropic  }
+   GL_TEXTURE_MAX_ANISOTROPY_EXT = $84FE;
+   GL_MAX_TEXTURE_MAX_ANISOTROPY_EXT = $84FF;
+{ GL_EXT_texture_type_2_10_10_10_REV  }
+   GL_UNSIGNED_INT_2_10_10_10_REV_EXT = $8368;
+{------------------------------------------------------------------------*
+ * OES extension functions
+ *------------------------------------------------------------------------ }
+{ GL_OES_compressed_ETC1_RGB8_texture  }
+   GL_OES_compressed_ETC1_RGB8_texture = 1;
+{ GL_OES_compressed_paletted_texture  }
+   GL_OES_compressed_paletted_texture = 1;
+{ GL_OES_EGL_image  }
 
-  var
-    glEGLImageTargetTexture2DOES : procedure(target:GLenum; image:GLeglImageOES);{$ifdef windows}stdcall;{$else}cdecl;{$endif}
-    glEGLImageTargetRenderbufferStorageOES : procedure(target:GLenum; image:GLeglImageOES);{$ifdef windows}stdcall;{$else}cdecl;{$endif}
+var
+  glEGLImageTargetTexture2DOES : procedure(target:GLenum; image:GLeglImageOES);{$ifdef windows}stdcall;{$else}cdecl;{$endif}
+  glEGLImageTargetRenderbufferStorageOES : procedure(target:GLenum; image:GLeglImageOES);{$ifdef windows}stdcall;{$else}cdecl;{$endif}
 
-  { GL_OES_depth24  }
+{ GL_OES_depth24  }
 
-  const
-     GL_OES_depth24 = 1;     
-  { GL_OES_depth32  }
-     GL_OES_depth32 = 1;     
-  { GL_OES_depth_texture  }
-     GL_OES_depth_texture = 1;     
-  { GL_OES_element_index_uint  }
-     GL_OES_element_index_uint = 1;     
-  { GL_OES_fbo_render_mipmap  }
-     GL_OES_fbo_render_mipmap = 1;     
-  { GL_OES_fragment_precision_high  }
-     GL_OES_fragment_precision_high = 1;     
-  { GL_OES_get_program_binary  }
+const
+   GL_OES_depth24 = 1;
+{ GL_OES_depth32  }
+   GL_OES_depth32 = 1;
+{ GL_OES_depth_texture  }
+   GL_OES_depth_texture = 1;
+{ GL_OES_element_index_uint  }
+   GL_OES_element_index_uint = 1;
+{ GL_OES_fbo_render_mipmap  }
+   GL_OES_fbo_render_mipmap = 1;
+{ GL_OES_fragment_precision_high  }
+   GL_OES_fragment_precision_high = 1;
+{ GL_OES_get_program_binary  }
 
-  var
-    glGetProgramBinaryOES : procedure(_program:GLuint; bufSize:GLsizei; length:pGLsizei; binaryFormat:pGLenum; binary:pointer);{$ifdef windows}stdcall;{$else}cdecl;{$endif}
+var
+  glGetProgramBinaryOES : procedure(_program:GLuint; bufSize:GLsizei; length:pGLsizei; binaryFormat:pGLenum; binary:pointer);{$ifdef windows}stdcall;{$else}cdecl;{$endif}
 (* Const before type ignored *)
-    glProgramBinaryOES : procedure(_program:GLuint; binaryFormat:GLenum; binary:pointer; length:GLint);{$ifdef windows}stdcall;{$else}cdecl;{$endif}
+  glProgramBinaryOES : procedure(_program:GLuint; binaryFormat:GLenum; binary:pointer; length:GLint);{$ifdef windows}stdcall;{$else}cdecl;{$endif}
 
 (* Const before type ignored *)
-  { GL_OES_mapbuffer  }
+{ GL_OES_mapbuffer  }
 
-  const
-     GL_OES_mapbuffer = 1;     
+const
+   GL_OES_mapbuffer = 1;
 
-  var
-    glMapBufferOES : function(target:GLenum; access:GLenum):pointer;{$ifdef windows}stdcall;{$else}cdecl;{$endif}
-    glUnmapBufferOES : function(target:GLenum):GLboolean;{$ifdef windows}stdcall;{$else}cdecl;{$endif}
-    glGetBufferPointervOES : procedure(target:GLenum; pname:GLenum; params:Ppointer);{$ifdef windows}stdcall;{$else}cdecl;{$endif}
+var
+  glMapBufferOES : function(target:GLenum; access:GLenum):pointer;{$ifdef windows}stdcall;{$else}cdecl;{$endif}
+  glUnmapBufferOES : function(target:GLenum):GLboolean;{$ifdef windows}stdcall;{$else}cdecl;{$endif}
+  glGetBufferPointervOES : procedure(target:GLenum; pname:GLenum; params:Ppointer);{$ifdef windows}stdcall;{$else}cdecl;{$endif}
 
-  type
+type
 
-     PFNGLMAPBUFFEROESPROC = pointer;
-  { GL_OES_packed_depth_stencil  }
+   PFNGLMAPBUFFEROESPROC = pointer;
+{ GL_OES_packed_depth_stencil  }
 
-  const
-     GL_OES_packed_depth_stencil = 1;     
-  { GL_OES_rgb8_rgba8  }
-     GL_OES_rgb8_rgba8 = 1;     
-  { GL_OES_standard_derivatives  }
-     GL_OES_standard_derivatives = 1;     
-  { GL_OES_stencil1  }
-     GL_OES_stencil1 = 1;     
-  { GL_OES_stencil4  }
-     GL_OES_stencil4 = 1;     
-  { GL_OES_texture_3D  }
-     GL_OES_texture_3D = 1;     
+const
+   GL_OES_packed_depth_stencil = 1;
+{ GL_OES_rgb8_rgba8  }
+   GL_OES_rgb8_rgba8 = 1;
+{ GL_OES_standard_derivatives  }
+   GL_OES_standard_derivatives = 1;
+{ GL_OES_stencil1  }
+   GL_OES_stencil1 = 1;
+{ GL_OES_stencil4  }
+   GL_OES_stencil4 = 1;
+{ GL_OES_texture_3D  }
+   GL_OES_texture_3D = 1;
 (* Const before type ignored *)
 
-  var
-    glTexImage3DOES : procedure(target:GLenum; level:GLint; internalformat:GLenum; width:GLsizei; height:GLsizei; 
-      depth:GLsizei; border:GLint; format:GLenum; _type:GLenum; pixels:pointer);{$ifdef windows}stdcall;{$else}cdecl;{$endif}
+var
+  glTexImage3DOES : procedure(target:GLenum; level:GLint; internalformat:GLenum; width:GLsizei; height:GLsizei;
+    depth:GLsizei; border:GLint; format:GLenum; _type:GLenum; pixels:pointer);{$ifdef windows}stdcall;{$else}cdecl;{$endif}
 (* Const before type ignored *)
-    glTexSubImage3DOES : procedure(target:GLenum; level:GLint; xoffset:GLint; yoffset:GLint; zoffset:GLint; 
-      width:GLsizei; height:GLsizei; depth:GLsizei; format:GLenum; _type:GLenum; 
-      pixels:pointer);{$ifdef windows}stdcall;{$else}cdecl;{$endif}
-    glCopyTexSubImage3DOES : procedure(target:GLenum; level:GLint; xoffset:GLint; yoffset:GLint; zoffset:GLint; 
-      x:GLint; y:GLint; width:GLsizei; height:GLsizei);{$ifdef windows}stdcall;{$else}cdecl;{$endif}
+  glTexSubImage3DOES : procedure(target:GLenum; level:GLint; xoffset:GLint; yoffset:GLint; zoffset:GLint;
+    width:GLsizei; height:GLsizei; depth:GLsizei; format:GLenum; _type:GLenum;
+    pixels:pointer);{$ifdef windows}stdcall;{$else}cdecl;{$endif}
+  glCopyTexSubImage3DOES : procedure(target:GLenum; level:GLint; xoffset:GLint; yoffset:GLint; zoffset:GLint;
+    x:GLint; y:GLint; width:GLsizei; height:GLsizei);{$ifdef windows}stdcall;{$else}cdecl;{$endif}
 (* Const before type ignored *)
-    glCompressedTexImage3DOES : procedure(target:GLenum; level:GLint; internalformat:GLenum; width:GLsizei; height:GLsizei; 
-      depth:GLsizei; border:GLint; imageSize:GLsizei; data:pointer);{$ifdef windows}stdcall;{$else}cdecl;{$endif}
+  glCompressedTexImage3DOES : procedure(target:GLenum; level:GLint; internalformat:GLenum; width:GLsizei; height:GLsizei;
+    depth:GLsizei; border:GLint; imageSize:GLsizei; data:pointer);{$ifdef windows}stdcall;{$else}cdecl;{$endif}
 (* Const before type ignored *)
-    glCompressedTexSubImage3DOES : procedure(target:GLenum; level:GLint; xoffset:GLint; yoffset:GLint; zoffset:GLint; 
-      width:GLsizei; height:GLsizei; depth:GLsizei; format:GLenum; imageSize:GLsizei; 
-      data:pointer);{$ifdef windows}stdcall;{$else}cdecl;{$endif}
-    glFramebufferTexture3DOES : procedure(target:GLenum; attachment:GLenum; textarget:GLenum; texture:GLuint; level:GLint; 
-      zoffset:GLint);{$ifdef windows}stdcall;{$else}cdecl;{$endif}
+  glCompressedTexSubImage3DOES : procedure(target:GLenum; level:GLint; xoffset:GLint; yoffset:GLint; zoffset:GLint;
+    width:GLsizei; height:GLsizei; depth:GLsizei; format:GLenum; imageSize:GLsizei;
+    data:pointer);{$ifdef windows}stdcall;{$else}cdecl;{$endif}
+  glFramebufferTexture3DOES : procedure(target:GLenum; attachment:GLenum; textarget:GLenum; texture:GLuint; level:GLint;
+    zoffset:GLint);{$ifdef windows}stdcall;{$else}cdecl;{$endif}
 (* Const before type ignored *)
 
 (* Const before type ignored *)
 (* Const before type ignored *)
 (* Const before type ignored *)
-  { GL_OES_texture_float_linear  }
+{ GL_OES_texture_float_linear  }
 
-  const
-     GL_OES_texture_float_linear = 1;     
-  { GL_OES_texture_half_float_linear  }
-     GL_OES_texture_half_float_linear = 1;     
-  { GL_OES_texture_float  }
-     GL_OES_texture_float = 1;     
-  { GL_OES_texture_half_float  }
-     GL_OES_texture_half_float = 1;     
-  { GL_OES_texture_npot  }
-     GL_OES_texture_npot = 1;     
-  { GL_OES_vertex_half_float  }
-     GL_OES_vertex_half_float = 1;     
-  { GL_OES_vertex_type_10_10_10_2  }
-     GL_OES_vertex_type_10_10_10_2 = 1;     
-  {------------------------------------------------------------------------*
-   * AMD extension functions
-   *------------------------------------------------------------------------ }
-  { GL_AMD_compressed_3DC_texture  }
-     GL_AMD_compressed_3DC_texture = 1;     
-  { GL_AMD_compressed_ATC_texture  }
-     GL_AMD_compressed_ATC_texture = 1;     
-  { GL_AMD_program_binary_Z400  }
-     GL_AMD_program_binary_Z400 = 1;     
-  { AMD_performance_monitor  }
-     GL_AMD_performance_monitor = 1;     
+const
+   GL_OES_texture_float_linear = 1;
+{ GL_OES_texture_half_float_linear  }
+   GL_OES_texture_half_float_linear = 1;
+{ GL_OES_texture_float  }
+   GL_OES_texture_float = 1;
+{ GL_OES_texture_half_float  }
+   GL_OES_texture_half_float = 1;
+{ GL_OES_texture_npot  }
+   GL_OES_texture_npot = 1;
+{ GL_OES_vertex_half_float  }
+   GL_OES_vertex_half_float = 1;
+{ GL_OES_vertex_type_10_10_10_2  }
+   GL_OES_vertex_type_10_10_10_2 = 1;
+{------------------------------------------------------------------------*
+ * AMD extension functions
+ *------------------------------------------------------------------------ }
+{ GL_AMD_compressed_3DC_texture  }
+   GL_AMD_compressed_3DC_texture = 1;
+{ GL_AMD_compressed_ATC_texture  }
+   GL_AMD_compressed_ATC_texture = 1;
+{ GL_AMD_program_binary_Z400  }
+   GL_AMD_program_binary_Z400 = 1;
+{ AMD_performance_monitor  }
+   GL_AMD_performance_monitor = 1;
 
-  var
-    glGetPerfMonitorGroupsAMD : procedure(numGroups:pGLint; groupsSize:GLsizei; groups:pGLuint);{$ifdef windows}stdcall;{$else}cdecl;{$endif}
-    glGetPerfMonitorCountersAMD : procedure(group:GLuint; numCounters:pGLint; maxActiveCounters:pGLint; counterSize:GLsizei; counters:pGLuint);{$ifdef windows}stdcall;{$else}cdecl;{$endif}
-    glGetPerfMonitorGroupStringAMD : procedure(group:GLuint; bufSize:GLsizei; length:pGLsizei; groupString:pchar);{$ifdef windows}stdcall;{$else}cdecl;{$endif}
-    glGetPerfMonitorCounterStringAMD : procedure(group:GLuint; counter:GLuint; bufSize:GLsizei; length:pGLsizei; counterString:pchar);{$ifdef windows}stdcall;{$else}cdecl;{$endif}
-    glGetPerfMonitorCounterInfoAMD : procedure(group:GLuint; counter:GLuint; pname:GLenum; data:pointer);{$ifdef windows}stdcall;{$else}cdecl;{$endif}
-    glGenPerfMonitorsAMD : procedure(n:GLsizei; monitors:pGLuint);{$ifdef windows}stdcall;{$else}cdecl;{$endif}
-    glDeletePerfMonitorsAMD : procedure(n:GLsizei; monitors:pGLuint);{$ifdef windows}stdcall;{$else}cdecl;{$endif}
-    glSelectPerfMonitorCountersAMD : procedure(monitor:GLuint; enable:GLboolean; group:GLuint; numCounters:GLint; countersList:pGLuint);{$ifdef windows}stdcall;{$else}cdecl;{$endif}
-    glBeginPerfMonitorAMD : procedure(monitor:GLuint);{$ifdef windows}stdcall;{$else}cdecl;{$endif}
-    glEndPerfMonitorAMD : procedure(monitor:GLuint);{$ifdef windows}stdcall;{$else}cdecl;{$endif}
-    glGetPerfMonitorCounterDataAMD : procedure(monitor:GLuint; pname:GLenum; dataSize:GLsizei; data:pGLuint; bytesWritten:pGLint);{$ifdef windows}stdcall;{$else}cdecl;{$endif}
+var
+  glGetPerfMonitorGroupsAMD : procedure(numGroups:pGLint; groupsSize:GLsizei; groups:pGLuint);{$ifdef windows}stdcall;{$else}cdecl;{$endif}
+  glGetPerfMonitorCountersAMD : procedure(group:GLuint; numCounters:pGLint; maxActiveCounters:pGLint; counterSize:GLsizei; counters:pGLuint);{$ifdef windows}stdcall;{$else}cdecl;{$endif}
+  glGetPerfMonitorGroupStringAMD : procedure(group:GLuint; bufSize:GLsizei; length:pGLsizei; groupString:pchar);{$ifdef windows}stdcall;{$else}cdecl;{$endif}
+  glGetPerfMonitorCounterStringAMD : procedure(group:GLuint; counter:GLuint; bufSize:GLsizei; length:pGLsizei; counterString:pchar);{$ifdef windows}stdcall;{$else}cdecl;{$endif}
+  glGetPerfMonitorCounterInfoAMD : procedure(group:GLuint; counter:GLuint; pname:GLenum; data:pointer);{$ifdef windows}stdcall;{$else}cdecl;{$endif}
+  glGenPerfMonitorsAMD : procedure(n:GLsizei; monitors:pGLuint);{$ifdef windows}stdcall;{$else}cdecl;{$endif}
+  glDeletePerfMonitorsAMD : procedure(n:GLsizei; monitors:pGLuint);{$ifdef windows}stdcall;{$else}cdecl;{$endif}
+  glSelectPerfMonitorCountersAMD : procedure(monitor:GLuint; enable:GLboolean; group:GLuint; numCounters:GLint; countersList:pGLuint);{$ifdef windows}stdcall;{$else}cdecl;{$endif}
+  glBeginPerfMonitorAMD : procedure(monitor:GLuint);{$ifdef windows}stdcall;{$else}cdecl;{$endif}
+  glEndPerfMonitorAMD : procedure(monitor:GLuint);{$ifdef windows}stdcall;{$else}cdecl;{$endif}
+  glGetPerfMonitorCounterDataAMD : procedure(monitor:GLuint; pname:GLenum; dataSize:GLsizei; data:pGLuint; bytesWritten:pGLint);{$ifdef windows}stdcall;{$else}cdecl;{$endif}
 
-  {------------------------------------------------------------------------*
-   * EXT extension functions
-   *------------------------------------------------------------------------ }
-  { GL_EXT_texture_filter_anisotropic  }
+{------------------------------------------------------------------------*
+ * EXT extension functions
+ *------------------------------------------------------------------------ }
+{ GL_EXT_texture_filter_anisotropic  }
 
-  const
-     GL_EXT_texture_filter_anisotropic = 1;     
-  { GL_EXT_texture_type_2_10_10_10_REV  }
-     GL_EXT_texture_type_2_10_10_10_REV = 1;     
+const
+   GL_EXT_texture_filter_anisotropic = 1;
+{ GL_EXT_texture_type_2_10_10_10_REV  }
+   GL_EXT_texture_type_2_10_10_10_REV = 1;
 
-function glGetProcAddress(ahlib:tlibhandle;ProcName:pchar):pointer;
-
 implementation
 
-  function glGetProcAddress(ahlib:tlibhandle;ProcName:pchar):pointer;
-    begin
-      result:=dynlibs.GetProcAddress(ahlib,ProcName);
-{$ifdef EGL}
-      if assigned(eglGetProcAddress) and not assigned(result) then
-        result:=eglGetProcAddress(ProcName);
-{$endif}
-    end;
+var
+  GLESv2Lib : tlibhandle;
 
-{$ifdef EGL}
-  { was #define dname def_expr }
-  function EGL_DEFAULT_DISPLAY : EGLNativeDisplayType;
-      begin
-         EGL_DEFAULT_DISPLAY:=EGLNativeDisplayType(0);
-      end;
+procedure FreeGLESv2;
+  begin
+    if GLESv2Lib<>0 then
+      FreeLibrary(GLESv2Lib);
 
-  { was #define dname def_expr }
-  function EGL_NO_CONTEXT : EGLContext;
-      begin
-         EGL_NO_CONTEXT:=EGLContext(0);
-      end;
+    glActiveTexture:=nil;
+    glAttachShader:=nil;
+    glBindAttribLocation:=nil;
+    glBindBuffer:=nil;
+    glBindFramebuffer:=nil;
+    glBindRenderbuffer:=nil;
+    glBindTexture:=nil;
+    glBlendColor:=nil;
+    glBlendEquation:=nil;
+    glBlendEquationSeparate:=nil;
+    glBlendFunc:=nil;
+    glBlendFuncSeparate:=nil;
+    glBufferData:=nil;
+    glBufferSubData:=nil;
+    glCheckFramebufferStatus:=nil;
+    glClear:=nil;
+    glClearColor:=nil;
+    glClearDepthf:=nil;
+    glClearStencil:=nil;
+    glColorMask:=nil;
+    glCompileShader:=nil;
+    glCompressedTexImage2D:=nil;
+    glCompressedTexSubImage2D:=nil;
+    glCopyTexImage2D:=nil;
+    glCopyTexSubImage2D:=nil;
+    glCreateProgram:=nil;
+    glCreateShader:=nil;
+    glCullFace:=nil;
+    glDeleteBuffers:=nil;
+    glDeleteFramebuffers:=nil;
+    glDeleteProgram:=nil;
+    glDeleteRenderbuffers:=nil;
+    glDeleteShader:=nil;
+    glDeleteTextures:=nil;
+    glDepthFunc:=nil;
+    glDepthMask:=nil;
+    glDepthRangef:=nil;
+    glDetachShader:=nil;
+    glDisable:=nil;
+    glDisableVertexAttribArray:=nil;
+    glDrawArrays:=nil;
+    glDrawElements:=nil;
+    glEnable:=nil;
+    glEnableVertexAttribArray:=nil;
+    glFinish:=nil;
+    glFlush:=nil;
+    glFramebufferRenderbuffer:=nil;
+    glFramebufferTexture2D:=nil;
+    glFrontFace:=nil;
+    glGenBuffers:=nil;
+    glGenerateMipmap:=nil;
+    glGenFramebuffers:=nil;
+    glGenRenderbuffers:=nil;
+    glGenTextures:=nil;
+    glGetActiveAttrib:=nil;
+    glGetActiveUniform:=nil;
+    glGetAttachedShaders:=nil;
+    glGetAttribLocation:=nil;
+    glGetBooleanv:=nil;
+    glGetBufferParameteriv:=nil;
+    glGetError:=nil;
+    glGetFloatv:=nil;
+    glGetFramebufferAttachmentParameteriv:=nil;
+    glGetIntegerv:=nil;
+    glGetProgramiv:=nil;
+    glGetProgramInfoLog:=nil;
+    glGetRenderbufferParameteriv:=nil;
+    glGetShaderiv:=nil;
+    glGetShaderInfoLog:=nil;
+    glGetShaderPrecisionFormat:=nil;
+    glGetShaderSource:=nil;
+    glGetString:=nil;
+    glGetTexParameterfv:=nil;
+    glGetTexParameteriv:=nil;
+    glGetUniformfv:=nil;
+    glGetUniformiv:=nil;
+    glGetUniformLocation:=nil;
+    glGetVertexAttribfv:=nil;
+    glGetVertexAttribiv:=nil;
+    glGetVertexAttribPointerv:=nil;
+    glHint:=nil;
+    glIsBuffer:=nil;
+    glIsEnabled:=nil;
+    glIsFramebuffer:=nil;
+    glIsProgram:=nil;
+    glIsRenderbuffer:=nil;
+    glIsShader:=nil;
+    glIsTexture:=nil;
+    glLineWidth:=nil;
+    glLinkProgram:=nil;
+    glPixelStorei:=nil;
+    glPolygonOffset:=nil;
+    glReadPixels:=nil;
+    glReleaseShaderCompiler:=nil;
+    glRenderbufferStorage:=nil;
+    glSampleCoverage:=nil;
+    glScissor:=nil;
+    glShaderBinary:=nil;
+    glShaderSource:=nil;
+    glStencilFunc:=nil;
+    glStencilFuncSeparate:=nil;
+    glStencilMask:=nil;
+    glStencilMaskSeparate:=nil;
+    glStencilOp:=nil;
+    glStencilOpSeparate:=nil;
+    glTexImage2D:=nil;
+    glTexParameterf:=nil;
+    glTexParameterfv:=nil;
+    glTexParameteri:=nil;
+    glTexParameteriv:=nil;
+    glTexSubImage2D:=nil;
+    glUniform1f:=nil;
+    glUniform1fv:=nil;
+    glUniform1i:=nil;
+    glUniform1iv:=nil;
+    glUniform2f:=nil;
+    glUniform2fv:=nil;
+    glUniform2i:=nil;
+    glUniform2iv:=nil;
+    glUniform3f:=nil;
+    glUniform3fv:=nil;
+    glUniform3i:=nil;
+    glUniform3iv:=nil;
+    glUniform4f:=nil;
+    glUniform4fv:=nil;
+    glUniform4i:=nil;
+    glUniform4iv:=nil;
+    glUniformMatrix2fv:=nil;
+    glUniformMatrix3fv:=nil;
+    glUniformMatrix4fv:=nil;
+    glUseProgram:=nil;
+    glValidateProgram:=nil;
+    glVertexAttrib1f:=nil;
+    glVertexAttrib1fv:=nil;
+    glVertexAttrib2f:=nil;
+    glVertexAttrib2fv:=nil;
+    glVertexAttrib3f:=nil;
+    glVertexAttrib3fv:=nil;
+    glVertexAttrib4f:=nil;
+    glVertexAttrib4fv:=nil;
+    glVertexAttribPointer:=nil;
+    glViewport:=nil;
+    glEGLImageTargetTexture2DOES:=nil;
+    glEGLImageTargetRenderbufferStorageOES:=nil;
+    glGetProgramBinaryOES:=nil;
+    glProgramBinaryOES:=nil;
+    glMapBufferOES:=nil;
+    glUnmapBufferOES:=nil;
+    glGetBufferPointervOES:=nil;
+    glTexImage3DOES:=nil;
+    glTexSubImage3DOES:=nil;
+    glCopyTexSubImage3DOES:=nil;
+    glCompressedTexImage3DOES:=nil;
+    glCompressedTexSubImage3DOES:=nil;
+    glFramebufferTexture3DOES:=nil;
+    glGetPerfMonitorGroupsAMD:=nil;
+    glGetPerfMonitorCountersAMD:=nil;
+    glGetPerfMonitorGroupStringAMD:=nil;
+    glGetPerfMonitorCounterStringAMD:=nil;
+    glGetPerfMonitorCounterInfoAMD:=nil;
+    glGenPerfMonitorsAMD:=nil;
+    glDeletePerfMonitorsAMD:=nil;
+    glSelectPerfMonitorCountersAMD:=nil;
+    glBeginPerfMonitorAMD:=nil;
+    glEndPerfMonitorAMD:=nil;
+    glGetPerfMonitorCounterDataAMD:=nil;
+  end;
 
-  { was #define dname def_expr }
-  function EGL_NO_DISPLAY : EGLDisplay;
-      begin
-         EGL_NO_DISPLAY:=EGLDisplay(0);
-      end;
+procedure LoadGLESv2(lib : pchar);
+  begin
+    FreeGLESv2;
+    GLESv2Lib:=dynlibs.LoadLibrary(lib);
+    if GLESv2Lib=0 then
+      raise Exception.Create(format('Could not load library: %s',[lib]));
 
-  { was #define dname def_expr }
-  function EGL_NO_SURFACE : EGLSurface;
-      begin
-         EGL_NO_SURFACE:=EGLSurface(0);
-      end;
+    pointer(glActiveTexture):=GetProcAddress(GLESv2Lib,'glActiveTexture');
+    pointer(glAttachShader):=GetProcAddress(GLESv2Lib,'glAttachShader');
+    pointer(glBindAttribLocation):=GetProcAddress(GLESv2Lib,'glBindAttribLocation');
+    pointer(glBindBuffer):=GetProcAddress(GLESv2Lib,'glBindBuffer');
+    pointer(glBindFramebuffer):=GetProcAddress(GLESv2Lib,'glBindFramebuffer');
+    pointer(glBindRenderbuffer):=GetProcAddress(GLESv2Lib,'glBindRenderbuffer');
+    pointer(glBindTexture):=GetProcAddress(GLESv2Lib,'glBindTexture');
+    pointer(glBlendColor):=GetProcAddress(GLESv2Lib,'glBlendColor');
+    pointer(glBlendEquation):=GetProcAddress(GLESv2Lib,'glBlendEquation');
+    pointer(glBlendEquationSeparate):=GetProcAddress(GLESv2Lib,'glBlendEquationSeparate');
+    pointer(glBlendFunc):=GetProcAddress(GLESv2Lib,'glBlendFunc');
+    pointer(glBlendFuncSeparate):=GetProcAddress(GLESv2Lib,'glBlendFuncSeparate');
+    pointer(glBufferData):=GetProcAddress(GLESv2Lib,'glBufferData');
+    pointer(glBufferSubData):=GetProcAddress(GLESv2Lib,'glBufferSubData');
+    pointer(glCheckFramebufferStatus):=GetProcAddress(GLESv2Lib,'glCheckFramebufferStatus');
+    pointer(glClear):=GetProcAddress(GLESv2Lib,'glClear');
+    pointer(glClearColor):=GetProcAddress(GLESv2Lib,'glClearColor');
+    pointer(glClearDepthf):=GetProcAddress(GLESv2Lib,'glClearDepthf');
+    pointer(glClearStencil):=GetProcAddress(GLESv2Lib,'glClearStencil');
+    pointer(glColorMask):=GetProcAddress(GLESv2Lib,'glColorMask');
+    pointer(glCompileShader):=GetProcAddress(GLESv2Lib,'glCompileShader');
+    pointer(glCompressedTexImage2D):=GetProcAddress(GLESv2Lib,'glCompressedTexImage2D');
+    pointer(glCompressedTexSubImage2D):=GetProcAddress(GLESv2Lib,'glCompressedTexSubImage2D');
+    pointer(glCopyTexImage2D):=GetProcAddress(GLESv2Lib,'glCopyTexImage2D');
+    pointer(glCopyTexSubImage2D):=GetProcAddress(GLESv2Lib,'glCopyTexSubImage2D');
+    pointer(glCreateProgram):=GetProcAddress(GLESv2Lib,'glCreateProgram');
+    pointer(glCreateShader):=GetProcAddress(GLESv2Lib,'glCreateShader');
+    pointer(glCullFace):=GetProcAddress(GLESv2Lib,'glCullFace');
+    pointer(glDeleteBuffers):=GetProcAddress(GLESv2Lib,'glDeleteBuffers');
+    pointer(glDeleteFramebuffers):=GetProcAddress(GLESv2Lib,'glDeleteFramebuffers');
+    pointer(glDeleteProgram):=GetProcAddress(GLESv2Lib,'glDeleteProgram');
+    pointer(glDeleteRenderbuffers):=GetProcAddress(GLESv2Lib,'glDeleteRenderbuffers');
+    pointer(glDeleteShader):=GetProcAddress(GLESv2Lib,'glDeleteShader');
+    pointer(glDeleteTextures):=GetProcAddress(GLESv2Lib,'glDeleteTextures');
+    pointer(glDepthFunc):=GetProcAddress(GLESv2Lib,'glDepthFunc');
+    pointer(glDepthMask):=GetProcAddress(GLESv2Lib,'glDepthMask');
+    pointer(glDepthRangef):=GetProcAddress(GLESv2Lib,'glDepthRangef');
+    pointer(glDetachShader):=GetProcAddress(GLESv2Lib,'glDetachShader');
+    pointer(glDisable):=GetProcAddress(GLESv2Lib,'glDisable');
+    pointer(glDisableVertexAttribArray):=GetProcAddress(GLESv2Lib,'glDisableVertexAttribArray');
+    pointer(glDrawArrays):=GetProcAddress(GLESv2Lib,'glDrawArrays');
+    pointer(glDrawElements):=GetProcAddress(GLESv2Lib,'glDrawElements');
+    pointer(glEnable):=GetProcAddress(GLESv2Lib,'glEnable');
+    pointer(glEnableVertexAttribArray):=GetProcAddress(GLESv2Lib,'glEnableVertexAttribArray');
+    pointer(glFinish):=GetProcAddress(GLESv2Lib,'glFinish');
+    pointer(glFlush):=GetProcAddress(GLESv2Lib,'glFlush');
+    pointer(glFramebufferRenderbuffer):=GetProcAddress(GLESv2Lib,'glFramebufferRenderbuffer');
+    pointer(glFramebufferTexture2D):=GetProcAddress(GLESv2Lib,'glFramebufferTexture2D');
+    pointer(glFrontFace):=GetProcAddress(GLESv2Lib,'glFrontFace');
+    pointer(glGenBuffers):=GetProcAddress(GLESv2Lib,'glGenBuffers');
+    pointer(glGenerateMipmap):=GetProcAddress(GLESv2Lib,'glGenerateMipmap');
+    pointer(glGenFramebuffers):=GetProcAddress(GLESv2Lib,'glGenFramebuffers');
+    pointer(glGenRenderbuffers):=GetProcAddress(GLESv2Lib,'glGenRenderbuffers');
+    pointer(glGenTextures):=GetProcAddress(GLESv2Lib,'glGenTextures');
+    pointer(glGetActiveAttrib):=GetProcAddress(GLESv2Lib,'glGetActiveAttrib');
+    pointer(glGetActiveUniform):=GetProcAddress(GLESv2Lib,'glGetActiveUniform');
+    pointer(glGetAttachedShaders):=GetProcAddress(GLESv2Lib,'glGetAttachedShaders');
+    pointer(glGetAttribLocation):=GetProcAddress(GLESv2Lib,'glGetAttribLocation');
+    pointer(glGetBooleanv):=GetProcAddress(GLESv2Lib,'glGetBooleanv');
+    pointer(glGetBufferParameteriv):=GetProcAddress(GLESv2Lib,'glGetBufferParameteriv');
+    pointer(glGetError):=GetProcAddress(GLESv2Lib,'glGetError');
+    pointer(glGetFloatv):=GetProcAddress(GLESv2Lib,'glGetFloatv');
+    pointer(glGetFramebufferAttachmentParameteriv):=GetProcAddress(GLESv2Lib,'glGetFramebufferAttachmentParameteriv');
+    pointer(glGetIntegerv):=GetProcAddress(GLESv2Lib,'glGetIntegerv');
+    pointer(glGetProgramiv):=GetProcAddress(GLESv2Lib,'glGetProgramiv');
+    pointer(glGetProgramInfoLog):=GetProcAddress(GLESv2Lib,'glGetProgramInfoLog');
+    pointer(glGetRenderbufferParameteriv):=GetProcAddress(GLESv2Lib,'glGetRenderbufferParameteriv');
+    pointer(glGetShaderiv):=GetProcAddress(GLESv2Lib,'glGetShaderiv');
+    pointer(glGetShaderInfoLog):=GetProcAddress(GLESv2Lib,'glGetShaderInfoLog');
+    pointer(glGetShaderPrecisionFormat):=GetProcAddress(GLESv2Lib,'glGetShaderPrecisionFormat');
+    pointer(glGetShaderSource):=GetProcAddress(GLESv2Lib,'glGetShaderSource');
+    pointer(glGetString):=GetProcAddress(GLESv2Lib,'glGetString');
+    pointer(glGetTexParameterfv):=GetProcAddress(GLESv2Lib,'glGetTexParameterfv');
+    pointer(glGetTexParameteriv):=GetProcAddress(GLESv2Lib,'glGetTexParameteriv');
+    pointer(glGetUniformfv):=GetProcAddress(GLESv2Lib,'glGetUniformfv');
+    pointer(glGetUniformiv):=GetProcAddress(GLESv2Lib,'glGetUniformiv');
+    pointer(glGetUniformLocation):=GetProcAddress(GLESv2Lib,'glGetUniformLocation');
+    pointer(glGetVertexAttribfv):=GetProcAddress(GLESv2Lib,'glGetVertexAttribfv');
+    pointer(glGetVertexAttribiv):=GetProcAddress(GLESv2Lib,'glGetVertexAttribiv');
+    pointer(glGetVertexAttribPointerv):=GetProcAddress(GLESv2Lib,'glGetVertexAttribPointerv');
+    pointer(glHint):=GetProcAddress(GLESv2Lib,'glHint');
+    pointer(glIsBuffer):=GetProcAddress(GLESv2Lib,'glIsBuffer');
+    pointer(glIsEnabled):=GetProcAddress(GLESv2Lib,'glIsEnabled');
+    pointer(glIsFramebuffer):=GetProcAddress(GLESv2Lib,'glIsFramebuffer');
+    pointer(glIsProgram):=GetProcAddress(GLESv2Lib,'glIsProgram');
+    pointer(glIsRenderbuffer):=GetProcAddress(GLESv2Lib,'glIsRenderbuffer');
+    pointer(glIsShader):=GetProcAddress(GLESv2Lib,'glIsShader');
+    pointer(glIsTexture):=GetProcAddress(GLESv2Lib,'glIsTexture');
+    pointer(glLineWidth):=GetProcAddress(GLESv2Lib,'glLineWidth');
+    pointer(glLinkProgram):=GetProcAddress(GLESv2Lib,'glLinkProgram');
+    pointer(glPixelStorei):=GetProcAddress(GLESv2Lib,'glPixelStorei');
+    pointer(glPolygonOffset):=GetProcAddress(GLESv2Lib,'glPolygonOffset');
+    pointer(glReadPixels):=GetProcAddress(GLESv2Lib,'glReadPixels');
+    pointer(glReleaseShaderCompiler):=GetProcAddress(GLESv2Lib,'glReleaseShaderCompiler');
+    pointer(glRenderbufferStorage):=GetProcAddress(GLESv2Lib,'glRenderbufferStorage');
+    pointer(glSampleCoverage):=GetProcAddress(GLESv2Lib,'glSampleCoverage');
+    pointer(glScissor):=GetProcAddress(GLESv2Lib,'glScissor');
+    pointer(glShaderBinary):=GetProcAddress(GLESv2Lib,'glShaderBinary');
+    pointer(glShaderSource):=GetProcAddress(GLESv2Lib,'glShaderSource');
+    pointer(glStencilFunc):=GetProcAddress(GLESv2Lib,'glStencilFunc');
+    pointer(glStencilFuncSeparate):=GetProcAddress(GLESv2Lib,'glStencilFuncSeparate');
+    pointer(glStencilMask):=GetProcAddress(GLESv2Lib,'glStencilMask');
+    pointer(glStencilMaskSeparate):=GetProcAddress(GLESv2Lib,'glStencilMaskSeparate');
+    pointer(glStencilOp):=GetProcAddress(GLESv2Lib,'glStencilOp');
+    pointer(glStencilOpSeparate):=GetProcAddress(GLESv2Lib,'glStencilOpSeparate');
+    pointer(glTexImage2D):=GetProcAddress(GLESv2Lib,'glTexImage2D');
+    pointer(glTexParameterf):=GetProcAddress(GLESv2Lib,'glTexParameterf');
+    pointer(glTexParameterfv):=GetProcAddress(GLESv2Lib,'glTexParameterfv');
+    pointer(glTexParameteri):=GetProcAddress(GLESv2Lib,'glTexParameteri');
+    pointer(glTexParameteriv):=GetProcAddress(GLESv2Lib,'glTexParameteriv');
+    pointer(glTexSubImage2D):=GetProcAddress(GLESv2Lib,'glTexSubImage2D');
+    pointer(glUniform1f):=GetProcAddress(GLESv2Lib,'glUniform1f');
+    pointer(glUniform1fv):=GetProcAddress(GLESv2Lib,'glUniform1fv');
+    pointer(glUniform1i):=GetProcAddress(GLESv2Lib,'glUniform1i');
+    pointer(glUniform1iv):=GetProcAddress(GLESv2Lib,'glUniform1iv');
+    pointer(glUniform2f):=GetProcAddress(GLESv2Lib,'glUniform2f');
+    pointer(glUniform2fv):=GetProcAddress(GLESv2Lib,'glUniform2fv');
+    pointer(glUniform2i):=GetProcAddress(GLESv2Lib,'glUniform2i');
+    pointer(glUniform2iv):=GetProcAddress(GLESv2Lib,'glUniform2iv');
+    pointer(glUniform3f):=GetProcAddress(GLESv2Lib,'glUniform3f');
+    pointer(glUniform3fv):=GetProcAddress(GLESv2Lib,'glUniform3fv');
+    pointer(glUniform3i):=GetProcAddress(GLESv2Lib,'glUniform3i');
+    pointer(glUniform3iv):=GetProcAddress(GLESv2Lib,'glUniform3iv');
+    pointer(glUniform4f):=GetProcAddress(GLESv2Lib,'glUniform4f');
+    pointer(glUniform4fv):=GetProcAddress(GLESv2Lib,'glUniform4fv');
+    pointer(glUniform4i):=GetProcAddress(GLESv2Lib,'glUniform4i');
+    pointer(glUniform4iv):=GetProcAddress(GLESv2Lib,'glUniform4iv');
+    pointer(glUniformMatrix2fv):=GetProcAddress(GLESv2Lib,'glUniformMatrix2fv');
+    pointer(glUniformMatrix3fv):=GetProcAddress(GLESv2Lib,'glUniformMatrix3fv');
+    pointer(glUniformMatrix4fv):=GetProcAddress(GLESv2Lib,'glUniformMatrix4fv');
+    pointer(glUseProgram):=GetProcAddress(GLESv2Lib,'glUseProgram');
+    pointer(glValidateProgram):=GetProcAddress(GLESv2Lib,'glValidateProgram');
+    pointer(glVertexAttrib1f):=GetProcAddress(GLESv2Lib,'glVertexAttrib1f');
+    pointer(glVertexAttrib1fv):=GetProcAddress(GLESv2Lib,'glVertexAttrib1fv');
+    pointer(glVertexAttrib2f):=GetProcAddress(GLESv2Lib,'glVertexAttrib2f');
+    pointer(glVertexAttrib2fv):=GetProcAddress(GLESv2Lib,'glVertexAttrib2fv');
+    pointer(glVertexAttrib3f):=GetProcAddress(GLESv2Lib,'glVertexAttrib3f');
+    pointer(glVertexAttrib3fv):=GetProcAddress(GLESv2Lib,'glVertexAttrib3fv');
+    pointer(glVertexAttrib4f):=GetProcAddress(GLESv2Lib,'glVertexAttrib4f');
+    pointer(glVertexAttrib4fv):=GetProcAddress(GLESv2Lib,'glVertexAttrib4fv');
+    pointer(glVertexAttribPointer):=GetProcAddress(GLESv2Lib,'glVertexAttribPointer');
+    pointer(glViewport):=GetProcAddress(GLESv2Lib,'glViewport');
+    pointer(glEGLImageTargetTexture2DOES):=GetProcAddress(GLESv2Lib,'glEGLImageTargetTexture2DOES');
+    pointer(glEGLImageTargetRenderbufferStorageOES):=GetProcAddress(GLESv2Lib,'glEGLImageTargetRenderbufferStorageOES');
+    pointer(glGetProgramBinaryOES):=GetProcAddress(GLESv2Lib,'glGetProgramBinaryOES');
+    pointer(glProgramBinaryOES):=GetProcAddress(GLESv2Lib,'glProgramBinaryOES');
+    pointer(glMapBufferOES):=GetProcAddress(GLESv2Lib,'glMapBufferOES');
+    pointer(glUnmapBufferOES):=GetProcAddress(GLESv2Lib,'glUnmapBufferOES');
+    pointer(glGetBufferPointervOES):=GetProcAddress(GLESv2Lib,'glGetBufferPointervOES');
+    pointer(glTexImage3DOES):=GetProcAddress(GLESv2Lib,'glTexImage3DOES');
+    pointer(glTexSubImage3DOES):=GetProcAddress(GLESv2Lib,'glTexSubImage3DOES');
+    pointer(glCopyTexSubImage3DOES):=GetProcAddress(GLESv2Lib,'glCopyTexSubImage3DOES');
+    pointer(glCompressedTexImage3DOES):=GetProcAddress(GLESv2Lib,'glCompressedTexImage3DOES');
+    pointer(glCompressedTexSubImage3DOES):=GetProcAddress(GLESv2Lib,'glCompressedTexSubImage3DOES');
+    pointer(glFramebufferTexture3DOES):=GetProcAddress(GLESv2Lib,'glFramebufferTexture3DOES');
+    pointer(glGetPerfMonitorGroupsAMD):=GetProcAddress(GLESv2Lib,'glGetPerfMonitorGroupsAMD');
+    pointer(glGetPerfMonitorCountersAMD):=GetProcAddress(GLESv2Lib,'glGetPerfMonitorCountersAMD');
+    pointer(glGetPerfMonitorGroupStringAMD):=GetProcAddress(GLESv2Lib,'glGetPerfMonitorGroupStringAMD');
+    pointer(glGetPerfMonitorCounterStringAMD):=GetProcAddress(GLESv2Lib,'glGetPerfMonitorCounterStringAMD');
+    pointer(glGetPerfMonitorCounterInfoAMD):=GetProcAddress(GLESv2Lib,'glGetPerfMonitorCounterInfoAMD');
+    pointer(glGenPerfMonitorsAMD):=GetProcAddress(GLESv2Lib,'glGenPerfMonitorsAMD');
+    pointer(glDeletePerfMonitorsAMD):=GetProcAddress(GLESv2Lib,'glDeletePerfMonitorsAMD');
+    pointer(glSelectPerfMonitorCountersAMD):=GetProcAddress(GLESv2Lib,'glSelectPerfMonitorCountersAMD');
+    pointer(glBeginPerfMonitorAMD):=GetProcAddress(GLESv2Lib,'glBeginPerfMonitorAMD');
+    pointer(glEndPerfMonitorAMD):=GetProcAddress(GLESv2Lib,'glEndPerfMonitorAMD');
+    pointer(glGetPerfMonitorCounterDataAMD):=GetProcAddress(GLESv2Lib,'glGetPerfMonitorCounterDataAMD');
+  end;
 
-  { was #define dname def_expr }
-  function EGL_DONT_CARE : EGLint;
-      begin
-         EGL_DONT_CARE:=EGLint(-(1));
-      end;
-
-  { was #define dname def_expr }
-  function EGL_UNKNOWN : EGLint;
-      begin
-         EGL_UNKNOWN:=EGLint(-(1));
-      end;
-
-  { was #define dname def_expr }
-  function EGL_NO_IMAGE_KHR : EGLImageKHR;
-      begin
-         EGL_NO_IMAGE_KHR:=EGLImageKHR(0);
-      end;
-
-
-  var
-    EGLLib : tlibhandle;
-
-
-  procedure FreeEGL;
-    begin
-      if EGLLib<>0 then
-        FreeLibrary(EGLLib);
-
-      eglGetError:=nil;
-      eglGetDisplay:=nil;
-      eglInitialize:=nil;
-      eglTerminate:=nil;
-      eglQueryString:=nil;
-      eglGetConfigs:=nil;
-      eglChooseConfig:=nil;
-      eglGetConfigAttrib:=nil;
-      eglCreateWindowSurface:=nil;
-      eglCreatePbufferSurface:=nil;
-      eglCreatePixmapSurface:=nil;
-      eglDestroySurface:=nil;
-      eglQuerySurface:=nil;
-      eglBindAPI:=nil;
-      eglQueryAPI:=nil;
-      eglWaitClient:=nil;
-      eglReleaseThread:=nil;
-      eglCreatePbufferFromClientBuffer:=nil;
-      eglSurfaceAttrib:=nil;
-      eglBindTexImage:=nil;
-      eglReleaseTexImage:=nil;
-      eglSwapInterval:=nil;
-      eglCreateContext:=nil;
-      eglDestroyContext:=nil;
-      eglMakeCurrent:=nil;
-      eglGetCurrentContext:=nil;
-      eglGetCurrentSurface:=nil;
-      eglGetCurrentDisplay:=nil;
-      eglQueryContext:=nil;
-      eglWaitGL:=nil;
-      eglWaitNative:=nil;
-      eglSwapBuffers:=nil;
-      eglCopyBuffers:=nil;
-      eglGetProcAddress:=nil;
-    end;
-
-
-  procedure LoadEGL(lib : pchar);
-    begin
-      FreeEGL;
-      EGLLib:=dynlibs.LoadLibrary(lib);
-      if EGLLib=0 then
-        raise Exception.Create(format('Could not load library: %s',[lib]));
-
-      pointer(eglGetProcAddress):=GetProcAddress(EGLLib,'glGetProcAddress');
-      
-      pointer(eglGetError):=glGetProcAddress(EGLLib,'eglGetError');
-      pointer(eglGetDisplay):=glGetProcAddress(EGLLib,'eglGetDisplay');
-      pointer(eglInitialize):=glGetProcAddress(EGLLib,'eglInitialize');
-      pointer(eglTerminate):=glGetProcAddress(EGLLib,'eglTerminate');
-      pointer(eglQueryString):=glGetProcAddress(EGLLib,'eglQueryString');
-      pointer(eglGetConfigs):=glGetProcAddress(EGLLib,'eglGetConfigs');
-      pointer(eglChooseConfig):=glGetProcAddress(EGLLib,'eglChooseConfig');
-      pointer(eglGetConfigAttrib):=glGetProcAddress(EGLLib,'eglGetConfigAttrib');
-      pointer(eglCreateWindowSurface):=glGetProcAddress(EGLLib,'eglCreateWindowSurface');
-      pointer(eglCreatePbufferSurface):=glGetProcAddress(EGLLib,'eglCreatePbufferSurface');
-      pointer(eglCreatePixmapSurface):=glGetProcAddress(EGLLib,'eglCreatePixmapSurface');
-      pointer(eglDestroySurface):=glGetProcAddress(EGLLib,'eglDestroySurface');
-      pointer(eglQuerySurface):=glGetProcAddress(EGLLib,'eglQuerySurface');
-      pointer(eglBindAPI):=glGetProcAddress(EGLLib,'eglBindAPI');
-      pointer(eglQueryAPI):=glGetProcAddress(EGLLib,'eglQueryAPI');
-      pointer(eglWaitClient):=glGetProcAddress(EGLLib,'eglWaitClient');
-      pointer(eglReleaseThread):=glGetProcAddress(EGLLib,'eglReleaseThread');
-      pointer(eglCreatePbufferFromClientBuffer):=glGetProcAddress(EGLLib,'eglCreatePbufferFromClientBuffer');
-      pointer(eglSurfaceAttrib):=glGetProcAddress(EGLLib,'eglSurfaceAttrib');
-      pointer(eglBindTexImage):=glGetProcAddress(EGLLib,'eglBindTexImage');
-      pointer(eglReleaseTexImage):=glGetProcAddress(EGLLib,'eglReleaseTexImage');
-      pointer(eglSwapInterval):=glGetProcAddress(EGLLib,'eglSwapInterval');
-      pointer(eglCreateContext):=glGetProcAddress(EGLLib,'eglCreateContext');
-      pointer(eglDestroyContext):=glGetProcAddress(EGLLib,'eglDestroyContext');
-      pointer(eglMakeCurrent):=glGetProcAddress(EGLLib,'eglMakeCurrent');
-      pointer(eglGetCurrentContext):=glGetProcAddress(EGLLib,'eglGetCurrentContext');
-      pointer(eglGetCurrentSurface):=glGetProcAddress(EGLLib,'eglGetCurrentSurface');
-      pointer(eglGetCurrentDisplay):=glGetProcAddress(EGLLib,'eglGetCurrentDisplay');
-      pointer(eglQueryContext):=glGetProcAddress(EGLLib,'eglQueryContext');
-      pointer(eglWaitGL):=glGetProcAddress(EGLLib,'eglWaitGL');
-      pointer(eglWaitNative):=glGetProcAddress(EGLLib,'eglWaitNative');
-      pointer(eglSwapBuffers):=glGetProcAddress(EGLLib,'eglSwapBuffers');
-      pointer(eglCopyBuffers):=glGetProcAddress(EGLLib,'eglCopyBuffers');
-    end;
-{$endif EGL}
-
-  var
-    GLESv2Lib : tlibhandle;
-
-  procedure FreeGLESv2;
-    begin
-      if GLESv2Lib<>0 then
-        FreeLibrary(GLESv2Lib);
-
-      glActiveTexture:=nil;
-      glAttachShader:=nil;
-      glBindAttribLocation:=nil;
-      glBindBuffer:=nil;
-      glBindFramebuffer:=nil;
-      glBindRenderbuffer:=nil;
-      glBindTexture:=nil;
-      glBlendColor:=nil;
-      glBlendEquation:=nil;
-      glBlendEquationSeparate:=nil;
-      glBlendFunc:=nil;
-      glBlendFuncSeparate:=nil;
-      glBufferData:=nil;
-      glBufferSubData:=nil;
-      glCheckFramebufferStatus:=nil;
-      glClear:=nil;
-      glClearColor:=nil;
-      glClearDepthf:=nil;
-      glClearStencil:=nil;
-      glColorMask:=nil;
-      glCompileShader:=nil;
-      glCompressedTexImage2D:=nil;
-      glCompressedTexSubImage2D:=nil;
-      glCopyTexImage2D:=nil;
-      glCopyTexSubImage2D:=nil;
-      glCreateProgram:=nil;
-      glCreateShader:=nil;
-      glCullFace:=nil;
-      glDeleteBuffers:=nil;
-      glDeleteFramebuffers:=nil;
-      glDeleteProgram:=nil;
-      glDeleteRenderbuffers:=nil;
-      glDeleteShader:=nil;
-      glDeleteTextures:=nil;
-      glDepthFunc:=nil;
-      glDepthMask:=nil;
-      glDepthRangef:=nil;
-      glDetachShader:=nil;
-      glDisable:=nil;
-      glDisableVertexAttribArray:=nil;
-      glDrawArrays:=nil;
-      glDrawElements:=nil;
-      glEnable:=nil;
-      glEnableVertexAttribArray:=nil;
-      glFinish:=nil;
-      glFlush:=nil;
-      glFramebufferRenderbuffer:=nil;
-      glFramebufferTexture2D:=nil;
-      glFrontFace:=nil;
-      glGenBuffers:=nil;
-      glGenerateMipmap:=nil;
-      glGenFramebuffers:=nil;
-      glGenRenderbuffers:=nil;
-      glGenTextures:=nil;
-      glGetActiveAttrib:=nil;
-      glGetActiveUniform:=nil;
-      glGetAttachedShaders:=nil;
-      glGetAttribLocation:=nil;
-      glGetBooleanv:=nil;
-      glGetBufferParameteriv:=nil;
-      glGetError:=nil;
-      glGetFloatv:=nil;
-      glGetFramebufferAttachmentParameteriv:=nil;
-      glGetIntegerv:=nil;
-      glGetProgramiv:=nil;
-      glGetProgramInfoLog:=nil;
-      glGetRenderbufferParameteriv:=nil;
-      glGetShaderiv:=nil;
-      glGetShaderInfoLog:=nil;
-      glGetShaderPrecisionFormat:=nil;
-      glGetShaderSource:=nil;
-      glGetString:=nil;
-      glGetTexParameterfv:=nil;
-      glGetTexParameteriv:=nil;
-      glGetUniformfv:=nil;
-      glGetUniformiv:=nil;
-      glGetUniformLocation:=nil;
-      glGetVertexAttribfv:=nil;
-      glGetVertexAttribiv:=nil;
-      glGetVertexAttribPointerv:=nil;
-      glHint:=nil;
-      glIsBuffer:=nil;
-      glIsEnabled:=nil;
-      glIsFramebuffer:=nil;
-      glIsProgram:=nil;
-      glIsRenderbuffer:=nil;
-      glIsShader:=nil;
-      glIsTexture:=nil;
-      glLineWidth:=nil;
-      glLinkProgram:=nil;
-      glPixelStorei:=nil;
-      glPolygonOffset:=nil;
-      glReadPixels:=nil;
-      glReleaseShaderCompiler:=nil;
-      glRenderbufferStorage:=nil;
-      glSampleCoverage:=nil;
-      glScissor:=nil;
-      glShaderBinary:=nil;
-      glShaderSource:=nil;
-      glStencilFunc:=nil;
-      glStencilFuncSeparate:=nil;
-      glStencilMask:=nil;
-      glStencilMaskSeparate:=nil;
-      glStencilOp:=nil;
-      glStencilOpSeparate:=nil;
-      glTexImage2D:=nil;
-      glTexParameterf:=nil;
-      glTexParameterfv:=nil;
-      glTexParameteri:=nil;
-      glTexParameteriv:=nil;
-      glTexSubImage2D:=nil;
-      glUniform1f:=nil;
-      glUniform1fv:=nil;
-      glUniform1i:=nil;
-      glUniform1iv:=nil;
-      glUniform2f:=nil;
-      glUniform2fv:=nil;
-      glUniform2i:=nil;
-      glUniform2iv:=nil;
-      glUniform3f:=nil;
-      glUniform3fv:=nil;
-      glUniform3i:=nil;
-      glUniform3iv:=nil;
-      glUniform4f:=nil;
-      glUniform4fv:=nil;
-      glUniform4i:=nil;
-      glUniform4iv:=nil;
-      glUniformMatrix2fv:=nil;
-      glUniformMatrix3fv:=nil;
-      glUniformMatrix4fv:=nil;
-      glUseProgram:=nil;
-      glValidateProgram:=nil;
-      glVertexAttrib1f:=nil;
-      glVertexAttrib1fv:=nil;
-      glVertexAttrib2f:=nil;
-      glVertexAttrib2fv:=nil;
-      glVertexAttrib3f:=nil;
-      glVertexAttrib3fv:=nil;
-      glVertexAttrib4f:=nil;
-      glVertexAttrib4fv:=nil;
-      glVertexAttribPointer:=nil;
-      glViewport:=nil;
-      glEGLImageTargetTexture2DOES:=nil;
-      glEGLImageTargetRenderbufferStorageOES:=nil;
-      glGetProgramBinaryOES:=nil;
-      glProgramBinaryOES:=nil;
-      glMapBufferOES:=nil;
-      glUnmapBufferOES:=nil;
-      glGetBufferPointervOES:=nil;
-      glTexImage3DOES:=nil;
-      glTexSubImage3DOES:=nil;
-      glCopyTexSubImage3DOES:=nil;
-      glCompressedTexImage3DOES:=nil;
-      glCompressedTexSubImage3DOES:=nil;
-      glFramebufferTexture3DOES:=nil;
-      glGetPerfMonitorGroupsAMD:=nil;
-      glGetPerfMonitorCountersAMD:=nil;
-      glGetPerfMonitorGroupStringAMD:=nil;
-      glGetPerfMonitorCounterStringAMD:=nil;
-      glGetPerfMonitorCounterInfoAMD:=nil;
-      glGenPerfMonitorsAMD:=nil;
-      glDeletePerfMonitorsAMD:=nil;
-      glSelectPerfMonitorCountersAMD:=nil;
-      glBeginPerfMonitorAMD:=nil;
-      glEndPerfMonitorAMD:=nil;
-      glGetPerfMonitorCounterDataAMD:=nil;
-    end;
-
-
-  procedure LoadGLESv2(lib : pchar);
-    begin
-      FreeGLESv2;
-      GLESv2Lib:=dynlibs.LoadLibrary(lib);
-      if GLESv2Lib=0 then
-        raise Exception.Create(format('Could not load library: %s',[lib]));
-
-      pointer(glActiveTexture):=glGetProcAddress(GLESv2Lib,'glActiveTexture');
-      pointer(glAttachShader):=glGetProcAddress(GLESv2Lib,'glAttachShader');
-      pointer(glBindAttribLocation):=glGetProcAddress(GLESv2Lib,'glBindAttribLocation');
-      pointer(glBindBuffer):=glGetProcAddress(GLESv2Lib,'glBindBuffer');
-      pointer(glBindFramebuffer):=glGetProcAddress(GLESv2Lib,'glBindFramebuffer');
-      pointer(glBindRenderbuffer):=glGetProcAddress(GLESv2Lib,'glBindRenderbuffer');
-      pointer(glBindTexture):=glGetProcAddress(GLESv2Lib,'glBindTexture');
-      pointer(glBlendColor):=glGetProcAddress(GLESv2Lib,'glBlendColor');
-      pointer(glBlendEquation):=glGetProcAddress(GLESv2Lib,'glBlendEquation');
-      pointer(glBlendEquationSeparate):=glGetProcAddress(GLESv2Lib,'glBlendEquationSeparate');
-      pointer(glBlendFunc):=glGetProcAddress(GLESv2Lib,'glBlendFunc');
-      pointer(glBlendFuncSeparate):=glGetProcAddress(GLESv2Lib,'glBlendFuncSeparate');
-      pointer(glBufferData):=glGetProcAddress(GLESv2Lib,'glBufferData');
-      pointer(glBufferSubData):=glGetProcAddress(GLESv2Lib,'glBufferSubData');
-      pointer(glCheckFramebufferStatus):=glGetProcAddress(GLESv2Lib,'glCheckFramebufferStatus');
-      pointer(glClear):=glGetProcAddress(GLESv2Lib,'glClear');
-      pointer(glClearColor):=glGetProcAddress(GLESv2Lib,'glClearColor');
-      pointer(glClearDepthf):=glGetProcAddress(GLESv2Lib,'glClearDepthf');
-      pointer(glClearStencil):=glGetProcAddress(GLESv2Lib,'glClearStencil');
-      pointer(glColorMask):=glGetProcAddress(GLESv2Lib,'glColorMask');
-      pointer(glCompileShader):=glGetProcAddress(GLESv2Lib,'glCompileShader');
-      pointer(glCompressedTexImage2D):=glGetProcAddress(GLESv2Lib,'glCompressedTexImage2D');
-      pointer(glCompressedTexSubImage2D):=glGetProcAddress(GLESv2Lib,'glCompressedTexSubImage2D');
-      pointer(glCopyTexImage2D):=glGetProcAddress(GLESv2Lib,'glCopyTexImage2D');
-      pointer(glCopyTexSubImage2D):=glGetProcAddress(GLESv2Lib,'glCopyTexSubImage2D');
-      pointer(glCreateProgram):=glGetProcAddress(GLESv2Lib,'glCreateProgram');
-      pointer(glCreateShader):=glGetProcAddress(GLESv2Lib,'glCreateShader');
-      pointer(glCullFace):=glGetProcAddress(GLESv2Lib,'glCullFace');
-      pointer(glDeleteBuffers):=glGetProcAddress(GLESv2Lib,'glDeleteBuffers');
-      pointer(glDeleteFramebuffers):=glGetProcAddress(GLESv2Lib,'glDeleteFramebuffers');
-      pointer(glDeleteProgram):=glGetProcAddress(GLESv2Lib,'glDeleteProgram');
-      pointer(glDeleteRenderbuffers):=glGetProcAddress(GLESv2Lib,'glDeleteRenderbuffers');
-      pointer(glDeleteShader):=glGetProcAddress(GLESv2Lib,'glDeleteShader');
-      pointer(glDeleteTextures):=glGetProcAddress(GLESv2Lib,'glDeleteTextures');
-      pointer(glDepthFunc):=glGetProcAddress(GLESv2Lib,'glDepthFunc');
-      pointer(glDepthMask):=glGetProcAddress(GLESv2Lib,'glDepthMask');
-      pointer(glDepthRangef):=glGetProcAddress(GLESv2Lib,'glDepthRangef');
-      pointer(glDetachShader):=glGetProcAddress(GLESv2Lib,'glDetachShader');
-      pointer(glDisable):=glGetProcAddress(GLESv2Lib,'glDisable');
-      pointer(glDisableVertexAttribArray):=glGetProcAddress(GLESv2Lib,'glDisableVertexAttribArray');
-      pointer(glDrawArrays):=glGetProcAddress(GLESv2Lib,'glDrawArrays');
-      pointer(glDrawElements):=glGetProcAddress(GLESv2Lib,'glDrawElements');
-      pointer(glEnable):=glGetProcAddress(GLESv2Lib,'glEnable');
-      pointer(glEnableVertexAttribArray):=glGetProcAddress(GLESv2Lib,'glEnableVertexAttribArray');
-      pointer(glFinish):=glGetProcAddress(GLESv2Lib,'glFinish');
-      pointer(glFlush):=glGetProcAddress(GLESv2Lib,'glFlush');
-      pointer(glFramebufferRenderbuffer):=glGetProcAddress(GLESv2Lib,'glFramebufferRenderbuffer');
-      pointer(glFramebufferTexture2D):=glGetProcAddress(GLESv2Lib,'glFramebufferTexture2D');
-      pointer(glFrontFace):=glGetProcAddress(GLESv2Lib,'glFrontFace');
-      pointer(glGenBuffers):=glGetProcAddress(GLESv2Lib,'glGenBuffers');
-      pointer(glGenerateMipmap):=glGetProcAddress(GLESv2Lib,'glGenerateMipmap');
-      pointer(glGenFramebuffers):=glGetProcAddress(GLESv2Lib,'glGenFramebuffers');
-      pointer(glGenRenderbuffers):=glGetProcAddress(GLESv2Lib,'glGenRenderbuffers');
-      pointer(glGenTextures):=glGetProcAddress(GLESv2Lib,'glGenTextures');
-      pointer(glGetActiveAttrib):=glGetProcAddress(GLESv2Lib,'glGetActiveAttrib');
-      pointer(glGetActiveUniform):=glGetProcAddress(GLESv2Lib,'glGetActiveUniform');
-      pointer(glGetAttachedShaders):=glGetProcAddress(GLESv2Lib,'glGetAttachedShaders');
-      pointer(glGetAttribLocation):=glGetProcAddress(GLESv2Lib,'glGetAttribLocation');
-      pointer(glGetBooleanv):=glGetProcAddress(GLESv2Lib,'glGetBooleanv');
-      pointer(glGetBufferParameteriv):=glGetProcAddress(GLESv2Lib,'glGetBufferParameteriv');
-      pointer(glGetError):=glGetProcAddress(GLESv2Lib,'glGetError');
-      pointer(glGetFloatv):=glGetProcAddress(GLESv2Lib,'glGetFloatv');
-      pointer(glGetFramebufferAttachmentParameteriv):=glGetProcAddress(GLESv2Lib,'glGetFramebufferAttachmentParameteriv');
-      pointer(glGetIntegerv):=glGetProcAddress(GLESv2Lib,'glGetIntegerv');
-      pointer(glGetProgramiv):=glGetProcAddress(GLESv2Lib,'glGetProgramiv');
-      pointer(glGetProgramInfoLog):=glGetProcAddress(GLESv2Lib,'glGetProgramInfoLog');
-      pointer(glGetRenderbufferParameteriv):=glGetProcAddress(GLESv2Lib,'glGetRenderbufferParameteriv');
-      pointer(glGetShaderiv):=glGetProcAddress(GLESv2Lib,'glGetShaderiv');
-      pointer(glGetShaderInfoLog):=glGetProcAddress(GLESv2Lib,'glGetShaderInfoLog');
-      pointer(glGetShaderPrecisionFormat):=glGetProcAddress(GLESv2Lib,'glGetShaderPrecisionFormat');
-      pointer(glGetShaderSource):=glGetProcAddress(GLESv2Lib,'glGetShaderSource');
-      pointer(glGetString):=glGetProcAddress(GLESv2Lib,'glGetString');
-      pointer(glGetTexParameterfv):=glGetProcAddress(GLESv2Lib,'glGetTexParameterfv');
-      pointer(glGetTexParameteriv):=glGetProcAddress(GLESv2Lib,'glGetTexParameteriv');
-      pointer(glGetUniformfv):=glGetProcAddress(GLESv2Lib,'glGetUniformfv');
-      pointer(glGetUniformiv):=glGetProcAddress(GLESv2Lib,'glGetUniformiv');
-      pointer(glGetUniformLocation):=glGetProcAddress(GLESv2Lib,'glGetUniformLocation');
-      pointer(glGetVertexAttribfv):=glGetProcAddress(GLESv2Lib,'glGetVertexAttribfv');
-      pointer(glGetVertexAttribiv):=glGetProcAddress(GLESv2Lib,'glGetVertexAttribiv');
-      pointer(glGetVertexAttribPointerv):=glGetProcAddress(GLESv2Lib,'glGetVertexAttribPointerv');
-      pointer(glHint):=glGetProcAddress(GLESv2Lib,'glHint');
-      pointer(glIsBuffer):=glGetProcAddress(GLESv2Lib,'glIsBuffer');
-      pointer(glIsEnabled):=glGetProcAddress(GLESv2Lib,'glIsEnabled');
-      pointer(glIsFramebuffer):=glGetProcAddress(GLESv2Lib,'glIsFramebuffer');
-      pointer(glIsProgram):=glGetProcAddress(GLESv2Lib,'glIsProgram');
-      pointer(glIsRenderbuffer):=glGetProcAddress(GLESv2Lib,'glIsRenderbuffer');
-      pointer(glIsShader):=glGetProcAddress(GLESv2Lib,'glIsShader');
-      pointer(glIsTexture):=glGetProcAddress(GLESv2Lib,'glIsTexture');
-      pointer(glLineWidth):=glGetProcAddress(GLESv2Lib,'glLineWidth');
-      pointer(glLinkProgram):=glGetProcAddress(GLESv2Lib,'glLinkProgram');
-      pointer(glPixelStorei):=glGetProcAddress(GLESv2Lib,'glPixelStorei');
-      pointer(glPolygonOffset):=glGetProcAddress(GLESv2Lib,'glPolygonOffset');
-      pointer(glReadPixels):=glGetProcAddress(GLESv2Lib,'glReadPixels');
-      pointer(glReleaseShaderCompiler):=glGetProcAddress(GLESv2Lib,'glReleaseShaderCompiler');
-      pointer(glRenderbufferStorage):=glGetProcAddress(GLESv2Lib,'glRenderbufferStorage');
-      pointer(glSampleCoverage):=glGetProcAddress(GLESv2Lib,'glSampleCoverage');
-      pointer(glScissor):=glGetProcAddress(GLESv2Lib,'glScissor');
-      pointer(glShaderBinary):=glGetProcAddress(GLESv2Lib,'glShaderBinary');
-      pointer(glShaderSource):=glGetProcAddress(GLESv2Lib,'glShaderSource');
-      pointer(glStencilFunc):=glGetProcAddress(GLESv2Lib,'glStencilFunc');
-      pointer(glStencilFuncSeparate):=glGetProcAddress(GLESv2Lib,'glStencilFuncSeparate');
-      pointer(glStencilMask):=glGetProcAddress(GLESv2Lib,'glStencilMask');
-      pointer(glStencilMaskSeparate):=glGetProcAddress(GLESv2Lib,'glStencilMaskSeparate');
-      pointer(glStencilOp):=glGetProcAddress(GLESv2Lib,'glStencilOp');
-      pointer(glStencilOpSeparate):=glGetProcAddress(GLESv2Lib,'glStencilOpSeparate');
-      pointer(glTexImage2D):=glGetProcAddress(GLESv2Lib,'glTexImage2D');
-      pointer(glTexParameterf):=glGetProcAddress(GLESv2Lib,'glTexParameterf');
-      pointer(glTexParameterfv):=glGetProcAddress(GLESv2Lib,'glTexParameterfv');
-      pointer(glTexParameteri):=glGetProcAddress(GLESv2Lib,'glTexParameteri');
-      pointer(glTexParameteriv):=glGetProcAddress(GLESv2Lib,'glTexParameteriv');
-      pointer(glTexSubImage2D):=glGetProcAddress(GLESv2Lib,'glTexSubImage2D');
-      pointer(glUniform1f):=glGetProcAddress(GLESv2Lib,'glUniform1f');
-      pointer(glUniform1fv):=glGetProcAddress(GLESv2Lib,'glUniform1fv');
-      pointer(glUniform1i):=glGetProcAddress(GLESv2Lib,'glUniform1i');
-      pointer(glUniform1iv):=glGetProcAddress(GLESv2Lib,'glUniform1iv');
-      pointer(glUniform2f):=glGetProcAddress(GLESv2Lib,'glUniform2f');
-      pointer(glUniform2fv):=glGetProcAddress(GLESv2Lib,'glUniform2fv');
-      pointer(glUniform2i):=glGetProcAddress(GLESv2Lib,'glUniform2i');
-      pointer(glUniform2iv):=glGetProcAddress(GLESv2Lib,'glUniform2iv');
-      pointer(glUniform3f):=glGetProcAddress(GLESv2Lib,'glUniform3f');
-      pointer(glUniform3fv):=glGetProcAddress(GLESv2Lib,'glUniform3fv');
-      pointer(glUniform3i):=glGetProcAddress(GLESv2Lib,'glUniform3i');
-      pointer(glUniform3iv):=glGetProcAddress(GLESv2Lib,'glUniform3iv');
-      pointer(glUniform4f):=glGetProcAddress(GLESv2Lib,'glUniform4f');
-      pointer(glUniform4fv):=glGetProcAddress(GLESv2Lib,'glUniform4fv');
-      pointer(glUniform4i):=glGetProcAddress(GLESv2Lib,'glUniform4i');
-      pointer(glUniform4iv):=glGetProcAddress(GLESv2Lib,'glUniform4iv');
-      pointer(glUniformMatrix2fv):=glGetProcAddress(GLESv2Lib,'glUniformMatrix2fv');
-      pointer(glUniformMatrix3fv):=glGetProcAddress(GLESv2Lib,'glUniformMatrix3fv');
-      pointer(glUniformMatrix4fv):=glGetProcAddress(GLESv2Lib,'glUniformMatrix4fv');
-      pointer(glUseProgram):=glGetProcAddress(GLESv2Lib,'glUseProgram');
-      pointer(glValidateProgram):=glGetProcAddress(GLESv2Lib,'glValidateProgram');
-      pointer(glVertexAttrib1f):=glGetProcAddress(GLESv2Lib,'glVertexAttrib1f');
-      pointer(glVertexAttrib1fv):=glGetProcAddress(GLESv2Lib,'glVertexAttrib1fv');
-      pointer(glVertexAttrib2f):=glGetProcAddress(GLESv2Lib,'glVertexAttrib2f');
-      pointer(glVertexAttrib2fv):=glGetProcAddress(GLESv2Lib,'glVertexAttrib2fv');
-      pointer(glVertexAttrib3f):=glGetProcAddress(GLESv2Lib,'glVertexAttrib3f');
-      pointer(glVertexAttrib3fv):=glGetProcAddress(GLESv2Lib,'glVertexAttrib3fv');
-      pointer(glVertexAttrib4f):=glGetProcAddress(GLESv2Lib,'glVertexAttrib4f');
-      pointer(glVertexAttrib4fv):=glGetProcAddress(GLESv2Lib,'glVertexAttrib4fv');
-      pointer(glVertexAttribPointer):=glGetProcAddress(GLESv2Lib,'glVertexAttribPointer');
-      pointer(glViewport):=glGetProcAddress(GLESv2Lib,'glViewport');
-      pointer(glEGLImageTargetTexture2DOES):=glGetProcAddress(GLESv2Lib,'glEGLImageTargetTexture2DOES');
-      pointer(glEGLImageTargetRenderbufferStorageOES):=glGetProcAddress(GLESv2Lib,'glEGLImageTargetRenderbufferStorageOES');
-      pointer(glGetProgramBinaryOES):=glGetProcAddress(GLESv2Lib,'glGetProgramBinaryOES');
-      pointer(glProgramBinaryOES):=glGetProcAddress(GLESv2Lib,'glProgramBinaryOES');
-      pointer(glMapBufferOES):=glGetProcAddress(GLESv2Lib,'glMapBufferOES');
-      pointer(glUnmapBufferOES):=glGetProcAddress(GLESv2Lib,'glUnmapBufferOES');
-      pointer(glGetBufferPointervOES):=glGetProcAddress(GLESv2Lib,'glGetBufferPointervOES');
-      pointer(glTexImage3DOES):=glGetProcAddress(GLESv2Lib,'glTexImage3DOES');
-      pointer(glTexSubImage3DOES):=glGetProcAddress(GLESv2Lib,'glTexSubImage3DOES');
-      pointer(glCopyTexSubImage3DOES):=glGetProcAddress(GLESv2Lib,'glCopyTexSubImage3DOES');
-      pointer(glCompressedTexImage3DOES):=glGetProcAddress(GLESv2Lib,'glCompressedTexImage3DOES');
-      pointer(glCompressedTexSubImage3DOES):=glGetProcAddress(GLESv2Lib,'glCompressedTexSubImage3DOES');
-      pointer(glFramebufferTexture3DOES):=glGetProcAddress(GLESv2Lib,'glFramebufferTexture3DOES');
-      pointer(glGetPerfMonitorGroupsAMD):=glGetProcAddress(GLESv2Lib,'glGetPerfMonitorGroupsAMD');
-      pointer(glGetPerfMonitorCountersAMD):=glGetProcAddress(GLESv2Lib,'glGetPerfMonitorCountersAMD');
-      pointer(glGetPerfMonitorGroupStringAMD):=glGetProcAddress(GLESv2Lib,'glGetPerfMonitorGroupStringAMD');
-      pointer(glGetPerfMonitorCounterStringAMD):=glGetProcAddress(GLESv2Lib,'glGetPerfMonitorCounterStringAMD');
-      pointer(glGetPerfMonitorCounterInfoAMD):=glGetProcAddress(GLESv2Lib,'glGetPerfMonitorCounterInfoAMD');
-      pointer(glGenPerfMonitorsAMD):=glGetProcAddress(GLESv2Lib,'glGenPerfMonitorsAMD');
-      pointer(glDeletePerfMonitorsAMD):=glGetProcAddress(GLESv2Lib,'glDeletePerfMonitorsAMD');
-      pointer(glSelectPerfMonitorCountersAMD):=glGetProcAddress(GLESv2Lib,'glSelectPerfMonitorCountersAMD');
-      pointer(glBeginPerfMonitorAMD):=glGetProcAddress(GLESv2Lib,'glBeginPerfMonitorAMD');
-      pointer(glEndPerfMonitorAMD):=glGetProcAddress(GLESv2Lib,'glEndPerfMonitorAMD');
-      pointer(glGetPerfMonitorCounterDataAMD):=glGetProcAddress(GLESv2Lib,'glGetPerfMonitorCounterDataAMD');
-    end;
-
-
 initialization
-{$ifdef EGL}
-  EGLLib:=0;
-  LoadEGL({$ifdef windows}'libEGL.dll'{$else}'libEGL.so'{$endif});
-{$endif}
   GLESv2Lib:=0;
   LoadGLESv2({$ifdef darwin}'/System/Library/Frameworks/OpenGLES.framework/OpenGLES'{$else}{$ifdef windows}'libGLESv2.dll'{$else}'libGLESv2.so'{$endif}{$endif});
 finalization
   FreeGLESv2;
-{$ifdef EGL}
-  FreeEGL;
-{$endif}
 end.
Index: packages/fpmake_add.inc
===================================================================
--- packages/fpmake_add.inc	(revision 26460)
+++ packages/fpmake_add.inc	(working copy)
@@ -10,6 +10,7 @@
   add_dblib(ADirectory+IncludeTrailingPathDelimiter('dblib'));
   add_dbus(ADirectory+IncludeTrailingPathDelimiter('dbus'));
   add_dts(ADirectory+IncludeTrailingPathDelimiter('dts'));
+  add_egl(ADirectory+IncludeTrailingPathDelimiter('egl'));
   add_fastcgi(ADirectory+IncludeTrailingPathDelimiter('fastcgi'));
   add_fcl_async(ADirectory+IncludeTrailingPathDelimiter('fcl-async'));
   add_fcl_base(ADirectory+IncludeTrailingPathDelimiter('fcl-base'));
Index: packages/fpmake_proc.inc
===================================================================
--- packages/fpmake_proc.inc	(revision 26460)
+++ packages/fpmake_proc.inc	(working copy)
@@ -86,6 +86,12 @@
 
 {$include fcl-db/fpmake.pp}
 
+procedure add_egl(const ADirectory: string);
+begin
+  with Installer do
+{$include egl/fpmake.pp}
+end;
+
 procedure add_fcl_extra(const ADirectory: string);
 begin
   with Installer do
egl_opengles_split-2.diff (253,742 bytes)   

Dennis Fehr

2014-01-15 21:29

reporter   ~0072469

Good point, I updated the patch to remove the X dependency in Linux.. There's no reason for it. I am using it for my 3D Game Engine (that's cross platform to Win[32/64], Linux[32/64] and Android[ARM] ).. I also needed to enable OpenAL and OGG/Vorbis on Android platforms.. Let me know if you need those patches too, as I just static link them all (External C libraries freetype/openal-soft/ogg/vorbis) and I'm currently working on adding a SteamSDK wrapper. Everything is included in a LibRX package and everything just works for you with minimal effort. :p

Dennis Fehr

2014-01-20 01:51

reporter  

egl_opengles_split-3.diff (102,113 bytes)   
Index: packages/egl/Makefile
===================================================================
--- packages/egl/Makefile	(revision 0)
+++ packages/egl/Makefile	(working copy)
@@ -0,0 +1,2812 @@
+#
+# Don't edit, this file is generated by FPCMake Version 2.0.0 [2013-11-16 rev 26097]
+#
+default: all
+MAKEFILETARGETS=i386-linux i386-go32v2 i386-win32 i386-os2 i386-freebsd i386-beos i386-haiku i386-netbsd i386-solaris i386-qnx i386-netware i386-openbsd i386-wdosx i386-darwin i386-emx i386-watcom i386-netwlibc i386-wince i386-embedded i386-symbian i386-nativent i386-iphonesim i386-android m68k-linux m68k-freebsd m68k-netbsd m68k-amiga m68k-atari m68k-openbsd m68k-palmos m68k-embedded powerpc-linux powerpc-netbsd powerpc-amiga powerpc-macos powerpc-darwin powerpc-morphos powerpc-embedded powerpc-wii powerpc-aix sparc-linux sparc-netbsd sparc-solaris sparc-embedded x86_64-linux x86_64-freebsd x86_64-netbsd x86_64-solaris x86_64-openbsd x86_64-darwin x86_64-win64 x86_64-embedded arm-linux arm-palmos arm-darwin arm-wince arm-gba arm-nds arm-embedded arm-symbian arm-android powerpc64-linux powerpc64-darwin powerpc64-embedded powerpc64-aix avr-embedded armeb-linux armeb-embedded mips-linux mipsel-linux jvm-java jvm-android i8086-msdos
+BSDs = freebsd netbsd openbsd darwin
+UNIXs = linux $(BSDs) solaris qnx haiku aix
+LIMIT83fs = go32v2 os2 emx watcom
+OSNeedsComspecToRunBatch = go32v2 watcom
+FORCE:
+.PHONY: FORCE
+override PATH:=$(patsubst %/,%,$(subst \,/,$(PATH)))
+ifneq ($(findstring darwin,$(OSTYPE)),)
+inUnix=1 #darwin
+SEARCHPATH:=$(filter-out .,$(subst :, ,$(PATH)))
+else
+ifeq ($(findstring ;,$(PATH)),)
+inUnix=1
+SEARCHPATH:=$(filter-out .,$(subst :, ,$(PATH)))
+else
+SEARCHPATH:=$(subst ;, ,$(PATH))
+endif
+endif
+SEARCHPATH+=$(patsubst %/,%,$(subst \,/,$(dir $(MAKE))))
+PWD:=$(strip $(wildcard $(addsuffix /pwd.exe,$(SEARCHPATH))))
+ifeq ($(PWD),)
+PWD:=$(strip $(wildcard $(addsuffix /pwd,$(SEARCHPATH))))
+ifeq ($(PWD),)
+$(error You need the GNU utils package to use this Makefile)
+else
+PWD:=$(firstword $(PWD))
+SRCEXEEXT=
+endif
+else
+PWD:=$(firstword $(PWD))
+SRCEXEEXT=.exe
+endif
+ifndef inUnix
+ifeq ($(OS),Windows_NT)
+inWinNT=1
+else
+ifdef OS2_SHELL
+inOS2=1
+endif
+endif
+else
+ifneq ($(findstring cygdrive,$(PATH)),)
+inCygWin=1
+endif
+endif
+ifdef inUnix
+SRCBATCHEXT=.sh
+else
+ifdef inOS2
+SRCBATCHEXT=.cmd
+else
+SRCBATCHEXT=.bat
+endif
+endif
+ifdef COMSPEC
+ifneq ($(findstring $(OS_SOURCE),$(OSNeedsComspecToRunBatch)),)
+ifndef RUNBATCH
+RUNBATCH=$(COMSPEC) /C
+endif
+endif
+endif
+ifdef inUnix
+PATHSEP=/
+else
+PATHSEP:=$(subst /,\,/)
+ifdef inCygWin
+PATHSEP=/
+endif
+endif
+ifdef PWD
+BASEDIR:=$(subst \,/,$(shell $(PWD)))
+ifdef inCygWin
+ifneq ($(findstring /cygdrive/,$(BASEDIR)),)
+BASENODIR:=$(patsubst /cygdrive%,%,$(BASEDIR))
+BASEDRIVE:=$(firstword $(subst /, ,$(BASENODIR)))
+BASEDIR:=$(subst /cygdrive/$(BASEDRIVE)/,$(BASEDRIVE):/,$(BASEDIR))
+endif
+endif
+else
+BASEDIR=.
+endif
+ifdef inOS2
+ifndef ECHO
+ECHO:=$(strip $(wildcard $(addsuffix /gecho$(SRCEXEEXT),$(SEARCHPATH))))
+ifeq ($(ECHO),)
+ECHO:=$(strip $(wildcard $(addsuffix /echo$(SRCEXEEXT),$(SEARCHPATH))))
+ifeq ($(ECHO),)
+ECHO=echo
+else
+ECHO:=$(firstword $(ECHO))
+endif
+else
+ECHO:=$(firstword $(ECHO))
+endif
+endif
+export ECHO
+endif
+override DEFAULT_FPCDIR=../..
+ifndef FPC
+ifdef PP
+FPC=$(PP)
+endif
+endif
+ifndef FPC
+FPCPROG:=$(strip $(wildcard $(addsuffix /fpc$(SRCEXEEXT),$(SEARCHPATH))))
+ifneq ($(FPCPROG),)
+FPCPROG:=$(firstword $(FPCPROG))
+ifneq ($(CPU_TARGET),)
+FPC:=$(shell $(FPCPROG) -P$(CPU_TARGET) -PB)
+else
+FPC:=$(shell $(FPCPROG) -PB)
+endif
+ifneq ($(findstring Error,$(FPC)),)
+override FPC=$(firstword $(strip $(wildcard $(addsuffix /ppc386$(SRCEXEEXT),$(SEARCHPATH)))))
+else
+ifeq ($(strip $(wildcard $(FPC))),)
+FPC:=$(firstword $(FPCPROG))
+endif
+endif
+else
+override FPC=$(firstword $(strip $(wildcard $(addsuffix /ppc386$(SRCEXEEXT),$(SEARCHPATH)))))
+endif
+endif
+override FPC:=$(subst $(SRCEXEEXT),,$(FPC))
+override FPC:=$(subst \,/,$(FPC))$(SRCEXEEXT)
+FOUNDFPC:=$(strip $(wildcard $(FPC)))
+ifeq ($(FOUNDFPC),)
+FOUNDFPC=$(strip $(wildcard $(addsuffix /$(FPC),$(SEARCHPATH))))
+ifeq ($(FOUNDFPC),)
+$(error Compiler $(FPC) not found)
+endif
+endif
+ifndef FPC_COMPILERINFO
+FPC_COMPILERINFO:=$(shell $(FPC) -iVSPTPSOTO)
+endif
+ifndef FPC_VERSION
+FPC_VERSION:=$(word 1,$(FPC_COMPILERINFO))
+endif
+export FPC FPC_VERSION FPC_COMPILERINFO
+unexport CHECKDEPEND ALLDEPENDENCIES
+ifndef CPU_TARGET
+ifdef CPU_TARGET_DEFAULT
+CPU_TARGET=$(CPU_TARGET_DEFAULT)
+endif
+endif
+ifndef OS_TARGET
+ifdef OS_TARGET_DEFAULT
+OS_TARGET=$(OS_TARGET_DEFAULT)
+endif
+endif
+ifndef CPU_SOURCE
+CPU_SOURCE:=$(word 2,$(FPC_COMPILERINFO))
+endif
+ifndef CPU_TARGET
+CPU_TARGET:=$(word 3,$(FPC_COMPILERINFO))
+endif
+ifndef OS_SOURCE
+OS_SOURCE:=$(word 4,$(FPC_COMPILERINFO))
+endif
+ifndef OS_TARGET
+OS_TARGET:=$(word 5,$(FPC_COMPILERINFO))
+endif
+FULL_TARGET=$(CPU_TARGET)-$(OS_TARGET)
+FULL_SOURCE=$(CPU_SOURCE)-$(OS_SOURCE)
+ifeq ($(CPU_TARGET),armeb)
+ARCH=arm
+override FPCOPT+=-Cb
+else
+ifeq ($(CPU_TARGET),armel)
+ARCH=arm
+override FPCOPT+=-CaEABI
+else
+ARCH=$(CPU_TARGET)
+endif
+endif
+ifeq ($(FULL_TARGET),arm-embedded)
+ifeq ($(SUBARCH),)
+$(error When compiling for arm-embedded, a sub-architecture (e.g. SUBARCH=armv4t or SUBARCH=armv7m) must be defined)
+endif
+override FPCOPT+=-Cp$(SUBARCH)
+endif
+ifneq ($(findstring $(OS_SOURCE),$(LIMIT83fs)),)
+TARGETSUFFIX=$(OS_TARGET)
+SOURCESUFFIX=$(OS_SOURCE)
+else
+ifneq ($(findstring $(OS_TARGET),$(LIMIT83fs)),)
+TARGETSUFFIX=$(OS_TARGET)
+else
+TARGETSUFFIX=$(FULL_TARGET)
+endif
+SOURCESUFFIX=$(FULL_SOURCE)
+endif
+ifneq ($(FULL_TARGET),$(FULL_SOURCE))
+CROSSCOMPILE=1
+endif
+ifeq ($(findstring makefile,$(MAKECMDGOALS)),)
+ifeq ($(findstring $(FULL_TARGET),$(MAKEFILETARGETS)),)
+$(error The Makefile doesn't support target $(FULL_TARGET), please run fpcmake first)
+endif
+endif
+ifneq ($(findstring $(OS_TARGET),$(BSDs)),)
+BSDhier=1
+endif
+ifeq ($(OS_TARGET),linux)
+linuxHier=1
+endif
+ifndef CROSSCOMPILE
+BUILDFULLNATIVE=1
+export BUILDFULLNATIVE
+endif
+ifdef BUILDFULLNATIVE
+BUILDNATIVE=1
+export BUILDNATIVE
+endif
+export OS_TARGET OS_SOURCE ARCH CPU_TARGET CPU_SOURCE FULL_TARGET FULL_SOURCE TARGETSUFFIX SOURCESUFFIX CROSSCOMPILE
+ifdef FPCDIR
+override FPCDIR:=$(subst \,/,$(FPCDIR))
+ifeq ($(wildcard $(addprefix $(FPCDIR)/,rtl units)),)
+override FPCDIR=wrong
+endif
+else
+override FPCDIR=wrong
+endif
+ifdef DEFAULT_FPCDIR
+ifeq ($(FPCDIR),wrong)
+override FPCDIR:=$(subst \,/,$(DEFAULT_FPCDIR))
+ifeq ($(wildcard $(addprefix $(FPCDIR)/,rtl units)),)
+override FPCDIR=wrong
+endif
+endif
+endif
+ifeq ($(FPCDIR),wrong)
+ifdef inUnix
+override FPCDIR=/usr/local/lib/fpc/$(FPC_VERSION)
+ifeq ($(wildcard $(FPCDIR)/units),)
+override FPCDIR=/usr/lib/fpc/$(FPC_VERSION)
+endif
+else
+override FPCDIR:=$(subst /$(FPC),,$(firstword $(strip $(wildcard $(addsuffix /$(FPC),$(SEARCHPATH))))))
+override FPCDIR:=$(FPCDIR)/..
+ifeq ($(wildcard $(addprefix $(FPCDIR)/,rtl units)),)
+override FPCDIR:=$(FPCDIR)/..
+ifeq ($(wildcard $(addprefix $(FPCDIR)/,rtl units)),)
+override FPCDIR:=$(BASEDIR)
+ifeq ($(wildcard $(addprefix $(FPCDIR)/,rtl units)),)
+override FPCDIR=c:/pp
+endif
+endif
+endif
+endif
+endif
+ifndef CROSSBINDIR
+CROSSBINDIR:=$(wildcard $(FPCDIR)/bin/$(TARGETSUFFIX))
+endif
+ifneq ($(findstring $(OS_TARGET),darwin iphonesim),)
+ifeq ($(OS_SOURCE),darwin)
+DARWIN2DARWIN=1
+endif
+endif
+ifndef BINUTILSPREFIX
+ifndef CROSSBINDIR
+ifdef CROSSCOMPILE
+ifndef DARWIN2DARWIN
+ifneq ($(CPU_TARGET),jvm)
+BINUTILSPREFIX=$(CPU_TARGET)-$(OS_TARGET)-
+ifeq ($(OS_TARGET),android)
+ifeq ($(CPU_TARGET),arm)
+BINUTILSPREFIX=arm-linux-androideabi-
+else
+ifeq ($(CPU_TARGET),i386)
+BINUTILSPREFIX=i686-linux-android-
+else
+ifeq ($(CPU_TARGET),mips)
+BINUTILSPREFIX=mipsel-linux-android-
+endif
+endif
+endif
+endif
+endif
+endif
+endif
+endif
+endif
+UNITSDIR:=$(wildcard $(FPCDIR)/units/$(TARGETSUFFIX))
+ifeq ($(UNITSDIR),)
+UNITSDIR:=$(wildcard $(FPCDIR)/units/$(OS_TARGET))
+endif
+PACKAGESDIR:=$(wildcard $(FPCDIR) $(FPCDIR)/packages $(FPCDIR)/packages/base $(FPCDIR)/packages/extra)
+ifndef FPCFPMAKE
+ifdef CROSSCOMPILE
+ifeq ($(strip $(wildcard $(addsuffix /compiler/ppc$(SRCEXEEXT),$(FPCDIR)))),)
+FPCPROG:=$(strip $(wildcard $(addsuffix /fpc$(SRCEXEEXT),$(SEARCHPATH))))
+ifneq ($(FPCPROG),)
+FPCPROG:=$(firstword $(FPCPROG))
+FPCFPMAKE:=$(shell $(FPCPROG) -PB)
+ifeq ($(strip $(wildcard $(FPCFPMAKE))),)
+FPCFPMAKE:=$(firstword $(FPCPROG))
+endif
+else
+override FPCFPMAKE=$(firstword $(strip $(wildcard $(addsuffix /ppc386$(SRCEXEEXT),$(SEARCHPATH)))))
+endif
+else
+FPCFPMAKE=$(strip $(wildcard $(addsuffix /compiler/ppc$(SRCEXEEXT),$(FPCDIR))))
+FPMAKE_SKIP_CONFIG=-n
+export FPCFPMAKE
+export FPMAKE_SKIP_CONFIG
+endif
+else
+FPMAKE_SKIP_CONFIG=-n
+FPCFPMAKE=$(FPC)
+endif
+endif
+override PACKAGE_NAME=egl
+override PACKAGE_VERSION=2.7.1
+ifeq ($(FULL_TARGET),i386-linux)
+override TARGET_UNITS+=egl
+endif
+ifeq ($(FULL_TARGET),i386-win32)
+override TARGET_UNITS+=egl
+endif
+ifeq ($(FULL_TARGET),i386-darwin)
+override TARGET_UNITS+=egl
+endif
+ifeq ($(FULL_TARGET),i386-wince)
+override TARGET_UNITS+=egl
+endif
+ifeq ($(FULL_TARGET),i386-android)
+override TARGET_UNITS+=egl
+endif
+ifeq ($(FULL_TARGET),m68k-linux)
+override TARGET_UNITS+=egl
+endif
+ifeq ($(FULL_TARGET),powerpc-linux)
+override TARGET_UNITS+=egl
+endif
+ifeq ($(FULL_TARGET),powerpc-darwin)
+override TARGET_UNITS+=egl
+endif
+ifeq ($(FULL_TARGET),sparc-linux)
+override TARGET_UNITS+=egl
+endif
+ifeq ($(FULL_TARGET),x86_64-linux)
+override TARGET_UNITS+=egl
+endif
+ifeq ($(FULL_TARGET),x86_64-darwin)
+override TARGET_UNITS+=egl
+endif
+ifeq ($(FULL_TARGET),x86_64-win64)
+override TARGET_UNITS+=egl
+endif
+ifeq ($(FULL_TARGET),arm-linux)
+override TARGET_UNITS+=egl
+endif
+ifeq ($(FULL_TARGET),arm-darwin)
+override TARGET_UNITS+=egl
+endif
+ifeq ($(FULL_TARGET),arm-wince)
+override TARGET_UNITS+=egl
+endif
+ifeq ($(FULL_TARGET),arm-android)
+override TARGET_UNITS+=egl
+endif
+ifeq ($(FULL_TARGET),powerpc64-linux)
+override TARGET_UNITS+=egl
+endif
+ifeq ($(FULL_TARGET),powerpc64-darwin)
+override TARGET_UNITS+=egl
+endif
+ifeq ($(FULL_TARGET),armeb-linux)
+override TARGET_UNITS+=egl
+endif
+ifeq ($(FULL_TARGET),mips-linux)
+override TARGET_UNITS+=egl
+endif
+ifeq ($(FULL_TARGET),mipsel-linux)
+override TARGET_UNITS+=egl
+endif
+ifeq ($(FULL_TARGET),jvm-android)
+override TARGET_UNITS+=egl
+endif
+ifeq ($(FULL_TARGET),i386-linux)
+override TARGET_EXAMPLEDIRS+=examples
+endif
+ifeq ($(FULL_TARGET),i386-go32v2)
+override TARGET_EXAMPLEDIRS+=examples
+endif
+ifeq ($(FULL_TARGET),i386-win32)
+override TARGET_EXAMPLEDIRS+=examples
+endif
+ifeq ($(FULL_TARGET),i386-os2)
+override TARGET_EXAMPLEDIRS+=examples
+endif
+ifeq ($(FULL_TARGET),i386-freebsd)
+override TARGET_EXAMPLEDIRS+=examples
+endif
+ifeq ($(FULL_TARGET),i386-beos)
+override TARGET_EXAMPLEDIRS+=examples
+endif
+ifeq ($(FULL_TARGET),i386-haiku)
+override TARGET_EXAMPLEDIRS+=examples
+endif
+ifeq ($(FULL_TARGET),i386-netbsd)
+override TARGET_EXAMPLEDIRS+=examples
+endif
+ifeq ($(FULL_TARGET),i386-solaris)
+override TARGET_EXAMPLEDIRS+=examples
+endif
+ifeq ($(FULL_TARGET),i386-qnx)
+override TARGET_EXAMPLEDIRS+=examples
+endif
+ifeq ($(FULL_TARGET),i386-netware)
+override TARGET_EXAMPLEDIRS+=examples
+endif
+ifeq ($(FULL_TARGET),i386-openbsd)
+override TARGET_EXAMPLEDIRS+=examples
+endif
+ifeq ($(FULL_TARGET),i386-wdosx)
+override TARGET_EXAMPLEDIRS+=examples
+endif
+ifeq ($(FULL_TARGET),i386-darwin)
+override TARGET_EXAMPLEDIRS+=examples
+endif
+ifeq ($(FULL_TARGET),i386-emx)
+override TARGET_EXAMPLEDIRS+=examples
+endif
+ifeq ($(FULL_TARGET),i386-watcom)
+override TARGET_EXAMPLEDIRS+=examples
+endif
+ifeq ($(FULL_TARGET),i386-netwlibc)
+override TARGET_EXAMPLEDIRS+=examples
+endif
+ifeq ($(FULL_TARGET),i386-wince)
+override TARGET_EXAMPLEDIRS+=examples
+endif
+ifeq ($(FULL_TARGET),i386-embedded)
+override TARGET_EXAMPLEDIRS+=examples
+endif
+ifeq ($(FULL_TARGET),i386-symbian)
+override TARGET_EXAMPLEDIRS+=examples
+endif
+ifeq ($(FULL_TARGET),i386-nativent)
+override TARGET_EXAMPLEDIRS+=examples
+endif
+ifeq ($(FULL_TARGET),i386-iphonesim)
+override TARGET_EXAMPLEDIRS+=examples
+endif
+ifeq ($(FULL_TARGET),i386-android)
+override TARGET_EXAMPLEDIRS+=examples
+endif
+ifeq ($(FULL_TARGET),m68k-linux)
+override TARGET_EXAMPLEDIRS+=examples
+endif
+ifeq ($(FULL_TARGET),m68k-freebsd)
+override TARGET_EXAMPLEDIRS+=examples
+endif
+ifeq ($(FULL_TARGET),m68k-netbsd)
+override TARGET_EXAMPLEDIRS+=examples
+endif
+ifeq ($(FULL_TARGET),m68k-amiga)
+override TARGET_EXAMPLEDIRS+=examples
+endif
+ifeq ($(FULL_TARGET),m68k-atari)
+override TARGET_EXAMPLEDIRS+=examples
+endif
+ifeq ($(FULL_TARGET),m68k-openbsd)
+override TARGET_EXAMPLEDIRS+=examples
+endif
+ifeq ($(FULL_TARGET),m68k-palmos)
+override TARGET_EXAMPLEDIRS+=examples
+endif
+ifeq ($(FULL_TARGET),m68k-embedded)
+override TARGET_EXAMPLEDIRS+=examples
+endif
+ifeq ($(FULL_TARGET),powerpc-linux)
+override TARGET_EXAMPLEDIRS+=examples
+endif
+ifeq ($(FULL_TARGET),powerpc-netbsd)
+override TARGET_EXAMPLEDIRS+=examples
+endif
+ifeq ($(FULL_TARGET),powerpc-amiga)
+override TARGET_EXAMPLEDIRS+=examples
+endif
+ifeq ($(FULL_TARGET),powerpc-macos)
+override TARGET_EXAMPLEDIRS+=examples
+endif
+ifeq ($(FULL_TARGET),powerpc-darwin)
+override TARGET_EXAMPLEDIRS+=examples
+endif
+ifeq ($(FULL_TARGET),powerpc-morphos)
+override TARGET_EXAMPLEDIRS+=examples
+endif
+ifeq ($(FULL_TARGET),powerpc-embedded)
+override TARGET_EXAMPLEDIRS+=examples
+endif
+ifeq ($(FULL_TARGET),powerpc-wii)
+override TARGET_EXAMPLEDIRS+=examples
+endif
+ifeq ($(FULL_TARGET),powerpc-aix)
+override TARGET_EXAMPLEDIRS+=examples
+endif
+ifeq ($(FULL_TARGET),sparc-linux)
+override TARGET_EXAMPLEDIRS+=examples
+endif
+ifeq ($(FULL_TARGET),sparc-netbsd)
+override TARGET_EXAMPLEDIRS+=examples
+endif
+ifeq ($(FULL_TARGET),sparc-solaris)
+override TARGET_EXAMPLEDIRS+=examples
+endif
+ifeq ($(FULL_TARGET),sparc-embedded)
+override TARGET_EXAMPLEDIRS+=examples
+endif
+ifeq ($(FULL_TARGET),x86_64-linux)
+override TARGET_EXAMPLEDIRS+=examples
+endif
+ifeq ($(FULL_TARGET),x86_64-freebsd)
+override TARGET_EXAMPLEDIRS+=examples
+endif
+ifeq ($(FULL_TARGET),x86_64-netbsd)
+override TARGET_EXAMPLEDIRS+=examples
+endif
+ifeq ($(FULL_TARGET),x86_64-solaris)
+override TARGET_EXAMPLEDIRS+=examples
+endif
+ifeq ($(FULL_TARGET),x86_64-openbsd)
+override TARGET_EXAMPLEDIRS+=examples
+endif
+ifeq ($(FULL_TARGET),x86_64-darwin)
+override TARGET_EXAMPLEDIRS+=examples
+endif
+ifeq ($(FULL_TARGET),x86_64-win64)
+override TARGET_EXAMPLEDIRS+=examples
+endif
+ifeq ($(FULL_TARGET),x86_64-embedded)
+override TARGET_EXAMPLEDIRS+=examples
+endif
+ifeq ($(FULL_TARGET),arm-linux)
+override TARGET_EXAMPLEDIRS+=examples
+endif
+ifeq ($(FULL_TARGET),arm-palmos)
+override TARGET_EXAMPLEDIRS+=examples
+endif
+ifeq ($(FULL_TARGET),arm-darwin)
+override TARGET_EXAMPLEDIRS+=examples
+endif
+ifeq ($(FULL_TARGET),arm-wince)
+override TARGET_EXAMPLEDIRS+=examples
+endif
+ifeq ($(FULL_TARGET),arm-gba)
+override TARGET_EXAMPLEDIRS+=examples
+endif
+ifeq ($(FULL_TARGET),arm-nds)
+override TARGET_EXAMPLEDIRS+=examples
+endif
+ifeq ($(FULL_TARGET),arm-embedded)
+override TARGET_EXAMPLEDIRS+=examples
+endif
+ifeq ($(FULL_TARGET),arm-symbian)
+override TARGET_EXAMPLEDIRS+=examples
+endif
+ifeq ($(FULL_TARGET),arm-android)
+override TARGET_EXAMPLEDIRS+=examples
+endif
+ifeq ($(FULL_TARGET),powerpc64-linux)
+override TARGET_EXAMPLEDIRS+=examples
+endif
+ifeq ($(FULL_TARGET),powerpc64-darwin)
+override TARGET_EXAMPLEDIRS+=examples
+endif
+ifeq ($(FULL_TARGET),powerpc64-embedded)
+override TARGET_EXAMPLEDIRS+=examples
+endif
+ifeq ($(FULL_TARGET),powerpc64-aix)
+override TARGET_EXAMPLEDIRS+=examples
+endif
+ifeq ($(FULL_TARGET),avr-embedded)
+override TARGET_EXAMPLEDIRS+=examples
+endif
+ifeq ($(FULL_TARGET),armeb-linux)
+override TARGET_EXAMPLEDIRS+=examples
+endif
+ifeq ($(FULL_TARGET),armeb-embedded)
+override TARGET_EXAMPLEDIRS+=examples
+endif
+ifeq ($(FULL_TARGET),mips-linux)
+override TARGET_EXAMPLEDIRS+=examples
+endif
+ifeq ($(FULL_TARGET),mipsel-linux)
+override TARGET_EXAMPLEDIRS+=examples
+endif
+ifeq ($(FULL_TARGET),jvm-java)
+override TARGET_EXAMPLEDIRS+=examples
+endif
+ifeq ($(FULL_TARGET),jvm-android)
+override TARGET_EXAMPLEDIRS+=examples
+endif
+ifeq ($(FULL_TARGET),i8086-msdos)
+override TARGET_EXAMPLEDIRS+=examples
+endif
+override INSTALL_FPCPACKAGE=y
+ifeq ($(FULL_TARGET),i386-linux)
+override COMPILER_INCLUDEDIR+=src
+endif
+ifeq ($(FULL_TARGET),i386-go32v2)
+override COMPILER_INCLUDEDIR+=src
+endif
+ifeq ($(FULL_TARGET),i386-win32)
+override COMPILER_INCLUDEDIR+=src
+endif
+ifeq ($(FULL_TARGET),i386-os2)
+override COMPILER_INCLUDEDIR+=src
+endif
+ifeq ($(FULL_TARGET),i386-freebsd)
+override COMPILER_INCLUDEDIR+=src
+endif
+ifeq ($(FULL_TARGET),i386-beos)
+override COMPILER_INCLUDEDIR+=src
+endif
+ifeq ($(FULL_TARGET),i386-haiku)
+override COMPILER_INCLUDEDIR+=src
+endif
+ifeq ($(FULL_TARGET),i386-netbsd)
+override COMPILER_INCLUDEDIR+=src
+endif
+ifeq ($(FULL_TARGET),i386-solaris)
+override COMPILER_INCLUDEDIR+=src
+endif
+ifeq ($(FULL_TARGET),i386-qnx)
+override COMPILER_INCLUDEDIR+=src
+endif
+ifeq ($(FULL_TARGET),i386-netware)
+override COMPILER_INCLUDEDIR+=src
+endif
+ifeq ($(FULL_TARGET),i386-openbsd)
+override COMPILER_INCLUDEDIR+=src
+endif
+ifeq ($(FULL_TARGET),i386-wdosx)
+override COMPILER_INCLUDEDIR+=src
+endif
+ifeq ($(FULL_TARGET),i386-darwin)
+override COMPILER_INCLUDEDIR+=src
+endif
+ifeq ($(FULL_TARGET),i386-emx)
+override COMPILER_INCLUDEDIR+=src
+endif
+ifeq ($(FULL_TARGET),i386-watcom)
+override COMPILER_INCLUDEDIR+=src
+endif
+ifeq ($(FULL_TARGET),i386-netwlibc)
+override COMPILER_INCLUDEDIR+=src
+endif
+ifeq ($(FULL_TARGET),i386-wince)
+override COMPILER_INCLUDEDIR+=src
+endif
+ifeq ($(FULL_TARGET),i386-embedded)
+override COMPILER_INCLUDEDIR+=src
+endif
+ifeq ($(FULL_TARGET),i386-symbian)
+override COMPILER_INCLUDEDIR+=src
+endif
+ifeq ($(FULL_TARGET),i386-nativent)
+override COMPILER_INCLUDEDIR+=src
+endif
+ifeq ($(FULL_TARGET),i386-iphonesim)
+override COMPILER_INCLUDEDIR+=src
+endif
+ifeq ($(FULL_TARGET),i386-android)
+override COMPILER_INCLUDEDIR+=src
+endif
+ifeq ($(FULL_TARGET),m68k-linux)
+override COMPILER_INCLUDEDIR+=src
+endif
+ifeq ($(FULL_TARGET),m68k-freebsd)
+override COMPILER_INCLUDEDIR+=src
+endif
+ifeq ($(FULL_TARGET),m68k-netbsd)
+override COMPILER_INCLUDEDIR+=src
+endif
+ifeq ($(FULL_TARGET),m68k-amiga)
+override COMPILER_INCLUDEDIR+=src
+endif
+ifeq ($(FULL_TARGET),m68k-atari)
+override COMPILER_INCLUDEDIR+=src
+endif
+ifeq ($(FULL_TARGET),m68k-openbsd)
+override COMPILER_INCLUDEDIR+=src
+endif
+ifeq ($(FULL_TARGET),m68k-palmos)
+override COMPILER_INCLUDEDIR+=src
+endif
+ifeq ($(FULL_TARGET),m68k-embedded)
+override COMPILER_INCLUDEDIR+=src
+endif
+ifeq ($(FULL_TARGET),powerpc-linux)
+override COMPILER_INCLUDEDIR+=src
+endif
+ifeq ($(FULL_TARGET),powerpc-netbsd)
+override COMPILER_INCLUDEDIR+=src
+endif
+ifeq ($(FULL_TARGET),powerpc-amiga)
+override COMPILER_INCLUDEDIR+=src
+endif
+ifeq ($(FULL_TARGET),powerpc-macos)
+override COMPILER_INCLUDEDIR+=src
+endif
+ifeq ($(FULL_TARGET),powerpc-darwin)
+override COMPILER_INCLUDEDIR+=src
+endif
+ifeq ($(FULL_TARGET),powerpc-morphos)
+override COMPILER_INCLUDEDIR+=src
+endif
+ifeq ($(FULL_TARGET),powerpc-embedded)
+override COMPILER_INCLUDEDIR+=src
+endif
+ifeq ($(FULL_TARGET),powerpc-wii)
+override COMPILER_INCLUDEDIR+=src
+endif
+ifeq ($(FULL_TARGET),powerpc-aix)
+override COMPILER_INCLUDEDIR+=src
+endif
+ifeq ($(FULL_TARGET),sparc-linux)
+override COMPILER_INCLUDEDIR+=src
+endif
+ifeq ($(FULL_TARGET),sparc-netbsd)
+override COMPILER_INCLUDEDIR+=src
+endif
+ifeq ($(FULL_TARGET),sparc-solaris)
+override COMPILER_INCLUDEDIR+=src
+endif
+ifeq ($(FULL_TARGET),sparc-embedded)
+override COMPILER_INCLUDEDIR+=src
+endif
+ifeq ($(FULL_TARGET),x86_64-linux)
+override COMPILER_INCLUDEDIR+=src
+endif
+ifeq ($(FULL_TARGET),x86_64-freebsd)
+override COMPILER_INCLUDEDIR+=src
+endif
+ifeq ($(FULL_TARGET),x86_64-netbsd)
+override COMPILER_INCLUDEDIR+=src
+endif
+ifeq ($(FULL_TARGET),x86_64-solaris)
+override COMPILER_INCLUDEDIR+=src
+endif
+ifeq ($(FULL_TARGET),x86_64-openbsd)
+override COMPILER_INCLUDEDIR+=src
+endif
+ifeq ($(FULL_TARGET),x86_64-darwin)
+override COMPILER_INCLUDEDIR+=src
+endif
+ifeq ($(FULL_TARGET),x86_64-win64)
+override COMPILER_INCLUDEDIR+=src
+endif
+ifeq ($(FULL_TARGET),x86_64-embedded)
+override COMPILER_INCLUDEDIR+=src
+endif
+ifeq ($(FULL_TARGET),arm-linux)
+override COMPILER_INCLUDEDIR+=src
+endif
+ifeq ($(FULL_TARGET),arm-palmos)
+override COMPILER_INCLUDEDIR+=src
+endif
+ifeq ($(FULL_TARGET),arm-darwin)
+override COMPILER_INCLUDEDIR+=src
+endif
+ifeq ($(FULL_TARGET),arm-wince)
+override COMPILER_INCLUDEDIR+=src
+endif
+ifeq ($(FULL_TARGET),arm-gba)
+override COMPILER_INCLUDEDIR+=src
+endif
+ifeq ($(FULL_TARGET),arm-nds)
+override COMPILER_INCLUDEDIR+=src
+endif
+ifeq ($(FULL_TARGET),arm-embedded)
+override COMPILER_INCLUDEDIR+=src
+endif
+ifeq ($(FULL_TARGET),arm-symbian)
+override COMPILER_INCLUDEDIR+=src
+endif
+ifeq ($(FULL_TARGET),arm-android)
+override COMPILER_INCLUDEDIR+=src
+endif
+ifeq ($(FULL_TARGET),powerpc64-linux)
+override COMPILER_INCLUDEDIR+=src
+endif
+ifeq ($(FULL_TARGET),powerpc64-darwin)
+override COMPILER_INCLUDEDIR+=src
+endif
+ifeq ($(FULL_TARGET),powerpc64-embedded)
+override COMPILER_INCLUDEDIR+=src
+endif
+ifeq ($(FULL_TARGET),powerpc64-aix)
+override COMPILER_INCLUDEDIR+=src
+endif
+ifeq ($(FULL_TARGET),avr-embedded)
+override COMPILER_INCLUDEDIR+=src
+endif
+ifeq ($(FULL_TARGET),armeb-linux)
+override COMPILER_INCLUDEDIR+=src
+endif
+ifeq ($(FULL_TARGET),armeb-embedded)
+override COMPILER_INCLUDEDIR+=src
+endif
+ifeq ($(FULL_TARGET),mips-linux)
+override COMPILER_INCLUDEDIR+=src
+endif
+ifeq ($(FULL_TARGET),mipsel-linux)
+override COMPILER_INCLUDEDIR+=src
+endif
+ifeq ($(FULL_TARGET),jvm-java)
+override COMPILER_INCLUDEDIR+=src
+endif
+ifeq ($(FULL_TARGET),jvm-android)
+override COMPILER_INCLUDEDIR+=src
+endif
+ifeq ($(FULL_TARGET),i8086-msdos)
+override COMPILER_INCLUDEDIR+=src
+endif
+ifeq ($(FULL_TARGET),i386-linux)
+override COMPILER_SOURCEDIR+=src examples
+endif
+ifeq ($(FULL_TARGET),i386-go32v2)
+override COMPILER_SOURCEDIR+=src examples
+endif
+ifeq ($(FULL_TARGET),i386-win32)
+override COMPILER_SOURCEDIR+=src examples
+endif
+ifeq ($(FULL_TARGET),i386-os2)
+override COMPILER_SOURCEDIR+=src examples
+endif
+ifeq ($(FULL_TARGET),i386-freebsd)
+override COMPILER_SOURCEDIR+=src examples
+endif
+ifeq ($(FULL_TARGET),i386-beos)
+override COMPILER_SOURCEDIR+=src examples
+endif
+ifeq ($(FULL_TARGET),i386-haiku)
+override COMPILER_SOURCEDIR+=src examples
+endif
+ifeq ($(FULL_TARGET),i386-netbsd)
+override COMPILER_SOURCEDIR+=src examples
+endif
+ifeq ($(FULL_TARGET),i386-solaris)
+override COMPILER_SOURCEDIR+=src examples
+endif
+ifeq ($(FULL_TARGET),i386-qnx)
+override COMPILER_SOURCEDIR+=src examples
+endif
+ifeq ($(FULL_TARGET),i386-netware)
+override COMPILER_SOURCEDIR+=src examples
+endif
+ifeq ($(FULL_TARGET),i386-openbsd)
+override COMPILER_SOURCEDIR+=src examples
+endif
+ifeq ($(FULL_TARGET),i386-wdosx)
+override COMPILER_SOURCEDIR+=src examples
+endif
+ifeq ($(FULL_TARGET),i386-darwin)
+override COMPILER_SOURCEDIR+=src examples
+endif
+ifeq ($(FULL_TARGET),i386-emx)
+override COMPILER_SOURCEDIR+=src examples
+endif
+ifeq ($(FULL_TARGET),i386-watcom)
+override COMPILER_SOURCEDIR+=src examples
+endif
+ifeq ($(FULL_TARGET),i386-netwlibc)
+override COMPILER_SOURCEDIR+=src examples
+endif
+ifeq ($(FULL_TARGET),i386-wince)
+override COMPILER_SOURCEDIR+=src examples
+endif
+ifeq ($(FULL_TARGET),i386-embedded)
+override COMPILER_SOURCEDIR+=src examples
+endif
+ifeq ($(FULL_TARGET),i386-symbian)
+override COMPILER_SOURCEDIR+=src examples
+endif
+ifeq ($(FULL_TARGET),i386-nativent)
+override COMPILER_SOURCEDIR+=src examples
+endif
+ifeq ($(FULL_TARGET),i386-iphonesim)
+override COMPILER_SOURCEDIR+=src examples
+endif
+ifeq ($(FULL_TARGET),i386-android)
+override COMPILER_SOURCEDIR+=src examples
+endif
+ifeq ($(FULL_TARGET),m68k-linux)
+override COMPILER_SOURCEDIR+=src examples
+endif
+ifeq ($(FULL_TARGET),m68k-freebsd)
+override COMPILER_SOURCEDIR+=src examples
+endif
+ifeq ($(FULL_TARGET),m68k-netbsd)
+override COMPILER_SOURCEDIR+=src examples
+endif
+ifeq ($(FULL_TARGET),m68k-amiga)
+override COMPILER_SOURCEDIR+=src examples
+endif
+ifeq ($(FULL_TARGET),m68k-atari)
+override COMPILER_SOURCEDIR+=src examples
+endif
+ifeq ($(FULL_TARGET),m68k-openbsd)
+override COMPILER_SOURCEDIR+=src examples
+endif
+ifeq ($(FULL_TARGET),m68k-palmos)
+override COMPILER_SOURCEDIR+=src examples
+endif
+ifeq ($(FULL_TARGET),m68k-embedded)
+override COMPILER_SOURCEDIR+=src examples
+endif
+ifeq ($(FULL_TARGET),powerpc-linux)
+override COMPILER_SOURCEDIR+=src examples
+endif
+ifeq ($(FULL_TARGET),powerpc-netbsd)
+override COMPILER_SOURCEDIR+=src examples
+endif
+ifeq ($(FULL_TARGET),powerpc-amiga)
+override COMPILER_SOURCEDIR+=src examples
+endif
+ifeq ($(FULL_TARGET),powerpc-macos)
+override COMPILER_SOURCEDIR+=src examples
+endif
+ifeq ($(FULL_TARGET),powerpc-darwin)
+override COMPILER_SOURCEDIR+=src examples
+endif
+ifeq ($(FULL_TARGET),powerpc-morphos)
+override COMPILER_SOURCEDIR+=src examples
+endif
+ifeq ($(FULL_TARGET),powerpc-embedded)
+override COMPILER_SOURCEDIR+=src examples
+endif
+ifeq ($(FULL_TARGET),powerpc-wii)
+override COMPILER_SOURCEDIR+=src examples
+endif
+ifeq ($(FULL_TARGET),powerpc-aix)
+override COMPILER_SOURCEDIR+=src examples
+endif
+ifeq ($(FULL_TARGET),sparc-linux)
+override COMPILER_SOURCEDIR+=src examples
+endif
+ifeq ($(FULL_TARGET),sparc-netbsd)
+override COMPILER_SOURCEDIR+=src examples
+endif
+ifeq ($(FULL_TARGET),sparc-solaris)
+override COMPILER_SOURCEDIR+=src examples
+endif
+ifeq ($(FULL_TARGET),sparc-embedded)
+override COMPILER_SOURCEDIR+=src examples
+endif
+ifeq ($(FULL_TARGET),x86_64-linux)
+override COMPILER_SOURCEDIR+=src examples
+endif
+ifeq ($(FULL_TARGET),x86_64-freebsd)
+override COMPILER_SOURCEDIR+=src examples
+endif
+ifeq ($(FULL_TARGET),x86_64-netbsd)
+override COMPILER_SOURCEDIR+=src examples
+endif
+ifeq ($(FULL_TARGET),x86_64-solaris)
+override COMPILER_SOURCEDIR+=src examples
+endif
+ifeq ($(FULL_TARGET),x86_64-openbsd)
+override COMPILER_SOURCEDIR+=src examples
+endif
+ifeq ($(FULL_TARGET),x86_64-darwin)
+override COMPILER_SOURCEDIR+=src examples
+endif
+ifeq ($(FULL_TARGET),x86_64-win64)
+override COMPILER_SOURCEDIR+=src examples
+endif
+ifeq ($(FULL_TARGET),x86_64-embedded)
+override COMPILER_SOURCEDIR+=src examples
+endif
+ifeq ($(FULL_TARGET),arm-linux)
+override COMPILER_SOURCEDIR+=src examples
+endif
+ifeq ($(FULL_TARGET),arm-palmos)
+override COMPILER_SOURCEDIR+=src examples
+endif
+ifeq ($(FULL_TARGET),arm-darwin)
+override COMPILER_SOURCEDIR+=src examples
+endif
+ifeq ($(FULL_TARGET),arm-wince)
+override COMPILER_SOURCEDIR+=src examples
+endif
+ifeq ($(FULL_TARGET),arm-gba)
+override COMPILER_SOURCEDIR+=src examples
+endif
+ifeq ($(FULL_TARGET),arm-nds)
+override COMPILER_SOURCEDIR+=src examples
+endif
+ifeq ($(FULL_TARGET),arm-embedded)
+override COMPILER_SOURCEDIR+=src examples
+endif
+ifeq ($(FULL_TARGET),arm-symbian)
+override COMPILER_SOURCEDIR+=src examples
+endif
+ifeq ($(FULL_TARGET),arm-android)
+override COMPILER_SOURCEDIR+=src examples
+endif
+ifeq ($(FULL_TARGET),powerpc64-linux)
+override COMPILER_SOURCEDIR+=src examples
+endif
+ifeq ($(FULL_TARGET),powerpc64-darwin)
+override COMPILER_SOURCEDIR+=src examples
+endif
+ifeq ($(FULL_TARGET),powerpc64-embedded)
+override COMPILER_SOURCEDIR+=src examples
+endif
+ifeq ($(FULL_TARGET),powerpc64-aix)
+override COMPILER_SOURCEDIR+=src examples
+endif
+ifeq ($(FULL_TARGET),avr-embedded)
+override COMPILER_SOURCEDIR+=src examples
+endif
+ifeq ($(FULL_TARGET),armeb-linux)
+override COMPILER_SOURCEDIR+=src examples
+endif
+ifeq ($(FULL_TARGET),armeb-embedded)
+override COMPILER_SOURCEDIR+=src examples
+endif
+ifeq ($(FULL_TARGET),mips-linux)
+override COMPILER_SOURCEDIR+=src examples
+endif
+ifeq ($(FULL_TARGET),mipsel-linux)
+override COMPILER_SOURCEDIR+=src examples
+endif
+ifeq ($(FULL_TARGET),jvm-java)
+override COMPILER_SOURCEDIR+=src examples
+endif
+ifeq ($(FULL_TARGET),jvm-android)
+override COMPILER_SOURCEDIR+=src examples
+endif
+ifeq ($(FULL_TARGET),i8086-msdos)
+override COMPILER_SOURCEDIR+=src examples
+endif
+ifdef REQUIRE_UNITSDIR
+override UNITSDIR+=$(REQUIRE_UNITSDIR)
+endif
+ifdef REQUIRE_PACKAGESDIR
+override PACKAGESDIR+=$(REQUIRE_PACKAGESDIR)
+endif
+ifdef ZIPINSTALL
+ifneq ($(findstring $(OS_TARGET),$(UNIXs)),)
+UNIXHier=1
+endif
+else
+ifneq ($(findstring $(OS_SOURCE),$(UNIXs)),)
+UNIXHier=1
+endif
+endif
+ifndef INSTALL_PREFIX
+ifdef PREFIX
+INSTALL_PREFIX=$(PREFIX)
+endif
+endif
+ifndef INSTALL_PREFIX
+ifdef UNIXHier
+INSTALL_PREFIX=/usr/local
+else
+ifdef INSTALL_FPCPACKAGE
+INSTALL_BASEDIR:=/pp
+else
+INSTALL_BASEDIR:=/$(PACKAGE_NAME)
+endif
+endif
+endif
+export INSTALL_PREFIX
+ifdef INSTALL_FPCSUBDIR
+export INSTALL_FPCSUBDIR
+endif
+ifndef DIST_DESTDIR
+DIST_DESTDIR:=$(BASEDIR)
+endif
+export DIST_DESTDIR
+ifndef COMPILER_UNITTARGETDIR
+ifdef PACKAGEDIR_MAIN
+COMPILER_UNITTARGETDIR=$(PACKAGEDIR_MAIN)/units/$(TARGETSUFFIX)
+else
+COMPILER_UNITTARGETDIR=units/$(TARGETSUFFIX)
+endif
+endif
+ifndef COMPILER_TARGETDIR
+COMPILER_TARGETDIR=.
+endif
+ifndef INSTALL_BASEDIR
+ifdef UNIXHier
+ifdef INSTALL_FPCPACKAGE
+INSTALL_BASEDIR:=$(INSTALL_PREFIX)/lib/fpc/$(FPC_VERSION)
+else
+INSTALL_BASEDIR:=$(INSTALL_PREFIX)/lib/$(PACKAGE_NAME)
+endif
+else
+INSTALL_BASEDIR:=$(INSTALL_PREFIX)
+endif
+endif
+ifndef INSTALL_BINDIR
+ifdef UNIXHier
+INSTALL_BINDIR:=$(INSTALL_PREFIX)/bin
+else
+INSTALL_BINDIR:=$(INSTALL_BASEDIR)/bin
+ifdef INSTALL_FPCPACKAGE
+ifdef CROSSCOMPILE
+ifdef CROSSINSTALL
+INSTALL_BINDIR:=$(INSTALL_BINDIR)/$(SOURCESUFFIX)
+else
+INSTALL_BINDIR:=$(INSTALL_BINDIR)/$(TARGETSUFFIX)
+endif
+else
+INSTALL_BINDIR:=$(INSTALL_BINDIR)/$(TARGETSUFFIX)
+endif
+endif
+endif
+endif
+ifndef INSTALL_UNITDIR
+INSTALL_UNITDIR:=$(INSTALL_BASEDIR)/units/$(TARGETSUFFIX)
+ifdef INSTALL_FPCPACKAGE
+ifdef PACKAGE_NAME
+INSTALL_UNITDIR:=$(INSTALL_UNITDIR)/$(PACKAGE_NAME)
+endif
+endif
+endif
+ifndef INSTALL_LIBDIR
+ifdef UNIXHier
+INSTALL_LIBDIR:=$(INSTALL_PREFIX)/lib
+else
+INSTALL_LIBDIR:=$(INSTALL_UNITDIR)
+endif
+endif
+ifndef INSTALL_SOURCEDIR
+ifdef UNIXHier
+ifdef BSDhier
+SRCPREFIXDIR=share/src
+else
+ifdef linuxHier
+SRCPREFIXDIR=share/src
+else
+SRCPREFIXDIR=src
+endif
+endif
+ifdef INSTALL_FPCPACKAGE
+ifdef INSTALL_FPCSUBDIR
+INSTALL_SOURCEDIR:=$(INSTALL_PREFIX)/$(SRCPREFIXDIR)/fpc-$(FPC_VERSION)/$(INSTALL_FPCSUBDIR)/$(PACKAGE_NAME)
+else
+INSTALL_SOURCEDIR:=$(INSTALL_PREFIX)/$(SRCPREFIXDIR)/fpc-$(FPC_VERSION)/$(PACKAGE_NAME)
+endif
+else
+INSTALL_SOURCEDIR:=$(INSTALL_PREFIX)/$(SRCPREFIXDIR)/$(PACKAGE_NAME)-$(PACKAGE_VERSION)
+endif
+else
+ifdef INSTALL_FPCPACKAGE
+ifdef INSTALL_FPCSUBDIR
+INSTALL_SOURCEDIR:=$(INSTALL_BASEDIR)/source/$(INSTALL_FPCSUBDIR)/$(PACKAGE_NAME)
+else
+INSTALL_SOURCEDIR:=$(INSTALL_BASEDIR)/source/$(PACKAGE_NAME)
+endif
+else
+INSTALL_SOURCEDIR:=$(INSTALL_BASEDIR)/source
+endif
+endif
+endif
+ifndef INSTALL_DOCDIR
+ifdef UNIXHier
+ifdef BSDhier
+DOCPREFIXDIR=share/doc
+else
+ifdef linuxHier
+DOCPREFIXDIR=share/doc
+else
+DOCPREFIXDIR=doc
+endif
+endif
+ifdef INSTALL_FPCPACKAGE
+INSTALL_DOCDIR:=$(INSTALL_PREFIX)/$(DOCPREFIXDIR)/fpc-$(FPC_VERSION)/$(PACKAGE_NAME)
+else
+INSTALL_DOCDIR:=$(INSTALL_PREFIX)/$(DOCPREFIXDIR)/$(PACKAGE_NAME)-$(PACKAGE_VERSION)
+endif
+else
+ifdef INSTALL_FPCPACKAGE
+INSTALL_DOCDIR:=$(INSTALL_BASEDIR)/doc/$(PACKAGE_NAME)
+else
+INSTALL_DOCDIR:=$(INSTALL_BASEDIR)/doc
+endif
+endif
+endif
+ifndef INSTALL_EXAMPLEDIR
+ifdef UNIXHier
+ifdef INSTALL_FPCPACKAGE
+ifdef BSDhier
+INSTALL_EXAMPLEDIR:=$(INSTALL_PREFIX)/share/examples/fpc-$(FPC_VERSION)/$(PACKAGE_NAME)
+else
+ifdef linuxHier
+INSTALL_EXAMPLEDIR:=$(INSTALL_DOCDIR)/examples
+else
+INSTALL_EXAMPLEDIR:=$(INSTALL_PREFIX)/doc/fpc-$(FPC_VERSION)/examples/$(PACKAGE_NAME)
+endif
+endif
+else
+ifdef BSDhier
+INSTALL_EXAMPLEDIR:=$(INSTALL_PREFIX)/share/examples/$(PACKAGE_NAME)-$(PACKAGE_VERSION)
+else
+ifdef linuxHier
+INSTALL_EXAMPLEDIR:=$(INSTALL_DOCDIR)/examples/$(PACKAGE_NAME)-$(PACKAGE_VERSION)
+else
+INSTALL_EXAMPLEDIR:=$(INSTALL_PREFIX)/doc/$(PACKAGE_NAME)-$(PACKAGE_VERSION)
+endif
+endif
+endif
+else
+ifdef INSTALL_FPCPACKAGE
+INSTALL_EXAMPLEDIR:=$(INSTALL_BASEDIR)/examples/$(PACKAGE_NAME)
+else
+INSTALL_EXAMPLEDIR:=$(INSTALL_BASEDIR)/examples
+endif
+endif
+endif
+ifndef INSTALL_DATADIR
+INSTALL_DATADIR=$(INSTALL_BASEDIR)
+endif
+ifndef INSTALL_SHAREDDIR
+INSTALL_SHAREDDIR=$(INSTALL_PREFIX)/lib
+endif
+ifdef CROSSCOMPILE
+ifndef CROSSBINDIR
+CROSSBINDIR:=$(wildcard $(CROSSTARGETDIR)/bin/$(SOURCESUFFIX))
+ifeq ($(CROSSBINDIR),)
+CROSSBINDIR:=$(wildcard $(INSTALL_BASEDIR)/cross/$(TARGETSUFFIX)/bin/$(FULL_SOURCE))
+endif
+endif
+else
+CROSSBINDIR=
+endif
+BATCHEXT=.bat
+LOADEREXT=.as
+EXEEXT=.exe
+PPLEXT=.ppl
+PPUEXT=.ppu
+OEXT=.o
+ASMEXT=.s
+SMARTEXT=.sl
+STATICLIBEXT=.a
+SHAREDLIBEXT=.so
+SHAREDLIBPREFIX=libfp
+STATICLIBPREFIX=libp
+IMPORTLIBPREFIX=libimp
+RSTEXT=.rst
+EXEDBGEXT=.dbg
+ifeq ($(OS_TARGET),go32v1)
+STATICLIBPREFIX=
+SHORTSUFFIX=v1
+endif
+ifeq ($(OS_TARGET),go32v2)
+STATICLIBPREFIX=
+SHORTSUFFIX=dos
+IMPORTLIBPREFIX=
+endif
+ifeq ($(OS_TARGET),watcom)
+STATICLIBPREFIX=
+OEXT=.obj
+ASMEXT=.asm
+SHAREDLIBEXT=.dll
+SHORTSUFFIX=wat
+IMPORTLIBPREFIX=
+endif
+ifneq ($(CPU_TARGET),jvm)
+ifeq ($(OS_TARGET),android)
+BATCHEXT=.sh
+EXEEXT=
+HASSHAREDLIB=1
+SHORTSUFFIX=lnx
+endif
+endif
+ifeq ($(OS_TARGET),linux)
+BATCHEXT=.sh
+EXEEXT=
+HASSHAREDLIB=1
+SHORTSUFFIX=lnx
+endif
+ifeq ($(OS_TARGET),freebsd)
+BATCHEXT=.sh
+EXEEXT=
+HASSHAREDLIB=1
+SHORTSUFFIX=fbs
+endif
+ifeq ($(OS_TARGET),netbsd)
+BATCHEXT=.sh
+EXEEXT=
+HASSHAREDLIB=1
+SHORTSUFFIX=nbs
+endif
+ifeq ($(OS_TARGET),openbsd)
+BATCHEXT=.sh
+EXEEXT=
+HASSHAREDLIB=1
+SHORTSUFFIX=obs
+endif
+ifeq ($(OS_TARGET),win32)
+SHAREDLIBEXT=.dll
+SHORTSUFFIX=w32
+endif
+ifeq ($(OS_TARGET),os2)
+BATCHEXT=.cmd
+AOUTEXT=.out
+STATICLIBPREFIX=
+SHAREDLIBEXT=.dll
+SHORTSUFFIX=os2
+ECHO=echo
+IMPORTLIBPREFIX=
+endif
+ifeq ($(OS_TARGET),emx)
+BATCHEXT=.cmd
+AOUTEXT=.out
+STATICLIBPREFIX=
+SHAREDLIBEXT=.dll
+SHORTSUFFIX=emx
+ECHO=echo
+IMPORTLIBPREFIX=
+endif
+ifeq ($(OS_TARGET),amiga)
+EXEEXT=
+SHAREDLIBEXT=.library
+SHORTSUFFIX=amg
+endif
+ifeq ($(OS_TARGET),morphos)
+EXEEXT=
+SHAREDLIBEXT=.library
+SHORTSUFFIX=mos
+endif
+ifeq ($(OS_TARGET),atari)
+EXEEXT=.ttp
+SHORTSUFFIX=ata
+endif
+ifeq ($(OS_TARGET),beos)
+BATCHEXT=.sh
+EXEEXT=
+SHORTSUFFIX=be
+endif
+ifeq ($(OS_TARGET),haiku)
+BATCHEXT=.sh
+EXEEXT=
+SHORTSUFFIX=hai
+endif
+ifeq ($(OS_TARGET),solaris)
+BATCHEXT=.sh
+EXEEXT=
+SHORTSUFFIX=sun
+endif
+ifeq ($(OS_TARGET),qnx)
+BATCHEXT=.sh
+EXEEXT=
+SHORTSUFFIX=qnx
+endif
+ifeq ($(OS_TARGET),netware)
+EXEEXT=.nlm
+STATICLIBPREFIX=
+SHORTSUFFIX=nw
+IMPORTLIBPREFIX=imp
+endif
+ifeq ($(OS_TARGET),netwlibc)
+EXEEXT=.nlm
+STATICLIBPREFIX=
+SHORTSUFFIX=nwl
+IMPORTLIBPREFIX=imp
+endif
+ifeq ($(OS_TARGET),macos)
+BATCHEXT=
+EXEEXT=
+DEBUGSYMEXT=.xcoff
+SHORTSUFFIX=mac
+IMPORTLIBPREFIX=imp
+endif
+ifneq ($(findstring $(OS_TARGET),darwin iphonesim),)
+BATCHEXT=.sh
+EXEEXT=
+HASSHAREDLIB=1
+SHORTSUFFIX=dwn
+EXEDBGEXT=.dSYM
+endif
+ifeq ($(OS_TARGET),gba)
+EXEEXT=.gba
+SHAREDLIBEXT=.so
+SHORTSUFFIX=gba
+endif
+ifeq ($(OS_TARGET),symbian)
+SHAREDLIBEXT=.dll
+SHORTSUFFIX=symbian
+endif
+ifeq ($(OS_TARGET),NativeNT)
+SHAREDLIBEXT=.dll
+SHORTSUFFIX=nativent
+endif
+ifeq ($(OS_TARGET),wii)
+EXEEXT=.dol
+SHAREDLIBEXT=.so
+SHORTSUFFIX=wii
+endif
+ifeq ($(OS_TARGET),aix)
+BATCHEXT=.sh
+EXEEXT=
+SHORTSUFFIX=aix
+endif
+ifeq ($(OS_TARGET),java)
+OEXT=.class
+ASMEXT=.j
+SHAREDLIBEXT=.jar
+SHORTSUFFIX=java
+endif
+ifeq ($(CPU_TARGET),jvm)
+ifeq ($(OS_TARGET),android)
+OEXT=.class
+ASMEXT=.j
+SHAREDLIBEXT=.jar
+SHORTSUFFIX=android
+endif
+endif
+ifneq ($(findstring $(OS_SOURCE),$(LIMIT83fs)),)
+FPCMADE=fpcmade.$(SHORTSUFFIX)
+ZIPSUFFIX=$(SHORTSUFFIX)
+ZIPCROSSPREFIX=
+ZIPSOURCESUFFIX=src
+ZIPEXAMPLESUFFIX=exm
+else
+FPCMADE=fpcmade.$(TARGETSUFFIX)
+ZIPSOURCESUFFIX=.source
+ZIPEXAMPLESUFFIX=.examples
+ifdef CROSSCOMPILE
+ZIPSUFFIX=.$(SOURCESUFFIX)
+ZIPCROSSPREFIX=$(TARGETSUFFIX)-
+else
+ZIPSUFFIX=.$(TARGETSUFFIX)
+ZIPCROSSPREFIX=
+endif
+endif
+ifndef ECHO
+ECHO:=$(strip $(wildcard $(addsuffix /gecho$(SRCEXEEXT),$(SEARCHPATH))))
+ifeq ($(ECHO),)
+ECHO:=$(strip $(wildcard $(addsuffix /echo$(SRCEXEEXT),$(SEARCHPATH))))
+ifeq ($(ECHO),)
+ECHO= __missing_command_ECHO
+else
+ECHO:=$(firstword $(ECHO))
+endif
+else
+ECHO:=$(firstword $(ECHO))
+endif
+endif
+export ECHO
+ifndef DATE
+DATE:=$(strip $(wildcard $(addsuffix /gdate$(SRCEXEEXT),$(SEARCHPATH))))
+ifeq ($(DATE),)
+DATE:=$(strip $(wildcard $(addsuffix /date$(SRCEXEEXT),$(SEARCHPATH))))
+ifeq ($(DATE),)
+DATE= __missing_command_DATE
+else
+DATE:=$(firstword $(DATE))
+endif
+else
+DATE:=$(firstword $(DATE))
+endif
+endif
+export DATE
+ifndef GINSTALL
+GINSTALL:=$(strip $(wildcard $(addsuffix /ginstall$(SRCEXEEXT),$(SEARCHPATH))))
+ifeq ($(GINSTALL),)
+GINSTALL:=$(strip $(wildcard $(addsuffix /install$(SRCEXEEXT),$(SEARCHPATH))))
+ifeq ($(GINSTALL),)
+GINSTALL= __missing_command_GINSTALL
+else
+GINSTALL:=$(firstword $(GINSTALL))
+endif
+else
+GINSTALL:=$(firstword $(GINSTALL))
+endif
+endif
+export GINSTALL
+ifndef CPPROG
+CPPROG:=$(strip $(wildcard $(addsuffix /cp$(SRCEXEEXT),$(SEARCHPATH))))
+ifeq ($(CPPROG),)
+CPPROG= __missing_command_CPPROG
+else
+CPPROG:=$(firstword $(CPPROG))
+endif
+endif
+export CPPROG
+ifndef RMPROG
+RMPROG:=$(strip $(wildcard $(addsuffix /rm$(SRCEXEEXT),$(SEARCHPATH))))
+ifeq ($(RMPROG),)
+RMPROG= __missing_command_RMPROG
+else
+RMPROG:=$(firstword $(RMPROG))
+endif
+endif
+export RMPROG
+ifndef MVPROG
+MVPROG:=$(strip $(wildcard $(addsuffix /mv$(SRCEXEEXT),$(SEARCHPATH))))
+ifeq ($(MVPROG),)
+MVPROG= __missing_command_MVPROG
+else
+MVPROG:=$(firstword $(MVPROG))
+endif
+endif
+export MVPROG
+ifndef MKDIRPROG
+MKDIRPROG:=$(strip $(wildcard $(addsuffix /gmkdir$(SRCEXEEXT),$(SEARCHPATH))))
+ifeq ($(MKDIRPROG),)
+MKDIRPROG:=$(strip $(wildcard $(addsuffix /mkdir$(SRCEXEEXT),$(SEARCHPATH))))
+ifeq ($(MKDIRPROG),)
+MKDIRPROG= __missing_command_MKDIRPROG
+else
+MKDIRPROG:=$(firstword $(MKDIRPROG))
+endif
+else
+MKDIRPROG:=$(firstword $(MKDIRPROG))
+endif
+endif
+export MKDIRPROG
+ifndef ECHOREDIR
+ifndef inUnix
+ECHOREDIR=echo
+else
+ECHOREDIR=$(ECHO)
+endif
+endif
+ifndef COPY
+COPY:=$(CPPROG) -fp
+endif
+ifndef COPYTREE
+COPYTREE:=$(CPPROG) -Rfp
+endif
+ifndef MKDIRTREE
+MKDIRTREE:=$(MKDIRPROG) -p
+endif
+ifndef MOVE
+MOVE:=$(MVPROG) -f
+endif
+ifndef DEL
+DEL:=$(RMPROG) -f
+endif
+ifndef DELTREE
+DELTREE:=$(RMPROG) -rf
+endif
+ifndef INSTALL
+ifdef inUnix
+INSTALL:=$(GINSTALL) -c -m 644
+else
+INSTALL:=$(COPY)
+endif
+endif
+ifndef INSTALLEXE
+ifdef inUnix
+INSTALLEXE:=$(GINSTALL) -c -m 755
+else
+INSTALLEXE:=$(COPY)
+endif
+endif
+ifndef MKDIR
+MKDIR:=$(GINSTALL) -m 755 -d
+endif
+export ECHOREDIR COPY COPYTREE MOVE DEL DELTREE INSTALL INSTALLEXE MKDIR
+ifndef PPUMOVE
+PPUMOVE:=$(strip $(wildcard $(addsuffix /ppumove$(SRCEXEEXT),$(SEARCHPATH))))
+ifeq ($(PPUMOVE),)
+PPUMOVE= __missing_command_PPUMOVE
+else
+PPUMOVE:=$(firstword $(PPUMOVE))
+endif
+endif
+export PPUMOVE
+ifndef FPCMAKE
+FPCMAKE:=$(strip $(wildcard $(addsuffix /fpcmake$(SRCEXEEXT),$(SEARCHPATH))))
+ifeq ($(FPCMAKE),)
+FPCMAKE= __missing_command_FPCMAKE
+else
+FPCMAKE:=$(firstword $(FPCMAKE))
+endif
+endif
+export FPCMAKE
+ifndef ZIPPROG
+ZIPPROG:=$(strip $(wildcard $(addsuffix /zip$(SRCEXEEXT),$(SEARCHPATH))))
+ifeq ($(ZIPPROG),)
+ZIPPROG= __missing_command_ZIPPROG
+else
+ZIPPROG:=$(firstword $(ZIPPROG))
+endif
+endif
+export ZIPPROG
+ifndef TARPROG
+TARPROG:=$(strip $(wildcard $(addsuffix /gtar$(SRCEXEEXT),$(SEARCHPATH))))
+ifeq ($(TARPROG),)
+TARPROG:=$(strip $(wildcard $(addsuffix /tar$(SRCEXEEXT),$(SEARCHPATH))))
+ifeq ($(TARPROG),)
+TARPROG= __missing_command_TARPROG
+else
+TARPROG:=$(firstword $(TARPROG))
+endif
+else
+TARPROG:=$(firstword $(TARPROG))
+endif
+endif
+export TARPROG
+ASNAME=$(BINUTILSPREFIX)as
+LDNAME=$(BINUTILSPREFIX)ld
+ARNAME=$(BINUTILSPREFIX)ar
+RCNAME=$(BINUTILSPREFIX)rc
+ifndef ASPROG
+ifdef CROSSBINDIR
+ASPROG=$(CROSSBINDIR)/$(ASNAME)$(SRCEXEEXT)
+else
+ASPROG=$(ASNAME)
+endif
+endif
+ifndef LDPROG
+ifdef CROSSBINDIR
+LDPROG=$(CROSSBINDIR)/$(LDNAME)$(SRCEXEEXT)
+else
+LDPROG=$(LDNAME)
+endif
+endif
+ifndef RCPROG
+ifdef CROSSBINDIR
+RCPROG=$(CROSSBINDIR)/$(RCNAME)$(SRCEXEEXT)
+else
+RCPROG=$(RCNAME)
+endif
+endif
+ifndef ARPROG
+ifdef CROSSBINDIR
+ARPROG=$(CROSSBINDIR)/$(ARNAME)$(SRCEXEEXT)
+else
+ARPROG=$(ARNAME)
+endif
+endif
+AS=$(ASPROG)
+LD=$(LDPROG)
+RC=$(RCPROG)
+AR=$(ARPROG)
+ifdef inUnix
+PPAS=./ppas$(SRCBATCHEXT)
+else
+PPAS=ppas$(SRCBATCHEXT)
+endif
+ifdef inUnix
+LDCONFIG=ldconfig
+else
+LDCONFIG=
+endif
+ifdef DATE
+DATESTR:=$(shell $(DATE) +%Y%m%d)
+else
+DATESTR=
+endif
+ZIPOPT=-9
+ZIPEXT=.zip
+ifeq ($(USETAR),bz2)
+TAROPT=vj
+TAREXT=.tar.bz2
+else
+TAROPT=vz
+TAREXT=.tar.gz
+endif
+override REQUIRE_PACKAGES=rtl 
+ifeq ($(FULL_TARGET),i386-linux)
+REQUIRE_PACKAGES_RTL=1
+endif
+ifeq ($(FULL_TARGET),i386-go32v2)
+REQUIRE_PACKAGES_RTL=1
+endif
+ifeq ($(FULL_TARGET),i386-win32)
+REQUIRE_PACKAGES_RTL=1
+endif
+ifeq ($(FULL_TARGET),i386-os2)
+REQUIRE_PACKAGES_RTL=1
+endif
+ifeq ($(FULL_TARGET),i386-freebsd)
+REQUIRE_PACKAGES_RTL=1
+endif
+ifeq ($(FULL_TARGET),i386-beos)
+REQUIRE_PACKAGES_RTL=1
+endif
+ifeq ($(FULL_TARGET),i386-haiku)
+REQUIRE_PACKAGES_RTL=1
+endif
+ifeq ($(FULL_TARGET),i386-netbsd)
+REQUIRE_PACKAGES_RTL=1
+endif
+ifeq ($(FULL_TARGET),i386-solaris)
+REQUIRE_PACKAGES_RTL=1
+endif
+ifeq ($(FULL_TARGET),i386-qnx)
+REQUIRE_PACKAGES_RTL=1
+endif
+ifeq ($(FULL_TARGET),i386-netware)
+REQUIRE_PACKAGES_RTL=1
+endif
+ifeq ($(FULL_TARGET),i386-openbsd)
+REQUIRE_PACKAGES_RTL=1
+endif
+ifeq ($(FULL_TARGET),i386-wdosx)
+REQUIRE_PACKAGES_RTL=1
+endif
+ifeq ($(FULL_TARGET),i386-darwin)
+REQUIRE_PACKAGES_RTL=1
+endif
+ifeq ($(FULL_TARGET),i386-emx)
+REQUIRE_PACKAGES_RTL=1
+endif
+ifeq ($(FULL_TARGET),i386-watcom)
+REQUIRE_PACKAGES_RTL=1
+endif
+ifeq ($(FULL_TARGET),i386-netwlibc)
+REQUIRE_PACKAGES_RTL=1
+endif
+ifeq ($(FULL_TARGET),i386-wince)
+REQUIRE_PACKAGES_RTL=1
+endif
+ifeq ($(FULL_TARGET),i386-embedded)
+REQUIRE_PACKAGES_RTL=1
+endif
+ifeq ($(FULL_TARGET),i386-symbian)
+REQUIRE_PACKAGES_RTL=1
+endif
+ifeq ($(FULL_TARGET),i386-nativent)
+REQUIRE_PACKAGES_RTL=1
+endif
+ifeq ($(FULL_TARGET),i386-iphonesim)
+REQUIRE_PACKAGES_RTL=1
+endif
+ifeq ($(FULL_TARGET),i386-android)
+REQUIRE_PACKAGES_RTL=1
+endif
+ifeq ($(FULL_TARGET),m68k-linux)
+REQUIRE_PACKAGES_RTL=1
+endif
+ifeq ($(FULL_TARGET),m68k-freebsd)
+REQUIRE_PACKAGES_RTL=1
+endif
+ifeq ($(FULL_TARGET),m68k-netbsd)
+REQUIRE_PACKAGES_RTL=1
+endif
+ifeq ($(FULL_TARGET),m68k-amiga)
+REQUIRE_PACKAGES_RTL=1
+endif
+ifeq ($(FULL_TARGET),m68k-atari)
+REQUIRE_PACKAGES_RTL=1
+endif
+ifeq ($(FULL_TARGET),m68k-openbsd)
+REQUIRE_PACKAGES_RTL=1
+endif
+ifeq ($(FULL_TARGET),m68k-palmos)
+REQUIRE_PACKAGES_RTL=1
+endif
+ifeq ($(FULL_TARGET),m68k-embedded)
+REQUIRE_PACKAGES_RTL=1
+endif
+ifeq ($(FULL_TARGET),powerpc-linux)
+REQUIRE_PACKAGES_RTL=1
+endif
+ifeq ($(FULL_TARGET),powerpc-netbsd)
+REQUIRE_PACKAGES_RTL=1
+endif
+ifeq ($(FULL_TARGET),powerpc-amiga)
+REQUIRE_PACKAGES_RTL=1
+endif
+ifeq ($(FULL_TARGET),powerpc-macos)
+REQUIRE_PACKAGES_RTL=1
+endif
+ifeq ($(FULL_TARGET),powerpc-darwin)
+REQUIRE_PACKAGES_RTL=1
+endif
+ifeq ($(FULL_TARGET),powerpc-morphos)
+REQUIRE_PACKAGES_RTL=1
+endif
+ifeq ($(FULL_TARGET),powerpc-embedded)
+REQUIRE_PACKAGES_RTL=1
+endif
+ifeq ($(FULL_TARGET),powerpc-wii)
+REQUIRE_PACKAGES_RTL=1
+endif
+ifeq ($(FULL_TARGET),powerpc-aix)
+REQUIRE_PACKAGES_RTL=1
+endif
+ifeq ($(FULL_TARGET),sparc-linux)
+REQUIRE_PACKAGES_RTL=1
+endif
+ifeq ($(FULL_TARGET),sparc-netbsd)
+REQUIRE_PACKAGES_RTL=1
+endif
+ifeq ($(FULL_TARGET),sparc-solaris)
+REQUIRE_PACKAGES_RTL=1
+endif
+ifeq ($(FULL_TARGET),sparc-embedded)
+REQUIRE_PACKAGES_RTL=1
+endif
+ifeq ($(FULL_TARGET),x86_64-linux)
+REQUIRE_PACKAGES_RTL=1
+endif
+ifeq ($(FULL_TARGET),x86_64-freebsd)
+REQUIRE_PACKAGES_RTL=1
+endif
+ifeq ($(FULL_TARGET),x86_64-netbsd)
+REQUIRE_PACKAGES_RTL=1
+endif
+ifeq ($(FULL_TARGET),x86_64-solaris)
+REQUIRE_PACKAGES_RTL=1
+endif
+ifeq ($(FULL_TARGET),x86_64-openbsd)
+REQUIRE_PACKAGES_RTL=1
+endif
+ifeq ($(FULL_TARGET),x86_64-darwin)
+REQUIRE_PACKAGES_RTL=1
+endif
+ifeq ($(FULL_TARGET),x86_64-win64)
+REQUIRE_PACKAGES_RTL=1
+endif
+ifeq ($(FULL_TARGET),x86_64-embedded)
+REQUIRE_PACKAGES_RTL=1
+endif
+ifeq ($(FULL_TARGET),arm-linux)
+REQUIRE_PACKAGES_RTL=1
+endif
+ifeq ($(FULL_TARGET),arm-palmos)
+REQUIRE_PACKAGES_RTL=1
+endif
+ifeq ($(FULL_TARGET),arm-darwin)
+REQUIRE_PACKAGES_RTL=1
+endif
+ifeq ($(FULL_TARGET),arm-wince)
+REQUIRE_PACKAGES_RTL=1
+endif
+ifeq ($(FULL_TARGET),arm-gba)
+REQUIRE_PACKAGES_RTL=1
+endif
+ifeq ($(FULL_TARGET),arm-nds)
+REQUIRE_PACKAGES_RTL=1
+endif
+ifeq ($(FULL_TARGET),arm-embedded)
+REQUIRE_PACKAGES_RTL=1
+endif
+ifeq ($(FULL_TARGET),arm-symbian)
+REQUIRE_PACKAGES_RTL=1
+endif
+ifeq ($(FULL_TARGET),arm-android)
+REQUIRE_PACKAGES_RTL=1
+endif
+ifeq ($(FULL_TARGET),powerpc64-linux)
+REQUIRE_PACKAGES_RTL=1
+endif
+ifeq ($(FULL_TARGET),powerpc64-darwin)
+REQUIRE_PACKAGES_RTL=1
+endif
+ifeq ($(FULL_TARGET),powerpc64-embedded)
+REQUIRE_PACKAGES_RTL=1
+endif
+ifeq ($(FULL_TARGET),powerpc64-aix)
+REQUIRE_PACKAGES_RTL=1
+endif
+ifeq ($(FULL_TARGET),avr-embedded)
+REQUIRE_PACKAGES_RTL=1
+endif
+ifeq ($(FULL_TARGET),armeb-linux)
+REQUIRE_PACKAGES_RTL=1
+endif
+ifeq ($(FULL_TARGET),armeb-embedded)
+REQUIRE_PACKAGES_RTL=1
+endif
+ifeq ($(FULL_TARGET),mips-linux)
+REQUIRE_PACKAGES_RTL=1
+endif
+ifeq ($(FULL_TARGET),mipsel-linux)
+REQUIRE_PACKAGES_RTL=1
+endif
+ifeq ($(FULL_TARGET),jvm-java)
+REQUIRE_PACKAGES_RTL=1
+endif
+ifeq ($(FULL_TARGET),jvm-android)
+REQUIRE_PACKAGES_RTL=1
+endif
+ifeq ($(FULL_TARGET),i8086-msdos)
+REQUIRE_PACKAGES_RTL=1
+endif
+ifdef REQUIRE_PACKAGES_RTL
+PACKAGEDIR_RTL:=$(firstword $(subst /Makefile.fpc,,$(strip $(wildcard $(addsuffix /rtl/Makefile.fpc,$(PACKAGESDIR))))))
+ifneq ($(PACKAGEDIR_RTL),)
+ifneq ($(wildcard $(PACKAGEDIR_RTL)/units/$(TARGETSUFFIX)),)
+UNITDIR_RTL=$(PACKAGEDIR_RTL)/units/$(TARGETSUFFIX)
+else
+UNITDIR_RTL=$(PACKAGEDIR_RTL)
+endif
+ifneq ($(wildcard $(PACKAGEDIR_RTL)/units/$(SOURCESUFFIX)),)
+UNITDIR_FPMAKE_RTL=$(PACKAGEDIR_RTL)/units/$(SOURCESUFFIX)
+else
+ifneq ($(wildcard $(PACKAGEDIR_RTL)/units_bs/$(SOURCESUFFIX)),)
+UNITDIR_FPMAKE_RTL=$(PACKAGEDIR_RTL)/units_bs/$(SOURCESUFFIX)
+else
+UNITDIR_FPMAKE_RTL=$(PACKAGEDIR_RTL)
+endif
+endif
+ifdef CHECKDEPEND
+$(PACKAGEDIR_RTL)/$(OS_TARGET)/$(FPCMADE):
+	$(MAKE) -C $(PACKAGEDIR_RTL)/$(OS_TARGET) $(FPCMADE)
+override ALLDEPENDENCIES+=$(PACKAGEDIR_RTL)/$(OS_TARGET)/$(FPCMADE)
+endif
+else
+PACKAGEDIR_RTL=
+UNITDIR_RTL:=$(subst /Package.fpc,,$(strip $(wildcard $(addsuffix /rtl/Package.fpc,$(UNITSDIR)))))
+ifneq ($(UNITDIR_RTL),)
+UNITDIR_RTL:=$(firstword $(UNITDIR_RTL))
+else
+UNITDIR_RTL=
+endif
+endif
+ifdef UNITDIR_RTL
+override COMPILER_UNITDIR+=$(UNITDIR_RTL)
+endif
+ifdef UNITDIR_FPMAKE_RTL
+override COMPILER_FPMAKE_UNITDIR+=$(UNITDIR_FPMAKE_RTL)
+endif
+endif
+ifndef NOCPUDEF
+override FPCOPTDEF=$(ARCH)
+endif
+ifneq ($(OS_TARGET),$(OS_SOURCE))
+override FPCOPT+=-T$(OS_TARGET)
+endif
+ifneq ($(CPU_TARGET),$(CPU_SOURCE))
+override FPCOPT+=-P$(ARCH)
+endif
+ifeq ($(OS_SOURCE),openbsd)
+override FPCOPT+=-FD$(NEW_BINUTILS_PATH)
+override FPCMAKEOPT+=-FD$(NEW_BINUTILS_PATH)
+endif
+ifndef CROSSBOOTSTRAP
+ifneq ($(BINUTILSPREFIX),)
+override FPCOPT+=-XP$(BINUTILSPREFIX)
+endif
+ifneq ($(BINUTILSPREFIX),)
+override FPCOPT+=-Xr$(RLINKPATH)
+endif
+endif
+ifndef CROSSCOMPILE
+ifneq ($(BINUTILSPREFIX),)
+override FPCMAKEOPT+=-XP$(BINUTILSPREFIX)
+endif
+endif
+ifdef UNITDIR
+override FPCOPT+=$(addprefix -Fu,$(UNITDIR))
+endif
+ifdef LIBDIR
+override FPCOPT+=$(addprefix -Fl,$(LIBDIR))
+endif
+ifdef OBJDIR
+override FPCOPT+=$(addprefix -Fo,$(OBJDIR))
+endif
+ifdef INCDIR
+override FPCOPT+=$(addprefix -Fi,$(INCDIR))
+endif
+ifdef LINKSMART
+override FPCOPT+=-XX
+endif
+ifdef CREATESMART
+override FPCOPT+=-CX
+endif
+ifdef DEBUG
+override FPCOPT+=-gl
+override FPCOPTDEF+=DEBUG
+endif
+ifdef RELEASE
+ifneq ($(findstring 2.0.,$(FPC_VERSION)),)
+ifeq ($(CPU_TARGET),i386)
+FPCCPUOPT:=-OG2p3
+endif
+ifeq ($(CPU_TARGET),powerpc)
+FPCCPUOPT:=-O1r
+endif
+else
+FPCCPUOPT:=-O2
+endif
+override FPCOPT+=-Ur -Xs $(FPCCPUOPT) -n
+override FPCOPTDEF+=RELEASE
+endif
+ifdef STRIP
+override FPCOPT+=-Xs
+endif
+ifdef OPTIMIZE
+override FPCOPT+=-O2
+endif
+ifdef VERBOSE
+override FPCOPT+=-vwni
+endif
+ifdef COMPILER_OPTIONS
+override FPCOPT+=$(COMPILER_OPTIONS)
+endif
+ifdef COMPILER_UNITDIR
+override FPCOPT+=$(addprefix -Fu,$(COMPILER_UNITDIR))
+endif
+ifdef COMPILER_LIBRARYDIR
+override FPCOPT+=$(addprefix -Fl,$(COMPILER_LIBRARYDIR))
+endif
+ifdef COMPILER_OBJECTDIR
+override FPCOPT+=$(addprefix -Fo,$(COMPILER_OBJECTDIR))
+endif
+ifdef COMPILER_INCLUDEDIR
+override FPCOPT+=$(addprefix -Fi,$(COMPILER_INCLUDEDIR))
+endif
+ifdef CROSSBINDIR
+override FPCOPT+=-FD$(CROSSBINDIR)
+endif
+ifdef COMPILER_TARGETDIR
+override FPCOPT+=-FE$(COMPILER_TARGETDIR)
+ifeq ($(COMPILER_TARGETDIR),.)
+override TARGETDIRPREFIX=
+else
+override TARGETDIRPREFIX=$(COMPILER_TARGETDIR)/
+endif
+endif
+ifdef COMPILER_UNITTARGETDIR
+override FPCOPT+=-FU$(COMPILER_UNITTARGETDIR)
+ifeq ($(COMPILER_UNITTARGETDIR),.)
+override UNITTARGETDIRPREFIX=
+else
+override UNITTARGETDIRPREFIX=$(COMPILER_UNITTARGETDIR)/
+endif
+else
+ifdef COMPILER_TARGETDIR
+override COMPILER_UNITTARGETDIR=$(COMPILER_TARGETDIR)
+override UNITTARGETDIRPREFIX=$(TARGETDIRPREFIX)
+endif
+endif
+ifdef CREATESHARED
+override FPCOPT+=-Cg
+endif
+ifneq ($(findstring $(OS_TARGET),freebsd openbsd netbsd linux solaris),)
+ifeq ($(CPU_TARGET),x86_64)
+override FPCOPT+=-Cg
+endif
+endif
+ifdef LINKSHARED
+endif
+ifdef OPT
+override FPCOPT+=$(OPT)
+endif
+ifdef FPCOPTDEF
+override FPCOPT+=$(addprefix -d,$(FPCOPTDEF))
+endif
+ifdef CFGFILE
+override FPCOPT+=@$(CFGFILE)
+endif
+ifdef USEENV
+override FPCEXTCMD:=$(FPCOPT)
+override FPCOPT:=!FPCEXTCMD
+export FPCEXTCMD
+endif
+override AFULL_TARGET=$(CPU_TARGET)-$(OS_TARGET)
+override AFULL_SOURCE=$(CPU_SOURCE)-$(OS_SOURCE)
+ifneq ($(AFULL_TARGET),$(AFULL_SOURCE))
+override ACROSSCOMPILE=1
+endif
+ifdef ACROSSCOMPILE
+override FPCOPT+=$(CROSSOPT)
+endif
+override COMPILER:=$(FPC) $(FPCOPT)
+ifeq (,$(findstring -s ,$(COMPILER)))
+EXECPPAS=
+else
+ifeq ($(FULL_SOURCE),$(FULL_TARGET))
+ifdef RUNBATCH
+EXECPPAS:=@$(RUNBATCH) $(PPAS)
+else
+EXECPPAS:=@$(PPAS)
+endif
+endif
+endif
+.PHONY: fpc_units
+ifneq ($(TARGET_UNITS)$(TARGET_IMPLICITUNITS),)
+override ALLTARGET+=fpc_units
+override UNITPPUFILES=$(addsuffix $(PPUEXT),$(TARGET_UNITS))
+override IMPLICITUNITPPUFILES=$(addsuffix $(PPUEXT),$(TARGET_IMPLICITUNITS))
+override INSTALLPPUFILES+=$(UNITPPUFILES) $(IMPLICITUNITPPUFILES)
+override CLEANPPUFILES+=$(UNITPPUFILES) $(IMPLICITUNITPPUFILES)
+endif
+fpc_units: $(COMPILER_UNITTARGETDIR) $(UNITPPUFILES)
+ifdef TARGET_RSTS
+override RSTFILES=$(addsuffix $(RSTEXT),$(TARGET_RSTS))
+override CLEANRSTFILES+=$(RSTFILES)
+endif
+.PHONY: fpc_examples
+ifneq ($(TARGET_EXAMPLES),)
+HASEXAMPLES=1
+override EXAMPLESOURCEFILES:=$(wildcard $(addsuffix .pp,$(TARGET_EXAMPLES)) $(addsuffix .pas,$(TARGET_EXAMPLES)) $(addsuffix .lpr,$(TARGET_EXAMPLES)) $(addsuffix .dpr,$(TARGET_EXAMPLES)))
+override EXAMPLEFILES:=$(addsuffix $(EXEEXT),$(TARGET_EXAMPLES))
+override EXAMPLEOFILES:=$(addsuffix $(OEXT),$(TARGET_EXAMPLES)) $(addprefix $(STATICLIBPREFIX),$(addsuffix $(STATICLIBEXT),$(TARGET_EXAMPLES))) $(addprefix $(IMPORTLIBPREFIX),$(addsuffix $(STATICLIBEXT),$(TARGET_EXAMPLES)))
+override EXAMPLEDBGFILES:=$(addsuffix $(EXEDBGEXT),$(TARGET_EXAMPLES))
+override CLEANEXEFILES+=$(EXAMPLEFILES) $(EXAMPLEOFILES)
+override CLEANEXEDBGFILES+=$(EXAMPLEDBGFILES)
+ifeq ($(OS_TARGET),os2)
+override CLEANEXEFILES+=$(addsuffix $(AOUTEXT),$(TARGET_EXAMPLES))
+endif
+ifeq ($(OS_TARGET),emx)
+override CLEANEXEFILES+=$(addsuffix $(AOUTEXT),$(TARGET_EXAMPLES))
+endif
+endif
+ifneq ($(TARGET_EXAMPLEDIRS),)
+HASEXAMPLES=1
+endif
+fpc_examples: all $(EXAMPLEFILES) $(addsuffix _all,$(TARGET_EXAMPLEDIRS))
+.PHONY: fpc_all fpc_smart fpc_debug fpc_release fpc_shared
+$(FPCMADE): $(ALLDEPENDENCIES) $(ALLTARGET)
+	@$(ECHOREDIR) Compiled > $(FPCMADE)
+fpc_all: $(FPCMADE)
+fpc_smart:
+	$(MAKE) all LINKSMART=1 CREATESMART=1
+fpc_debug:
+	$(MAKE) all DEBUG=1
+fpc_release:
+	$(MAKE) all RELEASE=1
+.SUFFIXES: $(EXEEXT) $(PPUEXT) $(OEXT) .pas .lpr .dpr .pp .rc .res
+$(COMPILER_UNITTARGETDIR):
+	$(MKDIRTREE) $(COMPILER_UNITTARGETDIR)
+$(COMPILER_TARGETDIR):
+	$(MKDIRTREE) $(COMPILER_TARGETDIR)
+%$(PPUEXT): %.pp
+	$(COMPILER) $<
+	$(EXECPPAS)
+%$(PPUEXT): %.pas
+	$(COMPILER) $<
+	$(EXECPPAS)
+%$(EXEEXT): %.pp
+	$(COMPILER) $<
+	$(EXECPPAS)
+%$(EXEEXT): %.pas
+	$(COMPILER) $<
+	$(EXECPPAS)
+%$(EXEEXT): %.lpr
+	$(COMPILER) $<
+	$(EXECPPAS)
+%$(EXEEXT): %.dpr
+	$(COMPILER) $<
+	$(EXECPPAS)
+%.res: %.rc
+	windres -i $< -o $@
+vpath %.pp $(COMPILER_SOURCEDIR) $(COMPILER_INCLUDEDIR)
+vpath %.pas $(COMPILER_SOURCEDIR) $(COMPILER_INCLUDEDIR)
+vpath %.lpr $(COMPILER_SOURCEDIR) $(COMPILER_INCLUDEDIR)
+vpath %.dpr $(COMPILER_SOURCEDIR) $(COMPILER_INCLUDEDIR)
+vpath %.inc $(COMPILER_INCLUDEDIR)
+vpath %$(OEXT) $(COMPILER_UNITTARGETDIR)
+vpath %$(PPUEXT) $(COMPILER_UNITTARGETDIR)
+.PHONY: fpc_shared
+override INSTALLTARGET+=fpc_shared_install
+ifndef SHARED_LIBVERSION
+SHARED_LIBVERSION=$(FPC_VERSION)
+endif
+ifndef SHARED_LIBNAME
+SHARED_LIBNAME=$(PACKAGE_NAME)
+endif
+ifndef SHARED_FULLNAME
+SHARED_FULLNAME=$(SHAREDLIBPREFIX)$(SHARED_LIBNAME)-$(SHARED_LIBVERSION)$(SHAREDLIBEXT)
+endif
+ifndef SHARED_LIBUNITS
+SHARED_LIBUNITS:=$(TARGET_UNITS) $(TARGET_IMPLICITUNITS)
+override SHARED_LIBUNITS:=$(filter-out $(INSTALL_BUILDUNIT),$(SHARED_LIBUNITS))
+endif
+fpc_shared:
+ifdef HASSHAREDLIB
+	$(MAKE) all CREATESHARED=1 LINKSHARED=1 CREATESMART=1
+ifneq ($(SHARED_BUILD),n)
+	$(PPUMOVE) -q $(SHARED_LIBUNITS) -i$(COMPILER_UNITTARGETDIR) -o$(SHARED_FULLNAME) -d$(COMPILER_UNITTARGETDIR)
+endif
+else
+	@$(ECHO) Shared Libraries not supported
+endif
+fpc_shared_install:
+ifneq ($(SHARED_BUILD),n)
+ifneq ($(SHARED_LIBUNITS),)
+ifneq ($(wildcard $(COMPILER_UNITTARGETDIR)/$(SHARED_FULLNAME)),)
+	$(INSTALL) $(COMPILER_UNITTARGETDIR)/$(SHARED_FULLNAME) $(INSTALL_SHAREDDIR)
+endif
+endif
+endif
+.PHONY: fpc_install fpc_sourceinstall fpc_exampleinstall
+ifdef INSTALL_UNITS
+override INSTALLPPUFILES+=$(addsuffix $(PPUEXT),$(INSTALL_UNITS))
+endif
+ifdef INSTALL_BUILDUNIT
+override INSTALLPPUFILES:=$(filter-out $(INSTALL_BUILDUNIT)$(PPUEXT),$(INSTALLPPUFILES))
+endif
+ifdef INSTALLPPUFILES
+override INSTALLPPULINKFILES:=$(subst $(PPUEXT),$(OEXT),$(INSTALLPPUFILES)) $(addprefix $(STATICLIBPREFIX),$(subst $(PPUEXT),$(STATICLIBEXT),$(INSTALLPPUFILES))) $(addprefix $(IMPORTLIBPREFIX),$(subst $(PPUEXT),$(STATICLIBEXT),$(INSTALLPPUFILES)))
+ifneq ($(UNITTARGETDIRPREFIX),)
+override INSTALLPPUFILES:=$(addprefix $(UNITTARGETDIRPREFIX),$(notdir $(INSTALLPPUFILES)))
+override INSTALLPPULINKFILES:=$(wildcard $(addprefix $(UNITTARGETDIRPREFIX),$(notdir $(INSTALLPPULINKFILES))))
+endif
+override INSTALL_CREATEPACKAGEFPC=1
+endif
+ifdef INSTALLEXEFILES
+ifneq ($(TARGETDIRPREFIX),)
+override INSTALLEXEFILES:=$(addprefix $(TARGETDIRPREFIX),$(notdir $(INSTALLEXEFILES)))
+endif
+endif
+fpc_install: all $(INSTALLTARGET)
+ifdef INSTALLEXEFILES
+	$(MKDIR) $(INSTALL_BINDIR)
+	$(INSTALLEXE) $(INSTALLEXEFILES) $(INSTALL_BINDIR)
+endif
+ifdef INSTALL_CREATEPACKAGEFPC
+ifdef FPCMAKE
+ifdef PACKAGE_VERSION
+ifneq ($(wildcard Makefile.fpc),)
+	$(FPCMAKE) -p -T$(CPU_TARGET)-$(OS_TARGET) Makefile.fpc
+	$(MKDIR) $(INSTALL_UNITDIR)
+	$(INSTALL) Package.fpc $(INSTALL_UNITDIR)
+endif
+endif
+endif
+endif
+ifdef INSTALLPPUFILES
+	$(MKDIR) $(INSTALL_UNITDIR)
+	$(INSTALL) $(INSTALLPPUFILES) $(INSTALL_UNITDIR)
+ifneq ($(INSTALLPPULINKFILES),)
+	$(INSTALL) $(INSTALLPPULINKFILES) $(INSTALL_UNITDIR)
+endif
+ifneq ($(wildcard $(LIB_FULLNAME)),)
+	$(MKDIR) $(INSTALL_LIBDIR)
+	$(INSTALL) $(LIB_FULLNAME) $(INSTALL_LIBDIR)
+ifdef inUnix
+	ln -sf $(LIB_FULLNAME) $(INSTALL_LIBDIR)/$(LIB_NAME)
+endif
+endif
+endif
+ifdef INSTALL_FILES
+	$(MKDIR) $(INSTALL_DATADIR)
+	$(INSTALL) $(INSTALL_FILES) $(INSTALL_DATADIR)
+endif
+fpc_sourceinstall: distclean
+	$(MKDIR) $(INSTALL_SOURCEDIR)
+	$(COPYTREE) $(BASEDIR)/* $(INSTALL_SOURCEDIR)
+fpc_exampleinstall: $(addsuffix _distclean,$(TARGET_EXAMPLEDIRS))
+ifdef HASEXAMPLES
+	$(MKDIR) $(INSTALL_EXAMPLEDIR)
+endif
+ifdef EXAMPLESOURCEFILES
+	$(COPY) $(EXAMPLESOURCEFILES) $(INSTALL_EXAMPLEDIR)
+endif
+ifdef TARGET_EXAMPLEDIRS
+	$(COPYTREE) $(addsuffix /*,$(TARGET_EXAMPLEDIRS)) $(INSTALL_EXAMPLEDIR)
+endif
+.PHONY: fpc_distinstall
+fpc_distinstall: install exampleinstall
+.PHONY: fpc_zipinstall fpc_zipsourceinstall fpc_zipexampleinstall
+ifndef PACKDIR
+ifndef inUnix
+PACKDIR=$(BASEDIR)/../fpc-pack
+else
+PACKDIR=/tmp/fpc-pack
+endif
+endif
+ifndef ZIPNAME
+ifdef DIST_ZIPNAME
+ZIPNAME=$(DIST_ZIPNAME)
+else
+ZIPNAME=$(PACKAGE_NAME)
+endif
+endif
+ifndef FULLZIPNAME
+FULLZIPNAME=$(ZIPCROSSPREFIX)$(ZIPPREFIX)$(ZIPNAME)$(ZIPSUFFIX)
+endif
+ifndef ZIPTARGET
+ifdef DIST_ZIPTARGET
+ZIPTARGET=DIST_ZIPTARGET
+else
+ZIPTARGET=install
+endif
+endif
+ifndef USEZIP
+ifdef inUnix
+USETAR=1
+endif
+endif
+ifndef inUnix
+USEZIPWRAPPER=1
+endif
+ifdef USEZIPWRAPPER
+ZIPPATHSEP=$(PATHSEP)
+ZIPWRAPPER=$(subst /,$(PATHSEP),$(DIST_DESTDIR)/fpczip$(SRCBATCHEXT))
+else
+ZIPPATHSEP=/
+endif
+ZIPCMD_CDPACK:=cd $(subst /,$(ZIPPATHSEP),$(PACKDIR))
+ZIPCMD_CDBASE:=cd $(subst /,$(ZIPPATHSEP),$(BASEDIR))
+ifdef USETAR
+ZIPDESTFILE:=$(DIST_DESTDIR)/$(FULLZIPNAME)$(TAREXT)
+ZIPCMD_ZIP:=$(TARPROG) c$(TAROPT)f $(ZIPDESTFILE) *
+else
+ZIPDESTFILE:=$(DIST_DESTDIR)/$(FULLZIPNAME)$(ZIPEXT)
+ZIPCMD_ZIP:=$(subst /,$(ZIPPATHSEP),$(ZIPPROG)) -Dr $(ZIPOPT) $(ZIPDESTFILE) *
+endif
+fpc_zipinstall:
+	$(MAKE) $(ZIPTARGET) INSTALL_PREFIX=$(PACKDIR) ZIPINSTALL=1
+	$(MKDIR) $(DIST_DESTDIR)
+	$(DEL) $(ZIPDESTFILE)
+ifdef USEZIPWRAPPER
+ifneq ($(ECHOREDIR),echo)
+	$(ECHOREDIR) -e "$(subst \,\\,$(ZIPCMD_CDPACK))" > $(ZIPWRAPPER)
+	$(ECHOREDIR) -e "$(subst \,\\,$(ZIPCMD_ZIP))" >> $(ZIPWRAPPER)
+	$(ECHOREDIR) -e "$(subst \,\\,$(ZIPCMD_CDBASE))" >> $(ZIPWRAPPER)
+else
+	echo $(ZIPCMD_CDPACK) > $(ZIPWRAPPER)
+	echo $(ZIPCMD_ZIP) >> $(ZIPWRAPPER)
+	echo $(ZIPCMD_CDBASE) >> $(ZIPWRAPPER)
+endif
+ifdef inUnix
+	/bin/sh $(ZIPWRAPPER)
+else
+ifdef RUNBATCH
+	$(RUNBATCH) $(ZIPWRAPPER)
+else
+	$(ZIPWRAPPER)
+endif
+endif
+	$(DEL) $(ZIPWRAPPER)
+else
+	$(ZIPCMD_CDPACK) ; $(ZIPCMD_ZIP) ; $(ZIPCMD_CDBASE)
+endif
+	$(DELTREE) $(PACKDIR)
+fpc_zipsourceinstall:
+	$(MAKE) fpc_zipinstall ZIPTARGET=sourceinstall ZIPSUFFIX=$(ZIPSOURCESUFFIX)
+fpc_zipexampleinstall:
+ifdef HASEXAMPLES
+	$(MAKE) fpc_zipinstall ZIPTARGET=exampleinstall ZIPSUFFIX=$(ZIPEXAMPLESUFFIX)
+endif
+fpc_zipdistinstall:
+	$(MAKE) fpc_zipinstall ZIPTARGET=distinstall
+.PHONY: fpc_clean fpc_cleanall fpc_distclean
+ifdef EXEFILES
+override CLEANEXEFILES:=$(addprefix $(TARGETDIRPREFIX),$(CLEANEXEFILES))
+override CLEANEXEDBGFILES:=$(addprefix $(TARGETDIRPREFIX),$(CLEANEXEDBGFILES))
+endif
+ifdef CLEAN_PROGRAMS
+override CLEANEXEFILES+=$(addprefix $(TARGETDIRPREFIX),$(addsuffix $(EXEEXT), $(CLEAN_PROGRAMS)))
+override CLEANEXEDBGFILES+=$(addprefix $(TARGETDIRPREFIX),$(addsuffix $(EXEDBGEXT), $(CLEAN_PROGRAMS)))
+endif
+ifdef CLEAN_UNITS
+override CLEANPPUFILES+=$(addsuffix $(PPUEXT),$(CLEAN_UNITS))
+endif
+ifdef CLEANPPUFILES
+override CLEANPPULINKFILES:=$(subst $(PPUEXT),$(OEXT),$(CLEANPPUFILES)) $(addprefix $(STATICLIBPREFIX),$(subst $(PPUEXT),$(STATICLIBEXT),$(CLEANPPUFILES))) $(addprefix $(IMPORTLIBPREFIX),$(subst $(PPUEXT),$(STATICLIBEXT),$(CLEANPPUFILES)))
+ifdef DEBUGSYMEXT
+override CLEANPPULINKFILES+=$(subst $(PPUEXT),$(DEBUGSYMEXT),$(CLEANPPUFILES))
+endif
+override CLEANPPUFILES:=$(addprefix $(UNITTARGETDIRPREFIX),$(CLEANPPUFILES))
+override CLEANPPULINKFILES:=$(wildcard $(addprefix $(UNITTARGETDIRPREFIX),$(CLEANPPULINKFILES)))
+endif
+fpc_clean: $(CLEANTARGET)
+ifdef CLEANEXEFILES
+	-$(DEL) $(CLEANEXEFILES)
+endif
+ifdef CLEANEXEDBGFILES
+	-$(DELTREE) $(CLEANEXEDBGFILES)
+endif
+ifdef CLEANPPUFILES
+	-$(DEL) $(CLEANPPUFILES)
+endif
+ifneq ($(CLEANPPULINKFILES),)
+	-$(DEL) $(CLEANPPULINKFILES)
+endif
+ifdef CLEANRSTFILES
+	-$(DEL) $(addprefix $(UNITTARGETDIRPREFIX),$(CLEANRSTFILES))
+endif
+ifdef CLEAN_FILES
+	-$(DEL) $(CLEAN_FILES)
+endif
+ifdef LIB_NAME
+	-$(DEL) $(LIB_NAME) $(LIB_FULLNAME)
+endif
+	-$(DEL) $(FPCMADE) Package.fpc $(PPAS) script.res link.res $(FPCEXTFILE) $(REDIRFILE)
+	-$(DEL) *$(ASMEXT) *_ppas$(BATCHEXT)
+fpc_cleanall: $(CLEANTARGET)
+ifdef CLEANEXEFILES
+	-$(DEL) $(CLEANEXEFILES)
+endif
+ifdef COMPILER_UNITTARGETDIR
+ifdef CLEANPPUFILES
+	-$(DEL) $(CLEANPPUFILES)
+endif
+ifneq ($(CLEANPPULINKFILES),)
+	-$(DEL) $(CLEANPPULINKFILES)
+endif
+ifdef CLEANRSTFILES
+	-$(DEL) $(addprefix $(UNITTARGETDIRPREFIX),$(CLEANRSTFILES))
+endif
+endif
+ifdef CLEAN_FILES
+	-$(DEL) $(CLEAN_FILES)
+endif
+	-$(DELTREE) units
+	-$(DEL) *$(OEXT) *$(PPUEXT) *$(RSTEXT) *$(ASMEXT) *$(STATICLIBEXT) *$(SHAREDLIBEXT) *$(PPLEXT)
+ifneq ($(PPUEXT),.ppu)
+	-$(DEL) *.o *.ppu *.a
+endif
+	-$(DELTREE) *$(SMARTEXT)
+	-$(DEL) fpcmade.* Package.fpc $(PPAS) script.res link.res $(FPCEXTFILE) $(REDIRFILE)
+	-$(DEL) *_ppas$(BATCHEXT)
+ifdef AOUTEXT
+	-$(DEL) *$(AOUTEXT)
+endif
+ifdef DEBUGSYMEXT
+	-$(DEL) *$(DEBUGSYMEXT)
+endif
+fpc_distclean: cleanall
+.PHONY: fpc_baseinfo
+override INFORULES+=fpc_baseinfo
+fpc_baseinfo:
+	@$(ECHO)
+	@$(ECHO)  == Package info ==
+	@$(ECHO)  Package Name..... $(PACKAGE_NAME)
+	@$(ECHO)  Package Version.. $(PACKAGE_VERSION)
+	@$(ECHO)
+	@$(ECHO)  == Configuration info ==
+	@$(ECHO)
+	@$(ECHO)  FPC.......... $(FPC)
+	@$(ECHO)  FPC Version.. $(FPC_VERSION)
+	@$(ECHO)  Source CPU... $(CPU_SOURCE)
+	@$(ECHO)  Target CPU... $(CPU_TARGET)
+	@$(ECHO)  Source OS.... $(OS_SOURCE)
+	@$(ECHO)  Target OS.... $(OS_TARGET)
+	@$(ECHO)  Full Source.. $(FULL_SOURCE)
+	@$(ECHO)  Full Target.. $(FULL_TARGET)
+	@$(ECHO)  SourceSuffix. $(SOURCESUFFIX)
+	@$(ECHO)  TargetSuffix. $(TARGETSUFFIX)
+	@$(ECHO)  FPC fpmake... $(FPCFPMAKE)
+	@$(ECHO)
+	@$(ECHO)  == Directory info ==
+	@$(ECHO)
+	@$(ECHO)  Required pkgs... $(REQUIRE_PACKAGES)
+	@$(ECHO)
+	@$(ECHO)  Basedir......... $(BASEDIR)
+	@$(ECHO)  FPCDir.......... $(FPCDIR)
+	@$(ECHO)  CrossBinDir..... $(CROSSBINDIR)
+	@$(ECHO)  UnitsDir........ $(UNITSDIR)
+	@$(ECHO)  PackagesDir..... $(PACKAGESDIR)
+	@$(ECHO)
+	@$(ECHO)  GCC library..... $(GCCLIBDIR)
+	@$(ECHO)  Other library... $(OTHERLIBDIR)
+	@$(ECHO)
+	@$(ECHO)  == Tools info ==
+	@$(ECHO)
+	@$(ECHO)  As........ $(AS)
+	@$(ECHO)  Ld........ $(LD)
+	@$(ECHO)  Ar........ $(AR)
+	@$(ECHO)  Rc........ $(RC)
+	@$(ECHO)
+	@$(ECHO)  Mv........ $(MVPROG)
+	@$(ECHO)  Cp........ $(CPPROG)
+	@$(ECHO)  Rm........ $(RMPROG)
+	@$(ECHO)  GInstall.. $(GINSTALL)
+	@$(ECHO)  Echo...... $(ECHO)
+	@$(ECHO)  Shell..... $(SHELL)
+	@$(ECHO)  Date...... $(DATE)
+	@$(ECHO)  FPCMake... $(FPCMAKE)
+	@$(ECHO)  PPUMove... $(PPUMOVE)
+	@$(ECHO)  Zip....... $(ZIPPROG)
+	@$(ECHO)
+	@$(ECHO)  == Object info ==
+	@$(ECHO)
+	@$(ECHO)  Target Loaders........ $(TARGET_LOADERS)
+	@$(ECHO)  Target Units.......... $(TARGET_UNITS)
+	@$(ECHO)  Target Implicit Units. $(TARGET_IMPLICITUNITS)
+	@$(ECHO)  Target Programs....... $(TARGET_PROGRAMS)
+	@$(ECHO)  Target Dirs........... $(TARGET_DIRS)
+	@$(ECHO)  Target Examples....... $(TARGET_EXAMPLES)
+	@$(ECHO)  Target ExampleDirs.... $(TARGET_EXAMPLEDIRS)
+	@$(ECHO)
+	@$(ECHO)  Clean Units......... $(CLEAN_UNITS)
+	@$(ECHO)  Clean Files......... $(CLEAN_FILES)
+	@$(ECHO)
+	@$(ECHO)  Install Units....... $(INSTALL_UNITS)
+	@$(ECHO)  Install Files....... $(INSTALL_FILES)
+	@$(ECHO)
+	@$(ECHO)  == Install info ==
+	@$(ECHO)
+	@$(ECHO)  DateStr.............. $(DATESTR)
+	@$(ECHO)  ZipName.............. $(ZIPNAME)
+	@$(ECHO)  ZipPrefix............ $(ZIPPREFIX)
+	@$(ECHO)  ZipCrossPrefix....... $(ZIPCROSSPREFIX)
+	@$(ECHO)  ZipSuffix............ $(ZIPSUFFIX)
+	@$(ECHO)  FullZipName.......... $(FULLZIPNAME)
+	@$(ECHO)  Install FPC Package.. $(INSTALL_FPCPACKAGE)
+	@$(ECHO)
+	@$(ECHO)  Install base dir..... $(INSTALL_BASEDIR)
+	@$(ECHO)  Install binary dir... $(INSTALL_BINDIR)
+	@$(ECHO)  Install library dir.. $(INSTALL_LIBDIR)
+	@$(ECHO)  Install units dir.... $(INSTALL_UNITDIR)
+	@$(ECHO)  Install source dir... $(INSTALL_SOURCEDIR)
+	@$(ECHO)  Install doc dir...... $(INSTALL_DOCDIR)
+	@$(ECHO)  Install example dir.. $(INSTALL_EXAMPLEDIR)
+	@$(ECHO)  Install data dir..... $(INSTALL_DATADIR)
+	@$(ECHO)
+	@$(ECHO)  Dist destination dir. $(DIST_DESTDIR)
+	@$(ECHO)  Dist zip name........ $(DIST_ZIPNAME)
+	@$(ECHO)
+.PHONY: fpc_info
+fpc_info: $(INFORULES)
+.PHONY: fpc_makefile fpc_makefiles fpc_makefile_sub1 fpc_makefile_sub2 \
+	fpc_makefile_dirs
+fpc_makefile:
+	$(FPCMAKE) -w -T$(OS_TARGET) Makefile.fpc
+fpc_makefile_sub1:
+ifdef TARGET_DIRS
+	$(FPCMAKE) -w -T$(OS_TARGET) $(addsuffix /Makefile.fpc,$(TARGET_DIRS))
+endif
+ifdef TARGET_EXAMPLEDIRS
+	$(FPCMAKE) -w -T$(OS_TARGET) $(addsuffix /Makefile.fpc,$(TARGET_EXAMPLEDIRS))
+endif
+fpc_makefile_sub2: $(addsuffix _makefile_dirs,$(TARGET_DIRS) $(TARGET_EXAMPLEDIRS))
+fpc_makefile_dirs: fpc_makefile_sub1 fpc_makefile_sub2
+fpc_makefiles: fpc_makefile fpc_makefile_dirs
+ifeq ($(FULL_TARGET),i386-linux)
+TARGET_EXAMPLEDIRS_EXAMPLES=1
+endif
+ifeq ($(FULL_TARGET),i386-go32v2)
+TARGET_EXAMPLEDIRS_EXAMPLES=1
+endif
+ifeq ($(FULL_TARGET),i386-win32)
+TARGET_EXAMPLEDIRS_EXAMPLES=1
+endif
+ifeq ($(FULL_TARGET),i386-os2)
+TARGET_EXAMPLEDIRS_EXAMPLES=1
+endif
+ifeq ($(FULL_TARGET),i386-freebsd)
+TARGET_EXAMPLEDIRS_EXAMPLES=1
+endif
+ifeq ($(FULL_TARGET),i386-beos)
+TARGET_EXAMPLEDIRS_EXAMPLES=1
+endif
+ifeq ($(FULL_TARGET),i386-haiku)
+TARGET_EXAMPLEDIRS_EXAMPLES=1
+endif
+ifeq ($(FULL_TARGET),i386-netbsd)
+TARGET_EXAMPLEDIRS_EXAMPLES=1
+endif
+ifeq ($(FULL_TARGET),i386-solaris)
+TARGET_EXAMPLEDIRS_EXAMPLES=1
+endif
+ifeq ($(FULL_TARGET),i386-qnx)
+TARGET_EXAMPLEDIRS_EXAMPLES=1
+endif
+ifeq ($(FULL_TARGET),i386-netware)
+TARGET_EXAMPLEDIRS_EXAMPLES=1
+endif
+ifeq ($(FULL_TARGET),i386-openbsd)
+TARGET_EXAMPLEDIRS_EXAMPLES=1
+endif
+ifeq ($(FULL_TARGET),i386-wdosx)
+TARGET_EXAMPLEDIRS_EXAMPLES=1
+endif
+ifeq ($(FULL_TARGET),i386-darwin)
+TARGET_EXAMPLEDIRS_EXAMPLES=1
+endif
+ifeq ($(FULL_TARGET),i386-emx)
+TARGET_EXAMPLEDIRS_EXAMPLES=1
+endif
+ifeq ($(FULL_TARGET),i386-watcom)
+TARGET_EXAMPLEDIRS_EXAMPLES=1
+endif
+ifeq ($(FULL_TARGET),i386-netwlibc)
+TARGET_EXAMPLEDIRS_EXAMPLES=1
+endif
+ifeq ($(FULL_TARGET),i386-wince)
+TARGET_EXAMPLEDIRS_EXAMPLES=1
+endif
+ifeq ($(FULL_TARGET),i386-embedded)
+TARGET_EXAMPLEDIRS_EXAMPLES=1
+endif
+ifeq ($(FULL_TARGET),i386-symbian)
+TARGET_EXAMPLEDIRS_EXAMPLES=1
+endif
+ifeq ($(FULL_TARGET),i386-nativent)
+TARGET_EXAMPLEDIRS_EXAMPLES=1
+endif
+ifeq ($(FULL_TARGET),i386-iphonesim)
+TARGET_EXAMPLEDIRS_EXAMPLES=1
+endif
+ifeq ($(FULL_TARGET),i386-android)
+TARGET_EXAMPLEDIRS_EXAMPLES=1
+endif
+ifeq ($(FULL_TARGET),m68k-linux)
+TARGET_EXAMPLEDIRS_EXAMPLES=1
+endif
+ifeq ($(FULL_TARGET),m68k-freebsd)
+TARGET_EXAMPLEDIRS_EXAMPLES=1
+endif
+ifeq ($(FULL_TARGET),m68k-netbsd)
+TARGET_EXAMPLEDIRS_EXAMPLES=1
+endif
+ifeq ($(FULL_TARGET),m68k-amiga)
+TARGET_EXAMPLEDIRS_EXAMPLES=1
+endif
+ifeq ($(FULL_TARGET),m68k-atari)
+TARGET_EXAMPLEDIRS_EXAMPLES=1
+endif
+ifeq ($(FULL_TARGET),m68k-openbsd)
+TARGET_EXAMPLEDIRS_EXAMPLES=1
+endif
+ifeq ($(FULL_TARGET),m68k-palmos)
+TARGET_EXAMPLEDIRS_EXAMPLES=1
+endif
+ifeq ($(FULL_TARGET),m68k-embedded)
+TARGET_EXAMPLEDIRS_EXAMPLES=1
+endif
+ifeq ($(FULL_TARGET),powerpc-linux)
+TARGET_EXAMPLEDIRS_EXAMPLES=1
+endif
+ifeq ($(FULL_TARGET),powerpc-netbsd)
+TARGET_EXAMPLEDIRS_EXAMPLES=1
+endif
+ifeq ($(FULL_TARGET),powerpc-amiga)
+TARGET_EXAMPLEDIRS_EXAMPLES=1
+endif
+ifeq ($(FULL_TARGET),powerpc-macos)
+TARGET_EXAMPLEDIRS_EXAMPLES=1
+endif
+ifeq ($(FULL_TARGET),powerpc-darwin)
+TARGET_EXAMPLEDIRS_EXAMPLES=1
+endif
+ifeq ($(FULL_TARGET),powerpc-morphos)
+TARGET_EXAMPLEDIRS_EXAMPLES=1
+endif
+ifeq ($(FULL_TARGET),powerpc-embedded)
+TARGET_EXAMPLEDIRS_EXAMPLES=1
+endif
+ifeq ($(FULL_TARGET),powerpc-wii)
+TARGET_EXAMPLEDIRS_EXAMPLES=1
+endif
+ifeq ($(FULL_TARGET),powerpc-aix)
+TARGET_EXAMPLEDIRS_EXAMPLES=1
+endif
+ifeq ($(FULL_TARGET),sparc-linux)
+TARGET_EXAMPLEDIRS_EXAMPLES=1
+endif
+ifeq ($(FULL_TARGET),sparc-netbsd)
+TARGET_EXAMPLEDIRS_EXAMPLES=1
+endif
+ifeq ($(FULL_TARGET),sparc-solaris)
+TARGET_EXAMPLEDIRS_EXAMPLES=1
+endif
+ifeq ($(FULL_TARGET),sparc-embedded)
+TARGET_EXAMPLEDIRS_EXAMPLES=1
+endif
+ifeq ($(FULL_TARGET),x86_64-linux)
+TARGET_EXAMPLEDIRS_EXAMPLES=1
+endif
+ifeq ($(FULL_TARGET),x86_64-freebsd)
+TARGET_EXAMPLEDIRS_EXAMPLES=1
+endif
+ifeq ($(FULL_TARGET),x86_64-netbsd)
+TARGET_EXAMPLEDIRS_EXAMPLES=1
+endif
+ifeq ($(FULL_TARGET),x86_64-solaris)
+TARGET_EXAMPLEDIRS_EXAMPLES=1
+endif
+ifeq ($(FULL_TARGET),x86_64-openbsd)
+TARGET_EXAMPLEDIRS_EXAMPLES=1
+endif
+ifeq ($(FULL_TARGET),x86_64-darwin)
+TARGET_EXAMPLEDIRS_EXAMPLES=1
+endif
+ifeq ($(FULL_TARGET),x86_64-win64)
+TARGET_EXAMPLEDIRS_EXAMPLES=1
+endif
+ifeq ($(FULL_TARGET),x86_64-embedded)
+TARGET_EXAMPLEDIRS_EXAMPLES=1
+endif
+ifeq ($(FULL_TARGET),arm-linux)
+TARGET_EXAMPLEDIRS_EXAMPLES=1
+endif
+ifeq ($(FULL_TARGET),arm-palmos)
+TARGET_EXAMPLEDIRS_EXAMPLES=1
+endif
+ifeq ($(FULL_TARGET),arm-darwin)
+TARGET_EXAMPLEDIRS_EXAMPLES=1
+endif
+ifeq ($(FULL_TARGET),arm-wince)
+TARGET_EXAMPLEDIRS_EXAMPLES=1
+endif
+ifeq ($(FULL_TARGET),arm-gba)
+TARGET_EXAMPLEDIRS_EXAMPLES=1
+endif
+ifeq ($(FULL_TARGET),arm-nds)
+TARGET_EXAMPLEDIRS_EXAMPLES=1
+endif
+ifeq ($(FULL_TARGET),arm-embedded)
+TARGET_EXAMPLEDIRS_EXAMPLES=1
+endif
+ifeq ($(FULL_TARGET),arm-symbian)
+TARGET_EXAMPLEDIRS_EXAMPLES=1
+endif
+ifeq ($(FULL_TARGET),arm-android)
+TARGET_EXAMPLEDIRS_EXAMPLES=1
+endif
+ifeq ($(FULL_TARGET),powerpc64-linux)
+TARGET_EXAMPLEDIRS_EXAMPLES=1
+endif
+ifeq ($(FULL_TARGET),powerpc64-darwin)
+TARGET_EXAMPLEDIRS_EXAMPLES=1
+endif
+ifeq ($(FULL_TARGET),powerpc64-embedded)
+TARGET_EXAMPLEDIRS_EXAMPLES=1
+endif
+ifeq ($(FULL_TARGET),powerpc64-aix)
+TARGET_EXAMPLEDIRS_EXAMPLES=1
+endif
+ifeq ($(FULL_TARGET),avr-embedded)
+TARGET_EXAMPLEDIRS_EXAMPLES=1
+endif
+ifeq ($(FULL_TARGET),armeb-linux)
+TARGET_EXAMPLEDIRS_EXAMPLES=1
+endif
+ifeq ($(FULL_TARGET),armeb-embedded)
+TARGET_EXAMPLEDIRS_EXAMPLES=1
+endif
+ifeq ($(FULL_TARGET),mips-linux)
+TARGET_EXAMPLEDIRS_EXAMPLES=1
+endif
+ifeq ($(FULL_TARGET),mipsel-linux)
+TARGET_EXAMPLEDIRS_EXAMPLES=1
+endif
+ifeq ($(FULL_TARGET),jvm-java)
+TARGET_EXAMPLEDIRS_EXAMPLES=1
+endif
+ifeq ($(FULL_TARGET),jvm-android)
+TARGET_EXAMPLEDIRS_EXAMPLES=1
+endif
+ifeq ($(FULL_TARGET),i8086-msdos)
+TARGET_EXAMPLEDIRS_EXAMPLES=1
+endif
+ifdef TARGET_EXAMPLEDIRS_EXAMPLES
+examples_all:
+	$(MAKE) -C examples all
+examples_debug:
+	$(MAKE) -C examples debug
+examples_smart:
+	$(MAKE) -C examples smart
+examples_release:
+	$(MAKE) -C examples release
+examples_units:
+	$(MAKE) -C examples units
+examples_examples:
+	$(MAKE) -C examples examples
+examples_shared:
+	$(MAKE) -C examples shared
+examples_install:
+	$(MAKE) -C examples install
+examples_sourceinstall:
+	$(MAKE) -C examples sourceinstall
+examples_exampleinstall:
+	$(MAKE) -C examples exampleinstall
+examples_distinstall:
+	$(MAKE) -C examples distinstall
+examples_zipinstall:
+	$(MAKE) -C examples zipinstall
+examples_zipsourceinstall:
+	$(MAKE) -C examples zipsourceinstall
+examples_zipexampleinstall:
+	$(MAKE) -C examples zipexampleinstall
+examples_zipdistinstall:
+	$(MAKE) -C examples zipdistinstall
+examples_clean:
+	$(MAKE) -C examples clean
+examples_distclean:
+	$(MAKE) -C examples distclean
+examples_cleanall:
+	$(MAKE) -C examples cleanall
+examples_info:
+	$(MAKE) -C examples info
+examples_makefiles:
+	$(MAKE) -C examples makefiles
+examples:
+	$(MAKE) -C examples all
+.PHONY: examples_all examples_debug examples_smart examples_release examples_units examples_examples examples_shared examples_install examples_sourceinstall examples_exampleinstall examples_distinstall examples_zipinstall examples_zipsourceinstall examples_zipexampleinstall examples_zipdistinstall examples_clean examples_distclean examples_cleanall examples_info examples_makefiles examples
+endif
+all: fpc_all
+debug: fpc_debug
+smart: fpc_smart
+release: fpc_release
+units: fpc_units
+examples: fpc_examples
+shared: fpc_shared
+install: fpc_install
+sourceinstall: fpc_sourceinstall
+exampleinstall: fpc_exampleinstall
+distinstall: fpc_distinstall
+zipinstall: fpc_zipinstall
+zipsourceinstall: fpc_zipsourceinstall
+zipexampleinstall: fpc_zipexampleinstall
+zipdistinstall: fpc_zipdistinstall
+clean: fpc_clean $(addsuffix _clean,$(TARGET_EXAMPLEDIRS))
+distclean: fpc_distclean
+cleanall: fpc_cleanall
+info: fpc_info
+makefiles: fpc_makefiles
+.PHONY: all debug smart release units examples shared install sourceinstall exampleinstall distinstall zipinstall zipsourceinstall zipexampleinstall zipdistinstall clean distclean cleanall info makefiles
+ifneq ($(wildcard fpcmake.loc),)
+include fpcmake.loc
+endif
+.NOTPARALLEL:
Index: packages/egl/Makefile.fpc
===================================================================
--- packages/egl/Makefile.fpc	(revision 0)
+++ packages/egl/Makefile.fpc	(working copy)
@@ -0,0 +1,91 @@
+#
+#   Makefile.fpc for running fpmake
+#
+
+[package]
+name=egl
+version=2.7.1
+
+[require]
+packages=rtl fpmkunit
+
+[install]
+fpcpackage=y
+
+[default]
+fpcdir=../..
+
+[prerules]
+FPMAKE_BIN_CLEAN=$(wildcard .$(PATHSEP)fpmake$(SRCEXEEXT))
+ifdef OS_TARGET
+FPC_TARGETOPT+=--os=$(OS_TARGET)
+endif
+ifdef CPU_TARGET
+FPC_TARGETOPT+=--cpu=$(CPU_TARGET)
+endif
+LOCALFPMAKE=.$(PATHSEP)fpmake$(SRCEXEEXT)
+
+[rules]
+# Do not pass the Makefile's unit and binary target locations. fpmake uses it's own.
+override FPCOPT:=$(filter-out -FU%,$(FPCOPT))
+override FPCOPT:=$(filter-out -FE%,$(FPCOPT))
+# Compose general fpmake-parameters
+ifdef FPMAKEOPT
+FPMAKE_OPT+=$(FPMAKEOPT)
+endif
+FPMAKE_OPT+=--localunitdir=../..
+FPMAKE_OPT+=--globalunitdir=..
+FPMAKE_OPT+=$(FPC_TARGETOPT)
+FPMAKE_OPT+=$(addprefix -o ,$(FPCOPT))
+FPMAKE_OPT+=--compiler=$(FPC)
+FPMAKE_OPT+=-bu
+.NOTPARALLEL:
+
+fpmake: fpmake.pp
+	$(FPCFPMAKE) fpmake.pp $(FPMAKE_SKIP_CONFIG) $(addprefix -Fu,$(COMPILER_FPMAKE_UNITDIR)) $(FPCMAKEOPT) $(OPT)
+all:	fpmake
+	$(LOCALFPMAKE) compile $(FPMAKE_OPT)
+smart:	fpmake
+	$(LOCALFPMAKE) compile $(FPMAKE_OPT) -o -XX -o -CX
+release:	fpmake
+	$(LOCALFPMAKE) compile $(FPMAKE_OPT) -o -dRELEASE
+debug:	fpmake
+	$(LOCALFPMAKE) compile $(FPMAKE_OPT) -o -dDEBUG
+# If no fpmake exists and (dist)clean is called, do not try to build fpmake, it will
+# most often fail because the dependencies are cleared.
+# In case of a clean, simply do nothing
+ifeq ($(FPMAKE_BIN_CLEAN),)
+clean:
+else
+clean:
+	$(FPMAKE_BIN_CLEAN) clean $(FPMAKE_OPT)
+endif
+# In case of a distclean, perform an 'old'-style distclean. This to avoid problems
+# when the package is compiled using fpcmake prior to running this clean using fpmake
+ifeq ($(FPMAKE_BIN_CLEAN),)
+distclean:	$(addsuffix _distclean,$(TARGET_DIRS)) fpc_cleanall
+else
+distclean:
+ifdef inUnix
+        { $(FPMAKE_BIN_CLEAN) distclean $(FPMAKE_OPT); if [ $$? != "0" ]; then { echo Something wrong with fpmake exectable. Remove the executable and call make recursively to recover.; $(DEL) $(FPMAKE_BIN_CLEAN); $(MAKE) fpc_cleanall; }; fi;  }
+else
+        $(FPMAKE_BIN_CLEAN) distclean $(FPMAKE_OPT)
+endif
+	-$(DEL) $(LOCALFPMAKE)
+endif
+cleanall: distclean
+install:	fpmake
+ifdef UNIXHier
+	$(LOCALFPMAKE) install $(FPMAKE_OPT) --prefix=$(INSTALL_PREFIX) --baseinstalldir=$(INSTALL_LIBDIR)/fpc/$(FPC_VERSION) --unitinstalldir=$(INSTALL_UNITDIR)
+else
+	$(LOCALFPMAKE) install $(FPMAKE_OPT) --prefix=$(INSTALL_BASEDIR) --unitinstalldir=$(INSTALL_UNITDIR)
+endif
+# distinstall also installs the example-sources
+distinstall:	fpmake
+ifdef UNIXHier
+	$(LOCALFPMAKE) install $(FPMAKE_OPT) --prefix=$(INSTALL_PREFIX) --baseinstalldir=$(INSTALL_LIBDIR)/fpc/$(FPC_VERSION) --unitinstalldir=$(INSTALL_UNITDIR) -ie
+else
+	$(LOCALFPMAKE) install $(FPMAKE_OPT) --prefix=$(INSTALL_BASEDIR)  --unitinstalldir=$(INSTALL_UNITDIR) -ie
+endif
+zipinstall:	fpmake
+	$(LOCALFPMAKE) zipinstall $(FPMAKE_OPT)
Index: packages/egl/Makefile.fpc.fpcmake
===================================================================
--- packages/egl/Makefile.fpc.fpcmake	(revision 0)
+++ packages/egl/Makefile.fpc.fpcmake	(working copy)
@@ -0,0 +1,29 @@
+#
+#   Makefile.fpc for EGL for FPC
+#
+
+[package]
+name=egl
+version=2.7.1
+
+[target]
+units_linux=egl
+units_wince=egl
+units_win32=egl
+units_win64=egl
+units_darwin=egl
+units_android=egl
+exampledirs=examples
+
+[install]
+fpcpackage=y
+
+[compiler]
+includedir=src
+sourcedir=src examples
+
+[default]
+fpcdir=../..
+
+[rules]
+.NOTPARALLEL:
Index: packages/egl/fpmake.pp
===================================================================
--- packages/egl/fpmake.pp	(revision 0)
+++ packages/egl/fpmake.pp	(working copy)
@@ -0,0 +1,36 @@
+{$ifndef ALLPACKAGES}
+{$mode objfpc}{$H+}
+program fpmake;
+
+uses fpmkunit;
+
+Var
+  P : TPackage;
+  T : TTarget;
+
+begin
+  With Installer do 
+    begin
+{$endif ALLPACKAGES}
+
+    P:=AddPackage('egl');
+{$ifdef ALLPACKAGES}
+    P.Directory:=ADirectory;
+{$endif ALLPACKAGES}
+    P.Version:='2.7.1';
+    P.Author := 'Free Pascal Development team';
+    P.License := 'LGPL with modification';
+    P.HomepageURL := 'www.freepascal.org';
+    P.OSes := [android,darwin,iphonesim,linux,win32,win64,wince];
+
+    P.SourcePath.Add('src');
+
+    T:=P.Targets.AddUnit('egl.pas',[linux,win32,win64,wince,darwin,android]);
+
+    P.Sources.AddExampleFiles('examples/*',false,'.');
+
+{$ifndef ALLPACKAGES}
+    Run;
+    end;
+end.
+{$endif ALLPACKAGES}
Index: packages/egl/src/egl.pas
===================================================================
--- packages/egl/src/egl.pas	(revision 0)
+++ packages/egl/src/egl.pas	(working copy)
@@ -0,0 +1,573 @@
+{** Separated from GLES/EGL by Dennis Fehr
+ **
+ ** Copyright (c) 2007-2009 The Khronos Group Inc.
+ **
+ ** Permission is hereby granted, free of charge, to any person obtaining a
+ ** copy of this software and/or associated documentation files (the
+ ** "Materials"), to deal in the Materials without restriction, including
+ ** without limitation the rights to use, copy, modify, merge, publish,
+ ** distribute, sublicense, and/or sell copies of the Materials, and to
+ ** permit persons to whom the Materials are furnished to do so, subject to
+ ** the following conditions:
+ **
+ ** The above copyright notice and this permission notice shall be included
+ ** in all copies or substantial portions of the Materials.
+ **
+ ** THE MATERIALS ARE PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
+ ** EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
+ ** MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.
+ ** IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY
+ ** CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT,
+ ** TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE 
+ ** MATERIALS OR THE USE OR OTHER DEALINGS IN THE MATERIALS.
+ **}
+unit egl;
+
+interface
+
+{$MODE objfpc}
+
+uses SysUtils,dynlibs{$ifdef windows},Windows{$endif};
+
+{$IFDEF FPC}
+  {$PACKRECORDS C}
+{$ENDIF}
+
+{ EGL Types  }
+{ EGLint is defined in eglplatform.h  }
+
+type
+
+  PEGLConfig  = ^EGLConfig;
+  PEGLInt     = ^EGLInt;
+  EGLInt      = longint;
+  EGLConfig   = pointer;
+  
+  EGLImageKHREGLConfig = pointer;
+
+  {$IF DEFINED(LINUX) }
+    EGLNativeDisplayType = ptrint;
+    EGLNativeWindowType  = cardinal;
+    EGLNativePixmapType  = cardinal;
+  {$ELSEIF DEFINED(WINDOWS) }
+    EGLNativeDisplayType = HDC;
+    EGLNativeWindowType  = HWND;
+    EGLNativePixmapType  = HBITMAP;
+  {$ELSE}
+    EGLNativeDisplayType = ptrint;
+    EGLNativeWindowType  = pointer;
+    EGLNativePixmapType  = pointer;
+  {$ENDIF}
+
+  EGLBoolean      = dword;
+  EGLenum         = dword;
+  EGLContext      = pointer;
+  EGLDisplay      = pointer;
+  EGLSurface      = pointer;
+  EGLClientBuffer = pointer;
+
+  { EGL Versioning  }
+
+const
+   EGL_VERSION_1_0 = 1;     
+   EGL_VERSION_1_1 = 1;     
+   EGL_VERSION_1_2 = 1;     
+   EGL_VERSION_1_3 = 1;     
+   EGL_VERSION_1_4 = 1;     
+
+{ EGL Enumerants. Bitmasks and other exceptional cases aside, most
+ * enums are assigned unique values starting at 0x3000.
+  }
+{ EGL aliases  }
+   EGL_FALSE = 0;
+   EGL_TRUE  = 1;
+{ Out-of-band handle values  }
+{ was #define dname def_expr }
+function EGL_DEFAULT_DISPLAY : EGLNativeDisplayType;    
+
+{ was #define dname def_expr }
+function EGL_NO_CONTEXT : EGLContext;    
+
+{ was #define dname def_expr }
+function EGL_NO_DISPLAY : EGLDisplay;    
+
+{ was #define dname def_expr }
+function EGL_NO_SURFACE : EGLSurface;    
+
+{ Out-of-band attribute value  }
+{ was #define dname def_expr }
+function EGL_DONT_CARE : EGLint;    
+
+{ Errors / GetError return values  }
+
+const
+   EGL_SUCCESS = $3000;     
+   EGL_NOT_INITIALIZED = $3001;     
+   EGL_BAD_ACCESS = $3002;     
+   EGL_BAD_ALLOC = $3003;     
+   EGL_BAD_ATTRIBUTE = $3004;     
+   EGL_BAD_CONFIG = $3005;     
+   EGL_BAD_CONTEXT = $3006;     
+   EGL_BAD_CURRENT_SURFACE = $3007;     
+   EGL_BAD_DISPLAY = $3008;     
+   EGL_BAD_MATCH = $3009;     
+   EGL_BAD_NATIVE_PIXMAP = $300A;     
+   EGL_BAD_NATIVE_WINDOW = $300B;     
+   EGL_BAD_PARAMETER = $300C;     
+   EGL_BAD_SURFACE = $300D;     
+{ EGL 1.1 - IMG_power_management  }
+   EGL_CONTEXT_LOST = $300E;     
+{ Reserved 0x300F-0x301F for additional errors  }
+{ Config attributes  }
+   EGL_BUFFER_SIZE = $3020;     
+   EGL_ALPHA_SIZE = $3021;     
+   EGL_BLUE_SIZE = $3022;     
+   EGL_GREEN_SIZE = $3023;     
+   EGL_RED_SIZE = $3024;     
+   EGL_DEPTH_SIZE = $3025;     
+   EGL_STENCIL_SIZE = $3026;     
+   EGL_CONFIG_CAVEAT = $3027;     
+   EGL_CONFIG_ID = $3028;     
+   EGL_LEVEL = $3029;     
+   EGL_MAX_PBUFFER_HEIGHT = $302A;     
+   EGL_MAX_PBUFFER_PIXELS = $302B;     
+   EGL_MAX_PBUFFER_WIDTH = $302C;     
+   EGL_NATIVE_RENDERABLE = $302D;     
+   EGL_NATIVE_VISUAL_ID = $302E;     
+   EGL_NATIVE_VISUAL_TYPE = $302F;     
+   EGL_PRESERVED_RESOURCES = $3030;     
+   EGL_SAMPLES = $3031;     
+   EGL_SAMPLE_BUFFERS = $3032;     
+   EGL_SURFACE_TYPE = $3033;     
+   EGL_TRANSPARENT_TYPE = $3034;     
+   EGL_TRANSPARENT_BLUE_VALUE = $3035;     
+   EGL_TRANSPARENT_GREEN_VALUE = $3036;     
+   EGL_TRANSPARENT_RED_VALUE = $3037;     
+{ Attrib list terminator  }
+   EGL_NONE = $3038;     
+   EGL_BIND_TO_TEXTURE_RGB = $3039;     
+   EGL_BIND_TO_TEXTURE_RGBA = $303A;     
+   EGL_MIN_SWAP_INTERVAL = $303B;     
+   EGL_MAX_SWAP_INTERVAL = $303C;     
+   EGL_LUMINANCE_SIZE = $303D;     
+   EGL_ALPHA_MASK_SIZE = $303E;     
+   EGL_COLOR_BUFFER_TYPE = $303F;     
+   EGL_RENDERABLE_TYPE = $3040;     
+{ Pseudo-attribute (not queryable)  }
+   EGL_MATCH_NATIVE_PIXMAP = $3041;     
+   EGL_CONFORMANT = $3042;     
+{ Reserved 0x3041-0x304F for additional config attributes  }
+{ Config attribute values  }
+{ EGL_CONFIG_CAVEAT value  }
+   EGL_SLOW_CONFIG = $3050;     
+{ EGL_CONFIG_CAVEAT value  }
+   EGL_NON_CONFORMANT_CONFIG = $3051;     
+{ EGL_TRANSPARENT_TYPE value  }
+   EGL_TRANSPARENT_RGB = $3052;     
+{ EGL_COLOR_BUFFER_TYPE value  }
+   EGL_RGB_BUFFER = $308E;     
+{ EGL_COLOR_BUFFER_TYPE value  }
+   EGL_LUMINANCE_BUFFER = $308F;     
+{ More config attribute values, for EGL_TEXTURE_FORMAT  }
+   EGL_NO_TEXTURE = $305C;     
+   EGL_TEXTURE_RGB = $305D;     
+   EGL_TEXTURE_RGBA = $305E;     
+   EGL_TEXTURE_2D = $305F;     
+{ Config attribute mask bits  }
+{ EGL_SURFACE_TYPE mask bits  }
+   EGL_PBUFFER_BIT = $0001;     
+{ EGL_SURFACE_TYPE mask bits  }
+   EGL_PIXMAP_BIT = $0002;     
+{ EGL_SURFACE_TYPE mask bits  }
+   EGL_WINDOW_BIT = $0004;     
+{ EGL_SURFACE_TYPE mask bits  }
+   EGL_VG_COLORSPACE_LINEAR_BIT = $0020;     
+{ EGL_SURFACE_TYPE mask bits  }
+   EGL_VG_ALPHA_FORMAT_PRE_BIT = $0040;     
+{ EGL_SURFACE_TYPE mask bits  }
+   EGL_MULTISAMPLE_RESOLVE_BOX_BIT = $0200;     
+{ EGL_SURFACE_TYPE mask bits  }
+   EGL_SWAP_BEHAVIOR_PRESERVED_BIT = $0400;     
+{ EGL_RENDERABLE_TYPE mask bits  }
+   EGL_OPENGL_ES_BIT = $0001;     
+{ EGL_RENDERABLE_TYPE mask bits  }
+   EGL_OPENVG_BIT = $0002;     
+{ EGL_RENDERABLE_TYPE mask bits  }
+   EGL_OPENGL_ES2_BIT = $0004;     
+{ EGL_RENDERABLE_TYPE mask bits  }
+   EGL_OPENGL_BIT = $0008;     
+{ QueryString targets  }
+   EGL_VENDOR = $3053;     
+   EGL_VERSION = $3054;     
+   EGL_EXTENSIONS = $3055;     
+   EGL_CLIENT_APIS = $308D;     
+{ QuerySurface / SurfaceAttrib / CreatePbufferSurface targets  }
+   EGL_HEIGHT = $3056;     
+   EGL_WIDTH = $3057;     
+   EGL_LARGEST_PBUFFER = $3058;     
+   EGL_TEXTURE_FORMAT = $3080;     
+   EGL_TEXTURE_TARGET = $3081;     
+   EGL_MIPMAP_TEXTURE = $3082;     
+   EGL_MIPMAP_LEVEL = $3083;     
+   EGL_RENDER_BUFFER = $3086;     
+   EGL_VG_COLORSPACE = $3087;     
+   EGL_VG_ALPHA_FORMAT = $3088;     
+   EGL_HORIZONTAL_RESOLUTION = $3090;     
+   EGL_VERTICAL_RESOLUTION = $3091;     
+   EGL_PIXEL_ASPECT_RATIO = $3092;     
+   EGL_SWAP_BEHAVIOR = $3093;     
+   EGL_MULTISAMPLE_RESOLVE = $3099;     
+{ EGL_RENDER_BUFFER values / BindTexImage / ReleaseTexImage buffer targets  }
+   EGL_BACK_BUFFER = $3084;     
+   EGL_SINGLE_BUFFER = $3085;     
+{ OpenVG color spaces  }
+{ EGL_VG_COLORSPACE value  }
+   EGL_VG_COLORSPACE_sRGB = $3089;     
+{ EGL_VG_COLORSPACE value  }
+   EGL_VG_COLORSPACE_LINEAR = $308A;     
+{ OpenVG alpha formats  }
+{ EGL_ALPHA_FORMAT value  }
+   EGL_VG_ALPHA_FORMAT_NONPRE = $308B;     
+{ EGL_ALPHA_FORMAT value  }
+   EGL_VG_ALPHA_FORMAT_PRE = $308C;     
+{ Constant scale factor by which fractional display resolutions &
+ * aspect ratio are scaled when queried as integer values.
+  }
+   EGL_DISPLAY_SCALING = 10000;     
+{ Unknown display resolution/aspect ratio  }
+{ was #define dname def_expr }
+function EGL_UNKNOWN : EGLint;    
+
+{ Back buffer swap behaviors  }
+{ EGL_SWAP_BEHAVIOR value  }
+
+const
+   EGL_BUFFER_PRESERVED = $3094;     
+{ EGL_SWAP_BEHAVIOR value  }
+   EGL_BUFFER_DESTROYED = $3095;     
+{ CreatePbufferFromClientBuffer buffer types  }
+   EGL_OPENVG_IMAGE = $3096;     
+{ QueryContext targets  }
+   EGL_CONTEXT_CLIENT_TYPE = $3097;     
+{ CreateContext attributes  }
+   EGL_CONTEXT_CLIENT_VERSION = $3098;     
+{ Multisample resolution behaviors  }
+{ EGL_MULTISAMPLE_RESOLVE value  }
+   EGL_MULTISAMPLE_RESOLVE_DEFAULT = $309A;     
+{ EGL_MULTISAMPLE_RESOLVE value  }
+   EGL_MULTISAMPLE_RESOLVE_BOX = $309B;     
+{ BindAPI/QueryAPI targets  }
+   EGL_OPENGL_ES_API = $30A0;     
+   EGL_OPENVG_API = $30A1;     
+   EGL_OPENGL_API = $30A2;     
+{ GetCurrentSurface targets  }
+   EGL_DRAW = $3059;     
+   EGL_READ = $305A;     
+{ WaitNative engines  }
+   EGL_CORE_NATIVE_ENGINE = $305B;     
+{ EGL 1.2 tokens renamed for consistency in EGL 1.3  }
+   EGL_COLORSPACE = EGL_VG_COLORSPACE;     
+   EGL_ALPHA_FORMAT = EGL_VG_ALPHA_FORMAT;     
+   EGL_COLORSPACE_sRGB = EGL_VG_COLORSPACE_sRGB;     
+   EGL_COLORSPACE_LINEAR = EGL_VG_COLORSPACE_LINEAR;     
+   EGL_ALPHA_FORMAT_NONPRE = EGL_VG_ALPHA_FORMAT_NONPRE;     
+   EGL_ALPHA_FORMAT_PRE = EGL_VG_ALPHA_FORMAT_PRE;     
+{ EGL extensions must request enum blocks from the Khronos
+ * API Registrar, who maintains the enumerant registry. Submit
+ * a bug in Khronos Bugzilla against task "Registry".
+  }
+{ EGL Functions  }
+
+var
+  eglGetError : function:EGLint;{$ifdef windows}stdcall;{$else}cdecl;{$endif}
+  eglGetDisplay : function(display_id:EGLNativeDisplayType):EGLDisplay;{$ifdef windows}stdcall;{$else}cdecl;{$endif}
+  eglInitialize : function(dpy:EGLDisplay; major:pEGLint; minor:pEGLint):EGLBoolean;{$ifdef windows}stdcall;{$else}cdecl;{$endif}
+  eglTerminate : function(dpy:EGLDisplay):EGLBoolean;{$ifdef windows}stdcall;{$else}cdecl;{$endif}
+(* Const before type ignored *)
+  eglQueryString : function(dpy:EGLDisplay; name:EGLint):pchar;{$ifdef windows}stdcall;{$else}cdecl;{$endif}
+  eglGetConfigs : function(dpy:EGLDisplay; configs:pEGLConfig; config_size:EGLint; num_config:pEGLint):EGLBoolean;{$ifdef windows}stdcall;{$else}cdecl;{$endif}
+(* Const before type ignored *)
+  eglChooseConfig : function(dpy:EGLDisplay; attrib_list:pEGLint; configs:pEGLConfig; config_size:EGLint; num_config:pEGLint):EGLBoolean;{$ifdef windows}stdcall;{$else}cdecl;{$endif}
+  eglGetConfigAttrib : function(dpy:EGLDisplay; config:EGLConfig; attribute:EGLint; value:pEGLint):EGLBoolean;{$ifdef windows}stdcall;{$else}cdecl;{$endif}
+(* Const before type ignored *)
+  eglCreateWindowSurface : function(dpy:EGLDisplay; config:EGLConfig; win:EGLNativeWindowType; attrib_list:pEGLint):EGLSurface;{$ifdef windows}stdcall;{$else}cdecl;{$endif}
+(* Const before type ignored *)
+  eglCreatePbufferSurface : function(dpy:EGLDisplay; config:EGLConfig; attrib_list:pEGLint):EGLSurface;{$ifdef windows}stdcall;{$else}cdecl;{$endif}
+(* Const before type ignored *)
+  eglCreatePixmapSurface : function(dpy:EGLDisplay; config:EGLConfig; pixmap:EGLNativePixmapType; attrib_list:pEGLint):EGLSurface;{$ifdef windows}stdcall;{$else}cdecl;{$endif}
+  eglDestroySurface : function(dpy:EGLDisplay; surface:EGLSurface):EGLBoolean;{$ifdef windows}stdcall;{$else}cdecl;{$endif}
+  eglQuerySurface : function(dpy:EGLDisplay; surface:EGLSurface; attribute:EGLint; value:pEGLint):EGLBoolean;{$ifdef windows}stdcall;{$else}cdecl;{$endif}
+  eglBindAPI : function(api:EGLenum):EGLBoolean;{$ifdef windows}stdcall;{$else}cdecl;{$endif}
+  eglQueryAPI : function:EGLenum;{$ifdef windows}stdcall;{$else}cdecl;{$endif}
+  eglWaitClient : function:EGLBoolean;{$ifdef windows}stdcall;{$else}cdecl;{$endif}
+  eglReleaseThread : function:EGLBoolean;{$ifdef windows}stdcall;{$else}cdecl;{$endif}
+(* Const before type ignored *)
+  eglCreatePbufferFromClientBuffer : function(dpy:EGLDisplay; buftype:EGLenum; buffer:EGLClientBuffer; config:EGLConfig; attrib_list:pEGLint):EGLSurface;{$ifdef windows}stdcall;{$else}cdecl;{$endif}
+  eglSurfaceAttrib : function(dpy:EGLDisplay; surface:EGLSurface; attribute:EGLint; value:EGLint):EGLBoolean;{$ifdef windows}stdcall;{$else}cdecl;{$endif}
+  eglBindTexImage : function(dpy:EGLDisplay; surface:EGLSurface; buffer:EGLint):EGLBoolean;{$ifdef windows}stdcall;{$else}cdecl;{$endif}
+  eglReleaseTexImage : function(dpy:EGLDisplay; surface:EGLSurface; buffer:EGLint):EGLBoolean;{$ifdef windows}stdcall;{$else}cdecl;{$endif}
+  eglSwapInterval : function(dpy:EGLDisplay; interval:EGLint):EGLBoolean;{$ifdef windows}stdcall;{$else}cdecl;{$endif}
+(* Const before type ignored *)
+  eglCreateContext : function(dpy:EGLDisplay; config:EGLConfig; share_context:EGLContext; attrib_list:pEGLint):EGLContext;{$ifdef windows}stdcall;{$else}cdecl;{$endif}
+  eglDestroyContext : function(dpy:EGLDisplay; ctx:EGLContext):EGLBoolean;{$ifdef windows}stdcall;{$else}cdecl;{$endif}
+  eglMakeCurrent : function(dpy:EGLDisplay; draw:EGLSurface; read:EGLSurface; ctx:EGLContext):EGLBoolean;{$ifdef windows}stdcall;{$else}cdecl;{$endif}
+  eglGetCurrentContext : function:EGLContext;{$ifdef windows}stdcall;{$else}cdecl;{$endif}
+  eglGetCurrentSurface : function(readdraw:EGLint):EGLSurface;{$ifdef windows}stdcall;{$else}cdecl;{$endif}
+  eglGetCurrentDisplay : function:EGLDisplay;{$ifdef windows}stdcall;{$else}cdecl;{$endif}
+  eglQueryContext : function(dpy:EGLDisplay; ctx:EGLContext; attribute:EGLint; value:pEGLint):EGLBoolean;{$ifdef windows}stdcall;{$else}cdecl;{$endif}
+  eglWaitGL : function:EGLBoolean;{$ifdef windows}stdcall;{$else}cdecl;{$endif}
+  eglWaitNative : function(engine:EGLint):EGLBoolean;{$ifdef windows}stdcall;{$else}cdecl;{$endif}
+  eglSwapBuffers : function(dpy:EGLDisplay; surface:EGLSurface):EGLBoolean;{$ifdef windows}stdcall;{$else}cdecl;{$endif}
+  eglCopyBuffers : function(dpy:EGLDisplay; surface:EGLSurface; target:EGLNativePixmapType):EGLBoolean;{$ifdef windows}stdcall;{$else}cdecl;{$endif}
+{ This is a generic function pointer type, whose name indicates it must
+ * be cast to the proper type *and calling convention* before use.
+  }
+
+var
+  eglGetProcAddress : function(procname:pchar):pointer;{$ifdef windows}stdcall;{$else}CDecl;{$endif}
+{ Header file version number  }
+{ Current version at http://www.khronos.org/registry/egl/  }
+
+const
+   EGL_EGLEXT_VERSION = 3;     
+   EGL_KHR_config_attribs = 1;     
+{ EGLConfig attribute  }
+   EGL_CONFORMANT_KHR = $3042;     
+{ EGL_SURFACE_TYPE bitfield  }
+   EGL_VG_COLORSPACE_LINEAR_BIT_KHR = $0020;     
+{ EGL_SURFACE_TYPE bitfield  }
+   EGL_VG_ALPHA_FORMAT_PRE_BIT_KHR = $0040;     
+   EGL_KHR_lock_surface = 1;     
+{ EGL_LOCK_USAGE_HINT_KHR bitfield  }
+   EGL_READ_SURFACE_BIT_KHR = $0001;     
+{ EGL_LOCK_USAGE_HINT_KHR bitfield  }
+   EGL_WRITE_SURFACE_BIT_KHR = $0002;     
+{ EGL_SURFACE_TYPE bitfield  }
+   EGL_LOCK_SURFACE_BIT_KHR = $0080;     
+{ EGL_SURFACE_TYPE bitfield  }
+   EGL_OPTIMAL_FORMAT_BIT_KHR = $0100;     
+{ EGLConfig attribute  }
+   EGL_MATCH_FORMAT_KHR = $3043;     
+{ EGL_MATCH_FORMAT_KHR value  }
+   EGL_FORMAT_RGB_565_EXACT_KHR = $30C0;     
+{ EGL_MATCH_FORMAT_KHR value  }
+   EGL_FORMAT_RGB_565_KHR = $30C1;     
+{ EGL_MATCH_FORMAT_KHR value  }
+   EGL_FORMAT_RGBA_8888_EXACT_KHR = $30C2;     
+{ EGL_MATCH_FORMAT_KHR value  }
+   EGL_FORMAT_RGBA_8888_KHR = $30C3;     
+{ eglLockSurfaceKHR attribute  }
+   EGL_MAP_PRESERVE_PIXELS_KHR = $30C4;     
+{ eglLockSurfaceKHR attribute  }
+   EGL_LOCK_USAGE_HINT_KHR = $30C5;     
+{ eglQuerySurface attribute  }
+   EGL_BITMAP_POINTER_KHR = $30C6;     
+{ eglQuerySurface attribute  }
+   EGL_BITMAP_PITCH_KHR = $30C7;     
+{ eglQuerySurface attribute  }
+   EGL_BITMAP_ORIGIN_KHR = $30C8;     
+{ eglQuerySurface attribute  }
+   EGL_BITMAP_PIXEL_RED_OFFSET_KHR = $30C9;     
+{ eglQuerySurface attribute  }
+   EGL_BITMAP_PIXEL_GREEN_OFFSET_KHR = $30CA;     
+{ eglQuerySurface attribute  }
+   EGL_BITMAP_PIXEL_BLUE_OFFSET_KHR = $30CB;     
+{ eglQuerySurface attribute  }
+   EGL_BITMAP_PIXEL_ALPHA_OFFSET_KHR = $30CC;     
+{ eglQuerySurface attribute  }
+   EGL_BITMAP_PIXEL_LUMINANCE_OFFSET_KHR = $30CD;     
+{ EGL_BITMAP_ORIGIN_KHR value  }
+   EGL_LOWER_LEFT_KHR = $30CE;     
+{ EGL_BITMAP_ORIGIN_KHR value  }
+   EGL_UPPER_LEFT_KHR = $30CF;     
+(* Const before type ignored *)
+
+const
+   EGL_KHR_image = 1;     
+{ eglCreateImageKHR target  }
+   EGL_NATIVE_PIXMAP_KHR = $30B0;     
+
+type
+  EGLImageKHR = pointer;
+  { was #define dname def_expr }
+
+function EGL_NO_IMAGE_KHR : EGLImageKHR;    
+
+(* Const before type ignored *)
+
+const
+   EGL_KHR_vg_parent_image = 1;     
+{ eglCreateImageKHR target  }
+   EGL_VG_PARENT_IMAGE_KHR = $30BA;     
+   EGL_KHR_gl_texture_2D_image = 1;     
+{ eglCreateImageKHR target  }
+   EGL_GL_TEXTURE_2D_KHR = $30B1;     
+{ eglCreateImageKHR attribute  }
+   EGL_GL_TEXTURE_LEVEL_KHR = $30BC;     
+   EGL_KHR_gl_texture_cubemap_image = 1;     
+{ eglCreateImageKHR target  }
+   EGL_GL_TEXTURE_CUBE_MAP_POSITIVE_X_KHR = $30B3;     
+{ eglCreateImageKHR target  }
+   EGL_GL_TEXTURE_CUBE_MAP_NEGATIVE_X_KHR = $30B4;     
+{ eglCreateImageKHR target  }
+   EGL_GL_TEXTURE_CUBE_MAP_POSITIVE_Y_KHR = $30B5;     
+{ eglCreateImageKHR target  }
+   EGL_GL_TEXTURE_CUBE_MAP_NEGATIVE_Y_KHR = $30B6;     
+{ eglCreateImageKHR target  }
+   EGL_GL_TEXTURE_CUBE_MAP_POSITIVE_Z_KHR = $30B7;     
+{ eglCreateImageKHR target  }
+   EGL_GL_TEXTURE_CUBE_MAP_NEGATIVE_Z_KHR = $30B8;     
+   EGL_KHR_gl_texture_3D_image = 1;     
+{ eglCreateImageKHR target  }
+   EGL_GL_TEXTURE_3D_KHR = $30B2;     
+{ eglCreateImageKHR attribute  }
+   EGL_GL_TEXTURE_ZOFFSET_KHR = $30BD;     
+   EGL_KHR_gl_renderbuffer_image = 1;     
+{ eglCreateImageKHR target  }
+   EGL_GL_RENDERBUFFER_KHR = $30B9;     
+   EGL_KHR_image_base = 1;     
+{ Most interfaces defined by EGL_KHR_image_pixmap above  }
+{ eglCreateImageKHR attribute  }
+   EGL_IMAGE_PRESERVED_KHR = $30D2;     
+   EGL_KHR_image_pixmap = 1;     
+{ Interfaces defined by EGL_KHR_image above  }
+
+implementation
+
+{ was #define dname def_expr }
+function EGL_DEFAULT_DISPLAY : EGLNativeDisplayType; inline;
+  begin
+     EGL_DEFAULT_DISPLAY:=EGLNativeDisplayType(0);
+  end;
+
+{ was #define dname def_expr }
+function EGL_NO_CONTEXT : EGLContext; inline;
+  begin
+     EGL_NO_CONTEXT:=EGLContext(0);
+  end;
+
+{ was #define dname def_expr }
+function EGL_NO_DISPLAY : EGLDisplay; inline;
+  begin
+     EGL_NO_DISPLAY:=EGLDisplay(0);
+  end;
+
+{ was #define dname def_expr }
+function EGL_NO_SURFACE : EGLSurface; inline;
+  begin
+     EGL_NO_SURFACE:=EGLSurface(0);
+  end;
+
+{ was #define dname def_expr }
+function EGL_DONT_CARE : EGLint; inline;
+  begin
+     EGL_DONT_CARE:=EGLint(-(1));
+  end;
+
+{ was #define dname def_expr }
+function EGL_UNKNOWN : EGLint; inline;
+  begin
+     EGL_UNKNOWN:=EGLint(-(1));
+  end;
+
+{ was #define dname def_expr }
+function EGL_NO_IMAGE_KHR : EGLImageKHR; inline;
+  begin
+     EGL_NO_IMAGE_KHR:=EGLImageKHR(0);
+  end;
+
+
+var
+  EGLLib : tlibhandle;
+
+procedure FreeEGL;
+  begin
+    if EGLLib<>0 then
+      FreeLibrary(EGLLib);
+
+    eglGetError:=nil;
+    eglGetDisplay:=nil;
+    eglInitialize:=nil;
+    eglTerminate:=nil;
+    eglQueryString:=nil;
+    eglGetConfigs:=nil;
+    eglChooseConfig:=nil;
+    eglGetConfigAttrib:=nil;
+    eglCreateWindowSurface:=nil;
+    eglCreatePbufferSurface:=nil;
+    eglCreatePixmapSurface:=nil;
+    eglDestroySurface:=nil;
+    eglQuerySurface:=nil;
+    eglBindAPI:=nil;
+    eglQueryAPI:=nil;
+    eglWaitClient:=nil;
+    eglReleaseThread:=nil;
+    eglCreatePbufferFromClientBuffer:=nil;
+    eglSurfaceAttrib:=nil;
+    eglBindTexImage:=nil;
+    eglReleaseTexImage:=nil;
+    eglSwapInterval:=nil;
+    eglCreateContext:=nil;
+    eglDestroyContext:=nil;
+    eglMakeCurrent:=nil;
+    eglGetCurrentContext:=nil;
+    eglGetCurrentSurface:=nil;
+    eglGetCurrentDisplay:=nil;
+    eglQueryContext:=nil;
+    eglWaitGL:=nil;
+    eglWaitNative:=nil;
+    eglSwapBuffers:=nil;
+    eglCopyBuffers:=nil;
+    eglGetProcAddress:=nil;
+  end;
+
+procedure LoadEGL(lib : pchar);
+  begin
+    FreeEGL;
+    EGLLib:=dynlibs.LoadLibrary(lib);
+    if EGLLib=0 then
+      raise Exception.Create(format('Could not load library: %s',[lib]));
+
+    pointer(eglGetProcAddress):=GetProcAddress(EGLLib,'eglGetProcAddress');
+
+    pointer(eglGetError):=GetProcAddress(EGLLib,'eglGetError');
+    pointer(eglGetDisplay):=GetProcAddress(EGLLib,'eglGetDisplay');
+    pointer(eglInitialize):=GetProcAddress(EGLLib,'eglInitialize');
+    pointer(eglTerminate):=GetProcAddress(EGLLib,'eglTerminate');
+    pointer(eglQueryString):=GetProcAddress(EGLLib,'eglQueryString');
+    pointer(eglGetConfigs):=GetProcAddress(EGLLib,'eglGetConfigs');
+    pointer(eglChooseConfig):=GetProcAddress(EGLLib,'eglChooseConfig');
+    pointer(eglGetConfigAttrib):=GetProcAddress(EGLLib,'eglGetConfigAttrib');
+    pointer(eglCreateWindowSurface):=GetProcAddress(EGLLib,'eglCreateWindowSurface');
+    pointer(eglCreatePbufferSurface):=GetProcAddress(EGLLib,'eglCreatePbufferSurface');
+    pointer(eglCreatePixmapSurface):=GetProcAddress(EGLLib,'eglCreatePixmapSurface');
+    pointer(eglDestroySurface):=GetProcAddress(EGLLib,'eglDestroySurface');
+    pointer(eglQuerySurface):=GetProcAddress(EGLLib,'eglQuerySurface');
+    pointer(eglBindAPI):=GetProcAddress(EGLLib,'eglBindAPI');
+    pointer(eglQueryAPI):=GetProcAddress(EGLLib,'eglQueryAPI');
+    pointer(eglWaitClient):=GetProcAddress(EGLLib,'eglWaitClient');
+    pointer(eglReleaseThread):=GetProcAddress(EGLLib,'eglReleaseThread');
+    pointer(eglCreatePbufferFromClientBuffer):=GetProcAddress(EGLLib,'eglCreatePbufferFromClientBuffer');
+    pointer(eglSurfaceAttrib):=GetProcAddress(EGLLib,'eglSurfaceAttrib');
+    pointer(eglBindTexImage):=GetProcAddress(EGLLib,'eglBindTexImage');
+    pointer(eglReleaseTexImage):=GetProcAddress(EGLLib,'eglReleaseTexImage');
+    pointer(eglSwapInterval):=GetProcAddress(EGLLib,'eglSwapInterval');
+    pointer(eglCreateContext):=GetProcAddress(EGLLib,'eglCreateContext');
+    pointer(eglDestroyContext):=GetProcAddress(EGLLib,'eglDestroyContext');
+    pointer(eglMakeCurrent):=GetProcAddress(EGLLib,'eglMakeCurrent');
+    pointer(eglGetCurrentContext):=GetProcAddress(EGLLib,'eglGetCurrentContext');
+    pointer(eglGetCurrentSurface):=GetProcAddress(EGLLib,'eglGetCurrentSurface');
+    pointer(eglGetCurrentDisplay):=GetProcAddress(EGLLib,'eglGetCurrentDisplay');
+    pointer(eglQueryContext):=GetProcAddress(EGLLib,'eglQueryContext');
+    pointer(eglWaitGL):=GetProcAddress(EGLLib,'eglWaitGL');
+    pointer(eglWaitNative):=GetProcAddress(EGLLib,'eglWaitNative');
+    pointer(eglSwapBuffers):=GetProcAddress(EGLLib,'eglSwapBuffers');
+    pointer(eglCopyBuffers):=GetProcAddress(EGLLib,'eglCopyBuffers');
+  end;
+
+initialization
+  EGLLib:=0;
+  LoadEGL({$ifdef windows}'libEGL.dll'{$else}'libEGL.so'{$endif});
+finalization
+  FreeEGL;
+end.
Index: packages/fpmake_proc.inc
===================================================================
--- packages/fpmake_proc.inc	(revision 26460)
+++ packages/fpmake_proc.inc	(working copy)
@@ -86,6 +86,12 @@
 
 {$include fcl-db/fpmake.pp}
 
+procedure add_egl(const ADirectory: string);
+begin
+  with Installer do
+{$include egl/fpmake.pp}
+end;
+
 procedure add_fcl_extra(const ADirectory: string);
 begin
   with Installer do
Index: packages/fpmake_add.inc
===================================================================
--- packages/fpmake_add.inc	(revision 26460)
+++ packages/fpmake_add.inc	(working copy)
@@ -10,6 +10,7 @@
   add_dblib(ADirectory+IncludeTrailingPathDelimiter('dblib'));
   add_dbus(ADirectory+IncludeTrailingPathDelimiter('dbus'));
   add_dts(ADirectory+IncludeTrailingPathDelimiter('dts'));
+  add_egl(ADirectory+IncludeTrailingPathDelimiter('egl'));
   add_fastcgi(ADirectory+IncludeTrailingPathDelimiter('fastcgi'));
   add_fcl_async(ADirectory+IncludeTrailingPathDelimiter('fcl-async'));
   add_fcl_base(ADirectory+IncludeTrailingPathDelimiter('fcl-base'));
egl_opengles_split-3.diff (102,113 bytes)   

Dennis Fehr

2014-01-20 01:52

reporter   ~0072552

Again, changed a small difference.. For some reason the original EGL code had EGLInt defined as a 64-bit integer on 64-bit systems.. When in reality that is not the case.. Even in the eglplatform.h .. Corrected, and TESTED in 64-bit linux this time.

Yuriy Sydorov

2014-02-08 12:37

manager   ~0072929

Dennis Fehr, please provide your latest patches. For opengles and enabling additional packages for android.
Also will your opengles patches fix this bug?
http://bugs.freepascal.org/view.php?id=25024

Dennis Fehr

2014-02-12 00:20

reporter   ~0073011

Last edited: 2014-02-12 00:21

View 2 revisions

Hi Yury, sure I'll update it. Give me a bit and I shall produce a patch that still retains the split, and the correct 32bit TYPE-DEF, and No-Runtime Linking on Android.

Edit: The only downside, is it's incompatible with a recent FPC commit (which my version has anyway -- The exclusion of the X dependency) so you would have to undo that to accept mine.

Thaddy de Koning

2014-02-12 11:54

reporter   ~0073013

Last edited: 2014-02-12 12:04

View 4 revisions

@Dennis: There is no downside. The dependency on X was a big, very big, mistake and is a *bug*. It has to be broken, but just a little extra unit for X will conveniently almost fix this without too much trouble.
My work will also break that *big* bug when submitted. Keep up the good work!
I am currently testing this patch on arm-android and arm-linux with very limited changes. Results are promising ;-)

My patch moved the X code to a separate unit in the X11 code branch.
Maybe this is not necessary any more, because you did a good job at separating.
My own code is still a bit of a mess. I changed my code to reflect your changes by hand, not by merging.

Yuriy Sydorov

2014-02-12 12:07

manager   ~0073014

Of course the X dependency need to be dropped if possible.
I am waiting for a patch which is tested and accepted by all interested parties.

Thaddy de Koning

2014-02-12 12:08

reporter   ~0073015

Last edited: 2014-02-12 12:22

View 3 revisions

{$ifdef linux},x,xlib{$endif} should hurt anybody's eyes. This WILL go away, I hope. I already submitted a very small but breaking patch some time ago. Basically just a change to an opaque pointer. I moved the X specialization to a separate unit. That unit only contains a hard cast. That patch was refused. It is not very elegant, so I understand.

Dennis Fehr

2014-02-12 20:33

reporter  

egl_opengles_split-4.diff (329,630 bytes)

Dennis Fehr

2014-02-12 20:42

reporter   ~0073022

Last edited: 2014-02-12 21:19

View 2 revisions

Actually use diff-5, as it takes away the dependency of EGL from GLES (as even on the Khronos website it shows there is GLES + GLES[without EGL] as well). I just tested it with Linux 64-bit EGL, and Android ARMV7 on a Samsung Galaxy S3 (with no Run-Time Linking) using my Game Engine, and it seems to be running well.. I gave the same loving to the GLES1.1 unit as well. Looks pretty smooth, Thaddy, wanna test it?

Edit: It also fixes bug 0025024 as it does not have runtime linking when compiling for Android (if I wasn't clear enough :) )

Dennis Fehr

2014-02-12 20:42

reporter  

egl_opengles_split-5.diff (329,638 bytes)

Issue History

Date Modified Username Field Change
2014-01-14 21:15 Dennis Fehr New Issue
2014-01-14 21:15 Dennis Fehr File Added: egl_opengles_split.diff
2014-01-15 05:48 Thaddy de Koning Note Added: 0072452
2014-01-15 05:52 Thaddy de Koning Note Edited: 0072452 View Revisions
2014-01-15 21:27 Dennis Fehr File Added: egl_opengles_split-2.diff
2014-01-15 21:29 Dennis Fehr Note Added: 0072469
2014-01-20 01:51 Dennis Fehr File Added: egl_opengles_split-3.diff
2014-01-20 01:52 Dennis Fehr Note Added: 0072552
2014-02-08 12:37 Yuriy Sydorov Note Added: 0072929
2014-02-08 12:37 Yuriy Sydorov Assigned To => Yuriy Sydorov
2014-02-08 12:37 Yuriy Sydorov Status new => assigned
2014-02-12 00:20 Dennis Fehr Note Added: 0073011
2014-02-12 00:21 Dennis Fehr Note Edited: 0073011 View Revisions
2014-02-12 11:54 Thaddy de Koning Note Added: 0073013
2014-02-12 11:56 Thaddy de Koning Note Edited: 0073013 View Revisions
2014-02-12 11:59 Thaddy de Koning Note Edited: 0073013 View Revisions
2014-02-12 12:04 Thaddy de Koning Note Edited: 0073013 View Revisions
2014-02-12 12:07 Yuriy Sydorov Note Added: 0073014
2014-02-12 12:07 Yuriy Sydorov Status assigned => feedback
2014-02-12 12:07 Yuriy Sydorov Relationship added related to 0025024
2014-02-12 12:08 Thaddy de Koning Note Added: 0073015
2014-02-12 12:12 Thaddy de Koning Note Edited: 0073015 View Revisions
2014-02-12 12:22 Thaddy de Koning Note Edited: 0073015 View Revisions
2014-02-12 20:33 Dennis Fehr File Added: egl_opengles_split-4.diff
2014-02-12 20:42 Dennis Fehr Note Added: 0073022
2014-02-12 20:42 Dennis Fehr Status feedback => assigned
2014-02-12 20:42 Dennis Fehr File Added: egl_opengles_split-5.diff
2014-02-12 21:19 Dennis Fehr Note Edited: 0073022 View Revisions