[Update: Mar. 17. 2025]
cnijfilter2 version  "6.80.1"
------------------------------------

cnijfilter2.SlackBuild
[code]
#!/bin/bash

# Slackware build script for cnijfilter2

# Copyright 2019 Kenneth Chan, Hong Kong
# All rights reserved.
#
# Redistribution and use of this script, with or without modification, is
# permitted provided that the following conditions are met:
#
# 1. Redistributions of this script must retain the above copyright
#    notice, this list of conditions and the following disclaimer.
#
#  THIS SOFTWARE IS PROVIDED BY THE AUTHOR "AS IS" AND ANY EXPRESS OR IMPLIED
#  WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF
#  MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.  IN NO
#  EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
#  SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
#  PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS;
#  OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY,
#  WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR
#  OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF
#  ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.

# 20220301 bkw: Modified by SlackBuilds.org, BUILD=2:
# - strip binaries.
# - relative symlinks.
# - remove INSTALL from doc dir.

cd $(dirname $0) ; CWD=$(pwd)

PRGNAM=
cnijfilter2
VERSION=${VERSION:-
6.80.1}
BUILD=${BUILD:-1}
TAG=${TAG:-jw}
PKGTYPE=${PKGTYPE:-txz}

SRCNAM=$PRGNAM-source
SRCVERSION=
6.80-1

if [ -z "$ARCH" ]; then
  case "$( uname -m )" in
    i?86) ARCH=i586 ;;
    aarch64) ARCH=aarch64 ;;
    arm*) ARCH=arm ;;
       *) ARCH=$( uname -m ) ;;
  esac
fi

# If the variable PRINT_PACKAGE_NAME is set, then this script will report what
# the name of the created package would be, and then exit. This information
# could be useful to other scripts.
if [ ! -z "${PRINT_PACKAGE_NAME}" ]; then
  echo "$PRGNAM-$VERSION-$ARCH-$BUILD$TAG.$PKGTYPE"
  exit 0
fi

TMP=${TMP:-/tmp/SBo}
PKG=$TMP/package-$PRGNAM
OUTPUT=${OUTPUT:-/tmp}

if [ "$ARCH" = "i586" ]; then
  SLKCFLAGS="-O2 -march=i586 -mtune=i686"
  LIBDIRSUFFIX=""
  BITS="i686"
elif [ "$ARCH" = "i686" ]; then
  SLKCFLAGS="-O2 -march=i686 -mtune=i686"
  LIBDIRSUFFIX=""
  BITS="i686"
elif [ "$ARCH" = "x86_64" ]; then
  SLKCFLAGS="-O2 -fPIC"
  LIBDIRSUFFIX="64"
  BITS="x86_64"
elif [ "$ARCH" = "aarch64" ]; then
  SLKCFLAGS="-O2 -fPIC"
  LIBDIRSUFFIX="64"
  BITS="aarch64"
else
  echo "Package for $ARCH architecture is not available."
  exit 1
fi

export ARCH
export SLKCFLAGS
export LIBDIRSUFFIX

set -e

rm -rf $PKG
mkdir -p $TMP $PKG $OUTPUT
cd $TMP
rm -rf $SRCNAM-$SRCVERSION

tar xvzf $CWD/$SRCNAM-${SRCVERSION}.tar.gz
cd $SRCNAM-$SRCVERSION
chown -R root:root .
find -L . \
 \( -perm 777 -o -perm 775 -o -perm 750 -o -perm 711 -o -perm 555 \
  -o -perm 511 \) -exec chmod 755 {} \; -o \
 \( -perm 666 -o -perm 664 -o -perm 640 -o -perm 600 -o -perm 444 \
  -o -perm 440 -o -perm 400 \) -exec chmod 644 {} \;
find -L . \
 \( -type f \! -name autogen.sh \) \
  -exec chmod 644 {} \;

#patch -p1 < $CWD/gcc10.patch
patch -p1 < $CWD/001_cnijfilter2-6.80-fno-common.patch --verbose || exit 1
patch -p1 < $CWD/002_add-missing-import.patch --verbose || exit 1
patch -p1 < $CWD/003_fix-libxml2-config.patch --verbose || exit 1


