Skip to content

Commit

Permalink
brlaser version 1
Browse files Browse the repository at this point in the history
  • Loading branch information
pdewacht committed Dec 27, 2013
0 parents commit b7af164
Show file tree
Hide file tree
Showing 18 changed files with 1,753 additions and 0 deletions.
20 changes: 20 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,20 @@
#
# Autotools
#
/Makefile
/Makefile.in
/aclocal.m4
/autom4te.cache
/build-aux
/config.*
/configure
/stamp-*
.deps/
.dirstamp

#
# Binaries
#
/rastertobrlaser
/brlaser.drv
*.o
339 changes: 339 additions & 0 deletions COPYING

Large diffs are not rendered by default.

18 changes: 18 additions & 0 deletions Makefile.am
Original file line number Diff line number Diff line change
@@ -0,0 +1,18 @@
ACLOCAL_AMFLAGS = -I m4

filter_PROGRAMS = rastertobrlaser
filterdir = $(CUPS_SERVERBIN)/filter

drv_DATA = brlaser.drv
drvdir = $(CUPS_DATADIR)/drv

rastertobrlaser_SOURCES = \
src/main.cc \
src/debug.h \
src/debug.cc \
src/job.h \
src/job.cc \
src/line.h \
src/line.cc
rastertobrlaser_CPPFLAGS = $(CUPS_CFLAGS)
rastertobrlaser_LDADD = $(CUPS_LIBS)
15 changes: 15 additions & 0 deletions autogen.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
#! /bin/sh

srcdir=`dirname "$0"`
test -z "$srcdir" && srcdir=.

ORIGDIR=`pwd`
cd "$srcdir"

autoreconf --force -v --install || exit 1
cd "$ORIGDIR" || exit $?

if test -z "$NOCONFIGURE"; then
exec "$srcdir"/configure "$@"
fi

83 changes: 83 additions & 0 deletions brlaser.drv.in
Original file line number Diff line number Diff line change
@@ -0,0 +1,83 @@
// This file is part of the brlaser printer driver.
//
// Copyright 2013 Peter De Wachter
//
// brlaser is free software: you can redistribute it and/or modify
// it under the terms of the GNU General Public License as published by
// the Free Software Foundation, either version 2 of the License, or
// (at your option) any later version.
//
// brlaser 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. See the
// GNU General Public License for more details.
//
// You should have received a copy of the GNU General Public License
// along with brlaser. If not, see <http://www.gnu.org/licenses/>.

// Include standard font and media definitions
#include <font.defs>
#include <media.defs>

// List the fonts that are supported, in this case all standard fonts...
Font *

// Manufacturer and driver version.
Manufacturer "Brother"
Version @VERSION@

// Each filter provided by the driver...
Filter application/vnd.cups-raster 33 rastertobrlaser

// Supported resolutions.
// The 1200dpi mode is weird: we need to send 1200x1200dpi raster
// data, but Brother only advertises 1200x600dpi. I wonder what
// is going on there.
Resolution k 1 0 0 0 "300dpi/300 DPI"
*Resolution k 1 0 0 0 "600dpi/600 DPI"
Resolution k 1 0 0 0 "1200dpi/1200HQ"

// Supported page sizes.
HWMargins 8 8 8 16
*MediaSize A4
MediaSize A5
MediaSize A6
MediaSize B5
MediaSize B6
MediaSize EnvC5
MediaSize EnvMonarch
MediaSize EnvPRC5
MediaSize Executive
MediaSize Legal
MediaSize Letter

// Input trays. Numbers must match the filter source code.
*InputSlot 0 "Auto/Auto-select"
InputSlot 1 "Tray1/Tray 1"
InputSlot 2 "Tray2/Tray 2"
InputSlot 3 "Tray3/Tray 3"
InputSlot 4 "MPTray/MP Tray"
InputSlot 5 "Manual/Manual"

// Media types.
*MediaType 0 "PLAIN/Plain paper"
MediaType 1 "THIN/Thin paper"
MediaType 2 "THICK/Thick paper"
MediaType 3 "THICKER/Thicker paper"
MediaType 4 "BOND/Bond paper"
MediaType 5 "TRANS/Transparencies"
MediaType 6 "ENV/Envelopes"
MediaType 7 "ENV-THICK/Thick envelopes"
MediaType 8 "ENV-THIN/Thin envelopes"

