[xorg-commit-diffs] xc/packager/tarball Imakefile, NONE, 1.1.2.1 README_tarball, NONE, 1.1.2.1 make_xprint_binary_tarball.sh, NONE, 1.1.2.1 startxprint.sh, NONE, 1.1.2.1

Roland Mainz xorg-commit at pdx.freedesktop.org
Mon Apr 12 20:16:36 PDT 2004


Committed by: gisburn

Update of /cvs/xorg/xc/packager/tarball
In directory pdx:/tmp/cvs-serv9732/xc/packager/tarball

Added Files:
      Tag: XPRINT
	Imakefile README_tarball make_xprint_binary_tarball.sh 
	startxprint.sh 
Log Message:
Fix for http://xprint.freedesktop.org/cgi-bin/bugzilla/show_bug.cgi?id=462 - RFE: Merge xprint.mozdev.org Xprint enhancements into Xorg XPRINT branch

--- NEW FILE: Imakefile ---
XCOMM $Xorg: Imakefile,v 1.1 2003/02/10 19:54:53 gisburn Exp $

#if InstallXF86EncodingFiles
INSTALLXF86ENCODINGFILES=1
#else
INSTALLXF86ENCODINGFILES=0
#endif /* InstallXF86EncodingFiles */

FONT_ENCODINGS_PATH      = XF86EncodingsPath
FONT_ENCODINGS_DIRECTORY = $(FONT_ENCODINGS_PATH)/encodings.dir

make_xprint_tarball::
	XPRINTDIR=$(XPRINTDIR) XBINDIR=$(BINDIR) XTOP=$(TOP) XMANPATH=$(MANPATH) XFONTENCPATH=$(FONT_ENCODINGS_PATH) XINSTALLXF86ENCODINGFILES=$(INSTALLXF86ENCODINGFILES) ; \
	export XPRINTDIR XBINDIR XTOP XMANPATH XFONTENCPATH XINSTALLXF86ENCODINGFILES ; \
	$(SHELL) make_xprint_binary_tarball.sh

--- NEW FILE: README_tarball ---

Xprint server for Linux/AIX/IRIX README

8th release of the Xprt (X11 print server) build from xprint.mozdev.org sources

Disclaimer:
We do not guarantee that any source code or executable code available from the 
in this package is Year 2000 compliant, works in any way or may not eat your
harddisk alive.

Please read the the Xprint_FAQ.txt how to configure Xprint.

* Installation and usage 
  (short version, reading the Xprint_FAQ.txt first is better):
a) For the impatient, the hurry or if you do not have the "root"-password or if 
   you do not want to try this as "root":
     1. Unpack the tarball to your favourite dir:
       % mkdir /tmp/test_xprint
       % cd /tmp/test_xprint
       % gunzip -c xprint_linux_tarball.tar.gz | tar -xvf -

     2. Start the Xprint server
        ("./run_xprint_from_tarball.sh" is a wrapper script
        for the "/etc/init.d/xprint" script which tells that script where the
        Xprint server files are currently be located.)
       % cd xprint
       % ./run_xprint_from_tarball.sh start
  
     3. Set the ${XPSERVERLIST} env var (and/or put this into your shell profile,
        do not forget to specify the _full_ path to the "run_xprint_from_tarball.sh"
        script):
       # sh
       % XPSERVERLIST="`./run_xprint_from_tarball.sh get_xpserverlist`"
       % export XPSERVERLIST
       
       # ksh/bash syntax
       % export XPSERVERLIST="$(./run_xprint_from_tarball.sh get_xpserverlist)"

     4. Verifying that Xprint is running and working 
       (this is usually "done" by /usr/X11R6/bin/xplsprinters - but the
        "./run_xprint_from_tarball.sh" / "/etc/init.d/xprint" scripts provide
        a wrapper for that tool, too):
       % ./run_xprint_from_tarball.sh lsprinters

     5. Run the application you want to use
       % /usr/local/bin/bin/mozilla

     * Alternatively you can replace step [3] and [5] with:
       % ./run_xprint_from_tarball.sh wrapper /usr/local/bin/bin/mozilla
  