for dir in cmdtocanonij2 cmdtocanonij3 ; do
  pushd $dir
  ./autogen.sh --prefix=/usr --datadir=/usr/share LDFLAGS="-L../../com/libs_bin_${BITS}"
  make
  popd
done

pushd cnijbe2
  ./autogen.sh --prefix=/usr --enable-progpath=/usr/bin
  make
popd

pushd lgmon3
  ./autogen.sh --prefix=/usr --enable-libpath=/usr/lib${LIBDIRSUFFIX}/bjlib2 --enable-progpath=/usr/bin \
    --datadir=/usr/share LDFLAGS="-L../../com/libs_bin_${BITS}"
  make
popd

pushd rastertocanonij
  ./autogen.sh --prefix=/usr --enable-progpath=/usr/bin
  make
popd

for dir in tocanonij tocnpwg ; do
  pushd $dir
  ./autogen.sh --prefix=/usr
  make
  popd
done

common_pkg="cmdtocanonij2 cmdtocanonij3 cnijbe2 lgmon3 rastertocanonij tocanonij tocnpwg"
for dir in $common_pkg; do
  pushd $dir
    make install DESTDIR=$PKG
  popd
done

if [ "$ARCH" = "x86_64" ]; then
  mv $PKG/usr/lib $PKG/usr/lib64
fi
mkdir -p $PKG/usr/lib${LIBDIRSUFFIX}/bjlib2
install -c -o lp -g lp -m 644 com/ini/cnnet.ini $PKG/usr/lib${LIBDIRSUFFIX}/bjlib2/
install -c -m 755 com/libs_bin_${BITS}/*.so.* $PKG/usr/lib${LIBDIRSUFFIX}/

# 20220409 bkw: this bit of template was missing.
find $PKG -print0 | xargs -0 file | grep -e "executable" -e "shared object" | grep ELF \
  | cut -f 1 -d : | xargs strip --strip-unneeded 2> /dev/null || true

# Run ldconfig in the build script so that /usr/lib{64}/libcn*.so
# are tracked by doinst.sh
if [ -x /sbin/ldconfig ]; then
  /sbin/ldconfig $PKG/usr/lib${LIBDIRSUFFIX}
fi

mkdir -p $PKG/usr/share/ppd/cnijfilter2 $PKG/usr/share/cups/model
cp -a ppd/*.ppd $PKG/usr/share/ppd/cnijfilter2

# 20220409 bkw: made these relative symlinks.
PPD_FILES=$( cd $PKG/usr/share/ppd/cnijfilter2 ; ls *.ppd )
for f in $PPD_FILES; do
  ln -fs ../../ppd/cnijfilter2/${f} $PKG/usr/share/cups/model/${f}
done

mkdir -p $PKG/usr/doc/$PRGNAM-$VERSION/lproptions
cp -a doc/* $PKG/usr/doc/$PRGNAM-$VERSION
cp -a lproptions/lpr* $PKG/usr/doc/$PRGNAM-$VERSION/lproptions
cat ppd/NEWS > $PKG/usr/doc/$PRGNAM-$VERSION/NEWS
# Copy all README to /usr/doc
for dir in $common_pkg; do
  mkdir $PKG/usr/doc/$PRGNAM-$VERSION/$dir
  pushd $dir
    for file in AUTHORS COPYING ChangeLog LICENSE* NEWS README; do
      [ -f $file ] && cp -a $file $PKG/usr/doc/$PRGNAM-$VERSION/$dir
    done
  popd
done
cat $CWD/README > $PKG/usr/doc/$PRGNAM-$VERSION/README.SBo
cat $CWD/$PRGNAM.SlackBuild > $PKG/usr/doc/$PRGNAM-$VERSION/$PRGNAM.SlackBuild

mkdir -p $PKG/install
cat $CWD/slack-desc > $PKG/install/slack-desc

cd $PKG
/sbin/makepkg -l y -c n $OUTPUT/$PRGNAM-$VERSION-$ARCH-$BUILD$TAG.$PKGTYPE

cnijfilter2.info
[code]
PRGNAM="cnijfilter2"
VERSION="
6.80.1"
HOMEPAGE="https://canon.jp/support/software/os/select/ij-mfp/cnijfilter2-source-680-1tar"
DOWNLOAD="
https://gdlp01.c-wss.com/gds/2/0100012302/02/cnijfilter2-source-6.80-1.tar.gz"
MD5SUM="98b5836e486c94a9214c79766bd532ff"
DOWNLOAD_x86_64=""
MD5SUM_x86_64=""
REQUIRES=""
MAINTAINER=""
EMAIL=""

001_cnijfilter2-6.80-fno-common.patch
[code]
--- a/lgmon3/src/cnijlgmon3.c    2025-03-17 21:47:45.151131390 +0900
+++ b/lgmon3/src/cnijlgmon3.c    2025-03-17 21:52:16.590335545 +0900
@@ -55,7 +55,7 @@
 int (*GET_STATUS)(char *, int, int *, int * , char *);
 int (*GET_STATUS2)(char *, int, char *, int *, int * , char *, char *);
 int (*GET_STATUS2_MAINTENANCE)(char *, int, char *, int *, int * , char *, char *);
-int (*GET_PROTOCOL)(char *, size_t);
+static int (*GET_PROTOCOL)(char *, size_t);
 
 
  int main(int argc, char *argv[])

002_add-missing-import.patch
[code]
diff -ura cnijfilter2-source-6.60-1/lgmon3/src/keytext.c cnijfilter2-source-6.60-1-new/lgmon3/src/keytext.c
--- cnijfilter2-source-6.60-1/lgmon3/src/keytext.c    2022-12-20 05:28:46.000000000 +0000
+++ cnijfilter2-source-6.60-1-new/lgmon3/src/keytext.c    2024-07-23 20:35:24.859816250 +0100
@@ -37,6 +37,7 @@
 #include <unistd.h>
 #include <libxml/parser.h>    /* Ver.2.80 */
 #include <string.h>
