From owner-freebsd-ports Sat Oct 13 15:52:12 2001 Delivered-To: freebsd-ports@freebsd.org Received: from corbulon.video-collage.com (corbulon.video-collage.com [64.35.99.179]) by hub.freebsd.org (Postfix) with ESMTP id E882137B40D; Sat, 13 Oct 2001 15:51:59 -0700 (PDT) Received: (from mi@localhost) by corbulon.video-collage.com (8.11.4/8.11.4) id f9DMpxt44264; Sat, 13 Oct 2001 18:51:59 -0400 (EDT) (envelope-from mi) From: Mikhail Teterin Message-Id: <200110132251.f9DMpxt44264@corbulon.video-collage.com> Subject: xpm WITHOUT_X11 To: ports@freebsd.org Date: Sat, 13 Oct 2001 18:51:59 -0400 (EDT) Cc: jseger@freebsd.org, torstenb@freebsd.org X-Mailer: ELM [version 2.4ME+ PL92b (25)] MIME-Version: 1.0 Content-Transfer-Encoding: 7bit Content-Type: text/plain; charset=US-ASCII Sender: owner-freebsd-ports@FreeBSD.ORG Precedence: bulk List-ID: List-Archive: (Web Archive) List-Help: (List Instructions) List-Subscribe: List-Unsubscribe: X-Loop: FreeBSD.org Hello! I'm about to commit the following patch to graphics/xpm. It is intended to allow to build the (limited) version of libXpm on X11-less machines. It deliberately uses X11BASE as a prefix in either case -- not sure if this is a good idea, I did this to help other things link with it. sxpm is not built without X11 -- there are uses for it in X11-less case, but too much needs to be ripped out. Perhaps, it can be done later. It installs my home-cooked xpm-nox.h next to the standard xpm.h. All one needs to compile and link xpm clients without X11 is define XPM_NOX prior to including xpm.h. In particular graphics/gd can be built to generate xpm-images without requiring X11. Rather than patching the long-forsaken Makefile.noX, home cooked bsd.*.* based Makefiles are used. Unless there are loud objections, I'll commit it some time next week -- the poor thing has no maintainer :) Thanks! -mi Index: Makefile =================================================================== RCS file: /home/ncvs/ports/graphics/xpm/Makefile,v retrieving revision 1.33 diff -U2 -r1.33 Makefile --- Makefile 2001/09/17 17:40:18 1.33 +++ Makefile 2001/10/13 22:38:50 @@ -8,5 +8,5 @@ PORTNAME= xpm PORTVERSION= 3.4k -CATEGORIES= graphics x11 +CATEGORIES= graphics MASTER_SITES= ${MASTER_SITE_XCONTRIB} MASTER_SITE_SUBDIR= libraries @@ -14,11 +14,23 @@ MAINTAINER= ports@FreeBSD.org +MAN1= cxpm.1 +.if defined(WITHOUT_X11) +MAKEFILE= ${FILESDIR}/Makefile.bsd +PREFIX= ${X11BASE} +MAKE_ENV+= FILESDIR="${FILESDIR}" +PLIST_SUB+= SXPM='@comment ' +MTREE_FILE= ${FILESDIR}/mtree +MANCOMPRESSED= maybe +.else +CATEGORIES+= x11 +PLIST_SUB+= SXPM='' USE_IMAKE= yes -INSTALLS_SHLIB= yes - -MAN1= cxpm.1 sxpm.1 - +MAN1+= sxpm.1 post-install: @ranlib ${PREFIX}/lib/libXpm.a + @${INSTALL_DATA} ${FILESDIR}/xpm-nox.h ${PREFIX}/include/X11/ +.endif + +INSTALLS_SHLIB= yes .include Index: pkg-descr =================================================================== RCS file: /home/ncvs/ports/graphics/xpm/pkg-descr,v retrieving revision 1.6 diff -U2 -r1.6 pkg-descr --- pkg-descr 2001/06/26 16:27:52 1.6 +++ pkg-descr 2001/10/13 22:38:50 @@ -1,3 +1,3 @@ - + * This package can now also be built without X11 support. * Here is an extract from the README file: Index: pkg-plist =================================================================== RCS file: /home/ncvs/ports/graphics/xpm/pkg-plist,v retrieving revision 1.21 diff -U2 -r1.21 pkg-plist --- pkg-plist 2000/06/15 16:44:15 1.21 +++ pkg-plist 2001/10/13 22:38:50 @@ -1,6 +1,7 @@ bin/cxpm -bin/sxpm +%%SXPM%%bin/sxpm include/X11/xpm.h lib/libXpm.a lib/libXpm.so lib/libXpm.so.4 +include/X11/xpm-nox.h Index: files/Makefile.bsd =================================================================== RCS file: Makefile.bsd diff -N Makefile.bsd --- /dev/null Sat Oct 13 15:21:23 2001 +++ Makefile.bsd Sat Oct 13 15:38:50 2001 @@ -0,0 +1,8 @@ +# This Makefiles are only used in the WITHOUT_X11 case. If X is present, +# the standard, imake-based build is performed. + +all install: + cd ${.CURDIR}/lib && ${MAKE} -f ${FILESDIR}/Makefile.lib ${.TARGET} -j2 + cd ${.CURDIR}/cxpm && ${MAKE} -f ${FILESDIR}/Makefile.cxpm ${.TARGET} -j2 +# sxpm can not yet be built without X11 +# cd ${.CURDIR}/cxpm && ${MAKE} -f ${FILESDIR}/Makefile.cxpm ${.TARGET} Index: files/Makefile.cxpm =================================================================== RCS file: Makefile.cxpm diff -N Makefile.cxpm --- /dev/null Sat Oct 13 15:21:23 2001 +++ Makefile.cxpm Sat Oct 13 15:38:50 2001 @@ -0,0 +1,9 @@ +PROG= cxpm +BINDIR= ${PREFIX}/bin +MANDIR= ${PREFIX}/man/man +CFLAGS+=-DXPM_NOX -I${FILESDIR} + +cxpm.1: + ln -s cxpm.man cxpm.1 + +.include Index: files/Makefile.lib =================================================================== RCS file: Makefile.lib diff -N Makefile.lib --- /dev/null Sat Oct 13 15:21:23 2001 +++ Makefile.lib Sat Oct 13 15:38:50 2001 @@ -0,0 +1,16 @@ +OBJS= data.o create.o misc.o rgb.o scan.o parse.o hashtab.o \ + WrFFrI.o RdFToI.o CrIFrDat.o CrDatFrI.o \ + CrIFrBuf.o CrPFrBuf.o CrBufFrI.o CrBufFrP.o \ + RdFToDat.o WrFFrDat.o \ + Attrib.o Image.o Info.o RdFToBuf.o WrFFrBuf.o + +CFLAGS+=-DXPM_NOX -I.. -I${FILESDIR} +LIB= Xpm +LIBDIR= ${PREFIX}/lib +INCDIR= ${PREFIX}/include/X11 +SHLIB_MAJOR= 4 +SHLIB_MINOR= 1 + +INCS= xpm.h ${FILESDIR}/xpm-nox.h + +.include Index: files/mtree =================================================================== RCS file: mtree diff -N mtree --- /dev/null Sat Oct 13 15:21:23 2001 +++ mtree Sat Oct 13 15:38:50 2001 @@ -0,0 +1,15 @@ +/set type=dir uname=root gname=wheel mode=0755 +. + bin + .. + include + X11 + .. + .. + lib + .. + man + man1 + .. + .. +.. Index: files/patch-nox =================================================================== RCS file: patch-nox diff -N patch-nox --- /dev/null Sat Oct 13 15:21:23 2001 +++ patch-nox Sat Oct 13 15:38:50 2001 @@ -0,0 +1,35 @@ +--- lib/xpm.h Thu Mar 19 14:51:00 1998 ++++ lib/xpm.h Wed Mar 7 16:12:14 2001 +@@ -75,4 +75,8 @@ + # else /* not AMIGA */ +-# include +-# include ++# ifdef XPM_NOX ++# include "xpm-nox.h" ++# else ++# include ++# include ++# endif /* not XPM_NOX */ + # endif /* not AMIGA */ +--- lib/create.c Thu Mar 19 14:51:00 1998 ++++ lib/create.c Wed Mar 7 17:34:47 2001 +@@ -182,3 +182,3 @@ + #ifndef FOR_MSW +-# ifndef AMIGA ++# if !defined(AMIGA) && !defined(XPM_NOX) + switch (visual->class) { +@@ -569,3 +569,3 @@ + +-#ifndef FOR_MSW ++#if !defined(FOR_MSW) && !defined(XPM_NOX) + if (USE_CLOSECOLOR) { +--- lib/Makefile.noX Thu Mar 19 14:50:59 1998 ++++ lib/Makefile.noX Sat Oct 13 17:04:04 2001 +@@ -53,6 +53,5 @@ + OBJS= data.o create.o misc.o rgb.o scan.o parse.o hashtab.o \ +- WrFFrP.o RdFToP.o CrPFrDat.o CrDatFrP.o \ + WrFFrI.o RdFToI.o CrIFrDat.o CrDatFrI.o \ + CrIFrBuf.o CrPFrBuf.o CrBufFrI.o CrBufFrP.o \ + RdFToDat.o WrFFrDat.o \ +- Attrib.o CrIFrP.o CrPFrI.o Image.o Info.o RdFToBuf.o WrFFrBuf.o ++ Attrib.o Image.o Info.o RdFToBuf.o WrFFrBuf.o Index: files/xpm-nox.h =================================================================== RCS file: xpm-nox.h diff -N xpm-nox.h --- /dev/null Sat Oct 13 15:21:23 2001 +++ xpm-nox.h Sat Oct 13 15:38:51 2001 @@ -0,0 +1,134 @@ +#if !defined(XPM_NOX) || !defined(XPM_h) +#error "This file should only be included by xpm.h and only in the XPM_NOX case" +#endif +#ifndef _NOX_H +#define _NOX_H + +#define boundCheckingMalloc malloc +#define boundCheckingCalloc calloc +#define boundCheckingRealloc realloc + +typedef void *Display; /* this should be similar */ +typedef void *Screen; /* not used */ +typedef void *Visual; /* not used yet, is for GRAY, COLOR, + * MONO */ + +typedef void *Colormap; /* should be COLORPALETTE, not done + * yet */ + +typedef unsigned long Pixel; + +#define PIXEL_ALREADY_TYPEDEFED /* to let xpm.h know about it */ + +typedef struct { + Pixel pixel; + unsigned short red, green, blue; +} XColor; + +#define XDefaultVisual(D,S) NULL +#define XDefaultScreen(D) NULL +#define XDefaultColormap(D,S) NULL +#define XDefaultDepth(D,S) 24 /* bits per pixel */ + +#if 0 +/* color related */ + FUNC(XParseColor, int, (Display *, Colormap *, char *, XColor *)); + FUNC(XAllocColor, int, (Display *, Colormap *, XColor *)); + FUNC(XQueryColors, void, (Display *display, Colormap *colormap, + XColor *xcolors, int ncolors)); + FUNC(XFreeColors, int, (Display *d, Colormap cmap, + unsigned long pixels[], + int npixels, unsigned long planes)); +/* XImage */ + FUNC(XCreateImage, XImage *, (Display *, Visual *, int depth, int format, + int x, int y, int width, int height, + int pad, int foo)); + +/* free and destroy bitmap */ + FUNC(XDestroyImage, void /* ? */ , (XImage *)); +/* free only, bitmap remains */ + FUNC(XImageFree, void, (XImage *)); +#if defined(__cplusplus) || defined(c_plusplus) +} /* end of extern "C" */ +#endif /* cplusplus */ + +#endif /* 0 */ + +#ifndef True +#define True 1 +#define False 0 +#endif +#ifndef Bool +# ifdef __unix__ +typedef char Bool; +# include +typedef u_int32_t Drawable; +typedef u_int32_t Pixmap; +# else +typedef BOOL Bool; /* take MSW bool */ +# endif +#endif +/* make these local here, simx.c gets the same from xpm.h */ +#undef LFUNC +#undef FUNC + + +#endif /* _SIMX_H */ + +/* Stolen from: */ + +/* $TOG: Xlib.h /main/122 1998/03/22 18:22:09 barstow $ */ +/* $XFree86: xc/lib/X11/Xlib.h,v 3.18 2000/12/04 18:49:20 dawes Exp $ */ + +typedef struct _XImage { + int width, height; /* size of image */ + int xoffset; /* number of pixels offset in X direction */ + int format; /* XYBitmap, XYPixmap, ZPixmap */ + char *data; /* pointer to image data */ + int byte_order; /* data byte order, LSBFirst, MSBFirst */ + int bitmap_unit; /* quant. of scanline 8, 16, 32 */ + int bitmap_bit_order; /* LSBFirst, MSBFirst */ + int bitmap_pad; /* 8, 16, 32 either XY or ZPixmap */ + int depth; /* depth of image */ + int bytes_per_line; /* accelarator to next line */ + int bits_per_pixel; /* bits per pixel (ZPixmap) */ + unsigned long red_mask; /* bits in z arrangment */ + unsigned long green_mask; + unsigned long blue_mask; + char *obdata; /* hook for the object routines to hang on */ + struct funcs { /* image manipulation routines */ +#if NeedFunctionPrototypes + struct _XImage *(*create_image)( + struct _XDisplay* /* display */, + Visual* /* visual */, + unsigned int /* depth */, + int /* format */, + int /* offset */, + char* /* data */, + unsigned int /* width */, + unsigned int /* height */, + int /* bitmap_pad */, + int /* bytes_per_line */); + int (*destroy_image) (struct _XImage *); + unsigned long (*get_pixel) (struct _XImage *, int, int); + int (*put_pixel) (struct _XImage *, int, int, unsigned long); + struct _XImage *(*sub_image)(struct _XImage *, int, int, unsigned int, unsigned int); + int (*add_pixel) (struct _XImage *, long); +#else + struct _XImage *(*create_image)(); + int (*destroy_image)(); + unsigned long (*get_pixel)(); + int (*put_pixel)(); + struct _XImage *(*sub_image)(); + int (*add_pixel)(); +#endif + } f; +} XImage; + +/* This is from X.h */ +#define LSBFirst 0 +#define MSBFirst 1 + +#define XYBitmap 0 /* depth 1, XYFormat */ +#define XYPixmap 1 /* depth == drawable depth */ +#define ZPixmap 2 /* depth == drawable depth */ To Unsubscribe: send mail to majordomo@FreeBSD.org with "unsubscribe freebsd-ports" in the body of the message