a) If you have adminstrator priviledges ("root") on your machine:
  # There are binary and source RPMs for Linux, *.deb packages for Debian and
  # *.pkg packages for Solaris available at http://xprint.mozdev.org,
  # the tarball installation is only for those platforms which are not coverd
  # by the list above or for those people who only want to run Xprint per-user
  # without installing it permanently <--

  1. Make sure that you eliminate any existing Xfree86-based Xprt servers.
     All Xprt binares build from Xfree86 sources up to today are broken and
     will not work.
     Example:
     % which Xprt
     /usr/X11R6/bin/Xprt
     % mv /usr/X11R6/bin/Xprt /usr/X11R6/bin/Xprt_xf86_disabled

  2. Copy the files in dist/usr into the matching dirs on your hard disk:
     Example:
     % (cd install; chmod -R og=u,og-w . ; tar -cf - usr etc) | (cd / ; tar -xf -)

  3. Start X print server:
     % /etc/init.d/xprint start

  4. Make the info available where the applications can find Xprint server(s):
     For all users (maybe in /etc/profile):
     % XPSERVERLIST="`/etc/init.d/xprint get_xpserverlist`"
     % export XPSERVERLIST
     (this step is optional for systems which support /etc/profile.d/ ; the tarball
     comes with /etc/profile.d/xprint.sh and /etc/profile.d/xprint.csh which will
     set the XPSERVERLIST env var for all users if the Xprint servers are running)

    # Do not set $DISPLAY to the Xprt server. You still need your normal
    # Xserver for your video card(=framebuffer) - Xprt is only for your
    # printer(s).

  5. Verifying that Xprint is running and working 
    % /usr/X11R6/bin/xplsprinters
      OR
    % ./run_xprint_from_tarball.sh lsprinters