+#include <stdlib.h>
 
 #include "keytext.h"


003_fix-libxml2-config.patch
[code]
diff -ura cnijfilter2-source-6.80-1/lgmon3/configure.in cnijfilter2-source-6.80-1.new/lgmon3/configure.in
--- cnijfilter2-source-6.80-1/lgmon3/configure.in    2024-09-20 07:28:40.000000000 +0100
+++ cnijfilter2-source-6.80-1.new/lgmon3/configure.in    2025-02-24 01:21:57.676721707 +0000
@@ -72,7 +72,7 @@
 
 CFLAGS="-O2"
 
-XML2_CFLAGS=`xml2-config --cflags`
+XML2_CFLAGS=`pkg-config libxml-2.0 --cflags`
 AC_SUBST(XML2_CFLAGS)
 
 AC_OUTPUT([
diff -ura cnijfilter2-source-6.80-1/tocnpwg/configure.in cnijfilter2-source-6.80-1.new/tocnpwg/configure.in
--- cnijfilter2-source-6.80-1/tocnpwg/configure.in    2024-09-20 07:28:40.000000000 +0100
+++ cnijfilter2-source-6.80-1.new/tocnpwg/configure.in    2025-02-24 01:22:00.930699848 +0000
@@ -41,7 +41,7 @@
 
 CFLAGS="-O2"
 
-XML_2_CFLAGS=`xml2-config --cflags`
+XML_2_CFLAGS=`pkg-config libxml-2.0 --cflags`
 AC_SUBST(XML_2_CFLAGS)
 
 AC_OUTPUT(Makefile


slack-desc
[code]
# HOW TO EDIT THIS FILE:
# The "handy ruler" below makes it easier to edit a package description.  Line
# up the first '|' above the ':' following the base package name, and the '|'
# on the right side marks the last column you can put a character in.  You must
# make exactly 11 lines for the formatting to be correct.  It's also
# customary to leave one space after the ':'.

           |-----handy-ruler------------------------------------------------------|
cnijfilter2: cnijfilter2 (Canon IJ Printer Driver)
cnijfilter2:
cnijfilter2: cnijfilter2 provides printing functions for Canon Inkjet printers
cnijfilter2: operating under the CUPS (Common UNIX Printing System) environment.
cnijfilter2:
cnijfilter2: It supports MG7500 series, MG6700 series, MG6600 series, MG5600
cnijfilter2: series, MG2900 series, MB2000 series, MB2300, iB4000 series,
cnijfilter2: MB5000 series, MB5300 series, iP110 series, E450 series, MX490
cnijfilter2: series, E480 series.
cnijfilter2:
cnijfilter2: Homepage: https://asia.canon/en/support/0101163901

Supported_printers.lst
[code]
canone200.ppd    canong1030.ppd    canong3090.ppd   canong7000.ppd   canongx6000.ppd   canonmb5300.ppd   canonmx490.ppd   canontr8530.ppd  
canonts3500.ppd  canonts6180.ppd   canonts7330.ppd  canonts8180.ppd  canonts9000.ppd   canonxk70.ppd     canone300.ppd    canong2020.ppd  
canong4000.ppd   canong7080.ppd    canongx6500.ppd  canonmb5400.ppd  canontr150.ppd    canontr8580.ppd   canonts3600.ppd  canonts6200.ppd  
canonts7400.ppd  canonts8200.ppd   canonts9100.ppd  canonxk80.ppd    canone3100.ppd    canong2030.ppd    canong4010.ppd   canongm2000.ppd  
canongx7000.ppd  canonmg2900.ppd   canontr4500.ppd  canontr8600.ppd  canonts3700.ppd   canonts6230.ppd   canonts7430.ppd  canonts8230.ppd  
canonts9180.ppd  canonxk90.ppd     canone3300.ppd   canong2060.ppd   canong4070.ppd    canongm2080.ppd   canonib4000.ppd  canonmg3000.ppd  
canontr4600.ppd  canontr8630.ppd   canonts5000.ppd  canonts6280.ppd  canonts7450i.ppd  canonts8280.ppd   canonts9500.ppd  canone3400.ppd  
canong2070.ppd   canong4080.ppd    canongm4000.ppd  canonib4100.ppd  canonmg3600.ppd   canontr4700.ppd   canontr9530.ppd  canonts5100.ppd   
canonts6300.ppd  canonts7530.ppd   canonts8300.ppd  canonts9580.ppd  canone3600.ppd    canong3000.ppd    canong4090.ppd   canongm4080.ppd  
canonip110.ppd   canonmg5600.ppd   canontr7000.ppd  canonts200.ppd   canonts5300.ppd   canonts6330.ppd   canonts7600i.ppd canonts8330.ppd  
canonxk100.ppd   canone4200.ppd    canong3010.ppd   canong500.ppd    canongx1000.ppd   canonmb2000.ppd   canonmg5700.ppd  canontr703.ppd   
canonts2400.ppd  canonts5350i.ppd  canonts6380.ppd  canonts7700.ppd  canonts8380.ppd   canonxk110.ppd    canone4500.ppd   canong3020.ppd  
canong5000.ppd   canongx2000.ppd   canonmb2100.ppd  canonmg6600.ppd  canontr7500.ppd   canonts2600.ppd   canonts5380.ppd  canonts6400.ppd  
canonts7700a.ppd  canonts8430.ppd  canonxk120.ppd   canone460.ppd    canong3030.ppd    canong5080.ppd    canongx3000.ppd  canonmb2300.ppd  
canonmg6800.ppd  canontr7530.ppd   canonts300.ppd   canonts5400.ppd  canonts6630.ppd   canonts7700i.ppd  canonts8530.ppd  canonxk130.ppd
canone470.ppd    canong3060.ppd    canong600.ppd    canongx4000.ppd  canonmb2700.ppd   canonmg6900.ppd   canontr7600.ppd  canonts3100.ppd  
canonts6000.ppd  canonts6730.ppd   canonts8000.ppd  canonts8630.ppd  canonxk50.ppd     canone480.ppd     canong3070.ppd   canong6000.ppd  
canongx5000.ppd  canonmb5000.ppd   canonmg7500.ppd  canontr7800.ppd  canonts3300.ppd   canonts6100.ppd   canonts700.ppd   canonts8100.ppd   
canonts8700.ppd  canonxk500.ppd    canong1020.ppd   canong3080.ppd   canong6080.ppd    canongx5500.ppd   canonmb5100.ppd  canonmg7700.ppd  
canontr8500.ppd  canonts3400.ppd   canonts6130.ppd  canonts708.ppd   canonts8130.ppd   canonts8800.ppd   canonxk60.ppd

---
[Update] Mar.17,2025