Browse Source

* readded libraries in mainbranch

peter 24 years ago
parent
commit
2189a3f921

+ 81 - 1
packages/Makefile

@@ -118,7 +118,7 @@ endif
 UNITSDIR=$(wildcard $(FPCDIR)/units/$(OS_TARGET))
 PACKAGESDIR=$(wildcard $(FPCDIR) $(FPCDIR)/packages)
 ifeq ($(OS_TARGET),linux)
-override TARGET_DIRS+=zlib ncurses x11 gtk syslog inet uncgi mysql ibase postgres oracle opengl forms svgalib ggi utmp paszlib gdbint cmem regexpr unzip
+override TARGET_DIRS+=zlib ncurses x11 gtk syslog inet uncgi mysql ibase postgres oracle opengl forms svgalib ggi libpng libgd utmp paszlib gdbint cmem regexpr unzip
 endif
 ifeq ($(OS_TARGET),go32v2)
 override TARGET_DIRS+=uncgi gdbint paszlib unzip regexpr
@@ -744,6 +744,8 @@ TARGET_DIRS_OPENGL=1
 TARGET_DIRS_FORMS=1
 TARGET_DIRS_SVGALIB=1
 TARGET_DIRS_GGI=1
+TARGET_DIRS_LIBPNG=1
+TARGET_DIRS_LIBGD=1
 TARGET_DIRS_UTMP=1
 TARGET_DIRS_PASZLIB=1
 TARGET_DIRS_GDBINT=1
@@ -1383,6 +1385,84 @@ ggi:
 	$(MAKE) -C ggi all
 .PHONY: ggi_all ggi_debug ggi_examples ggi_smart ggi_shared ggi_install ggi_sourceinstall ggi_exampleinstall ggi_distinstall ggi_zipinstall ggi_zipsourceinstall ggi_zipexampleinstall ggi_zipdistinstall ggi_clean ggi_distclean ggi_cleanall ggi_info ggi
 endif
+ifdef TARGET_DIRS_LIBPNG
+libpng_all:
+	$(MAKE) -C libpng all
+libpng_debug:
+	$(MAKE) -C libpng debug
+libpng_examples:
+	$(MAKE) -C libpng examples
+libpng_smart:
+	$(MAKE) -C libpng smart
+libpng_shared:
+	$(MAKE) -C libpng shared
+libpng_install:
+	$(MAKE) -C libpng install
+libpng_sourceinstall:
+	$(MAKE) -C libpng sourceinstall
+libpng_exampleinstall:
+	$(MAKE) -C libpng exampleinstall
+libpng_distinstall:
+	$(MAKE) -C libpng distinstall
+libpng_zipinstall:
+	$(MAKE) -C libpng zipinstall
+libpng_zipsourceinstall:
+	$(MAKE) -C libpng zipsourceinstall
+libpng_zipexampleinstall:
+	$(MAKE) -C libpng zipexampleinstall
+libpng_zipdistinstall:
+	$(MAKE) -C libpng zipdistinstall
+libpng_clean:
+	$(MAKE) -C libpng clean
+libpng_distclean:
+	$(MAKE) -C libpng distclean
+libpng_cleanall:
+	$(MAKE) -C libpng cleanall
+libpng_info:
+	$(MAKE) -C libpng info
+libpng:
+	$(MAKE) -C libpng all
+.PHONY: libpng_all libpng_debug libpng_examples libpng_smart libpng_shared libpng_install libpng_sourceinstall libpng_exampleinstall libpng_distinstall libpng_zipinstall libpng_zipsourceinstall libpng_zipexampleinstall libpng_zipdistinstall libpng_clean libpng_distclean libpng_cleanall libpng_info libpng
+endif
+ifdef TARGET_DIRS_LIBGD
+libgd_all:
+	$(MAKE) -C libgd all
+libgd_debug:
+	$(MAKE) -C libgd debug
+libgd_examples:
+	$(MAKE) -C libgd examples
+libgd_smart:
+	$(MAKE) -C libgd smart
+libgd_shared:
+	$(MAKE) -C libgd shared
+libgd_install:
+	$(MAKE) -C libgd install
+libgd_sourceinstall:
+	$(MAKE) -C libgd sourceinstall
+libgd_exampleinstall:
+	$(MAKE) -C libgd exampleinstall
+libgd_distinstall:
+	$(MAKE) -C libgd distinstall
+libgd_zipinstall:
+	$(MAKE) -C libgd zipinstall
+libgd_zipsourceinstall:
+	$(MAKE) -C libgd zipsourceinstall
+libgd_zipexampleinstall:
+	$(MAKE) -C libgd zipexampleinstall
+libgd_zipdistinstall:
+	$(MAKE) -C libgd zipdistinstall
+libgd_clean:
+	$(MAKE) -C libgd clean
+libgd_distclean:
+	$(MAKE) -C libgd distclean
+libgd_cleanall:
+	$(MAKE) -C libgd cleanall
+libgd_info:
+	$(MAKE) -C libgd info
+libgd:
+	$(MAKE) -C libgd all
+.PHONY: libgd_all libgd_debug libgd_examples libgd_smart libgd_shared libgd_install libgd_sourceinstall libgd_exampleinstall libgd_distinstall libgd_zipinstall libgd_zipsourceinstall libgd_zipexampleinstall libgd_zipdistinstall libgd_clean libgd_distclean libgd_cleanall libgd_info libgd
+endif
 ifdef TARGET_DIRS_UTMP
 utmp_all:
 	$(MAKE) -C utmp all

+ 1 - 1
packages/Makefile.fpc

@@ -6,7 +6,7 @@
 dirs_linux=zlib ncurses x11 gtk syslog \
            inet uncgi \
            mysql ibase postgres oracle \
-           opengl forms svgalib ggi \
+           opengl forms svgalib ggi libpng libgd \
            utmp paszlib gdbint cmem regexpr unzip
 dirs_win32=uncgi gtk gdbint ibase mysql zlib paszlib unzip regexpr opengl
 dirs_go32v2=uncgi gdbint paszlib unzip regexpr

+ 892 - 0
packages/libgd/Makefile