* Top two of the issues on Linux (all items from the FAQ):
  ("P"=problem, "B"=background, "S"=solution", "W"=Workaround)
  1. P: "Printing works but the printout is covers only 1/4 of the page"
     B: This is usually an indicator for a wrong DPI setting. The default
        "PSdefault" model config uses 300DPI but some printers use 600DPI.
     W: Edit ${XPCONFIGDIR}/C/print/attributes/document and replace the line
        "*default-printer-resolution: 300" with
        "*default-printer-resolution: 600"
     S: Create a model-config for your printer which only contains attributes
        supported by your printer (read the docs... :)
   
  2. P: "Printing works but I get large borders..."
     B: Same issue as issue [2] - wrong DPI
     S: Check the DPI value and adjust it as described in [2]. Common DPI
        values are 240, 300, 360, 400 and 600 DPI.

More info will follow when I have time, take a look at the Xprint pages at
http://xprint.mozdev.org/ in the meantime...

----

Bye,
Roland

-- 
  __ .  . __
 (o.\ \/ /.o) roland.mainz at nrubsig.org
  \__\/\/__/  MPEG specialist, C&&JAVA&&Sun&&Unix programmer
  /O /==\ O\  TEL +49 2426 901568 FAX +49 2426 901569
 (;O/ \/ \O;) 



--- NEW FILE: make_xprint_binary_tarball.sh ---
#!/bin/sh
#
# make_xprint_binary_tarball.sh - packager script for Xprint stuff
#
# $Xorg: make_xprint_binary_tarball.sh,v 1.2 2003/02/09 04:41:52 gisburn Exp $
#
# This script creates a binary tarball for Xprint stuff (Xprt, Xprt config
# files and Xprint helper applications.
#
# Written by Roland Mainz <roland.mainz at nrubsig.org>
#

# These should be provided by Imakefile
#XTOP=..
#XPRINTDIR=/usr/openwin/lib/X11/xserver
#XBINDIR=/usr/openwin/bin
#
# XPDESTTARFILE may be optionally set as a command line argument to give the 
# destination filepath for the tarball, otherwise it will be found in /tmp.
# Note that the tarball is automatically compressed (to .gz, if gzip is
# available, otherwise to .Z); your name for XPDESTTARFILE should reflect this.

PATH=/usr/bin:/bin:/usr/sbin:/sbin
if [ "`uname -s`" = "SunOS" ] ; then
    PATH=/usr/xpg4/bin:/usr/ccs/bin:${PATH}
fi
export PATH

fatal_error()
{
    echo "${this_script}: ## FATAL ERROR: ${1}" 1>&2
    exit 1
}

# Check if mandatory env vars have been set
[ "${XTOP}"                       = "" ] && fatal_error "XTOP env var not set."
[ "${XPRINTDIR}"                  = "" ] && fatal_error "XPRINTDIR env var not set."
[ "${XBINDIR}"                    = "" ] && fatal_error "XBINDIR env var not set."
[ "${XMANPATH}"                   = "" ] && fatal_error "XMANPATH env var not set."
[ "${XFONTENCPATH}"               = "" ] && fatal_error "XFONTENCPATH env var not set."
[ "${XINSTALLXF86ENCODINGFILES}"  = "" ] && fatal_error "XINSTALLXF86ENCODINGFILES env var not set."


# Do not edit
# REL_* vars are paths relative to '/'
# Thanks to the "wonders" of some /bin/sh I cannot use ...
# REL_XPRINTDIR=${XPRINTDIR#*/}
# REL_XBINDIR=${XBINDIR#*/}
# ... ;-(
REL_XPRINTDIR="`echo ${XPRINTDIR} | sed 's/\///'`"
REL_XBINDIR="`echo ${XBINDIR} | sed 's/\///'`"
REL_XMANPATH="`echo ${XMANPATH} | sed 's/\///'`"
REL_XFONTENCPATH="`echo ${XFONTENCPATH} | sed 's/\///'`"

XPINSTALL_SESSION="`date +%y%m%d%H%M%S`"
XPINSTALLDIR_BASE=/tmp/xpinstall_${XPINSTALL_SESSION}
XPINSTALLDIR=${XPINSTALLDIR_BASE}/xprint
XPINSTALLDIR_X11=${XPINSTALLDIR}/install
XPLOGFILE=/tmp/xpinstall_${XPINSTALL_SESSION}.log
XPTARFILE=/tmp/xprint_server_${XPINSTALL_SESSION}.tar

CURR_DIR="`pwd`"

DO_BUILD=false

# List of files/dirs which should be put into the tarball
if [ "`uname -s`" = "FreeBSD" ] ; then
  REL_XETCDIR="`echo ${XBINDIR} | sed 's/\///' | sed 's/bin/etc/'`"
else
  REL_XETCDIR="etc"
fi
BINFILELIST=" \
  xprint/install/${REL_XBINDIR}/Xprt \
  xprint/install/${REL_XBINDIR}/xplsprinters \
  xprint/install/${REL_XBINDIR}/xphelloworld \
  xprint/install/${REL_XBINDIR}/xpxthelloworld \
  xprint/install/${REL_XBINDIR}/xpsimplehelloworld \
  xprint/install/${REL_XETCDIR} \
  xprint/install/${REL_XPRINTDIR} \
  xprint/install/${REL_XPRINTDIR}/C/print/models/PSdefault/fonts/fonts.dir \
  xprint/install/${REL_XPRINTDIR}/C/print/models/PSdefault/fonts/Courier.pmf \
  xprint/install/${REL_XPRINTDIR}/C/print/attributes/document \
  xprint/install/${REL_XPRINTDIR}/en_US/print/attributes/document \
  xprint/install/${REL_XMANPATH} \
  xprint/run_xprint_from_tarball.sh \
  xprint/README"

# Solaris/CDE1.x || AIX/CDE extra files
if [ "`uname -s`" = "SunOS" -o "`uname -s`" = "AIX" ] ; then
  BINFILELIST="${BINFILELIST} \
    xprint/install/usr/dt/config/Xsession.d"
fi

# Should we install our own copies of the XF86 encoding files ?
if [ ${XINSTALLXF86ENCODINGFILES} -eq 1 ] ; then
  BINFILELIST="${BINFILELIST} \
    xprint/install/${REL_XFONTENCPATH}"
fi

# List of manual page names (suffix is omitted here since it differs
# from platform to platform)
MANPAGELIST=" \
  Xprint. \
  Xprt. \
  xplsprinters. \
  xphelloworld \
  xpxthelloworld. \
  xpawhelloworld. \
  xpxmhelloworld. \
  xpsimplehelloworld."

step=0

umask 022

inc_step_counter()
{
  step=`expr ${step} + 1`
}

has_gzip()
{
  for i in `echo ${PATH} | tr ":" " "` 
  do
    if [ -x "${i}/gzip" ] ; then
      return 0
    fi
  done

  return 1
}

# Step 1:
# Build xc/ tree...
if ${DO_BUILD} ; then
  inc_step_counter
  echo "## Step ${step}: Building..."
  (
    (
      cd ${XTOP}
      if make World 2>&1 | tee -a buildlog.log >&${XPLOGFILE} ; then
        echo "Build OK."
      else
        echo "Build failed:"
        echo "-- snip --"
        tail ${XPLOGFILE}
        echo "-- snip --"
        exit 1
      fi
    )
  )
  echo "##         Build completed DONE."
fi # ${DO_BUILD}

# Step 2:
# Verification...
inc_step_counter
echo "## Step ${step}: Verifying..."
(
  status=true

  if [ ! -x ${XTOP}/programs/Xserver/Xprt ] ; then
    echo "error: X print server (${XTOP}/programs/Xserver/Xprt) binary missing."
    status=false
  fi

  if [ ! -x ${XTOP}/programs/xplsprinters/xplsprinters ] ; then
    echo "error: ${XTOP}/programs/xplsprinters/xplsprinters binary missing."
    status=false
  fi

  if [ ! -x ${XTOP}/programs/xphelloworld/xpxthelloworld/xpxthelloworld ] ; then
    echo "error: ${XTOP}/programs/xphelloworld/xpxthelloworld/xpxthelloworld binary missing."
    status=false
  fi

  if [ ! -x ${XTOP}/programs/xphelloworld/xphelloworld/xphelloworld ] ; then
    echo "error: ${XTOP}/programs/xphelloworld/xphelloworld/xphelloworld binary missing."
    status=false
  fi

  if [ ! -x ${XTOP}/programs/xphelloworld/xpsimplehelloworld/xpsimplehelloworld  ] ; then
    echo "error: ${XTOP}/programs/xphelloworld/xpsimplehelloworld/xpsimplehelloworld binary missing."
    status=false
  fi

  if ${status} ; then
    echo "No errors found."
  else
    fatal_error "Verification failed."
  fi
)
[ $? != 0 ] && exit 1;
echo "##         Verification DONE."

# Step 3:
# Install into temp. location
inc_step_counter
echo "## Step ${step}: Install into temporary location..."
(
  [ -d ${XPINSTALLDIR} ] && fatal_error "Temp. installation dir ${XPINSTALLDIR} already exists."
  mkdir -p ${XPINSTALLDIR}
  [ ! -d ${XPINSTALLDIR} ] && fatal_error "Could not create temp. installation dir ${XPINSTALLDIR}."

  mkdir ${XPINSTALLDIR_X11}
  [ ! -d ${XPINSTALLDIR_X11} ] && fatal_error "Could not create temp. installation dir ${XPINSTALLDIR_X11}."
  
  (
    cd ${XTOP}
    
    # Install binaries, config files etc.
    if make install DESTDIR=${XPINSTALLDIR_X11} >>${XPLOGFILE} 2>&1 ; then
      echo "Installation (1/3) OK."
    else
      echo "Installation (1/3) failed:"
      echo "-- snip --"
      tail ${XPLOGFILE}
      echo "-- snip --"
      exit 1
    fi
    
    # Install manual pages...
    if make install.man DESTDIR=${XPINSTALLDIR_X11} >>${XPLOGFILE} 2>&1 ; then
      echo "Installation (2/3) OK."
    else
      echo "Installation (2/3) failed:"
      echo "-- snip --"
      tail ${XPLOGFILE}
      echo "-- snip --"
      exit 1
    fi
    
    # Copy tarball startxprint.sh and README_tarball
    cp "${CURR_DIR}/README_tarball" "${XPINSTALLDIR}/README"
    cp "${CURR_DIR}/startxprint.sh" "${XPINSTALLDIR}/run_xprint_from_tarball.sh"
    chmod a+rx "${XPINSTALLDIR}/run_xprint_from_tarball.sh"
    echo "Installation (3/3) OK."
    
    # Search the ${XPINSTALLDIR_X11}/${REL_XMANPATH} dir for manual pages which
    # do not occur in the ${MANPAGELIST} list and remove those files
    cd ${XPINSTALLDIR_X11}/${REL_XMANPATH}
    for i in */*.* ; do
      NO_MATCH="true"
      
      for j in ${MANPAGELIST} ; do
        [ "`echo "${i}" | fgrep "${j}"`" != "" ] && NO_MATCH="false"
      done
      
      if ${NO_MATCH} ; then 
        rm -f "${i}"
      fi
    done
  )
)
[ $? != 0 ] && exit 1;
echo "##         Temp. installation DONE."

# Step 4:
# Verify installation
inc_step_counter
echo "## Step ${step}: Verifying installation..."
(
  # Part 1: Test for missing files
  cd ${XPINSTALLDIR_BASE}
  status=true
  for i in ${BINFILELIST} ; do
    if [ ! -r ${i} ] ; then
      echo "File ${i} missing."
      status=false
    fi
  done
  
  # Part 2: Test "PSdefault" printer model
  cd ${XPINSTALLDIR_BASE}
  x=`cat "xprint/install/${REL_XPRINTDIR}/C/print/models/PSdefault/fonts/fonts.dir" | wc -l`
  if [ "$x" -ne 31 ] ; then
    echo "PSdefault model fonts.dir misses font entries."
    status=false
  fi
  
  if ${status} ; then
    echo "No errors found."
  else
    fatal_error "Verification failed."
  fi
)
[ $? != 0 ] && exit 1;
echo "##        Verification of installation DONE."

# Step 5.a:
# Create binary tarball
inc_step_counter
echo "## Step ${step}: Create binary tarball..."
(
  cd ${XPINSTALLDIR_BASE}
  if has_gzip ; then
    tar -cf - ${BINFILELIST} | gzip --best --stdout >${XPTARFILE}.gz
  else
    tar -cf - ${BINFILELIST} | compress >${XPTARFILE}.Z
  fi
)
[ $? != 0 ] && exit 1;
echo "##        Binary tarball creation DONE."

# Step 5.b:
# Copy binary tarball to destination, if required.
if [ "${XPDESTTARFILE}" != "" ] ; then
    inc_step_counter
    echo "## Step ${step}: Copying binary tarball to destination..."
    (
    if has_gzip ; then
	mv ${XPTARFILE}.gz ${XPDESTTARFILE}
    else
	mv ${XPTARFILE}.Z ${XPDESTTARFILE}
    fi
    )
    echo "##        Copying tarball to destination DONE."
fi

# Step 6:
# Cleaning up
inc_step_counter
echo "## Step ${step}: Cleaning up..."
(
  # Be carefull... =:-)
  if [ "${XPINSTALLDIR_BASE}" != "/" ] ; then
    rm -Rf ${XPINSTALLDIR_BASE}
  fi
)
echo "##        Cleanup done."


# Done.
echo "#### Binary tarball is now available at "
if [ "${XPDESTTARFILE}" != "" ] ; then
    ls -l ${XPDESTTARFILE}*
else
    ls -l ${XPTARFILE}*
fi
echo "#### All done."

exit 0
# EOF.

--- NEW FILE: startxprint.sh ---
#!/bin/sh
#
# Copyright (c) 2003-2004 by Roland Mainz <roland.mainz at nrubsig.org>
# All rights reserved.
#
#ident  "@(#)startxprint.sh   0.1    2003/02/08 gisburn"
#
# (Hack-like) wrapper script to use /etc/init.d/xprint directly from a
# tarball without the need to be "root" nor to do any special installation
# steps
#
############################################################################

# Force use of a POSIX conformant sh 
# (Solaris /sbin/sh is plain Bourne shell)
[ "$1" != "posix_sh_forced" -a -x /usr/dt/bin/dtksh  ]   && exec /usr/dt/bin/dtksh  "$0" posix_sh_forced "$@"
[ "$1" != "posix_sh_forced" -a -x /bin/ksh93  ]          && exec /bin/ksh93  "$0" posix_sh_forced "$@"
[ "$1" != "posix_sh_forced" -a -x /bin/ksh  ]            && exec /bin/ksh  "$0" posix_sh_forced "$@"
[ "$1" != "posix_sh_forced" -a -x /bin/bash ]            && exec /bin/bash "$0" posix_sh_forced "$@"
[ "$1" != "posix_sh_forced" -a -x /usr/local/bin/ksh93 ] && exec /usr/local/bin/ksh93 "$0" posix_sh_forced "$@"
[ "$1" != "posix_sh_forced" -a -x /usr/local/bin/ksh ]   && exec /usr/local/bin/ksh "$0" posix_sh_forced "$@"
[ "$1" != "posix_sh_forced" -a -x /usr/local/bin/bash ]  && exec /usr/local/bin/bash "$0" posix_sh_forced "$@"
if [ "$1" != "posix_sh_forced" ] ; then
    echo "${0}: ## FATAL ERROR: No POSIX-shell found."  1>&2
    exit 1
fi


shift # Drop "posix_sh_forced"

PATH=/usr/sbin:/usr/bin:/sbin:/bin
export PATH

fatal_error()
{
    echo "${this_script}: ## FATAL ERROR: ${1}" 1>&2
    exit 1
}

relpath2abspath()
{
    (
      dirpart="`dirname "${1}"`"
      basepart="`basename "${1}"`"
    
      echo "`cd "${dirpart}" ; pwd`/${basepart}"
    )
    return 0
}

##### main
this_script="$(relpath2abspath "${0}")"
unpackdir="$(dirname "${this_script}")/install"
if [ -d ${unpackdir}/usr/X11R6/etc/rc.d ]; then
xinitdir="usr/X11R6/etc/rc.d"
else
xinitdir="etc/init.d"
fi

## prechecks
[ ! -d "${unpackdir}/usr"               ] && fatal_error "${unpackdir}/usr not found"
[ ! -r "${unpackdir}/${xinitdir}/xprint" ] && fatal_error "${unpackdir}/${xinitdir}/xprint not found"

xprt_path="$(find "${unpackdir}" -name Xprt -print)"
xplsprinters_path="$(find "${unpackdir}" -name xplsprinters -print)"
psdefault_path="$(find "${unpackdir}" -name PSdefault -print)"
xf86encodingsdir_path="$(find "${unpackdir}" -name encodings.dir -print)"

[ "${psdefault_path}"         = "" ] && fatal_error "no PSdefault model found in ${unpackdir}"
[ "${xprt_path}"              = "" ] && fatal_error "no Xprt binary found in ${unpackdir}"
[ "${xplsprinters_path}"      = "" ] && fatal_error "no xplsprinters binary found in ${unpackdir}"
[ ! -r "${psdefault_path}"         ] && fatal_error "PSdefault model \"${psdefault_path}\" found in ${unpackdir} not accessible"
[ ! -x "${xprt_path}"              ] && fatal_error "Xprt binary \"${xprt_path}\" found in ${unpackdir} not accessible/executable"

xpconfig_dir="${psdefault_path%*/C/print/models/PSdefault}"

# run the "/etc/init.d/xprint start" using the binaries/config files/scripts in the tarball
ETC_INITD_XPRINT_XPRT_PATH="${xprt_path}"
ETC_INITD_XPRINT_XPLSPRINTERS_PATH="${xplsprinters_path}"
ETC_INITD_XPRINT_XPCONFIGDIR="${xpconfig_dir}"
ETC_INITD_XPRINT_XF86ENCODINGSDIR="${xf86encodingsdir_path}"
export ETC_INITD_XPRINT_XPRT_PATH ETC_INITD_XPRINT_XPCONFIGDIR ETC_INITD_XPRINT_XPLSPRINTERS_PATH ETC_INITD_XPRINT_XF86ENCODINGSDIR
/bin/sh "${unpackdir}/${xinitdir}/xprint" "$@"

# EOF.




More information about the xorg-commit-diffs mailing list