Option "brlaserEconomode/Toner save mode" Boolean AnySetup 10
*Choice False/Off "<</cupsInteger10 0>>setpagedevice"
Choice True/On "<</cupsInteger10 1>>setpagedevice"


{
ModelName "DCP-7030"
Attribute "NickName" "" "Brother DCP-7030, using @PACKAGE@ v@VERSION@"
Attribute "1284DeviceID" "" "MFG:Brother;CMD:PJL,HBP;MDL:DCP-7030;CLS:PRINTER;"
PCFileName "br7030.ppd"
}
57 changes: 57 additions & 0 deletions configure.ac
Original file line number Diff line number Diff line change
@@ -0,0 +1,57 @@
# This file is part of the brlaser printer driver.
#
# Copyright 2013 Peter De Wachter
#
# brlaser is free software: you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
# the Free Software Foundation, either version 2 of the License, or
# (at your option) any later version.
#
# brlaser 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. See the
# GNU General Public License for more details.
#
# You should have received a copy of the GNU General Public License
# along with brlaser. If not, see <http:#www.gnu.org/licenses/>.

AC_PREREQ(2.68)
AC_INIT([brlaser], [1], [[email protected]], [brlaser],
[https://github.com/pdewacht/brlaser])

AC_CONFIG_SRCDIR([src/line.cc])
AC_CONFIG_MACRO_DIR([m4])
AC_CONFIG_AUX_DIR([build-aux])
AC_LANG([C++])

AM_INIT_AUTOMAKE([1.11.1 foreign subdir-objects dist-xz -Wall -Werror])
AM_MAINTAINER_MODE([enable])
AM_SILENT_RULES([yes])

AC_PROG_CXX
AX_CXX_COMPILE_STDCXX_11
AX_CXXFLAGS_WARN_ALL

dnl Use cups-config to detect the CUPS configuration.
AC_PATH_PROG(CUPS_CONFIG, cups-config)
AS_IF([test -z "$CUPS_CONFIG"],
[AC_MSG_ERROR(["cups-config" command not found. Please install the CUPS development package.])])
CUPS_CFLAGS=`"$CUPS_CONFIG" --cflags`
CUPS_LIBS=`"$CUPS_CONFIG" --image --libs`
CUPS_SERVERBIN=`"$CUPS_CONFIG" --serverbin`
CUPS_DATADIR=`"$CUPS_CONFIG" --datadir`
AC_SUBST(CUPS_CFLAGS)
AC_SUBST(CUPS_LIBS)
AC_SUBST(CUPS_SERVERBIN)
AC_SUBST(CUPS_DATADIR)

dnl 'cups-config --libs' lists a lot of libs we don't need/want,
dnl try to figure out whether the linker knows about --as-needed.
AC_ARG_ENABLE([as-needed],
AC_HELP_STRING([--disable-as-needed], [disable overlinking protection]))
AS_IF([test "x$enable_as_needed" != "xno"],
[AX_APPEND_LINK_FLAGS([-Wl,--as-needed])])

AC_CONFIG_HEADERS([config.h])
AC_CONFIG_FILES([Makefile brlaser.drv])
AC_OUTPUT
69 changes: 69 additions & 0 deletions m4/ax_append_flag.m4
Original file line number Diff line number Diff line change
@@ -0,0 +1,69 @@
# ===========================================================================
# http://www.gnu.org/software/autoconf-archive/ax_append_flag.html
# ===========================================================================
#
# SYNOPSIS
#
# AX_APPEND_FLAG(FLAG, [FLAGS-VARIABLE])
#
# DESCRIPTION
#
# FLAG is appended to the FLAGS-VARIABLE shell variable, with a space
# added in between.
#
# If FLAGS-VARIABLE is not specified, the current language's flags (e.g.
# CFLAGS) is used. FLAGS-VARIABLE is not changed if it already contains
# FLAG. If FLAGS-VARIABLE is unset in the shell, it is set to exactly
# FLAG.
#
# NOTE: Implementation based on AX_CFLAGS_GCC_OPTION.
#
# LICENSE
#
# Copyright (c) 2008 Guido U. Draheim <[email protected]>
# Copyright (c) 2011 Maarten Bosmans <[email protected]>
#
# This program is free software: you can redistribute it and/or modify it
# under the terms of the GNU General Public License as published by the
# Free Software Foundation, either version 3 of the License, or (at your
# option) any later version.
#
# 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. See the GNU General
# Public License for more details.
#
# You should have received a copy of the GNU General Public License along
# with this program. If not, see <http://www.gnu.org/licenses/>.
#
# As a special exception, the respective Autoconf Macro's copyright owner
# gives unlimited permission to copy, distribute and modify the configure
# scripts that are the output of Autoconf when processing the Macro. You
# need not follow the terms of the GNU General Public License when using
# or distributing such scripts, even though portions of the text of the
# Macro appear in them. The GNU General Public License (GPL) does govern
# all other use of the material that constitutes the Autoconf Macro.
#
# This special exception to the GPL applies to versions of the Autoconf
# Macro released by the Autoconf Archive. When you make and distribute a
# modified version of the Autoconf Macro, you may extend this special
# exception to the GPL to apply to your modified version as well.

#serial 2

AC_DEFUN([AX_APPEND_FLAG],
[AC_PREREQ(2.59)dnl for _AC_LANG_PREFIX
AS_VAR_PUSHDEF([FLAGS], [m4_default($2,_AC_LANG_PREFIX[FLAGS])])dnl
AS_VAR_SET_IF(FLAGS,
[case " AS_VAR_GET(FLAGS) " in
*" $1 "*)
AC_RUN_LOG([: FLAGS already contains $1])
;;
*)
AC_RUN_LOG([: FLAGS="$FLAGS $1"])
AS_VAR_SET(FLAGS, ["AS_VAR_GET(FLAGS) $1"])
;;
esac],
[AS_VAR_SET(FLAGS,["$1"])])
AS_VAR_POPDEF([FLAGS])dnl
])dnl AX_APPEND_FLAG
61 changes: 61 additions & 0 deletions m4/ax_append_link_flags.m4
Original file line number Diff line number Diff line change
@@ -0,0 +1,61 @@
# ===========================================================================
# http://www.gnu.org/software/autoconf-archive/ax_append_link_flags.html
# ===========================================================================
#
# SYNOPSIS
#
# AX_APPEND_LINK_FLAGS([FLAG1 FLAG2 ...], [FLAGS-VARIABLE], [EXTRA-FLAGS])
#
# DESCRIPTION
#
# For every FLAG1, FLAG2 it is checked whether the linker works with the
# flag. If it does, the flag is added FLAGS-VARIABLE
#
# If FLAGS-VARIABLE is not specified, the linker's flags (LDFLAGS) is
# used. During the check the flag is always added to the linker's flags.
#
# If EXTRA-FLAGS is defined, it is added to the linker's default flags
# when the check is done. The check is thus made with the flags: "LDFLAGS
# EXTRA-FLAGS FLAG". This can for example be used to force the linker to
# issue an error when a bad flag is given.
#
# NOTE: This macro depends on the AX_APPEND_FLAG and AX_CHECK_LINK_FLAG.
# Please keep this macro in sync with AX_APPEND_COMPILE_FLAGS.
#
# LICENSE
#
# Copyright (c) 2011 Maarten Bosmans <[email protected]>
#
# This program is free software: you can redistribute it and/or modify it
# under the terms of the GNU General Public License as published by the
# Free Software Foundation, either version 3 of the License, or (at your
# option) any later version.
#
# 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. See the GNU General
# Public License for more details.
#
# You should have received a copy of the GNU General Public License along
# with this program. If not, see <http://www.gnu.org/licenses/>.
#
# As a special exception, the respective Autoconf Macro's copyright owner
# gives unlimited permission to copy, distribute and modify the configure
# scripts that are the output of Autoconf when processing the Macro. You
# need not follow the terms of the GNU General Public License when using
# or distributing such scripts, even though portions of the text of the
# Macro appear in them. The GNU General Public License (GPL) does govern
# all other use of the material that constitutes the Autoconf Macro.
#
# This special exception to the GPL applies to versions of the Autoconf
# Macro released by the Autoconf Archive. When you make and distribute a
# modified version of the Autoconf Macro, you may extend this special
# exception to the GPL to apply to your modified version as well.

#serial 2

AC_DEFUN([AX_APPEND_LINK_FLAGS],
[for flag in $1; do
AX_CHECK_LINK_FLAG([$flag], [AX_APPEND_FLAG([$flag], [m4_default([$2], [LDFLAGS])])], [], [$3])
done
])dnl AX_APPEND_LINK_FLAGS
Loading

0 comments on commit b7af164

Please sign in to comment.