@@ -0,0 +1,892 @@
+#
+# Don't edit, this file is generated by fpcmake v1.99.0 [2001/04/11]
+#
+default: all
+override PATH:=$(subst \,/,$(PATH))
+ifeq ($(findstring ;,$(PATH)),)
+inUnix=1
+SEARCHPATH=$(subst :, ,$(PATH))
+else
+SEARCHPATH=$(subst ;, ,$(PATH))
+endif
+PWD:=$(strip $(wildcard $(addsuffix /pwd.exe,$(SEARCHPATH))))
+ifeq ($(PWD),)
+PWD:=$(strip $(wildcard $(addsuffix /pwd,$(SEARCHPATH))))
+ifeq ($(PWD),)
+nopwd:
+	@echo You need the GNU utils package to use this Makefile!
+	@echo Get ftp://ftp.freepascal.org/pub/fpc/dist/go32v2/utilgo32.zip
+	@exit
+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 cygwin,$(MACH_TYPE)),)
+inCygWin=1
+endif
+endif
+ifdef inUnix
+BATCHEXT=.sh
+else
+ifdef inOS2
+BATCHEXT=.cmd
+else
+BATCHEXT=.bat
+endif
+endif
+ifdef inUnix
+PATHSEP=/
+else
+PATHSEP=$(subst /,\,/)
+endif
+ifdef PWD
+BASEDIR:=$(shell $(PWD))
+else
+BASEDIR=.
+endif
+ifndef FPC
+ifdef PP
+FPC=$(PP)
+else
+FPC=ppc386
+endif
+endif
+override FPC:=$(subst $(SRCEXEEXT),,$(FPC))
+override FPC:=$(subst \,/,$(FPC))$(SRCEXEEXT)
+ifndef OS_TARGET
+OS_TARGET:=$(shell $(FPC) -iTO)
+endif
+ifndef OS_SOURCE
+OS_SOURCE:=$(shell $(FPC) -iSO)
+endif
+ifndef CPU_TARGET
+CPU_TARGET:=$(shell $(FPC) -iTP)
+endif
+ifndef CPU_SOURCE
+CPU_SOURCE:=$(shell $(FPC) -iSP)
+endif
+ifndef FPC_VERSION
+FPC_VERSION:=$(shell $(FPC) -iV)
+endif
+export FPC OS_TARGET OS_SOURCE CPU_TARGET CPU_SOURCE FPC_VERSION
+ifdef FPCDIR
+override FPCDIR:=$(subst \,/,$(FPCDIR))
+ifeq ($(wildcard $(addprefix $(FPCDIR)/,rtl units)),)
+override FPCDIR=wrong
+endif
+else
+override FPCDIR=wrong
+endif
+ifeq ($(FPCDIR),wrong)
+override FPCDIR=../..
+ifeq ($(wildcard $(FPCDIR)/rtl),)
+ifeq ($(wildcard $(FPCDIR)/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=c:/pp
+endif
+endif
+endif
+endif
+UNITSDIR=$(wildcard $(FPCDIR)/units/$(OS_TARGET))
+PACKAGESDIR=$(wildcard $(FPCDIR) $(FPCDIR)/packages)
+override PACKAGE_NAME=libgd
+override PACKAGE_VERSION=1.0.5
+override TARGET_UNITS+=gd
+override TARGET_EXAMPLES+=gdtest
+ifndef ECHO
+ECHO:=$(strip $(wildcard $(addsuffix /gecho$(EXEEXT),$(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
+ifndef COPY
+COPY:=cp -fp
+endif
+ifndef COPYTREE
+COPYTREE:=cp -rfp
+endif
+ifndef MOVE
+MOVE:=mv -f
+endif
+ifndef DEL
+DEL:=rm -f
+endif
+ifndef DELTREE
+DELTREE:=rm -rf
+endif
+ifndef INSTALL
+ifdef inUnix
+INSTALL:=install -c -m 644
+else
+INSTALL:=$(COPY)
+endif
+endif
+ifndef INSTALLEXE
+ifdef inUnix
+INSTALLEXE:=install -c -m 755
+else
+INSTALLEXE:=$(COPY)
+endif
+endif
+ifndef MKDIR
+ifdef inUnix
+MKDIR:=install -m 755 -d
+else
+MKDIR:=ginstall -m 755 -d
+endif
+endif
+export ECHO COPY COPYTREE MOVE DEL DELTREE INSTALL INSTALLEXE MKDIR
+ifndef AS
+AS=as
+endif
+ifndef LD
+LD=ld
+endif
+ifndef RC
+RC=rc
+endif
+PPAS=ppas$(BATCHEXT)
+ifdef inUnix
+LDCONFIG=ldconfig
+else
+LDCONFIG=
+endif
+ifndef PPUMOVE
+PPUMOVE:=$(strip $(wildcard $(addsuffix /ppumove$(SRCEXEEXT),$(SEARCHPATH))))
+ifeq ($(PPUMOVE),)
+PPUMOVE=
+else
+PPUMOVE:=$(firstword $(PPUMOVE))
+endif
+endif
+export PPUMOVE
+ifndef PPUFILES
+PPUFILES:=$(strip $(wildcard $(addsuffix /ppufiles$(SRCEXEEXT),$(SEARCHPATH))))
+ifeq ($(PPUFILES),)
+PPUFILES=
+else
+PPUFILES:=$(firstword $(PPUFILES))
+endif
+endif
+export PPUFILES
+ifndef DATE
+DATE:=$(strip $(wildcard $(addsuffix /date$(SRCEXEEXT),$(SEARCHPATH))))
+ifeq ($(DATE),)
+DATE:=$(strip $(wildcard $(addsuffix /gdate$(SRCEXEEXT),$(SEACHPATH))))
+ifeq ($(DATE),)
+DATE=
+else
+DATE:=$(firstword $(DATE))
+endif
+else
+DATE:=$(firstword $(DATE))
+endif
+endif
+export DATE
+ifdef DATE
+DATESTR:=$(shell $(DATE) +%Y%m%d)
+else
+DATESTR=
+endif
+ifndef UPXPROG
+ifeq ($(OS_TARGET),go32v2)
+UPXPROG:=1
+endif
+ifeq ($(OS_TARGET),win32)
+UPXPROG:=1
+endif
+ifdef UPXPROG
+UPXPROG:=$(strip $(wildcard $(addsuffix /upx$(SRCEXEEXT),$(SEARCHPATH))))
+ifeq ($(UPXPROG),)
+UPXPROG=
+else
+UPXPROG:=$(firstword $(UPXPROG))
+endif
+else
+UPXPROG=
+endif
+endif
+export UPXPROG
+ifndef ZIPPROG
+ZIPPROG:=$(strip $(wildcard $(addsuffix /zip$(SRCEXEEXT),$(SEARCHPATH))))
+ifeq ($(ZIPPROG),)
+ZIPPROG=
+else
+ZIPPROG:=$(firstword $(ZIPPROG))
+endif
+endif
+export ZIPPROG
+ZIPOPT=-9
+ZIPEXT=.zip
+ifndef TARPROG
+TARPROG:=$(strip $(wildcard $(addsuffix /tar$(SRCEXEEXT),$(SEARCHPATH))))
+ifeq ($(TARPROG),)
+TARPROG=
+else
+TARPROG:=$(firstword $(TARPROG))
+endif
+endif
+export TARPROG
+ifeq ($(USETAR),bz2)
+TAROPT=vI
+TAREXT=.tar.bz2
+else
+TAROPT=vz
+TAREXT=.tar.gz
+endif
+LOADEREXT=.as
+EXEEXT=.exe
+PPLEXT=.ppl
+PPUEXT=.ppu
+OEXT=.o
+ASMEXT=.s
+SMARTEXT=.sl
+STATICLIBEXT=.a
+SHAREDLIBEXT=.so
+LIBPREFIX=lib
+RSTEXT=.rst
+FPCMADE=fpcmade
+ifeq ($(OS_TARGET),go32v1)
+PPUEXT=.pp1
+OEXT=.o1
+ASMEXT=.s1
+SMARTEXT=.sl1
+STATICLIBEXT=.a1
+SHAREDLIBEXT=.so1
+LIBPREFIX=
+FPCMADE=fpcmade.v1
+PACKAGESUFFIX=v1
+endif
+ifeq ($(OS_TARGET),go32v2)
+LIBPREFIX=
+FPCMADE=fpcmade.dos
+ZIPSUFFIX=go32
+endif
+ifeq ($(OS_TARGET),linux)
+EXEEXT=
+HASSHAREDLIB=1
+FPCMADE=fpcmade.lnx
+ZIPSUFFIX=linux
+endif
+ifeq ($(OS_TARGET),freebsd)
+EXEEXT=
+HASSHAREDLIB=1
+FPCMADE=fpcmade.freebsd
+ZIPSUFFIX=freebsd
+endif
+ifeq ($(OS_TARGET),win32)
+PPUEXT=.ppw
+OEXT=.ow
+ASMEXT=.sw
+SMARTEXT=.slw
+STATICLIBEXT=.aw
+SHAREDLIBEXT=.dll
+FPCMADE=fpcmade.w32
+ZIPSUFFIX=w32
+endif
+ifeq ($(OS_TARGET),os2)
+PPUEXT=.ppo
+ASMEXT=.so2
+OEXT=.oo2
+AOUTEXT=.out
+SMARTEXT=.so
+STATICLIBEXT=.ao2
+SHAREDLIBEXT=.dll
+FPCMADE=fpcmade.os2
+ZIPSUFFIX=emx
+endif
+ifdef REQUIRE_UNITSDIR
+override UNITSDIR+=$(REQUIRE_UNITSDIR)
+endif
+ifdef REQUIRE_PACKAGESDIR
+override PACKAGESDIR+=$(REQUIRE_PACKAGESDIR)
+endif
+ifdef ZIPINSTALL
+ifeq ($(OS_TARGET),linux)
+UNIXINSTALLDIR=1
+endif
+ifeq ($(OS_TARGET),freebsd)
+UNIXINSTALLDIR=1
+endif
+else
+ifeq ($(OS_SOURCE),linux)
+UNIXINSTALLDIR=1
+endif
+ifeq ($(OS_SOURCE),freebsd)
+UNIXINSTALLDIR=1
+endif
+endif
+ifndef INSTALL_PREFIX
+ifdef UNIXINSTALLDIR
+INSTALL_PREFIX=/usr/local
+else
+INSTALL_PREFIX=/pp
+endif
+endif
+export INSTALL_PREFIX
+ifndef DIST_DESTDIR
+DIST_DESTDIR:=$(BASEDIR)
+endif
+export DIST_DESTDIR
+ifndef INSTALL_BASEDIR
+ifdef UNIXINSTALLDIR
+INSTALL_BASEDIR=$(INSTALL_PREFIX)/lib/fpc/$(FPC_VERSION)
+else
+INSTALL_BASEDIR=$(INSTALL_PREFIX)
+endif
+endif
+ifndef INSTALL_BINDIR
+ifdef UNIXINSTALLDIR
+INSTALL_BINDIR=$(INSTALL_PREFIX)/bin
+else
+INSTALL_BINDIR=$(INSTALL_BASEDIR)/bin/$(OS_TARGET)
+endif
+endif
+ifndef INSTALL_UNITDIR
+INSTALL_UNITDIR=$(INSTALL_BASEDIR)/units/$(OS_TARGET)
+ifdef PACKAGE_NAME
+INSTALL_UNITDIR:=$(INSTALL_UNITDIR)/$(PACKAGE_NAME)
+endif
+endif
+ifndef INSTALL_LIBDIR
+ifdef UNIXINSTALLDIR
+INSTALL_LIBDIR=$(INSTALL_PREFIX)/lib
+else
+INSTALL_LIBDIR=$(INSTALL_UNITDIR)
+endif
+endif
+ifndef INSTALL_SOURCEDIR
+ifdef UNIXINSTALLDIR
+INSTALL_SOURCEDIR=$(INSTALL_PREFIX)/src/fpc-$(FPC_VERSION)
+else
+INSTALL_SOURCEDIR=$(INSTALL_BASEDIR)/source
+endif
+ifdef PACKAGE_NAME
+INSTALL_SOURCEDIR:=$(INSTALL_SOURCEDIR)/$(PACKAGE_NAME)
+endif
+endif
+ifndef INSTALL_DOCDIR
+ifdef UNIXINSTALLDIR
+INSTALL_DOCDIR=$(INSTALL_PREFIX)/doc/fpc-$(FPC_VERSION)
+else
+INSTALL_DOCDIR=$(INSTALL_BASEDIR)/doc
+endif
+endif
+ifndef INSTALL_EXAMPLEDIR
+ifdef UNIXINSTALLDIR
+INSTALL_EXAMPLEDIR=$(INSTALL_DOCDIR)/examples
+else
+INSTALL_EXAMPLEDIR=$(INSTALL_BASEDIR)/examples
+endif
+ifdef EXAMPLESUBDIR
+INSTALL_EXAMPLEDIR:=$(INSTALL_EXAMPLEDIR)/$(EXAMPLESUBDIR)
+endif
+endif
+ifndef INSTALL_DATADIR
+INSTALL_DATADIR=$(INSTALL_BASEDIR)
+endif
+ifdef inUnix
+ifndef GCCLIBDIR
+GCCLIBDIR:=$(shell dirname `(gcc -v 2>&1)| head -n 1| awk '{ print $$4 } '`)
+endif
+ifndef OTHERLIBDIR
+OTHERLIBDIR:=$(shell grep -v "^\#" /etc/ld.so.conf | awk '{ ORS=" "; print $1 }')
+endif
+export GCCLIBDIR OTHERLIB
+endif
+ifeq ($(OS_TARGET),linux)
+REQUIRE_PACKAGES_RTL=1
+endif
+ifeq ($(OS_TARGET),go32v2)
+REQUIRE_PACKAGES_RTL=1
+endif
+ifeq ($(OS_TARGET),win32)
+REQUIRE_PACKAGES_RTL=1
+endif
+ifeq ($(OS_TARGET),os2)
+REQUIRE_PACKAGES_RTL=1
+endif
+ifeq ($(OS_TARGET),freebsd)
+REQUIRE_PACKAGES_RTL=1
+endif
+ifdef REQUIRE_PACKAGES_RTL
+PACKAGEDIR_RTL:=$(subst /Makefile.fpc,,$(strip $(wildcard $(addsuffix /rtl/Makefile.fpc,$(PACKAGESDIR)))))
+ifneq ($(PACKAGEDIR_RTL),)
+PACKAGEDIR_RTL:=$(firstword $(PACKAGEDIR_RTL))
+ifeq ($(wildcard $(PACKAGEDIR_RTL)/$(FPCMADE)),)
+override COMPILEPACKAGES+=package_rtl
+package_rtl:
+	$(MAKE) -C $(PACKAGEDIR_RTL) all
+endif
+ifneq ($(wildcard $(PACKAGEDIR_RTL)/$(OS_TARGET)),)
+UNITDIR_RTL=$(PACKAGEDIR_RTL)/$(OS_TARGET)
+else
+UNITDIR_RTL=$(PACKAGEDIR_RTL)
+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
+endif
+.PHONY: package_rtl
+override FPCOPTDEF=$(CPU_TARGET)
+ifneq ($(OS_TARGET),$(OS_SOURCE))
+override FPCOPT+=-T$(OS_TARGET)
+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
+override FPCOPT+=-Xs -OG2p3 -n
+override FPCOPTDEF+=RELEASE
+endif
+ifdef STRIP
+override FPCOPT+=-Xs
+endif
+ifdef OPTIMIZE
+override FPCOPT+=-OG2p3
+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 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_TARGETDIR)/
+endif
+else
+ifdef COMPILER_TARGETDIR
+override COMPILER_UNITTARGETDIR=$(COMPILER_TARGETDIR)
+override UNITTARGETDIRPREFIX=$(TARGETDIRPREFIX)
+endif
+endif
+ifdef GCCLIBDIR
+override FPCOPT+=-Fl$(GCCLIBDIR)
+endif
+ifdef OTHERLIBDIR
+override FPCOPT+=$(addprefix -Fl,$(OTHERLIBDIR))
+endif
+ifdef OPT
+override FPCOPT+=$(OPT)
+endif
+ifdef FPCOPTDEF
+override FPCOPT+=$(addprefix -d,$(FPCOPTDEF))
+endif
+ifdef CFGFILE
+override FPCOPT+=@$(CFGFILE)
+endif
+ifeq ($(OS_SOURCE),win32)
+override FPCEXTCMD:=$(FPCOPT)
+override FPCOPT:=!FPCEXTCMD
+export FPCEXTCMD
+endif
+override COMPILER:=$(FPC) $(FPCOPT)
+ifeq (,$(findstring -s ,$(COMPILER)))
+EXECPPAS=
+else
+ifeq ($(OS_SOURCE),$(OS_TARGET))
+EXECPPAS:=@$(PPAS)
+endif
+endif
+.PHONY: fpc_units
+ifdef TARGET_UNITS
+override ALLTARGET+=fpc_units
+override UNITPPUFILES=$(addsuffix $(PPUEXT),$(TARGET_UNITS))
+override INSTALLPPUFILES+=$(UNITPPUFILES)
+override CLEANPPUFILES+=$(UNITPPUFILES)
+endif
+fpc_units: $(UNITPPUFILES)
+.PHONY: fpc_examples fpc_test
+ifdef TARGET_EXAMPLES
+HASEXAMPLES=1
+override EXAMPLESOURCEFILES:=$(wildcard $(addsuffix .pp,$(TARGET_EXAMPLES)) $(addsuffix .pas,$(TARGET_EXAMPLES)))
+override EXAMPLEFILES:=$(addsuffix $(EXEEXT),$(TARGET_EXAMPLES))
+override EXAMPLEOFILES:=$(addsuffix $(OEXT),$(TARGET_EXAMPLES)) $(addprefix $(LIBPREFIX),$(addsuffix $(STATICLIBEXT),$(TARGET_EXAMPLES)))
+override CLEANEXEFILES+=$(EXAMPLEFILES) $(EXAMPLEOFILES)
+ifeq ($(OS_TARGET),os2)
+override CLEANEXEFILES+=$(addsuffix $(AOUTEXT),$(TARGET_EXAMPLES))
+endif
+endif
+ifdef TARGET_EXAMPLEDIRS
+HASEXAMPLES=1
+endif
+fpc_examples: all $(EXAMPLEFILES) $(addsuffix _all,$(TARGET_EXAMPLEDIRS))
+.PHONY: fpc_packages fpc_all fpc_smart fpc_debug
+$(FPCMADE): $(ALLTARGET)
+	@$(ECHO) Compiled > $(FPCMADE)
+fpc_packages: $(COMPILEPACKAGES)
+fpc_all: fpc_packages $(FPCMADE)
+fpc_smart:
+	$(MAKE) all LINKSMART=1 CREATESMART=1
+fpc_debug:
+	$(MAKE) all DEBUG=1
+.SUFFIXES: $(EXEEXT) $(PPUEXT) $(OEXT) .pas .pp
+%$(PPUEXT): %.pp
+	$(COMPILER) $<
+	$(EXECPPAS)
+%$(PPUEXT): %.pas
+	$(COMPILER) $<
+	$(EXECPPAS)
+%$(EXEEXT): %.pp
+	$(COMPILER) $<
+	$(EXECPPAS)
+%$(EXEEXT): %.pas
+	$(COMPILER) $<
+	$(EXECPPAS)
+vpath %.pp $(COMPILER_SOURCEDIR) $(COMPILER_INCLUDEDIR)
+vpath %.pas $(COMPILER_SOURCEDIR) $(COMPILER_INCLUDEDIR)
+vpath %$(PPUEXT) $(COMPILER_UNITTARGETDIR)
+.PHONY: fpc_install fpc_sourceinstall fpc_exampleinstall
+ifdef INSTALL_UNITS
+override INSTALLPPUFILES+=$(addsuffix $(PPUEXT),$(INSTALL_UNITS))
+endif
+ifdef INSTALLPPUFILES
+ifdef PPUFILES
+override INSTALLPPUFILES:=$(addprefix $(UNITTARGETDIRPREFIX),$(INSTALLPPUFILES))
+override INSTALLPPULINKFILES:=$(addprefix $(UNITTARGETDIRPREFIX),$(shell $(PPUFILES) -S -O $(INSTALLPPUFILES)))
+else
+override INSTALLPPULINKFILES:=$(subst $(PPUEXT),$(OEXT),$(INSTALLPPUFILES)) $(addprefix $(LIBPREFIX),$(subst $(PPUEXT),$(STATICLIBEXT),$(INSTALLPPUFILES)))
+override INSTALLPPUFILES:=$(addprefix $(UNITTARGETDIRPREFIX),$(INSTALLPPUFILES))
+override INSTALLPPULINKFILES:=$(wildcard $(addprefix $(UNITTARGETDIRPREFIX),$(INSTALLPPULINKFILES)))
+endif
+endif
+ifdef INSTALLEXEFILES
+override INSTALLEXEFILES:=$(addprefix $(TARGETDIRPREFIX),$(INSTALLEXEFILES))
+endif
+fpc_install: $(INSTALLTARGET)
+ifdef INSTALLEXEFILES
+	$(MKDIR) $(INSTALL_BINDIR)
+ifdef UPXPROG
+	-$(UPXPROG) $(INSTALLEXEFILES)
+endif
+	$(INSTALLEXE) $(INSTALLEXEFILES) $(INSTALL_BINDIR)
+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
+fpc_distinstall: fpc_install fpc_exampleinstall
+.PHONY: fpc_zipinstall fpc_zipsourceinstall fpc_zipexampleinstall
+ifndef PACKDIR
+ifndef inUnix
+PACKDIR=$(BASEDIR)/../pack_tmp/$(PACKAGE_NAME)
+else
+PACKDIR=/tmp/fpc-pack/$(PACKAGE_NAME)
+endif
+endif
+ifndef ZIPNAME
+ifdef DIST_ZIPNAME
+ZIPNAME=$(DIST_ZIPNAME)
+else
+ZIPNAME=$(ZIPPREFIX)$(PACKAGE_NAME)$(ZIPSUFFIX)
+endif
+endif
+ifndef ZIPTARGET
+ifdef DIST_ZIPTARGET
+ZIPTARGET=DIST_ZIPTARGET
+else
+ZIPTARGET=install
+endif
+endif
+ifndef USEZIP
+ifdef inUnix
+USETAR=1
+endif
+endif
+ifdef inOS2
+USEZIPWRAPPER=1
+endif
+ZIPWRAPPER=$(DIST_DESTDIR)/fpczip$(BATCHEXT)
+ZIPCMD_CDPACK:=cd $(subst /,$(PATHSEP),$(PACKDIR))
+ZIPCMD_CDBASE:=cd $(subst /,$(PATHSEP),$(BASEDIR))
+ifdef USETAR
+ZIPDESTFILE:=$(DIST_DESTDIR)/$(ZIPNAME)$(TAREXT)
+ZIPCMD_ZIP:=$(TARPROG) cf$(TAROPT) $(ZIPDESTFILE) *
+else
+ZIPDESTFILE:=$(DIST_DESTDIR)/$(ZIPNAME)$(ZIPEXT)
+ZIPCMD_ZIP:=$(subst /,$(PATHSEP),$(ZIPPROG)) -Dr $(ZIPOPT) $(ZIPDESTFILE) *
+endif
+fpc_zipinstall:
+	$(MAKE) $(ZIPTARGET) INSTALL_PREFIX=$(PACKDIR) ZIPINSTALL=1
+	$(DEL) $(ZIPDESTFILE)
+ifdef USEZIPWRAPPER
+ifneq ($(ECHO),echo)
+	$(ECHO) "$(ZIPCMD_CDPACK)" > $(ZIPWRAPPER)
+	$(ECHO) "$(ZIPCMD_ZIP)" >> $(ZIPWRAPPER)
+	$(ECHO) "$(ZIPCMD_CDBASE)" >> $(ZIPWRAPPER)
+else
+	$(ECHO) $(ZIPCMD_CDPACK) > $(ZIPWRAPPER)
+	$(ECHO) $(ZIPCMD_ZIP) >> $(ZIPWRAPPER)
+	$(ECHO) $(ZIPCMD_CDBASE) >> $(ZIPWRAPPER)
+endif
+ifdef inUnix
+	/bin/sh $(ZIPWRAPPER)
+else
+	$(ZIPWRAPPER)
+endif
+	$(DEL) $(ZIPWRAPPER)
+else
+	$(ZIPCMD_CDPACK) ; $(ZIPCMD_ZIP) ; $(ZIPCMD_CDBASE)
+endif
+	$(DELTREE) $(PACKDIR)
+fpc_zipsourceinstall:
+	$(MAKE) fpc_zipinstall ZIPTARGET=sourceinstall ZIPSUFFIX=src
+fpc_zipexampleinstall:
+ifdef HASEXAMPLES
+	$(MAKE) fpc_zipinstall ZIPTARGET=exampleinstall ZIPSUFFIX=exm
+endif
+fpc_zipdistinstall:
+	$(MAKE) fpc_zipinstall ZIPTARGET=distinstall
+.PHONY: fpc_clean fpc_cleanall fpc_distclean
+ifdef EXEFILES
+override CLEANEXEFILES:=$(addprefix $(TARGETDIRPREFIX),$(CLEANEXEFILES))
+endif
+ifdef CLEAN_UNITS
+override CLEANPPUFILES+=$(addsuffix $(PPUEXT),$(CLEAN_UNITS))
+endif
+ifdef CLEANPPUFILES
+override CLEANPPUFILES:=$(addprefix $(UNITTARGETDIRPREFIX),$(CLEANPPUFILES))
+ifdef PPUFILES
+CLEANPPULINKFILES:=$(shell $(PPUFILES) $(CLEANPPUFILES))
+else
+CLEANPPULINKFILES:=$(wildcard $(subst $(PPUEXT),$(OEXT),$(CLEANPPUFILES)) $(addprefix $(LIBPREFIX),$(subst $(PPUEXT),$(STATICLIBEXT),$(CLEANPPUFILES))))
+endif
+override CLEANPPULINKFILES:=$(addprefix $(UNITTARGETDIRPREFIX),$(CLEANPPULINKFILES))
+endif
+fpc_clean: $(CLEANTARGET)
+ifdef CLEANEXEFILES
+	-$(DEL) $(CLEANEXEFILES)
+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) $(PPAS) link.res $(FPCEXTFILE) $(REDIRFILE)
+fpc_distclean: fpc_clean
+ifdef COMPILER_UNITTARGETDIR
+TARGETDIRCLEAN=fpc_clean
+endif
+fpc_cleanall: $(CLEANTARGET) $(TARGETDIRCLEAN)
+ifdef CLEANEXEFILES
+	-$(DEL) $(CLEANEXEFILES)
+endif
+	-$(DEL) *$(OEXT) *$(PPUEXT) *$(RSTEXT) *$(ASMEXT) *$(STATICLIBEXT) *$(SHAREDLIBEXT) *$(PPLEXT)
+	-$(DELTREE) *$(SMARTEXT)
+	-$(DEL) $(FPCMADE) $(PPAS) link.res $(FPCEXTFILE) $(REDIRFILE)
+ifdef AOUTEXT
+	-$(DEL) *$(AOUTEXT)
+endif
+.PHONY: fpc_info
+fpc_info:
+	@$(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)
+	@$(ECHO)  == Directory info ==
+	@$(ECHO)
+	@$(ECHO)  Basedir......... $(BASEDIR)
+	@$(ECHO)  FPCDir.......... $(FPCDIR)
+	@$(ECHO)  UnitsDir........ $(UNITSDIR)
+	@$(ECHO)  PackagesDir..... $(PACKAGESDIR)
+	@$(ECHO)
+	@$(ECHO)  GCC library..... $(GCCLIBDIR)
+	@$(ECHO)  Other library... $(OTHERLIBDIR)
+	@$(ECHO)
+	@$(ECHO)  == Tools info ==
+	@$(ECHO)
+	@$(ECHO)  Pwd....... $(PWD)
+	@$(ECHO)  Echo...... $(ECHO)
+	@$(ECHO)  PPUMove... $(PPUMOVE)
+	@$(ECHO)  PPUFiles.. $(PPUFILES)
+	@$(ECHO)  Date...... $(DATE)
+	@$(ECHO)  Upx....... $(UPXPROG)
+	@$(ECHO)  Zip....... $(ZIPPROG)
+	@$(ECHO)
+	@$(ECHO)  == Object info ==
+	@$(ECHO)
+	@$(ECHO)  Target Loaders...... $(TARGET_LOADERS)
+	@$(ECHO)  Target Units........ $(TARGET_UNITS)
+	@$(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)  ZipPrefix............ $(ZIPPREFIX)
+	@$(ECHO)  ZipSuffix............ $(ZIPSUFFIX)
+	@$(ECHO)
+	@$(ECHO)  INSTALL_BASEDIR...... $(INSTALL_BASEDIR)
+	@$(ECHO)  INSTALL_BINDIR....... $(INSTALL_BINDIR)
+	@$(ECHO)  INSTALL_LIBDIR....... $(INSTALL_LIBDIR)
+	@$(ECHO)  INSTALL_UNITDIR...... $(INSTALL_UNITDIR)
+	@$(ECHO)  INSTALL_SOURCEDIR.... $(INSTALL_SOURCEDIR)
+	@$(ECHO)  INSTALL_DOCDIR....... $(INSTALL_DOCDIR)
+	@$(ECHO)  INSTALL_DATADIR...... $(INSTALL_DATADIR)
+	@$(ECHO)
+	@$(ECHO)  DIST_DESTDIR......... $(DIST_DESTDIR)
+	@$(ECHO)  DIST_ZIPNAME......... $(DIST_ZIPNAME)
+	@$(ECHO)
+all: fpc_all
+debug: fpc_debug
+examples: fpc_examples
+smart: fpc_smart
+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
+distclean: fpc_distclean
+cleanall: fpc_cleanall
+info: fpc_info
+.PHONY: all debug examples smart shared install sourceinstall exampleinstall distinstall zipinstall zipsourceinstall zipexampleinstall zipdistinstall clean distclean cleanall info
+ifneq ($(wildcard fpcmake.loc),)
+include fpcmake.loc
+endif

+ 17 - 0
packages/libgd/Makefile.fpc

@@ -0,0 +1,17 @@
+#
+#   Makefile.fpc for GD Library interface
+#
+
+[package]
+name=libgd
+version=1.0.5
+
+[require]
+libc=y
+
+[target]
+units=gd
+examples=gdtest
+
+[default]
+fpcdir=../..

+ 30 - 0
packages/libgd/README

@@ -0,0 +1,30 @@
+This is the interface unit for the gd library, version 1.8.4.
+The gd library is a library to produce graphics files (jpeg,png and wbmp)
+
+The gd unit is a straight translation of the library headers.
+It has some additional calls which make it more pascal like:
+
+{overloaded pascal functions}
+function fopen(a,b:string):pFile;
+procedure gdImageChar(im:gdImagePtr; f:gdFontPtr; x:longint; y:longint; c:char; color:longint);
+procedure gdImageCharUp(im:gdImagePtr; f:gdFontPtr; x:longint; y:longint; c:char; color:longint); 
+procedure gdImageString(im:gdImagePtr; f:gdFontPtr; x:longint; y:longint; s:string;  color:longint); 
+procedure gdImageStringUp(im:gdImagePtr; f:gdFontPtr; x:longint; y:longint; s:string; color:longint); 
+procedure gdImageString16(im:gdImagePtr; f:gdFontPtr; x:longint; y:longint; s:string; color:longint); 
+procedure gdImageStringUp16(im:gdImagePtr; f:gdFontPtr; x:longint; y:longint; s:string; color:longint); 
+{$ifdef hasttf}
+function  gdImageStringTTF(im:PgdImage; brect:Plongint; fg:longint; fontlist:string; ptsize:double; angle:double; x:longint; y:longint; astring:string): string;
+function  gdImageStringFT(im:PgdImage; brect:Plongint; fg:longint; fontlist:string; ptsize:double; angle:double; x:longint; y:longint; astring:string):string;
+{$endif}
+
+These functions will work with both ansistrings and shortstrings; The unit
+can be compiled in both the {$H+} as the {$H-} state.
+
+The hasttf define should be defined for libraries which have TTF2 lib 
+support compiled in.
+
+The example is adapted from the example of the gd unit by Mike Bradbery.
+It shows how to use the pascal-like functions in the gd unit instead of the
+raw C like functions which use pchars.
+
+Michael.

+ 409 - 0
packages/libgd/gd.pp

@@ -0,0 +1,409 @@
+{
+    $Id$
+    This file is part of the Free Pascal run time library.
+    Copyright (c) 1999-2000 by Michael Van Canneyt, member of 
+    the Free Pascal development team
+
+    This file implements an interface to the gd library.
+    
+    See the file COPYING.FPC, included in this distribution,
+    for details about the copyright.
+
+    This program is distributed in the hope that it will be useful,
+    but WITHOUT ANY WARRANTY; without even the implied warranty of
+    MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
+
+ **********************************************************************}
+unit gd;
+
+  interface
+  
+{$linklib c}
+{$linklib m}
+{$linklib png}
+{$linklib gd}
+{$ifdef hasttf}
+{$linklib ttf}
+{$endif hasttf}
+
+{$PACKRECORDS C}
+
+const
+
+  libgd = 'gd';
+  libc = 'c';
+  
+  GD_H = 1;
+  DEFAULT_FONTPATH = '/usr/share/fonts/truetype';
+  PATHSEPARATOR = ':';
+  gdMaxColors = 256;
+
+type
+  PByte = ^Byte;
+  PPByte = ^PByte; 
+  PVoid = Pointer;
+  PFile = Pointer;
+  
+  PGDIMAGESTRUCT = ^gdImage;
+  gdImage = record
+    pixels : PPbyte;
+    sx : longint;
+    sy : longint;
+    colorsTotal : longint;
+    red : array[0..(gdMaxColors)-1] of longint;
+    green : array[0..(gdMaxColors)-1] of longint;
+    blue : array[0..(gdMaxColors)-1] of longint;
+    open : array[0..(gdMaxColors)-1] of longint;
+    transparent : longint;
+    polyInts : Plongint;
+    polyAllocated : longint;
+    brush : PgdImageStruct;
+    tile : PgdImageStruct;
+    brushColorMap : array[0..(gdMaxColors)-1] of longint;
+    tileColorMap : array[0..(gdMaxColors)-1] of longint;
+    styleLength : longint;
+    stylePos : longint;
+    style : Plongint;
+    interlace : longint;
+  end;
+
+  gdImageStruct = gdImage;
+  pgdImage = ^gdImage;
+  gdImagePtr = PgdImage;
+
+  gdFont = record
+       nchars : longint;
+       offset : longint;
+       w : longint;
+       h : longint;
+       data : Pchar;
+    end;
+  pgdFont = ^gdFont;
+  gdFontPtr = PgdFont;
+
+var
+  gdFontLarge      : gdFontPtr;external name 'gdFontLarge';
+  gdFontSmall      : gdFontPtr;external name 'gdFontSmall';
+  gdFontGiant      : gdFontPtr;external name 'gdFontGiant';
+  gdFontMediumBold : gdFontPtr;external name 'gdFontMediumBold';
+  gdFontTiny       : gdFontPtr;external name 'gdFontTiny';
+
+const
+  gdDashSize = 4;
+  gdStyled = -(2);
+  gdBrushed = -(3);
+  gdStyledBrushed = -(4);
+  gdTiled = -(5);
+  gdTransparent = -(6);
+
+type
+
+  gdSource = record
+    source : function (context:Pointer; buffer:Pchar; len:longint):longint;cdecl;
+    context : pointer;
+    end;
+  pgdSource = ^gdSource;
+  gdSourcePtr = PgdSource;
+
+  gdSink = record
+    sink : function (context:Pvoid; buffer:Pchar; len:longint):longint;cdecl;
+    context : pointer;
+  end;
+  pgdSink = ^gdSink;
+  gdSinkPtr = PgdSink;
+
+  gdPoint = record
+    x : longint;
+    y : longint;
+  end;
+  pgdPoint = ^gdPoint;
+  gdPointPtr = PgdPoint;
+
+  pgdIOCtx = ^gdIOCtx;
+  gdIOCtx = record
+    getC : function (_para1:PgdIOCtx):longint;cdecl;
+    getBuf : function (_para1:PgdIOCtx; _para2:pointer; _para3:longint):longint;
+    putC : procedure (_para1:PgdIOCtx; _para2:longint);
+    putBuf : function (_para1:PgdIOCtx; _para2:pointer; _para3:longint):longint;
+    seek : function (_para1:PgdIOCtx; _para2:longint):longint;
+    tell : function (_para1:PgdIOCtx):longint;
+    free : procedure (_para1:PgdIOCtx);
+  end;
+  GDIOCTXPTR = pgdIOCtx;
+  
+{ Translated from gd_io.h}
+function fopen(a,b:pchar):pFile; cdecl;external libc;
+procedure fclose(a:pFile); cdecl;external libc;
+
+procedure Putword(w:longint; ctx:PgdIOCtx); cdecl; external libgd;
+procedure Putchar(c:longint; ctx:PgdIOCtx); cdecl; external libgd;
+procedure gdPutC(c:byte; ctx:PgdIOCtx); cdecl; external libgd;
+function gdPutBuf(_para1:pointer; _para2:longint; _para3:PgdIOCtx):longint; cdecl; external libgd;
+procedure gdPutWord(w:longint; ctx:PgdIOCtx); cdecl; external libgd;
+procedure gdPutInt(w:longint; ctx:PgdIOCtx); cdecl; external libgd;
+function gdGetC(ctx:PgdIOCtx):longint; cdecl; external libgd;
+function gdGetBuf(_para1:pointer; _para2:longint; _para3:PgdIOCtx):longint; cdecl; external libgd;
+function gdGetByte(result:Plongint; ctx:PgdIOCtx):longint; cdecl; external libgd;
+function gdGetWord(result:Plongint; ctx:PgdIOCtx):longint; cdecl; external libgd;
+function gdGetInt(result:Plongint; ctx:PgdIOCtx):longint; cdecl; external libgd;
+function gdSeek(ctx:PgdIOCtx; _para2:longint):longint; cdecl; external libgd;
+function gdTell(ctx:PgdIOCtx):longint; cdecl; external libgd;
+
+function gdImageCreate(sx:longint; sy:longint):gdImagePtr; cdecl; external libgd;
+function gdImageCreateFromPng(fd:PFILE):gdImagePtr; cdecl; external libgd;
+function gdImageCreateFromPngCtx(inIO:gdIOCtxPtr):gdImagePtr; cdecl; external libgd;
+function gdImageCreateFromWBMP(inFile:PFILE):gdImagePtr; cdecl; external libgd;
+function gdImageCreateFromWBMPCtx(infile:PgdIOCtx):gdImagePtr; cdecl; external libgd;
+function gdImageCreateFromJpeg(infile:PFILE):gdImagePtr; cdecl; external libgd;
+function gdImageCreateFromJpegCtx(infile:PgdIOCtx):gdImagePtr; cdecl; external libgd;
+function gdImageCreateFromPngSource(infile:gdSourcePtr):gdImagePtr; cdecl; external libgd;
+function gdImageCreateFromGd(infile:PFILE):gdImagePtr; cdecl; external libgd;
+function gdImageCreateFromGdCtx(infile:gdIOCtxPtr):gdImagePtr; cdecl; external libgd;
+function gdImageCreateFromGd2(infile:PFILE):gdImagePtr; cdecl; external libgd;
+function gdImageCreateFromGd2Ctx(infile:gdIOCtxPtr):gdImagePtr; cdecl; external libgd;
+function gdImageCreateFromGd2Part(infile:PFILE; srcx:longint; srcy:longint; w:longint; h:longint):gdImagePtr; cdecl; external libgd;
+function gdImageCreateFromGd2PartCtx(infile:gdIOCtxPtr; srcx:longint; srcy:longint; w:longint; h:longint):gdImagePtr; cdecl; external libgd;
+function gdImageCreateFromXbm(fd:PFILE):gdImagePtr; cdecl; external libgd;
+procedure gdImageDestroy(im:gdImagePtr); cdecl; external libgd;
+procedure gdImageSetPixel(im:gdImagePtr; x:longint; y:longint; color:longint); cdecl; external libgd;
+function gdImageGetPixel(im:gdImagePtr; x:longint; y:longint):longint; cdecl; external libgd;
+procedure gdImageLine(im:gdImagePtr; x1:longint; y1:longint; x2:longint; y2:longint;  color:longint); cdecl; external libgd;
+procedure gdImageDashedLine(im:gdImagePtr; x1:longint; y1:longint; x2:longint; y2:longint;               color:longint); cdecl; external libgd;
+procedure gdImageRectangle(im:gdImagePtr; x1:longint; y1:longint; x2:longint; y2:longint;              color:longint); cdecl; external libgd;
+procedure gdImageFilledRectangle(im:gdImagePtr; x1:longint; y1:longint; x2:longint; y2:longint;               color:longint); cdecl; external libgd;
+function gdImageBoundsSafe(im:gdImagePtr; x:longint; y:longint):longint; cdecl; external libgd;
+procedure gdImageChar(im:gdImagePtr; f:gdFontPtr; x:longint; y:longint; c:longint; color:longint); cdecl; external libgd;
+procedure gdImageCharUp(im:gdImagePtr; f:gdFontPtr; x:longint; y:longint; c:longint; color:longint); cdecl; external libgd;
+procedure gdImageString(im:gdImagePtr; f:gdFontPtr; x:longint; y:longint; s:Pbyte;  color:longint); cdecl; external libgd;
+procedure gdImageStringUp(im:gdImagePtr; f:gdFontPtr; x:longint; y:longint; s:Pbyte; color:longint); cdecl; external libgd;
+procedure gdImageString16(im:gdImagePtr; f:gdFontPtr; x:longint; y:longint; s:Pword; color:longint); cdecl; external libgd;
+procedure gdImageStringUp16(im:gdImagePtr; f:gdFontPtr; x:longint; y:longint; s:Pword; color:longint); cdecl; external libgd;
+{$ifdef HasTTF}
+function gdImageStringTTF(im:PgdImage; brect:Plongint; fg:longint; fontlist:Pchar; ptsize:double; angle:double; x:longint; y:longint; astring:Pchar):Pchar; cdecl; external libgd;
+function gdImageStringFT(im:PgdImage; brect:Plongint; fg:longint; fontlist:Pchar; ptsize:double; angle:double; x:longint; y:longint; astring:Pchar):Pchar; cdecl; external libgd;
+{$endif hasTTF}
+procedure gdImagePolygon(im:gdImagePtr; p:gdPointPtr; n:longint; c:longint); cdecl; external libgd;
+procedure gdImageFilledPolygon(im:gdImagePtr; p:gdPointPtr; n:longint; c:longint); cdecl; external libgd;
+function gdImageColorAllocate(im:gdImagePtr; r:longint; g:longint; b:longint):longint; cdecl; external libgd;
+function gdImageColorClosest(im:gdImagePtr; r:longint; g:longint; b:longint):longint; cdecl; external libgd;
+function gdImageColorExact(im:gdImagePtr; r:longint; g:longint; b:longint):longint; cdecl; external libgd;
+function gdImageColorResolve(im:gdImagePtr; r:longint; g:longint; b:longint):longint; cdecl; external libgd;
+procedure gdImageColorDeallocate(im:gdImagePtr; color:longint); cdecl; external libgd;
+procedure gdImageColorTransparent(im:gdImagePtr; color:longint); cdecl; external libgd;
+procedure gdImagePaletteCopy(dst:gdImagePtr; src:gdImagePtr); cdecl; external libgd;
+procedure gdImagePng(im:gdImagePtr; out:PFILE); cdecl; external libgd;
+procedure gdImagePngCtx(im:gdImagePtr; out:PgdIOCtx); cdecl; external libgd;
+procedure gdImageWBMP(image:gdImagePtr; fg:longint; out:PFILE); cdecl; external libgd;
+procedure gdImageWBMPCtx(image:gdImagePtr; fg:longint; out:PgdIOCtx); cdecl; external libgd;
+procedure gdFree(m:Pvoid); cdecl; external libgd;
+function gdImageWBMPPtr(im:gdImagePtr; size:Plongint; fg:longint):pointer; cdecl; external libgd;
+procedure gdImageJpeg(im:gdImagePtr; out:PFILE; quality:longint); cdecl; external libgd;
+procedure gdImageJpegCtx(im:gdImagePtr; out:PgdIOCtx; quality:longint); cdecl; external libgd;
+function gdImageJpegPtr(im:gdImagePtr; size:Plongint; quality:longint):pointer; cdecl; external libgd;
+procedure gdImagePngToSink(im:gdImagePtr; out:gdSinkPtr); cdecl; external libgd;
+procedure gdImageGd(im:gdImagePtr; out:PFILE); cdecl; external libgd;
+procedure gdImageGd2(im:gdImagePtr; out:PFILE; cs:longint; fmt:longint); cdecl; external libgd;
+function gdImagePngPtr(im:gdImagePtr; size:Plongint):pointer; cdecl; external libgd;
+function gdImageGdPtr(im:gdImagePtr; size:Plongint):pointer; cdecl; external libgd;
+function gdImageGd2Ptr(im:gdImagePtr; cs:longint; fmt:longint; size:Plongint):pointer; cdecl; external libgd;
+procedure gdImageArc(im:gdImagePtr; cx:longint; cy:longint; w:longint; h:longint;  s:longint; e:longint; color:longint); cdecl; external libgd;
+procedure gdImageFillToBorder(im:gdImagePtr; x:longint; y:longint; border:longint; color:longint); cdecl; external libgd;
+procedure gdImageFill(im:gdImagePtr; x:longint; y:longint; color:longint); cdecl; external libgd;
+procedure gdImageCopy(dst:gdImagePtr; src:gdImagePtr; dstX:longint; dstY:longint; srcX:longint;             srcY:longint; w:longint; h:longint); cdecl; external libgd;
+procedure gdImageCopyMerge(dst:gdImagePtr; src:gdImagePtr; dstX:longint; dstY:longint; srcX:longint;              srcY:longint; w:longint; h:longint; pct:longint); cdecl; external libgd;
+procedure gdImageCopyMergeGray(dst:gdImagePtr; src:gdImagePtr; dstX:longint; dstY:longint; srcX:longint;              srcY:longint; w:longint; h:longint; pct:longint); cdecl; external libgd;
+procedure gdImageCopyResized(dst:gdImagePtr; src:gdImagePtr; dstX:longint; dstY:longint; srcX:longint;               srcY:longint; dstW:longint; dstH:longint; srcW:longint; srcH:longint); cdecl; external libgd;
+procedure gdImageSetBrush(im:gdImagePtr; brush:gdImagePtr); cdecl; external libgd;
+procedure gdImageSetTile(im:gdImagePtr; tile:gdImagePtr); cdecl; external libgd;
+procedure gdImageSetStyle(im:gdImagePtr; style:Plongint; noOfPixels:longint); cdecl; external libgd;
+procedure gdImageInterlace(im:gdImagePtr; interlaceArg:longint); cdecl; external libgd;
+  
+{ Translated macros }
+function gdImageSX(im : pgdimage) : longint;
+function gdImageSY(im : pgdimage) : longint;
+function gdImageColorsTotal(im : pgdimage) : longint;
+function gdImageRed(im : pgdimage; c : longint): longint;
+function gdImageGreen(im : pgdimage; c : longint): longint;
+function gdImageBlue(im : pgdimage; c : longint): longint;
+function gdImageGetTransparent(im : pgdimage) : longint;
+function gdImageGetInterlaced(im : pgdimage) : longint;
+
+function gdNewFileCtx(_para1:PFILE):PgdIOCtx; cdecl; external libgd;
+function gdNewDynamicCtx(_para1:longint; _para2:pointer):PgdIOCtx; cdecl; external libgd;
+function gdNewSSCtx(infile:gdSourcePtr; out:gdSinkPtr):PgdIOCtx; cdecl; external libgd;
+function gdDPExtractData(ctx:pointer; size:Plongint):pointer; cdecl; external libgd;
+
+{overloaded pascal functions}
+function fopen(a,b:string):pFile;
+procedure gdImageChar(im:gdImagePtr; f:gdFontPtr; x:longint; y:longint; c:char; color:longint);
+procedure gdImageCharUp(im:gdImagePtr; f:gdFontPtr; x:longint; y:longint; c:char; color:longint); 
+procedure gdImageString(im:gdImagePtr; f:gdFontPtr; x:longint; y:longint; s:string;  color:longint); 
+procedure gdImageStringUp(im:gdImagePtr; f:gdFontPtr; x:longint; y:longint; s:string; color:longint); 
+procedure gdImageString16(im:gdImagePtr; f:gdFontPtr; x:longint; y:longint; s:string; color:longint); 
+procedure gdImageStringUp16(im:gdImagePtr; f:gdFontPtr; x:longint; y:longint; s:string; color:longint); 
+{$ifdef hasttf}
+function  gdImageStringTTF(im:PgdImage; brect:Plongint; fg:longint; fontlist:string; ptsize:double; angle:double; x:longint; y:longint; astring:string): string;
+function  gdImageStringFT(im:PgdImage; brect:Plongint; fg:longint; fontlist:string; ptsize:double; angle:double; x:longint; y:longint; astring:string):string;
+{$endif}
+
+
+const
+  GD2_CHUNKSIZE = 128;
+  GD2_CHUNKSIZE_MIN = 64;
+  GD2_CHUNKSIZE_MAX = 4096;
+  GD2_VERS = 1;
+  GD2_ID = 'gd2';
+  GD2_FMT_RAW = 1;
+  GD2_FMT_COMPRESSED = 2;
+
+function gdImageCompare(im1:gdImagePtr; im2:gdImagePtr):longint;cdecl; external libgd;
+  
+const
+  GD_CMP_IMAGE = 1;
+  GD_CMP_NUM_COLORS = 2;
+  GD_CMP_COLOR = 4;
+  GD_CMP_SIZE_X = 8;
+  GD_CMP_SIZE_Y = 16;
+  GD_CMP_TRANSPARENT = 32;
+  GD_CMP_BACKGROUND = 64;
+  GD_CMP_INTERLACE = 128;
+  GD_RESOLUTION = 96;
+
+implementation
+
+  function gdImageSX(im : pgdimage) : longint;
+    begin
+       gdImageSX:=im^.sx;
+    end;
+  function gdImageSY(im : pgdimage) : longint;
+    begin
+       gdImageSY:=im^.sy;
+    end;
+  function gdImageColorsTotal(im : pgdimage) : longint;
+    begin
+       gdImageColorsTotal:=im^.colorsTotal;
+    end;
+  function gdImageGetTransparent(im : pgdimage) : longint;
+    begin
+       gdImageGetTransparent:=im^.transparent;
+    end;
+  function gdImageGetInterlaced(im : pgdimage) : longint;
+    begin
+       gdImageGetInterlaced:=im^.interlace;
+    end;
+    
+  function gdImageRed(im : pgdimage; c : longint): longint;
+  
+  begin
+    gdImageRed:=im^.red[c];
+  end;
+
+  function gdImageGreen(im : pgdimage; c : longint): longint;
+  
+  begin
+    gdImageGreen := im^.green[c];
+  end;
+  
+  function gdImageBlue(im : pgdimage; c : longint): longint;
+
+  begin
+    gdImageBlue := im^.blue[c];
+  end;
+
+function fopen(a,b:string):pFile;
+
+begin
+{$ifopt h+}
+  fopen:=fopen(pchar(a),pchar(b));
+{$else}
+  a:=a+#0;  
+  b:=b+#0;
+  fopen:=fopen(@a[1],@b[1]);
+{$endif}
+end;
+
+procedure gdImageChar(im:gdImagePtr; f:gdFontPtr; x:longint; y:longint; c:char; color:longint);
+
+begin
+  gdimagechar(im,f,x,y,ord(c),color);
+end;
+
+procedure gdImageCharUp(im:gdImagePtr; f:gdFontPtr; x:longint; y:longint; c:char; color:longint);
+
+begin
+  gdimagecharup(im,f,x,y,ord(c),color);
+end;
+
+procedure gdImageString(im:gdImagePtr; f:gdFontPtr; x:longint; y:longint; s:string;  color:longint);
+
+begin
+{$ifopt h+}
+  gdImageString(im,f,x,y,pbyte(pchar(s)),color);
+{$else}
+  s:=s+#0;
+  gdImageString(im,f,x,y,@s[1],color);
+{$endif}  
+end;
+
+procedure gdImageStringUp(im:gdImagePtr; f:gdFontPtr; x:longint; y:longint; s:string; color:longint);
+
+begin
+{$ifopt h+} 
+  gdImageStringUp(im,f,x,y,pbyte(pchar(s)),color);
+{$else}
+  s:=s+#0;
+  gdImageStringUp(im,f,x,y,pbyte(@s[1]),color);
+{$endif}  
+end;
+
+procedure gdImageString16(im:gdImagePtr; f:gdFontPtr; x:longint; y:longint; s:string; color:longint);
+
+begin
+{$ifopt h+}
+  gdImageString16(im,f,x,y,pword(pchar(s)),color);
+{$else}
+  s:=s+#0;
+  gdImageString16(im,f,x,y,pword(@s[1]),color);
+{$endif}  
+end;
+
+procedure gdImageStringUp16(im:gdImagePtr; f:gdFontPtr; x:longint; y:longint; s:string; color:longint);
+
+begin
+{$ifopt h+}
+  gdImageStringUp16(im,f,x,y,pword(pchar(s)),color);
+{$else}  
+  s:=s+#0;
+  gdImageStringUp16(im,f,x,y,pword(@s[1]),color);
+{$endif}  
+end;
+
+{$ifdef hasttf}
+
+function gdImageStringTTF(im:PgdImage; brect:Plongint; fg:longint; fontlist:string; ptsize:double; angle:double; x:longint; y:longint; astring:string): string;
+
+begin
+{$ifopt h+}  
+  gdImageStringTTF:=strpas(gdImageStringTTF(im,brect,fg,pchar(fontlist),ptsize,angle,x,y,pchar(astring)));
+{$else}  
+  fontlist:=fornlist+#0;
+  astring:=astring+#0;
+  gdImageStringTTF:=strpas(gdImageStringTTF(im,brect,fg,@fontlist[1],ptsize,angle,x,y,@astring[1]));
+{$endif}
+end;
+
+function gdImageStringFT(im:PgdImage; brect:Plongint; fg:longint; fontlist:string; ptsize:double; angle:double; x:longint; y:longint; astring:string):string;
+
+begin
+{$ifopt h+}
+  gdImageStringFT:=strpas(gdImageStringFT(im,brect,fg,pchar(fontlist),ptsize,angle,x,y,pchar(astring)));
+{$else}
+  fontlist:=fornlist+#0;
+  astring:=astring+#0;
+  gdImageStringFT:=strpas(gdImageStringFT(im,brect,fg,@fontlist[1],ptsize,angle,x,y,@astring[1]));
+    
+{$endif}  
+end;
+{$endif}
+
+end.

+ 82 - 0
packages/libgd/gdtest.pp

@@ -0,0 +1,82 @@
+{ Author   : Mike Bradbery 
+  Copyright: 2000 Mike Bradbery and others, see file "forum.txt" }
+
+program gdtest;
+
+uses gd;
+
+var 
+  f:pFile;
+  black,white:integer;
+  red,green,blue:integer;
+  im:gdImagePtr;
+  s1,s2:string;
+  points:array[0..2] of gdpoint;
+  x : longint;
+  styleDotted: array[0..1] of longint;
+  styleDashed: array[0..5] of longint;
+  top,bottom,left,right : longint;
+
+Begin
+  left := 60;
+  top := 30;
+  right := 580;
+  bottom := 300;
+  im:=gdImageCreate(600,390);
+  black:=gdImageColorAllocate(im,0,0,0);
+  white:=gdImageColorAllocate(im,255,255,255);
+  red:=gdImageColorAllocate(im,255,0,0);
+  green:=gdImageColorAllocate(im,0,255,0);
+  blue:=gdImageColorAllocate(im,0,0,255);
+  styleDotted[0] := red;
+  styleDotted[1] := gdTransparent;
+
+  styleDashed[0] := white;
+  styleDashed[1] := white;
+  styleDashed[2] := white;
+  styleDashed[3] := gdTransparent;
+  styleDashed[4] := gdTransparent;
+  styleDashed[5] := gdTransparent;
+  gdImageSetStyle(im,@styleDashed[0],6 );
+
+  {box around the lot}
+  gdImageRectangle(im,0,0,599,389,white);
+
+  {main title}
+  s1:='The Test Graph Title.';
+  gdImageString(im, gdFontLarge,{im^.w}600  div 2 - ((length(s1)-1)*gdFontLarge^.w div 2),2{gdFontLarge^.h}, s1, white);
+  gdImageLine(im,600  div 2 - ((length(s1)-1)*gdFontLarge^.w div 2),gdFontLarge^.h+3,600  div 2 + ((length(s1)-1)*gdFontLarge^.w div 2),gdFontLarge^.h+3,white);
+
+  {box around the legend.}
+  gdImageRectangle(im,100,350,500,370,white);
+  s1:='The Legend.';
+  gdImageString(im, gdFontLarge, 100+2, 350+2, s1, white);
+
+  s1:='The Y axis Title.';
+  gdImageStringUp(im, gdFontLarge, Left-5-gdFontLarge^.h-gdFontLarge^.w*2, top+(bottom-top) div 2+((length(s1)-1) * gdFontLarge^.w div 2),s1, white);
+  // gdImageStringUp(im, gdFontLarge, 2, 50, @s1[1], white);
+  s1:='The X axis Title.';
+  gdImageString(im, gdFontLarge, left+(right-left) div 2-((length(s1)-1)*gdFontLarge^.w div 2),Bottom + 5 +gdFontLarge^.h,s1,white);
+
+  {axis}
+  gdImageLine(im,left,top,left,bottom,white);
+  gdImageLine(im,left,bottom,right,bottom,white);
+
+  { the origin is 30,360}
+  for x:=0 to 10 do
+  begin
+    str(x,s1);
+    gdImageLine(im,left+(x*(right-left) div 10) ,bottom,left+(x*(right-left) div 10) ,bottom+3,white);
+    gdImageLine(im, left+(x*(right-left) div 10), bottom, left+(x*(right-left) div 10), top, gdStyled);
+    gdImageString(im, gdFontLarge, left+(x*(right-left) div 10) - ((length(s1)-1)*gdFontLarge^.w div 2),bottom+5, s1, white);
+    gdImageLine(im,left,bottom-(x*(bottom-top) div 10),left-3,bottom-(x*(bottom-top) div 10),white);
+    gdImageLine(im, left, bottom-(x*(bottom-top) div 10), right, bottom-(x*(bottom-top) div 10), gdStyled);
+    gdImageString(im, gdFontLarge,left-5-((length(s1)-1)*gdFontLarge^.w),bottom-(x*(bottom-top) div 10)-gdFontLarge^.h div 2, s1, white);
+  end;
+  f:=fopen(paramstr(1),'wb');
+  if (f=nil) then 
+    writeln('Help, the file pointer is nil');
+  gdImagePng(im,f);
+  fclose(f);
+  gdImageDestroy(im);
+End.

+ 908 - 0
packages/libpng/Makefile

@@ -0,0 +1,908 @@
+#
+# Don't edit, this file is generated by fpcmake v1.99.0 [2001/04/11]
+#
+default: all
+override PATH:=$(subst \,/,$(PATH))
+ifeq ($(findstring ;,$(PATH)),)
+inUnix=1
+SEARCHPATH=$(subst :, ,$(PATH))
+else
+SEARCHPATH=$(subst ;, ,$(PATH))
+endif
+PWD:=$(strip $(wildcard $(addsuffix /pwd.exe,$(SEARCHPATH))))
+ifeq ($(PWD),)
+PWD:=$(strip $(wildcard $(addsuffix /pwd,$(SEARCHPATH))))
+ifeq ($(PWD),)
+nopwd:
+	@echo You need the GNU utils package to use this Makefile!
+	@echo Get ftp://ftp.freepascal.org/pub/fpc/dist/go32v2/utilgo32.zip
+	@exit
+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 cygwin,$(MACH_TYPE)),)
+inCygWin=1
+endif
+endif
+ifdef inUnix
+BATCHEXT=.sh
+else
+ifdef inOS2
+BATCHEXT=.cmd
+else
+BATCHEXT=.bat
+endif
+endif
+ifdef inUnix
+PATHSEP=/
+else
+PATHSEP=$(subst /,\,/)
+endif
+ifdef PWD
+BASEDIR:=$(shell $(PWD))
+else
+BASEDIR=.
+endif
+ifndef FPC
+ifdef PP
+FPC=$(PP)
+else
+FPC=ppc386
+endif
+endif
+override FPC:=$(subst $(SRCEXEEXT),,$(FPC))
+override FPC:=$(subst \,/,$(FPC))$(SRCEXEEXT)
+ifndef OS_TARGET
+OS_TARGET:=$(shell $(FPC) -iTO)
+endif
+ifndef OS_SOURCE
+OS_SOURCE:=$(shell $(FPC) -iSO)
+endif
+ifndef CPU_TARGET
+CPU_TARGET:=$(shell $(FPC) -iTP)
+endif
+ifndef CPU_SOURCE
+CPU_SOURCE:=$(shell $(FPC) -iSP)
+endif
+ifndef FPC_VERSION
+FPC_VERSION:=$(shell $(FPC) -iV)
+endif
+export FPC OS_TARGET OS_SOURCE CPU_TARGET CPU_SOURCE FPC_VERSION
+ifdef FPCDIR
+override FPCDIR:=$(subst \,/,$(FPCDIR))
+ifeq ($(wildcard $(addprefix $(FPCDIR)/,rtl units)),)
+override FPCDIR=wrong
+endif
+else
+override FPCDIR=wrong
+endif
+ifeq ($(FPCDIR),wrong)
+override FPCDIR=../..
+ifeq ($(wildcard $(FPCDIR)/rtl),)
+ifeq ($(wildcard $(FPCDIR)/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=c:/pp
+endif
+endif
+endif
+endif
+UNITSDIR=$(wildcard $(FPCDIR)/units/$(OS_TARGET))
+PACKAGESDIR=$(wildcard $(FPCDIR) $(FPCDIR)/packages)
+override PACKAGE_NAME=libpng
+override PACKAGE_VERSION=1.0.5
+override TARGET_UNITS+=png
+ifndef ECHO
+ECHO:=$(strip $(wildcard $(addsuffix /gecho$(EXEEXT),$(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
+ifndef COPY
+COPY:=cp -fp
+endif
+ifndef COPYTREE
+COPYTREE:=cp -rfp
+endif
+ifndef MOVE
+MOVE:=mv -f
+endif
+ifndef DEL
+DEL:=rm -f
+endif
+ifndef DELTREE
+DELTREE:=rm -rf
+endif
+ifndef INSTALL
+ifdef inUnix
+INSTALL:=install -c -m 644
+else
+INSTALL:=$(COPY)
+endif
+endif
+ifndef INSTALLEXE
+ifdef inUnix
+INSTALLEXE:=install -c -m 755
+else
+INSTALLEXE:=$(COPY)
+endif
+endif
+ifndef MKDIR
+ifdef inUnix
+MKDIR:=install -m 755 -d
+else
+MKDIR:=ginstall -m 755 -d
+endif
+endif
+export ECHO COPY COPYTREE MOVE DEL DELTREE INSTALL INSTALLEXE MKDIR
+ifndef AS
+AS=as
+endif
+ifndef LD
+LD=ld
+endif
+ifndef RC
+RC=rc
+endif
+PPAS=ppas$(BATCHEXT)
+ifdef inUnix
+LDCONFIG=ldconfig
+else
+LDCONFIG=
+endif
+ifndef PPUMOVE
+PPUMOVE:=$(strip $(wildcard $(addsuffix /ppumove$(SRCEXEEXT),$(SEARCHPATH))))
+ifeq ($(PPUMOVE),)
+PPUMOVE=
+else
+PPUMOVE:=$(firstword $(PPUMOVE))
+endif
+endif
+export PPUMOVE
+ifndef PPUFILES
+PPUFILES:=$(strip $(wildcard $(addsuffix /ppufiles$(SRCEXEEXT),$(SEARCHPATH))))
+ifeq ($(PPUFILES),)
+PPUFILES=
+else
+PPUFILES:=$(firstword $(PPUFILES))
+endif
+endif
+export PPUFILES
+ifndef DATE
+DATE:=$(strip $(wildcard $(addsuffix /date$(SRCEXEEXT),$(SEARCHPATH))))
+ifeq ($(DATE),)
+DATE:=$(strip $(wildcard $(addsuffix /gdate$(SRCEXEEXT),$(SEACHPATH))))
+ifeq ($(DATE),)
+DATE=
+else
+DATE:=$(firstword $(DATE))
+endif
+else
+DATE:=$(firstword $(DATE))
+endif
+endif
+export DATE
+ifdef DATE
+DATESTR:=$(shell $(DATE) +%Y%m%d)
+else
+DATESTR=
+endif
+ifndef UPXPROG
+ifeq ($(OS_TARGET),go32v2)
+UPXPROG:=1
+endif
+ifeq ($(OS_TARGET),win32)
+UPXPROG:=1
+endif
+ifdef UPXPROG
+UPXPROG:=$(strip $(wildcard $(addsuffix /upx$(SRCEXEEXT),$(SEARCHPATH))))
+ifeq ($(UPXPROG),)
+UPXPROG=
+else
+UPXPROG:=$(firstword $(UPXPROG))
+endif
+else
+UPXPROG=
+endif
+endif
+export UPXPROG
+ifndef ZIPPROG
+ZIPPROG:=$(strip $(wildcard $(addsuffix /zip$(SRCEXEEXT),$(SEARCHPATH))))
+ifeq ($(ZIPPROG),)
+ZIPPROG=
+else
+ZIPPROG:=$(firstword $(ZIPPROG))
+endif
+endif
+export ZIPPROG
+ZIPOPT=-9
+ZIPEXT=.zip
+ifndef TARPROG
+TARPROG:=$(strip $(wildcard $(addsuffix /tar$(SRCEXEEXT),$(SEARCHPATH))))
+ifeq ($(TARPROG),)
+TARPROG=
+else
+TARPROG:=$(firstword $(TARPROG))
+endif
+endif
+export TARPROG
+ifeq ($(USETAR),bz2)
+TAROPT=vI
+TAREXT=.tar.bz2
+else
+TAROPT=vz
+TAREXT=.tar.gz
+endif
+LOADEREXT=.as
+EXEEXT=.exe
+PPLEXT=.ppl
+PPUEXT=.ppu
+OEXT=.o
+ASMEXT=.s
+SMARTEXT=.sl
+STATICLIBEXT=.a
+SHAREDLIBEXT=.so
+LIBPREFIX=lib
+RSTEXT=.rst
+FPCMADE=fpcmade
+ifeq ($(OS_TARGET),go32v1)
+PPUEXT=.pp1
+OEXT=.o1
+ASMEXT=.s1
+SMARTEXT=.sl1
+STATICLIBEXT=.a1
+SHAREDLIBEXT=.so1
+LIBPREFIX=
+FPCMADE=fpcmade.v1
+PACKAGESUFFIX=v1
+endif
+ifeq ($(OS_TARGET),go32v2)
+LIBPREFIX=
+FPCMADE=fpcmade.dos
+ZIPSUFFIX=go32
+endif
+ifeq ($(OS_TARGET),linux)
+EXEEXT=
+HASSHAREDLIB=1
+FPCMADE=fpcmade.lnx
+ZIPSUFFIX=linux
+endif
+ifeq ($(OS_TARGET),freebsd)
+EXEEXT=
+HASSHAREDLIB=1
+FPCMADE=fpcmade.freebsd
+ZIPSUFFIX=freebsd
+endif
+ifeq ($(OS_TARGET),win32)
+PPUEXT=.ppw
+OEXT=.ow
+ASMEXT=.sw
+SMARTEXT=.slw
+STATICLIBEXT=.aw
+SHAREDLIBEXT=.dll
+FPCMADE=fpcmade.w32
+ZIPSUFFIX=w32
+endif
+ifeq ($(OS_TARGET),os2)
+PPUEXT=.ppo
+ASMEXT=.so2
+OEXT=.oo2
+AOUTEXT=.out
+SMARTEXT=.so
+STATICLIBEXT=.ao2
+SHAREDLIBEXT=.dll
+FPCMADE=fpcmade.os2
+ZIPSUFFIX=emx
+endif
+ifdef REQUIRE_UNITSDIR
+override UNITSDIR+=$(REQUIRE_UNITSDIR)
+endif
+ifdef REQUIRE_PACKAGESDIR
+override PACKAGESDIR+=$(REQUIRE_PACKAGESDIR)
+endif
+ifdef ZIPINSTALL
+ifeq ($(OS_TARGET),linux)
+UNIXINSTALLDIR=1
+endif
+ifeq ($(OS_TARGET),freebsd)
+UNIXINSTALLDIR=1
+endif
+else
+ifeq ($(OS_SOURCE),linux)
+UNIXINSTALLDIR=1
+endif
+ifeq ($(OS_SOURCE),freebsd)
+UNIXINSTALLDIR=1
+endif
+endif
+ifndef INSTALL_PREFIX
+ifdef UNIXINSTALLDIR
+INSTALL_PREFIX=/usr/local
+else
+INSTALL_PREFIX=/pp
+endif
+endif
+export INSTALL_PREFIX
+ifndef DIST_DESTDIR
+DIST_DESTDIR:=$(BASEDIR)
+endif
+export DIST_DESTDIR
+ifndef INSTALL_BASEDIR
+ifdef UNIXINSTALLDIR
+INSTALL_BASEDIR=$(INSTALL_PREFIX)/lib/fpc/$(FPC_VERSION)
+else
+INSTALL_BASEDIR=$(INSTALL_PREFIX)
+endif
+endif
+ifndef INSTALL_BINDIR
+ifdef UNIXINSTALLDIR
+INSTALL_BINDIR=$(INSTALL_PREFIX)/bin
+else
+INSTALL_BINDIR=$(INSTALL_BASEDIR)/bin/$(OS_TARGET)
+endif
+endif
+ifndef INSTALL_UNITDIR
+INSTALL_UNITDIR=$(INSTALL_BASEDIR)/units/$(OS_TARGET)
+ifdef PACKAGE_NAME
+INSTALL_UNITDIR:=$(INSTALL_UNITDIR)/$(PACKAGE_NAME)
+endif
+endif
+ifndef INSTALL_LIBDIR
+ifdef UNIXINSTALLDIR
+INSTALL_LIBDIR=$(INSTALL_PREFIX)/lib
+else
+INSTALL_LIBDIR=$(INSTALL_UNITDIR)
+endif
+endif
+ifndef INSTALL_SOURCEDIR
+ifdef UNIXINSTALLDIR
+INSTALL_SOURCEDIR=$(INSTALL_PREFIX)/src/fpc-$(FPC_VERSION)
+else
+INSTALL_SOURCEDIR=$(INSTALL_BASEDIR)/source
+endif
+ifdef PACKAGE_NAME
+INSTALL_SOURCEDIR:=$(INSTALL_SOURCEDIR)/$(PACKAGE_NAME)
+endif
+endif
+ifndef INSTALL_DOCDIR
+ifdef UNIXINSTALLDIR
+INSTALL_DOCDIR=$(INSTALL_PREFIX)/doc/fpc-$(FPC_VERSION)
+else
+INSTALL_DOCDIR=$(INSTALL_BASEDIR)/doc
+endif
+endif
+ifndef INSTALL_EXAMPLEDIR
+ifdef UNIXINSTALLDIR
+INSTALL_EXAMPLEDIR=$(INSTALL_DOCDIR)/examples
+else
+INSTALL_EXAMPLEDIR=$(INSTALL_BASEDIR)/examples
+endif
+ifdef EXAMPLESUBDIR
+INSTALL_EXAMPLEDIR:=$(INSTALL_EXAMPLEDIR)/$(EXAMPLESUBDIR)
+endif
+endif
+ifndef INSTALL_DATADIR
+INSTALL_DATADIR=$(INSTALL_BASEDIR)
+endif
+ifdef inUnix
+ifndef GCCLIBDIR
+GCCLIBDIR:=$(shell dirname `(gcc -v 2>&1)| head -n 1| awk '{ print $$4 } '`)
+endif
+ifndef OTHERLIBDIR
+OTHERLIBDIR:=$(shell grep -v "^\#" /etc/ld.so.conf | awk '{ ORS=" "; print $1 }')
+endif
+export GCCLIBDIR OTHERLIB
+endif
+ifeq ($(OS_TARGET),linux)
+REQUIRE_PACKAGES_RTL=1
+REQUIRE_PACKAGES_ZLIB=1
+endif
+ifeq ($(OS_TARGET),go32v2)
+REQUIRE_PACKAGES_RTL=1
+REQUIRE_PACKAGES_ZLIB=1
+endif
+ifeq ($(OS_TARGET),win32)
+REQUIRE_PACKAGES_RTL=1
+REQUIRE_PACKAGES_ZLIB=1
+endif
+ifeq ($(OS_TARGET),os2)
+REQUIRE_PACKAGES_RTL=1
+REQUIRE_PACKAGES_ZLIB=1
+endif
+ifeq ($(OS_TARGET),freebsd)
+REQUIRE_PACKAGES_RTL=1
+REQUIRE_PACKAGES_ZLIB=1
+endif
+ifdef REQUIRE_PACKAGES_RTL
+PACKAGEDIR_RTL:=$(subst /Makefile.fpc,,$(strip $(wildcard $(addsuffix /rtl/Makefile.fpc,$(PACKAGESDIR)))))
+ifneq ($(PACKAGEDIR_RTL),)
+PACKAGEDIR_RTL:=$(firstword $(PACKAGEDIR_RTL))
+ifeq ($(wildcard $(PACKAGEDIR_RTL)/$(FPCMADE)),)
+override COMPILEPACKAGES+=package_rtl
+package_rtl:
+	$(MAKE) -C $(PACKAGEDIR_RTL) all
+endif
+ifneq ($(wildcard $(PACKAGEDIR_RTL)/$(OS_TARGET)),)
+UNITDIR_RTL=$(PACKAGEDIR_RTL)/$(OS_TARGET)
+else
+UNITDIR_RTL=$(PACKAGEDIR_RTL)
+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
+endif
+ifdef REQUIRE_PACKAGES_ZLIB
+PACKAGEDIR_ZLIB:=$(subst /Makefile.fpc,,$(strip $(wildcard $(addsuffix /zlib/Makefile.fpc,$(PACKAGESDIR)))))
+ifneq ($(PACKAGEDIR_ZLIB),)
+PACKAGEDIR_ZLIB:=$(firstword $(PACKAGEDIR_ZLIB))
+ifeq ($(wildcard $(PACKAGEDIR_ZLIB)/$(FPCMADE)),)
+override COMPILEPACKAGES+=package_zlib
+package_zlib:
+	$(MAKE) -C $(PACKAGEDIR_ZLIB) all
+endif
+ifneq ($(wildcard $(PACKAGEDIR_ZLIB)/$(OS_TARGET)),)
+UNITDIR_ZLIB=$(PACKAGEDIR_ZLIB)/$(OS_TARGET)
+else
+UNITDIR_ZLIB=$(PACKAGEDIR_ZLIB)
+endif
+else
+PACKAGEDIR_ZLIB=
+UNITDIR_ZLIB:=$(subst /Package.fpc,,$(strip $(wildcard $(addsuffix /zlib/Package.fpc,$(UNITSDIR)))))
+ifneq ($(UNITDIR_ZLIB),)
+UNITDIR_ZLIB:=$(firstword $(UNITDIR_ZLIB))
+else
+UNITDIR_ZLIB=
+endif
+endif
+ifdef UNITDIR_ZLIB
+override COMPILER_UNITDIR+=$(UNITDIR_ZLIB)
+endif
+endif
+.PHONY: package_rtl package_zlib
+override FPCOPTDEF=$(CPU_TARGET)
+ifneq ($(OS_TARGET),$(OS_SOURCE))
+override FPCOPT+=-T$(OS_TARGET)
+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
+override FPCOPT+=-Xs -OG2p3 -n
+override FPCOPTDEF+=RELEASE
+endif
+ifdef STRIP
+override FPCOPT+=-Xs
+endif
+ifdef OPTIMIZE
+override FPCOPT+=-OG2p3
+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 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_TARGETDIR)/
+endif
+else
+ifdef COMPILER_TARGETDIR
+override COMPILER_UNITTARGETDIR=$(COMPILER_TARGETDIR)
+override UNITTARGETDIRPREFIX=$(TARGETDIRPREFIX)
+endif
+endif
+ifdef GCCLIBDIR
+override FPCOPT+=-Fl$(GCCLIBDIR)
+endif
+ifdef OTHERLIBDIR
+override FPCOPT+=$(addprefix -Fl,$(OTHERLIBDIR))
+endif
+ifdef OPT
+override FPCOPT+=$(OPT)
+endif
+ifdef FPCOPTDEF
+override FPCOPT+=$(addprefix -d,$(FPCOPTDEF))
+endif
+ifdef CFGFILE
+override FPCOPT+=@$(CFGFILE)
+endif
+ifeq ($(OS_SOURCE),win32)
+override FPCEXTCMD:=$(FPCOPT)
+override FPCOPT:=!FPCEXTCMD
+export FPCEXTCMD
+endif
+override COMPILER:=$(FPC) $(FPCOPT)
+ifeq (,$(findstring -s ,$(COMPILER)))
+EXECPPAS=
+else
+ifeq ($(OS_SOURCE),$(OS_TARGET))
+EXECPPAS:=@$(PPAS)
+endif
+endif
+.PHONY: fpc_units
+ifdef TARGET_UNITS
+override ALLTARGET+=fpc_units
+override UNITPPUFILES=$(addsuffix $(PPUEXT),$(TARGET_UNITS))
+override INSTALLPPUFILES+=$(UNITPPUFILES)
+override CLEANPPUFILES+=$(UNITPPUFILES)
+endif
+fpc_units: $(UNITPPUFILES)
+.PHONY: fpc_packages fpc_all fpc_smart fpc_debug
+$(FPCMADE): $(ALLTARGET)
+	@$(ECHO) Compiled > $(FPCMADE)
+fpc_packages: $(COMPILEPACKAGES)
+fpc_all: fpc_packages $(FPCMADE)
+fpc_smart:
+	$(MAKE) all LINKSMART=1 CREATESMART=1
+fpc_debug:
+	$(MAKE) all DEBUG=1
+.SUFFIXES: $(EXEEXT) $(PPUEXT) $(OEXT) .pas .pp
+%$(PPUEXT): %.pp
+	$(COMPILER) $<
+	$(EXECPPAS)
+%$(PPUEXT): %.pas
+	$(COMPILER) $<
+	$(EXECPPAS)
+%$(EXEEXT): %.pp
+	$(COMPILER) $<
+	$(EXECPPAS)
+%$(EXEEXT): %.pas
+	$(COMPILER) $<
+	$(EXECPPAS)
+vpath %.pp $(COMPILER_SOURCEDIR) $(COMPILER_INCLUDEDIR)
+vpath %.pas $(COMPILER_SOURCEDIR) $(COMPILER_INCLUDEDIR)
+vpath %$(PPUEXT) $(COMPILER_UNITTARGETDIR)
+.PHONY: fpc_install fpc_sourceinstall fpc_exampleinstall
+ifdef INSTALL_UNITS
+override INSTALLPPUFILES+=$(addsuffix $(PPUEXT),$(INSTALL_UNITS))
+endif
+ifdef INSTALLPPUFILES
+ifdef PPUFILES
+override INSTALLPPUFILES:=$(addprefix $(UNITTARGETDIRPREFIX),$(INSTALLPPUFILES))
+override INSTALLPPULINKFILES:=$(addprefix $(UNITTARGETDIRPREFIX),$(shell $(PPUFILES) -S -O $(INSTALLPPUFILES)))
+else
+override INSTALLPPULINKFILES:=$(subst $(PPUEXT),$(OEXT),$(INSTALLPPUFILES)) $(addprefix $(LIBPREFIX),$(subst $(PPUEXT),$(STATICLIBEXT),$(INSTALLPPUFILES)))
+override INSTALLPPUFILES:=$(addprefix $(UNITTARGETDIRPREFIX),$(INSTALLPPUFILES))
+override INSTALLPPULINKFILES:=$(wildcard $(addprefix $(UNITTARGETDIRPREFIX),$(INSTALLPPULINKFILES)))
+endif
+endif
+ifdef INSTALLEXEFILES
+override INSTALLEXEFILES:=$(addprefix $(TARGETDIRPREFIX),$(INSTALLEXEFILES))
+endif
+fpc_install: $(INSTALLTARGET)
+ifdef INSTALLEXEFILES
+	$(MKDIR) $(INSTALL_BINDIR)
+ifdef UPXPROG
+	-$(UPXPROG) $(INSTALLEXEFILES)
+endif
+	$(INSTALLEXE) $(INSTALLEXEFILES) $(INSTALL_BINDIR)
+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
+fpc_distinstall: fpc_install fpc_exampleinstall
+.PHONY: fpc_zipinstall fpc_zipsourceinstall fpc_zipexampleinstall
+ifndef PACKDIR
+ifndef inUnix
+PACKDIR=$(BASEDIR)/../pack_tmp/$(PACKAGE_NAME)
+else
+PACKDIR=/tmp/fpc-pack/$(PACKAGE_NAME)
+endif
+endif
+ifndef ZIPNAME
+ifdef DIST_ZIPNAME
+ZIPNAME=$(DIST_ZIPNAME)
+else
+ZIPNAME=$(ZIPPREFIX)$(PACKAGE_NAME)$(ZIPSUFFIX)
+endif
+endif
+ifndef ZIPTARGET
+ifdef DIST_ZIPTARGET
+ZIPTARGET=DIST_ZIPTARGET
+else
+ZIPTARGET=install
+endif
+endif
+ifndef USEZIP
+ifdef inUnix
+USETAR=1
+endif
+endif
+ifdef inOS2
+USEZIPWRAPPER=1
+endif
+ZIPWRAPPER=$(DIST_DESTDIR)/fpczip$(BATCHEXT)
+ZIPCMD_CDPACK:=cd $(subst /,$(PATHSEP),$(PACKDIR))
+ZIPCMD_CDBASE:=cd $(subst /,$(PATHSEP),$(BASEDIR))
+ifdef USETAR
+ZIPDESTFILE:=$(DIST_DESTDIR)/$(ZIPNAME)$(TAREXT)
+ZIPCMD_ZIP:=$(TARPROG) cf$(TAROPT) $(ZIPDESTFILE) *
+else
+ZIPDESTFILE:=$(DIST_DESTDIR)/$(ZIPNAME)$(ZIPEXT)
+ZIPCMD_ZIP:=$(subst /,$(PATHSEP),$(ZIPPROG)) -Dr $(ZIPOPT) $(ZIPDESTFILE) *
+endif
+fpc_zipinstall:
+	$(MAKE) $(ZIPTARGET) INSTALL_PREFIX=$(PACKDIR) ZIPINSTALL=1
+	$(DEL) $(ZIPDESTFILE)
+ifdef USEZIPWRAPPER
+ifneq ($(ECHO),echo)
+	$(ECHO) "$(ZIPCMD_CDPACK)" > $(ZIPWRAPPER)
+	$(ECHO) "$(ZIPCMD_ZIP)" >> $(ZIPWRAPPER)
+	$(ECHO) "$(ZIPCMD_CDBASE)" >> $(ZIPWRAPPER)
+else
+	$(ECHO) $(ZIPCMD_CDPACK) > $(ZIPWRAPPER)
+	$(ECHO) $(ZIPCMD_ZIP) >> $(ZIPWRAPPER)
+	$(ECHO) $(ZIPCMD_CDBASE) >> $(ZIPWRAPPER)
+endif
+ifdef inUnix
+	/bin/sh $(ZIPWRAPPER)
+else
+	$(ZIPWRAPPER)
+endif
+	$(DEL) $(ZIPWRAPPER)
+else
+	$(ZIPCMD_CDPACK) ; $(ZIPCMD_ZIP) ; $(ZIPCMD_CDBASE)
+endif
+	$(DELTREE) $(PACKDIR)
+fpc_zipsourceinstall:
+	$(MAKE) fpc_zipinstall ZIPTARGET=sourceinstall ZIPSUFFIX=src
+fpc_zipexampleinstall:
+ifdef HASEXAMPLES
+	$(MAKE) fpc_zipinstall ZIPTARGET=exampleinstall ZIPSUFFIX=exm
+endif
+fpc_zipdistinstall:
+	$(MAKE) fpc_zipinstall ZIPTARGET=distinstall
+.PHONY: fpc_clean fpc_cleanall fpc_distclean
+ifdef EXEFILES
+override CLEANEXEFILES:=$(addprefix $(TARGETDIRPREFIX),$(CLEANEXEFILES))
+endif
+ifdef CLEAN_UNITS
+override CLEANPPUFILES+=$(addsuffix $(PPUEXT),$(CLEAN_UNITS))
+endif
+ifdef CLEANPPUFILES
+override CLEANPPUFILES:=$(addprefix $(UNITTARGETDIRPREFIX),$(CLEANPPUFILES))
+ifdef PPUFILES
+CLEANPPULINKFILES:=$(shell $(PPUFILES) $(CLEANPPUFILES))
+else
+CLEANPPULINKFILES:=$(wildcard $(subst $(PPUEXT),$(OEXT),$(CLEANPPUFILES)) $(addprefix $(LIBPREFIX),$(subst $(PPUEXT),$(STATICLIBEXT),$(CLEANPPUFILES))))
+endif
+override CLEANPPULINKFILES:=$(addprefix $(UNITTARGETDIRPREFIX),$(CLEANPPULINKFILES))
+endif
+fpc_clean: $(CLEANTARGET)
+ifdef CLEANEXEFILES
+	-$(DEL) $(CLEANEXEFILES)
+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) $(PPAS) link.res $(FPCEXTFILE) $(REDIRFILE)
+fpc_distclean: fpc_clean
+ifdef COMPILER_UNITTARGETDIR
+TARGETDIRCLEAN=fpc_clean
+endif
+fpc_cleanall: $(CLEANTARGET) $(TARGETDIRCLEAN)
+ifdef CLEANEXEFILES
+	-$(DEL) $(CLEANEXEFILES)
+endif
+	-$(DEL) *$(OEXT) *$(PPUEXT) *$(RSTEXT) *$(ASMEXT) *$(STATICLIBEXT) *$(SHAREDLIBEXT) *$(PPLEXT)
+	-$(DELTREE) *$(SMARTEXT)
+	-$(DEL) $(FPCMADE) $(PPAS) link.res $(FPCEXTFILE) $(REDIRFILE)
+ifdef AOUTEXT
+	-$(DEL) *$(AOUTEXT)
+endif
+.PHONY: fpc_info
+fpc_info:
+	@$(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)
+	@$(ECHO)  == Directory info ==
+	@$(ECHO)
+	@$(ECHO)  Basedir......... $(BASEDIR)
+	@$(ECHO)  FPCDir.......... $(FPCDIR)
+	@$(ECHO)  UnitsDir........ $(UNITSDIR)
+	@$(ECHO)  PackagesDir..... $(PACKAGESDIR)
+	@$(ECHO)
+	@$(ECHO)  GCC library..... $(GCCLIBDIR)
+	@$(ECHO)  Other library... $(OTHERLIBDIR)
+	@$(ECHO)
+	@$(ECHO)  == Tools info ==
+	@$(ECHO)
+	@$(ECHO)  Pwd....... $(PWD)
+	@$(ECHO)  Echo...... $(ECHO)
+	@$(ECHO)  PPUMove... $(PPUMOVE)
+	@$(ECHO)  PPUFiles.. $(PPUFILES)
+	@$(ECHO)  Date...... $(DATE)
+	@$(ECHO)  Upx....... $(UPXPROG)
+	@$(ECHO)  Zip....... $(ZIPPROG)
+	@$(ECHO)
+	@$(ECHO)  == Object info ==
+	@$(ECHO)
+	@$(ECHO)  Target Loaders...... $(TARGET_LOADERS)
+	@$(ECHO)  Target Units........ $(TARGET_UNITS)
+	@$(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)  ZipPrefix............ $(ZIPPREFIX)
+	@$(ECHO)  ZipSuffix............ $(ZIPSUFFIX)
+	@$(ECHO)
+	@$(ECHO)  INSTALL_BASEDIR...... $(INSTALL_BASEDIR)
+	@$(ECHO)  INSTALL_BINDIR....... $(INSTALL_BINDIR)
+	@$(ECHO)  INSTALL_LIBDIR....... $(INSTALL_LIBDIR)
+	@$(ECHO)  INSTALL_UNITDIR...... $(INSTALL_UNITDIR)
+	@$(ECHO)  INSTALL_SOURCEDIR.... $(INSTALL_SOURCEDIR)
+	@$(ECHO)  INSTALL_DOCDIR....... $(INSTALL_DOCDIR)
+	@$(ECHO)  INSTALL_DATADIR...... $(INSTALL_DATADIR)
+	@$(ECHO)
+	@$(ECHO)  DIST_DESTDIR......... $(DIST_DESTDIR)
+	@$(ECHO)  DIST_ZIPNAME......... $(DIST_ZIPNAME)
+	@$(ECHO)
+all: fpc_all
+debug: fpc_debug
+examples: fpc_examples
+smart: fpc_smart
+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
+distclean: fpc_distclean
+cleanall: fpc_cleanall
+info: fpc_info
+.PHONY: all debug examples smart shared install sourceinstall exampleinstall distinstall zipinstall zipsourceinstall zipexampleinstall zipdistinstall clean distclean cleanall info
+ifneq ($(wildcard fpcmake.loc),)
+include fpcmake.loc
+endif

+ 17 - 0
packages/libpng/Makefile.fpc

@@ -0,0 +1,17 @@
+#
+#   Makefile.fpc for PNG Library interface
+#
+
+[package]
+name=libpng
+version=1.0.5
+
+[require]
+packages=zlib
+libc=y
+
+[target]
+units=png
+
+[default]
+fpcdir=../..

+ 621 - 0
packages/libpng/png.pp

@@ -0,0 +1,621 @@
+unit png;
+
+interface
+
+{ Automatically converted by H2Pas 0.99.15 from png.h }
+{ The following command line parameters were used:
+    png.h
+}
+
+{$PACKRECORDS C}
+
+uses
+ zlib;
+
+Const
+  LibPng = 'png'; // Library name
+
+type
+   size_t = longint;
+   time_t = longint;
+   int = longint;
+   z_stream = TZStream;
+   voidp = pointer;
+   
+   png_uint_32 = dword;
+   png_int_32 = longint;
+   png_uint_16 = word;
+   png_int_16 = smallint;
+   png_byte = byte;
+   ppng_uint_32 = ^png_uint_32;
+   ppng_int_32 = ^png_int_32;
+   ppng_uint_16 = ^png_uint_16;
+   ppng_int_16 = ^png_int_16;
+   ppng_byte = ^png_byte;
+   pppng_uint_32 = ^ppng_uint_32;
+   pppng_int_32 = ^ppng_int_32;
+   pppng_uint_16 = ^ppng_uint_16;
+   pppng_int_16 = ^ppng_int_16;
+   pppng_byte = ^ppng_byte;
+   png_size_t = size_t;
+   png_fixed_point = png_int_32;
+   ppng_fixed_point = ^png_fixed_point;
+   pppng_fixed_point = ^ppng_fixed_point;
+   png_voidp = pointer;
+   png_bytep = Ppng_byte;
+   ppng_bytep = ^png_bytep;
+   png_uint_32p = Ppng_uint_32;
+   png_int_32p = Ppng_int_32;
+   png_uint_16p = Ppng_uint_16;
+   ppng_uint_16p = ^png_uint_16p;
+   png_int_16p = Ppng_int_16;
+(* Const before type ignored *)
+   png_const_charp = Pchar;
+   png_charp = Pchar;
+   ppng_charp = ^png_charp;
+   png_fixed_point_p = Ppng_fixed_point;
+   TFile = Pointer;
+   png_FILE_p = ^FILE;
+   png_doublep = Pdouble;
+   png_bytepp = PPpng_byte;
+   png_uint_32pp = PPpng_uint_32;
+   png_int_32pp = PPpng_int_32;
+   png_uint_16pp = PPpng_uint_16;
+   png_int_16pp = PPpng_int_16;
+ (* Const before type ignored *)
+   png_const_charpp = PPchar;
+   png_charpp = PPchar;
+   ppng_charpp = ^png_charpp;
+   png_fixed_point_pp = PPpng_fixed_point;
+   PPDouble = ^PDouble;
+   png_doublepp = PPdouble;
+   PPPChar = ^PPCHar;
+   png_charppp = PPPchar;
+   Pcharf = Pchar;
+   PPcharf = ^Pcharf;
+   png_zcharp = Pcharf;
+   png_zcharpp = PPcharf;
+   png_zstreamp = Pzstream;
+   
+
+var
+  png_libpng_ver : array[0..11] of char;external name 'png_libpng_ver';
+  png_pass_start : array[0..6] of longint;external name 'png_pass_start';
+  png_pass_inc : array[0..6] of longint;external name 'png_pass_inc';
+  png_pass_ystart : array[0..6] of longint;external name'png_pass_ystart';
+  png_pass_yinc : array[0..6] of longint;external name 'png_pass_yinc';
+  png_pass_mask : array[0..6] of longint;external name 'png_pass_mask';
+  png_pass_dsp_mask : array[0..6] of longint;external name 'png_pass_dsp_mask';
+
+Type
+  png_color = record
+       red : png_byte;
+       green : png_byte;
+       blue : png_byte;
+    end;
+  ppng_color = ^png_color;
+  pppng_color = ^ppng_color;
+  
+  png_color_struct = png_color;
+  png_colorp = Ppng_color;
+  ppng_colorp = ^png_colorp;
+  png_colorpp = PPpng_color;
+  png_color_16 = record
+       index : png_byte;
+       red : png_uint_16;
+       green : png_uint_16;
+       blue : png_uint_16;
+       gray : png_uint_16;
+    end;
+  ppng_color_16 = ^png_color_16 ;
+  pppng_color_16 = ^ppng_color_16 ;
+  png_color_16_struct = png_color_16;
+  png_color_16p = Ppng_color_16;
+  ppng_color_16p = ^png_color_16p;
+  png_color_16pp = PPpng_color_16;
+  png_color_8 = record
+       red : png_byte;
+       green : png_byte;
+       blue : png_byte;
+       gray : png_byte;
+       alpha : png_byte;
+    end;
+  ppng_color_8 = ^png_color_8;  
+  pppng_color_8 = ^ppng_color_8;  
+  png_color_8_struct = png_color_8;
+  png_color_8p = Ppng_color_8;
+  ppng_color_8p = ^png_color_8p;
+  png_color_8pp = PPpng_color_8;
+  png_sPLT_entry = record
+       red : png_uint_16;
+       green : png_uint_16;
+       blue : png_uint_16;
+       alpha : png_uint_16;
+       frequency : png_uint_16;
+    end;
+  ppng_sPLT_entry = ^png_sPLT_entry;  
+  pppng_sPLT_entry = ^ppng_sPLT_entry;  
+  png_sPLT_entry_struct = png_sPLT_entry;
+  png_sPLT_entryp = Ppng_sPLT_entry;
+  png_sPLT_entrypp = PPpng_sPLT_entry;
+  png_sPLT_t = record
+       name : png_charp;
+       depth : png_byte;
+       entries : png_sPLT_entryp;
+       nentries : png_int_32;
+    end;
+  ppng_sPLT_t = ^png_sPLT_t;  
+  pppng_sPLT_t = ^ppng_sPLT_t;  
+  png_sPLT_struct = png_sPLT_t;
+  png_sPLT_tp = Ppng_sPLT_t;
+  png_sPLT_tpp = PPpng_sPLT_t;
+  png_text = record
+       compression : longint;
+       key : png_charp;
+       text : png_charp;
+       text_length : png_size_t;
+    end;
+  ppng_text = ^png_text;
+  pppng_text = ^ppng_text;
+    
+  png_text_struct = png_text;
+  png_textp = Ppng_text;
+  ppng_textp = ^png_textp;
+  png_textpp = PPpng_text;
+  png_time = record
+       year : png_uint_16;
+       month : png_byte;
+       day : png_byte;
+       hour : png_byte;
+       minute : png_byte;
+       second : png_byte;
+    end;
+  ppng_time = ^png_time;
+  pppng_time = ^ppng_time;
+    
+  png_time_struct = png_time;
+  png_timep = Ppng_time;
+  PPNG_TIMEP = ^PNG_TIMEP;
+  png_timepp = PPpng_time;
+  png_unknown_chunk = record
+       name : array[0..4] of png_byte;
+       data : Ppng_byte;
+       size : png_size_t;
+       location : png_byte;
+    end;
+  ppng_unknown_chunk = ^png_unknown_chunk;
+  pppng_unknown_chunk = ^ppng_unknown_chunk;
+    
+  png_unknown_chunk_t = png_unknown_chunk;
+  png_unknown_chunkp = Ppng_unknown_chunk;
+  png_unknown_chunkpp = PPpng_unknown_chunk;
+  png_info = record
+       width : png_uint_32;
+       height : png_uint_32;
+       valid : png_uint_32;
+       rowbytes : png_uint_32;
+       palette : png_colorp;
+       num_palette : png_uint_16;
+       num_trans : png_uint_16;
+       bit_depth : png_byte;
+       color_type : png_byte;
+       compression_type : png_byte;
+       filter_type : png_byte;
+       interlace_type : png_byte;
+       channels : png_byte;
+       pixel_depth : png_byte;
+       spare_byte : png_byte;
+       signature : array[0..7] of png_byte;
+       gamma : double;
+       srgb_intent : png_byte;
+       num_text : longint;
+       max_text : longint;
+       text : png_textp;
+       mod_time : png_time;
+       sig_bit : png_color_8;
+       trans : png_bytep;
+       trans_values : png_color_16;
+       background : png_color_16;
+       x_offset : png_int_32;
+       y_offset : png_int_32;
+       offset_unit_type : png_byte;
+       x_pixels_per_unit : png_uint_32;
+       y_pixels_per_unit : png_uint_32;
+       phys_unit_type : png_byte;
+       hist : png_uint_16p;
+       x_white : double;
+       y_white : double;
+       x_red : double;
+       y_red : double;
+       x_green : double;
+       y_green : double;
+       x_blue : double;
+       y_blue : double;
+       pcal_purpose : png_charp;
+       pcal_X0 : png_int_32;
+       pcal_X1 : png_int_32;
+       pcal_units : png_charp;
+       pcal_params : png_charpp;
+       pcal_type : png_byte;
+       pcal_nparams : png_byte;
+       free_me : png_uint_32;
+       unknown_chunks : png_unknown_chunkp;
+       unknown_chunks_num : png_size_t;
+       iccp_name : png_charp;
+       iccp_profile : png_charp;
+       iccp_proflen : png_uint_32;
+       iccp_compression : png_byte;
+       splt_palettes : png_sPLT_tp;
+       splt_palettes_num : png_uint_32;
+       scal_unit : png_byte;
+       scal_pixel_width : double;
+       scal_pixel_height : double;
+       scal_s_width : png_charp;
+       scal_s_height : png_charp;
+       row_pointers : png_bytepp;
+       int_gamma : png_fixed_point;
+       int_x_white : png_fixed_point;
+       int_y_white : png_fixed_point;
+       int_x_red : png_fixed_point;
+       int_y_red : png_fixed_point;
+       int_x_green : png_fixed_point;
+       int_y_green : png_fixed_point;
+       int_x_blue : png_fixed_point;
+       int_y_blue : png_fixed_point;
+    end;
+  ppng_info = ^png_info;
+  pppng_info = ^ppng_info;
+    
+  png_info_struct = png_info;
+  png_infop = Ppng_info;
+  png_infopp = PPpng_info;
+  png_row_info = record
+       width : png_uint_32;
+       rowbytes : png_uint_32;
+       color_type : png_byte;
+       bit_depth : png_byte;
+       channels : png_byte;
+       pixel_depth : png_byte;
+    end;
+  ppng_row_info = ^png_row_info;
+  pppng_row_info = ^ppng_row_info;
+    
+  png_row_info_struct = png_row_info;
+  png_row_infop = Ppng_row_info;
+  png_row_infopp = PPpng_row_info;
+//  png_struct_def = png_struct;
+  png_structp = ^png_struct;
+
+
+
+png_error_ptr = Procedure(Arg1 : png_structp; Arg2 : png_const_charp);cdecl;
+png_rw_ptr = Procedure(Arg1 : png_structp; Arg2 : png_bytep; Arg3 : png_size_t);cdecl;
+png_flush_ptr = procedure (Arg1 : png_structp) ;cdecl;
+png_read_status_ptr = procedure (Arg1 : png_structp; Arg2 : png_uint_32; Arg3: int);cdecl;
+png_write_status_ptr = Procedure (Arg1 : png_structp; Arg2:png_uint_32;Arg3 : int) ;cdecl;
+png_progressive_info_ptr = Procedure (Arg1 : png_structp; Arg2 : png_infop) ;cdecl;
+png_progressive_end_ptr = Procedure (Arg1 : png_structp; Arg2 : png_infop) ;cdecl;
+png_progressive_row_ptr = Procedure (Arg1 : png_structp; Arg2 : png_bytep; Arg3 : png_uint_32; Arg4 : int) ;cdecl;
+png_user_transform_ptr = Procedure (Arg1 : png_structp; Arg2 : png_row_infop; Arg3 : png_bytep) ;cdecl;
+png_user_chunk_ptr = Function (Arg1 : png_structp; Arg2 : png_unknown_chunkp): longint;cdecl;
+png_unknown_chunk_ptr = Procedure (Arg1 : png_structp);cdecl;
+png_malloc_ptr = Function (Arg1 : png_structp; Arg2 : png_size_t) : png_voidp ;cdecl;
+png_free_ptr = Procedure (Arg1 : png_structp; Arg2 : png_voidp) ; cdecl;
+
+   png_struct_def = record
+        jmpbuf : jmp_buf;
+        error_fn : png_error_ptr;
+        warning_fn : png_error_ptr;
+        error_ptr : png_voidp;
+        write_data_fn : png_rw_ptr;
+        read_data_fn : png_rw_ptr;
+        io_ptr : png_voidp;
+        read_user_transform_fn : png_user_transform_ptr;
+        write_user_transform_fn : png_user_transform_ptr;
+        user_transform_ptr : png_voidp;
+        user_transform_depth : png_byte;
+        user_transform_channels : png_byte;
+        mode : png_uint_32;
+        flags : png_uint_32;
+        transformations : png_uint_32;
+        zstream : z_stream;
+        zbuf : png_bytep;
+        zbuf_size : png_size_t;
+        zlib_level : longint;
+        zlib_method : longint;
+        zlib_window_bits : longint;
+        zlib_mem_level : longint;
+        zlib_strategy : longint;
+        width : png_uint_32;
+        height : png_uint_32;
+        num_rows : png_uint_32;
+        usr_width : png_uint_32;
+        rowbytes : png_uint_32;
+        irowbytes : png_uint_32;
+        iwidth : png_uint_32;
+        row_number : png_uint_32;
+        prev_row : png_bytep;
+        row_buf : png_bytep;
+        sub_row : png_bytep;
+        up_row : png_bytep;
+        avg_row : png_bytep;
+        paeth_row : png_bytep;
+        row_info : png_row_info;
+        idat_size : png_uint_32;
+        crc : png_uint_32;
+        palette : png_colorp;
+        num_palette : png_uint_16;
+        num_trans : png_uint_16;
+        chunk_name : array[0..4] of png_byte;
+        compression : png_byte;
+        filter : png_byte;
+        interlaced : png_byte;
+        pass : png_byte;
+        do_filter : png_byte;
+        color_type : png_byte;
+        bit_depth : png_byte;
+        usr_bit_depth : png_byte;
+        pixel_depth : png_byte;
+        channels : png_byte;
+        usr_channels : png_byte;
+        sig_bytes : png_byte;
+        filler : png_uint_16;
+        background_gamma_type : png_byte;
+        background_gamma : double;
+        background : png_color_16;
+        background_1 : png_color_16;
+        output_flush_fn : png_flush_ptr;
+        flush_dist : png_uint_32;
+        flush_rows : png_uint_32;
+        gamma_shift : longint;
+        gamma : double;
+        screen_gamma : double;
+        gamma_table : png_bytep;
+        gamma_from_1 : png_bytep;
+        gamma_to_1 : png_bytep;
+        gamma_16_table : png_uint_16pp;
+        gamma_16_from_1 : png_uint_16pp;
+        gamma_16_to_1 : png_uint_16pp;
+        sig_bit : png_color_8;
+        shift : png_color_8;
+        trans : png_bytep;
+        trans_values : png_color_16;
+        read_row_fn : png_read_status_ptr;
+        write_row_fn : png_write_status_ptr;
+        info_fn : png_progressive_info_ptr;
+        row_fn : png_progressive_row_ptr;
+        end_fn : png_progressive_end_ptr;
+        save_buffer_ptr : png_bytep;
+        save_buffer : png_bytep;
+        current_buffer_ptr : png_bytep;
+        current_buffer : png_bytep;
+        push_length : png_uint_32;
+        skip_length : png_uint_32;
+        save_buffer_size : png_size_t;
+        save_buffer_max : png_size_t;
+        buffer_size : png_size_t;
+        current_buffer_size : png_size_t;
+        process_mode : longint;
+        cur_palette : longint;
+        current_text_size : png_size_t;
+        current_text_left : png_size_t;
+        current_text : png_charp;
+        current_text_ptr : png_charp;
+        palette_lookup : png_bytep;
+        dither_index : png_bytep;
+        hist : png_uint_16p;
+        heuristic_method : png_byte;
+        num_prev_filters : png_byte;
+        prev_filters : png_bytep;
+        filter_weights : png_uint_16p;
+        inv_filter_weights : png_uint_16p;
+        filter_costs : png_uint_16p;
+        inv_filter_costs : png_uint_16p;
+        time_buffer : png_charp;
+        free_me : png_uint_32;
+        user_chunk_ptr : png_voidp;
+        read_user_chunk_fn : png_user_chunk_ptr;
+        num_chunk_list : longint;
+        chunk_list : png_bytep;
+        rgb_to_gray_status : png_byte;
+        rgb_to_gray_red_coeff : png_uint_16;
+        rgb_to_gray_green_coeff : png_uint_16;
+        rgb_to_gray_blue_coeff : png_uint_16;
+        empty_plte_permitted : png_byte;
+        int_gamma : png_fixed_point;
+     end;
+   ppng_struct_def = ^png_struct_def;
+   pppng_struct_def = ^ppng_struct_def;
+   png_struct = png_struct_def;
+   ppng_struct = ^png_struct;
+   pppng_struct = ^ppng_struct;
+   
+   version_1_0_8 = png_structp;
+   png_structpp = PPpng_struct;
+   
+function png_access_version_number:png_uint_32;cdecl; external libpng;
+procedure png_set_sig_bytes(png_ptr:png_structp; num_bytes:longint);cdecl; external libpng;
+function png_sig_cmp(sig:png_bytep; start:png_size_t; num_to_check:png_size_t):longint;cdecl; external libpng;
+function png_check_sig(sig:png_bytep; num:longint):longint;cdecl; external libpng;
+function png_create_read_struct(user_png_ver:png_const_charp; error_ptr:png_voidp; error_fn:png_error_ptr; warn_fn:png_error_ptr):png_structp;cdecl; external libpng;
+function png_create_write_struct(user_png_ver:png_const_charp; error_ptr:png_voidp; error_fn:png_error_ptr; warn_fn:png_error_ptr):png_structp;cdecl; external libpng;
+function png_get_compression_buffer_size(png_ptr:png_structp):png_uint_32;cdecl; external libpng;
+procedure png_set_compression_buffer_size(png_ptr:png_structp; size:png_uint_32);cdecl; external libpng;
+function png_reset_zstream(png_ptr:png_structp):longint;cdecl; external libpng;
+procedure png_write_chunk(png_ptr:png_structp; chunk_name:png_bytep; data:png_bytep; length:png_size_t);cdecl; external libpng;
+procedure png_write_chunk_start(png_ptr:png_structp; chunk_name:png_bytep; length:png_uint_32);cdecl; external libpng;
+procedure png_write_chunk_data(png_ptr:png_structp; data:png_bytep; length:png_size_t);cdecl; external libpng;
+procedure png_write_chunk_end(png_ptr:png_structp);cdecl; external libpng;
+function png_create_info_struct(png_ptr:png_structp):png_infop;cdecl; external libpng;
+procedure png_info_init(info_ptr:png_infop);cdecl; external libpng;
+procedure png_write_info_before_PLTE(png_ptr:png_structp; info_ptr:png_infop);cdecl; external libpng;
+procedure png_write_info(png_ptr:png_structp; info_ptr:png_infop);cdecl; external libpng;
+procedure png_read_info(png_ptr:png_structp; info_ptr:png_infop);cdecl; external libpng;
+function png_convert_to_rfc1123(png_ptr:png_structp; ptime:png_timep):png_charp;cdecl; external libpng;
+procedure png_convert_from_struct_tm(ptime:png_timep; ttime:Pointer);cdecl; external libpng;
+procedure png_convert_from_time_t(ptime:png_timep; ttime:time_t);cdecl; external libpng;
+procedure png_set_expand(png_ptr:png_structp);cdecl; external libpng;
+procedure png_set_gray_1_2_4_to_8(png_ptr:png_structp);cdecl; external libpng;
+procedure png_set_palette_to_rgb(png_ptr:png_structp);cdecl; external libpng;
+procedure png_set_tRNS_to_alpha(png_ptr:png_structp);cdecl; external libpng;
+procedure png_set_bgr(png_ptr:png_structp);cdecl; external libpng;
+procedure png_set_gray_to_rgb(png_ptr:png_structp);cdecl; external libpng;
+procedure png_set_rgb_to_gray(png_ptr:png_structp; error_action:longint; red:double; green:double);cdecl; external libpng;
+procedure png_set_rgb_to_gray_fixed(png_ptr:png_structp; error_action:longint; red:png_fixed_point; green:png_fixed_point);cdecl; external libpng;
+function png_get_rgb_to_gray_status(png_ptr:png_structp):png_byte;cdecl; external libpng;
+procedure png_build_grayscale_palette(bit_depth:longint; palette:png_colorp);cdecl; external libpng;
+procedure png_set_strip_alpha(png_ptr:png_structp);cdecl; external libpng;
+procedure png_set_swap_alpha(png_ptr:png_structp);cdecl; external libpng;
+procedure png_set_invert_alpha(png_ptr:png_structp);cdecl; external libpng;
+procedure png_set_filler(png_ptr:png_structp; filler:png_uint_32; flags:longint);cdecl; external libpng;
+procedure png_set_swap(png_ptr:png_structp);cdecl; external libpng;
+procedure png_set_packing(png_ptr:png_structp);cdecl; external libpng;
+procedure png_set_packswap(png_ptr:png_structp);cdecl; external libpng;
+procedure png_set_shift(png_ptr:png_structp; true_bits:png_color_8p);cdecl; external libpng;
+function png_set_interlace_handling(png_ptr:png_structp):longint;cdecl; external libpng;
+procedure png_set_invert_mono(png_ptr:png_structp);cdecl; external libpng;
+procedure png_set_background(png_ptr:png_structp; background_color:png_color_16p; background_gamma_code:longint; need_expand:longint; background_gamma:double);cdecl; external libpng;
+procedure png_set_strip_16(png_ptr:png_structp);cdecl; external libpng;
+procedure png_set_dither(png_ptr:png_structp; palette:png_colorp; num_palette:longint; maximum_colors:longint; histogram:png_uint_16p; 
+            full_dither:longint);cdecl; external libpng;
+procedure png_set_gamma(png_ptr:png_structp; screen_gamma:double; default_file_gamma:double);cdecl; external libpng;
+procedure png_permit_empty_plte(png_ptr:png_structp; empty_plte_permitted:longint);cdecl; external libpng;
+procedure png_set_flush(png_ptr:png_structp; nrows:longint);cdecl; external libpng;
+procedure png_write_flush(png_ptr:png_structp);cdecl; external libpng;
+procedure png_start_read_image(png_ptr:png_structp);cdecl; external libpng;
+procedure png_read_update_info(png_ptr:png_structp; info_ptr:png_infop);cdecl; external libpng;
+procedure png_read_rows(png_ptr:png_structp; row:png_bytepp; display_row:png_bytepp; num_rows:png_uint_32);cdecl; external libpng;
+procedure png_read_row(png_ptr:png_structp; row:png_bytep; display_row:png_bytep);cdecl; external libpng;
+procedure png_read_image(png_ptr:png_structp; image:png_bytepp);cdecl; external libpng;
+procedure png_write_row(png_ptr:png_structp; row:png_bytep);cdecl; external libpng;
+procedure png_write_rows(png_ptr:png_structp; row:png_bytepp; num_rows:png_uint_32);cdecl; external libpng;
+procedure png_write_image(png_ptr:png_structp; image:png_bytepp);cdecl; external libpng;
+procedure png_write_end(png_ptr:png_structp; info_ptr:png_infop);cdecl; external libpng;
+procedure png_read_end(png_ptr:png_structp; info_ptr:png_infop);cdecl; external libpng;
+procedure png_destroy_info_struct(png_ptr:png_structp; info_ptr_ptr:png_infopp);cdecl; external libpng;
+procedure png_destroy_read_struct(png_ptr_ptr:png_structpp; info_ptr_ptr:png_infopp; end_info_ptr_ptr:png_infopp);cdecl; external libpng;
+procedure png_read_destroy(png_ptr:png_structp; info_ptr:png_infop; end_info_ptr:png_infop);cdecl; external libpng;
+procedure png_destroy_write_struct(png_ptr_ptr:png_structpp; info_ptr_ptr:png_infopp);cdecl; external libpng;
+procedure png_write_destroy_info(info_ptr:png_infop);cdecl; external libpng;
+procedure png_write_destroy(png_ptr:png_structp);cdecl; external libpng;
+procedure png_set_crc_action(png_ptr:png_structp; crit_action:longint; ancil_action:longint);cdecl; external libpng;
+procedure png_set_filter(png_ptr:png_structp; method:longint; filters:longint);cdecl; external libpng;
+procedure png_set_filter_heuristics(png_ptr:png_structp; heuristic_method:longint; num_weights:longint; filter_weights:png_doublep; filter_costs:png_doublep);cdecl; external libpng;
+procedure png_set_compression_level(png_ptr:png_structp; level:longint);cdecl; external libpng;
+procedure png_set_compression_mem_level(png_ptr:png_structp; mem_level:longint);cdecl; external libpng;
+procedure png_set_compression_strategy(png_ptr:png_structp; strategy:longint);cdecl; external libpng;
+procedure png_set_compression_window_bits(png_ptr:png_structp; window_bits:longint);cdecl; external libpng;
+procedure png_set_compression_method(png_ptr:png_structp; method:longint);cdecl; external libpng;
+procedure png_init_io(png_ptr:png_structp; fp:png_FILE_p);cdecl; external libpng;
+procedure png_set_error_fn(png_ptr:png_structp; error_ptr:png_voidp; error_fn:png_error_ptr; warning_fn:png_error_ptr);cdecl; external libpng;
+function png_get_error_ptr(png_ptr:png_structp):png_voidp;cdecl; external libpng;
+procedure png_set_write_fn(png_ptr:png_structp; io_ptr:png_voidp; write_data_fn:png_rw_ptr; output_flush_fn:png_flush_ptr);cdecl; external libpng;
+procedure png_set_read_fn(png_ptr:png_structp; io_ptr:png_voidp; read_data_fn:png_rw_ptr);cdecl; external libpng;
+function png_get_io_ptr(png_ptr:png_structp):png_voidp;cdecl; external libpng;
+procedure png_set_read_status_fn(png_ptr:png_structp; read_row_fn:png_read_status_ptr);cdecl; external libpng;
+procedure png_set_write_status_fn(png_ptr:png_structp; write_row_fn:png_write_status_ptr);cdecl; external libpng;
+procedure png_set_read_user_transform_fn(png_ptr:png_structp; read_user_transform_fn:png_user_transform_ptr);cdecl; external libpng;
+procedure png_set_write_user_transform_fn(png_ptr:png_structp; write_user_transform_fn:png_user_transform_ptr);cdecl; external libpng;
+procedure png_set_user_transform_info(png_ptr:png_structp; user_transform_ptr:png_voidp; user_transform_depth:longint; user_transform_channels:longint);cdecl; external libpng;
+function png_get_user_transform_ptr(png_ptr:png_structp):png_voidp;cdecl; external libpng;
+procedure png_set_read_user_chunk_fn(png_ptr:png_structp; user_chunk_ptr:png_voidp; read_user_chunk_fn:png_user_chunk_ptr);cdecl; external libpng;
+function png_get_user_chunk_ptr(png_ptr:png_structp):png_voidp;cdecl; external libpng;
+procedure png_set_progressive_read_fn(png_ptr:png_structp; progressive_ptr:png_voidp; info_fn:png_progressive_info_ptr; row_fn:png_progressive_row_ptr; end_fn:png_progressive_end_ptr);cdecl; external libpng;
+function png_get_progressive_ptr(png_ptr:png_structp):png_voidp;cdecl; external libpng;
+procedure png_process_data(png_ptr:png_structp; info_ptr:png_infop; buffer:png_bytep; buffer_size:png_size_t);cdecl; external libpng;
+procedure png_progressive_combine_row(png_ptr:png_structp; old_row:png_bytep; new_row:png_bytep);cdecl; external libpng;
+function png_malloc(png_ptr:png_structp; size:png_uint_32):png_voidp;cdecl; external libpng;
+procedure png_free(png_ptr:png_structp; ptr:png_voidp);cdecl; external libpng;
+procedure png_free_data(png_ptr:png_structp; info_ptr:png_infop; free_me:png_uint_32; num:longint);cdecl; external libpng;
+procedure png_data_freer(png_ptr:png_structp; info_ptr:png_infop; freer:longint; mask:png_uint_32);cdecl; external libpng;
+function png_memcpy_check(png_ptr:png_structp; s1:png_voidp; s2:png_voidp; size:png_uint_32):png_voidp;cdecl; external libpng;
+function png_memset_check(png_ptr:png_structp; s1:png_voidp; value:longint; size:png_uint_32):png_voidp;cdecl; external libpng;
+procedure png_error(png_ptr:png_structp; error:png_const_charp);cdecl; external libpng;
+procedure png_chunk_error(png_ptr:png_structp; error:png_const_charp);cdecl; external libpng;
+procedure png_warning(png_ptr:png_structp; message:png_const_charp);cdecl; external libpng;
+procedure png_chunk_warning(png_ptr:png_structp; message:png_const_charp);cdecl; external libpng;
+function png_get_valid(png_ptr:png_structp; info_ptr:png_infop; flag:png_uint_32):png_uint_32;cdecl; external libpng;
+function png_get_rowbytes(png_ptr:png_structp; info_ptr:png_infop):png_uint_32;cdecl; external libpng;
+function png_get_rows(png_ptr:png_structp; info_ptr:png_infop):png_bytepp;cdecl; external libpng;
+procedure png_set_rows(png_ptr:png_structp; info_ptr:png_infop; row_pointers:png_bytepp);cdecl; external libpng;
+function png_get_channels(png_ptr:png_structp; info_ptr:png_infop):png_byte;cdecl; external libpng;
+function png_get_image_width(png_ptr:png_structp; info_ptr:png_infop):png_uint_32;cdecl; external libpng;
+function png_get_image_height(png_ptr:png_structp; info_ptr:png_infop):png_uint_32;cdecl; external libpng;
+function png_get_bit_depth(png_ptr:png_structp; info_ptr:png_infop):png_byte;cdecl; external libpng;
+function png_get_color_type(png_ptr:png_structp; info_ptr:png_infop):png_byte;cdecl; external libpng;
+function png_get_filter_type(png_ptr:png_structp; info_ptr:png_infop):png_byte;cdecl; external libpng;
+function png_get_interlace_type(png_ptr:png_structp; info_ptr:png_infop):png_byte;cdecl; external libpng;
+function png_get_compression_type(png_ptr:png_structp; info_ptr:png_infop):png_byte;cdecl; external libpng;
+function png_get_pixels_per_meter(png_ptr:png_structp; info_ptr:png_infop):png_uint_32;cdecl; external libpng;
+function png_get_x_pixels_per_meter(png_ptr:png_structp; info_ptr:png_infop):png_uint_32;cdecl; external libpng;
+function png_get_y_pixels_per_meter(png_ptr:png_structp; info_ptr:png_infop):png_uint_32;cdecl; external libpng;
+function png_get_pixel_aspect_ratio(png_ptr:png_structp; info_ptr:png_infop):double;cdecl; external libpng;
+function png_get_x_offset_pixels(png_ptr:png_structp; info_ptr:png_infop):png_int_32;cdecl; external libpng;
+function png_get_y_offset_pixels(png_ptr:png_structp; info_ptr:png_infop):png_int_32;cdecl; external libpng;
+function png_get_x_offset_microns(png_ptr:png_structp; info_ptr:png_infop):png_int_32;cdecl; external libpng;
+function png_get_y_offset_microns(png_ptr:png_structp; info_ptr:png_infop):png_int_32;cdecl; external libpng;
+function png_get_signature(png_ptr:png_structp; info_ptr:png_infop):png_bytep;cdecl; external libpng;
+function png_get_bKGD(png_ptr:png_structp; info_ptr:png_infop; background:Ppng_color_16p):png_uint_32;cdecl; external libpng;
+procedure png_set_bKGD(png_ptr:png_structp; info_ptr:png_infop; background:png_color_16p);cdecl; external libpng;
+function png_get_cHRM(png_ptr:png_structp; info_ptr:png_infop; white_x:Pdouble; white_y:Pdouble; red_x:Pdouble; 
+           red_y:Pdouble; green_x:Pdouble; green_y:Pdouble; blue_x:Pdouble; blue_y:Pdouble):png_uint_32;cdecl; external libpng;
+function png_get_cHRM_fixed(png_ptr:png_structp; info_ptr:png_infop; int_white_x:Ppng_fixed_point; int_white_y:Ppng_fixed_point; int_red_x:Ppng_fixed_point; 
+           int_red_y:Ppng_fixed_point; int_green_x:Ppng_fixed_point; int_green_y:Ppng_fixed_point; int_blue_x:Ppng_fixed_point; int_blue_y:Ppng_fixed_point):png_uint_32;cdecl; external libpng;
+procedure png_set_cHRM(png_ptr:png_structp; info_ptr:png_infop; white_x:double; white_y:double; red_x:double; 
+            red_y:double; green_x:double; green_y:double; blue_x:double; blue_y:double);cdecl; external libpng;
+procedure png_set_cHRM_fixed(png_ptr:png_structp; info_ptr:png_infop; int_white_x:png_fixed_point; int_white_y:png_fixed_point; int_red_x:png_fixed_point; 
+            int_red_y:png_fixed_point; int_green_x:png_fixed_point; int_green_y:png_fixed_point; int_blue_x:png_fixed_point; int_blue_y:png_fixed_point);cdecl; external libpng;
+function png_get_gAMA(png_ptr:png_structp; info_ptr:png_infop; file_gamma:Pdouble):png_uint_32;cdecl; external libpng;
+function png_get_gAMA_fixed(png_ptr:png_structp; info_ptr:png_infop; int_file_gamma:Ppng_fixed_point):png_uint_32;cdecl; external libpng;
+procedure png_set_gAMA(png_ptr:png_structp; info_ptr:png_infop; file_gamma:double);cdecl; external libpng;
+procedure png_set_gAMA_fixed(png_ptr:png_structp; info_ptr:png_infop; int_file_gamma:png_fixed_point);cdecl; external libpng;
+function png_get_hIST(png_ptr:png_structp; info_ptr:png_infop; hist:Ppng_uint_16p):png_uint_32;cdecl; external libpng;
+procedure png_set_hIST(png_ptr:png_structp; info_ptr:png_infop; hist:png_uint_16p);cdecl; external libpng;
+function png_get_IHDR(png_ptr:png_structp; info_ptr:png_infop; width:Ppng_uint_32; height:Ppng_uint_32; bit_depth:Plongint; 
+           color_type:Plongint; interlace_type:Plongint; compression_type:Plongint; filter_type:Plongint):png_uint_32;cdecl; external libpng;
+procedure png_set_IHDR(png_ptr:png_structp; info_ptr:png_infop; width:png_uint_32; height:png_uint_32; bit_depth:longint; 
+            color_type:longint; interlace_type:longint; compression_type:longint; filter_type:longint);cdecl; external libpng;
+function png_get_oFFs(png_ptr:png_structp; info_ptr:png_infop; offset_x:Ppng_int_32; offset_y:Ppng_int_32; unit_type:Plongint):png_uint_32;cdecl; external libpng;
+procedure png_set_oFFs(png_ptr:png_structp; info_ptr:png_infop; offset_x:png_int_32; offset_y:png_int_32; unit_type:longint);cdecl; external libpng;
+function png_get_pCAL(png_ptr:png_structp; info_ptr:png_infop; purpose:Ppng_charp; X0:Ppng_int_32; X1:Ppng_int_32; 
+           atype:Plongint; nparams:Plongint; units:Ppng_charp; params:Ppng_charpp):png_uint_32;cdecl; external libpng;
+procedure png_set_pCAL(png_ptr:png_structp; info_ptr:png_infop; purpose:png_charp; X0:png_int_32; X1:png_int_32; 
+            atype:longint; nparams:longint; units:png_charp; params:png_charpp);cdecl; external libpng;
+function png_get_pHYs(png_ptr:png_structp; info_ptr:png_infop; res_x:Ppng_uint_32; res_y:Ppng_uint_32; unit_type:Plongint):png_uint_32;cdecl; external libpng;
+procedure png_set_pHYs(png_ptr:png_structp; info_ptr:png_infop; res_x:png_uint_32; res_y:png_uint_32; unit_type:longint);cdecl; external libpng;
+function png_get_PLTE(png_ptr:png_structp; info_ptr:png_infop; palette:Ppng_colorp; num_palette:Plongint):png_uint_32;cdecl; external libpng;
+procedure png_set_PLTE(png_ptr:png_structp; info_ptr:png_infop; palette:png_colorp; num_palette:longint);cdecl; external libpng;
+function png_get_sBIT(png_ptr:png_structp; info_ptr:png_infop; sig_bit:Ppng_color_8p):png_uint_32;cdecl; external libpng;
+procedure png_set_sBIT(png_ptr:png_structp; info_ptr:png_infop; sig_bit:png_color_8p);cdecl; external libpng;
+function png_get_sRGB(png_ptr:png_structp; info_ptr:png_infop; intent:Plongint):png_uint_32;cdecl; external libpng;
+procedure png_set_sRGB(png_ptr:png_structp; info_ptr:png_infop; intent:longint);cdecl; external libpng;
+procedure png_set_sRGB_gAMA_and_cHRM(png_ptr:png_structp; info_ptr:png_infop; intent:longint);cdecl; external libpng;
+function png_get_iCCP(png_ptr:png_structp; info_ptr:png_infop; name:png_charpp; compression_type:Plongint; profile:png_charpp; 
+           proflen:Ppng_uint_32):png_uint_32;cdecl; external libpng;
+procedure png_set_iCCP(png_ptr:png_structp; info_ptr:png_infop; name:png_charp; compression_type:longint; profile:png_charp; 
+            proflen:png_uint_32);cdecl; external libpng;
+function png_get_sPLT(png_ptr:png_structp; info_ptr:png_infop; entries:png_sPLT_tpp):png_uint_32;cdecl; external libpng;
+procedure png_set_sPLT(png_ptr:png_structp; info_ptr:png_infop; entries:png_sPLT_tp; nentries:longint);cdecl; external libpng;
+function png_get_text(png_ptr:png_structp; info_ptr:png_infop; text_ptr:Ppng_textp; num_text:Plongint):png_uint_32;cdecl; external libpng;
+procedure png_set_text(png_ptr:png_structp; info_ptr:png_infop; text_ptr:png_textp; num_text:longint);cdecl; external libpng;
+function png_get_tIME(png_ptr:png_structp; info_ptr:png_infop; mod_time:Ppng_timep):png_uint_32;cdecl; external libpng;
+procedure png_set_tIME(png_ptr:png_structp; info_ptr:png_infop; mod_time:png_timep);cdecl; external libpng;
+function png_get_tRNS(png_ptr:png_structp; info_ptr:png_infop; trans:Ppng_bytep; num_trans:Plongint; trans_values:Ppng_color_16p):png_uint_32;cdecl; external libpng;
+procedure png_set_tRNS(png_ptr:png_structp; info_ptr:png_infop; trans:png_bytep; num_trans:longint; trans_values:png_color_16p);cdecl; external libpng;
+function png_get_sCAL(png_ptr:png_structp; info_ptr:png_infop; aunit:Plongint; width:Pdouble; height:Pdouble):png_uint_32;cdecl; external libpng;
+procedure png_set_sCAL(png_ptr:png_structp; info_ptr:png_infop; aunit:longint; width:double; height:double);cdecl; external libpng;
+procedure png_set_sCAL_s(png_ptr:png_structp; info_ptr:png_infop; aunit:longint; swidth:png_charp; sheight:png_charp);cdecl; external libpng;
+procedure png_set_keep_unknown_chunks(png_ptr:png_structp; keep:longint; chunk_list:png_bytep; num_chunks:longint);cdecl; external libpng;
+procedure png_set_unknown_chunks(png_ptr:png_structp; info_ptr:png_infop; unknowns:png_unknown_chunkp; num_unknowns:longint);cdecl; external libpng;
+procedure png_set_unknown_chunk_location(png_ptr:png_structp; info_ptr:png_infop; chunk:longint; location:longint);cdecl; external libpng;
+function png_get_unknown_chunks(png_ptr:png_structp; info_ptr:png_infop; entries:png_unknown_chunkpp):png_uint_32;cdecl; external libpng;
+procedure png_set_invalid(png_ptr:png_structp; info_ptr:png_infop; mask:longint);cdecl; external libpng;
+procedure png_read_png(png_ptr:png_structp; info_ptr:png_infop; transforms:longint; params:voidp);cdecl; external libpng;
+procedure png_write_png(png_ptr:png_structp; info_ptr:png_infop; transforms:longint; params:voidp);cdecl; external libpng;
+function png_get_header_ver(png_ptr:png_structp):png_charp;cdecl; external libpng;
+function png_get_header_version(png_ptr:png_structp):png_charp;cdecl; external libpng;
+function png_get_libpng_ver(png_ptr:png_structp):png_charp;cdecl; external libpng;
+
+implementation
+  
+end.