You are not logged in.

#1 2014-04-05 09:13:19

greymatter
Member
Registered: 2014-04-05
Posts: 5

[SOLVED] Asking for help and reviews for a PKGBUILD (cnijfilter-mp250)

Hi everyone,

I recently changed the desktop pc used by my parents, and I installed Arch on it (the previous desktop was running Debian). I know that I need to install a driver to get the printer working (a Canon MP 250 Series), because I did it before with Debian.

The driver is in the AUR:
https://aur.archlinux.org/packages/cnijfilter-mp250/

A user in the comment (Huulivoide) suggested that the PKGBUILD was old, but the current mantainer didn't respond, so I decided to try to update the PKGBUILD myself as a learning opportunity and as a way to give something back to the community. This is the first PKGBUILD that I modify; while I've used Arch for quite some time, I'm still a noob in many respects.

I tried to apply all the suggestions, and I did some other things (like quoting variables) that I often see in PKGBUILDs. This is the PKGBUILD:

# Maintainer: Alireza Savand <alireza.savand@gmail.com>
# Special thanks to: olive, mirrr, GUiHKX, alessiofachechi, jeremy33,
#		     jstitch, plv

pkgname=cnijfilter-mp250
pkgver=3.40.1
pkgrel=5.1
_pkgrealver=3.40
_pkgrealrel=1
pkgdesc="Canon IJ Printer Driver (MP250 series)"
url="http://support-au.canon.com.au/contents/AU/EN/0100302002.html"
arch=('i686' 'x86_64')
license=('custom')
depends=(
    'libcups'
    'cups'
    'popt'
    'ghostscript'
    'gsfonts'
    'atk>=1.9.0'
    'gtk2>=2.8.0'
    'pango>=1.12.3'
    'libpng>=1.2.8'
    'libtiff'
    'cairo>=1.0.2'
    'libxml2>=2.6.24'
    'fontconfig>=2.3.0'
    'libxinerama'
)
makedepends=(
    'autoconf>=2.13'
    'automake>=1.6'
    'tar'
    'make'
    'gcc'
)
conflicts=('cnijfilter-common')
install=cnijfilter-mp250.install
source=(
    'http://gdlp01.c-wss.com/gds/0/0100003020/01/cnijfilter-source-3.40-1.tar.gz'
    'fix.patch'
    'libpng.patch'
    'automake_fix.patch'
)
md5sums=(
    '609975a05d6050fcca88f312d3f35c6a'
    'ba9c7ec49e76bf74cc50702e362aba7b'
    '15e417cd427a920c83e4f28e225e428e'
    '07f698d8987632d9bb427d3f4a42a29a'
)


prepare() {
  cd "${srcdir}/cnijfilter-source-${_pkgrealver}-${_pkgrealrel}/"
  #patch -p0 < "${srcdir}/fix.patch"
  #patch -p0 < "${srcdir}/libpng.patch"
  #patch -p0 < "${srcdir}/automake_fix.patch"
  
}


build() {

  cd "${srcdir}/cnijfilter-source-${_pkgrealver}-${_pkgrealrel}/libs"
  ./autogen.sh --prefix=/usr --program-suffix=mp250
  make 

  cd "${srcdir}/cnijfilter-source-${_pkgrealver}-${_pkgrealrel}/cngpij"
  ./autogen.sh --prefix=/usr --program-suffix=mp250 --enable-progpath=/usr/bin
  make

  cd "${srcdir}/cnijfilter-source-${_pkgrealver}-${_pkgrealrel}/cnijfilter"
  ./autogen.sh --prefix=/usr --program-suffix=mp250 --enable-progpath=/usr/bin
  make

  cd "${srcdir}/cnijfilter-source-${_pkgrealver}-${_pkgrealrel}/pstocanonij"
  ./autogen.sh --prefix=/usr --program-suffix=mp250 --enable-progpath=/usr/bin
  make 

  cd "${srcdir}/cnijfilter-source-${_pkgrealver}-${_pkgrealrel}/lgmon"
  ./autogen.sh --prefix=/usr --program-suffix=mp250 --enable-progpath=/usr/bin
  make 

  cd "${srcdir}/cnijfilter-source-${_pkgrealver}-${_pkgrealrel}/ppd"
  ./autogen.sh --prefix=/usr --program-suffix=mp250
  make 

  cd "${srcdir}/cnijfilter-source-${_pkgrealver}-${_pkgrealrel}/cngpijmon/cnijnpr"
  ./autogen.sh --prefix=/usr --program-suffix=mp250 --enable-progpath=/usr/bin LIBS="-ldl"
  make 

  cd "${srcdir}/cnijfilter-source-${_pkgrealver}-${_pkgrealrel}/backend"
  ./autogen.sh --prefix=/usr --program-suffix=mp250 --enable-progpath=/usr/bin
  make 

  cd "${srcdir}/cnijfilter-source-${_pkgrealver}-${_pkgrealrel}/backendnet"
  ./autogen.sh --prefix=/usr --program-suffix=mp250 --enable-progpath=/usr/bin
  make 

}


package() {
  cd "${srcdir}/cnijfilter-source-${_pkgrealver}-${_pkgrealrel}/libs"
  make DESTDIR="${pkgdir}" install

  cd "${srcdir}/cnijfilter-source-${_pkgrealver}-${_pkgrealrel}/cngpij"
  make DESTDIR="${pkgdir}" install


  cd "${srcdir}/cnijfilter-source-${_pkgrealver}-${_pkgrealrel}/cnijfilter"
  make DESTDIR="${pkgdir}" install

  cd "${srcdir}/cnijfilter-source-${_pkgrealver}-${_pkgrealrel}/pstocanonij"
  make DESTDIR="${pkgdir}" install

  cd "${srcdir}/cnijfilter-source-${_pkgrealver}-${_pkgrealrel}/lgmon"
  make DESTDIR="${pkgdir}" install

  cd "${srcdir}/cnijfilter-source-${_pkgrealver}-${_pkgrealrel}/ppd"
  make DESTDIR="${pkgdir}" install

  cd "${srcdir}/cnijfilter-source-${_pkgrealver}-${_pkgrealrel}/cngpijmon/cnijnpr"
  make DESTDIR="${pkgdir}" install

  cd "${srcdir}/cnijfilter-source-${_pkgrealver}-${_pkgrealrel}/backend"
  make DESTDIR="${pkgdir}" install

  cd "${srcdir}/cnijfilter-source-${_pkgrealver}-${_pkgrealrel}/backendnet"
  make DESTDIR="${pkgdir}" install
   
  cp "${srcdir}/cnijfilter-source-${_pkgrealver}-${_pkgrealrel}"/cnijfilter/src/config* \
    "${srcdir}/cnijfilter-source-${_pkgrealver}-${_pkgrealrel}"/lgmon/src/
  cp "${srcdir}/cnijfilter-source-${_pkgrealver}-${_pkgrealrel}"/cnijfilter/src/config* \
    "${srcdir}/cnijfilter-source-${_pkgrealver}-${_pkgrealrel}"/cngpijmon/cnijnpr/cnijnpr/


  cd "${srcdir}/cnijfilter-source-${_pkgrealver}-${_pkgrealrel}"
  install -d "${pkgdir}/usr/lib/bjlib"
  install -m 755 356/database/* "${pkgdir}/usr/lib/bjlib"

  if [ "$CARCH" == "x86_64" ]; then  
    libdir=libs_bin64
  else
    libdir=libs_bin32
  fi
  
  install -m 755 "${srcdir}/cnijfilter-source-${_pkgrealver}-${_pkgrealrel}/356/${libdir}/libcnbpcmcm356.so.8.0.1" \
    "${pkgdir}/usr/lib/"
  install -m 755 "${srcdir}/cnijfilter-source-${_pkgrealver}-${_pkgrealrel}/356/${libdir}/libcnbpcnclapi356.so.3.5.0" \
    "${pkgdir}/usr/lib/"
  install -m 755 "${srcdir}/cnijfilter-source-${_pkgrealver}-${_pkgrealrel}/356/${libdir}/libcnbpcnclbjcmd356.so.3.3.0" \
    "${pkgdir}/usr/lib/"
  install -m 755 "${srcdir}/cnijfilter-source-${_pkgrealver}-${_pkgrealrel}/356/${libdir}/libcnbpcnclui356.so.3.6.0" \
    "${pkgdir}/usr/lib/"
  install -m 755 "${srcdir}/cnijfilter-source-${_pkgrealver}-${_pkgrealrel}/356/${libdir}/libcnbpess356.so.3.3.3" \
    "${pkgdir}/usr/lib/"
  install -m 755 "${srcdir}/cnijfilter-source-${_pkgrealver}-${_pkgrealrel}/356/${libdir}/libcnbpess356.so.3.3.3" \
    "${pkgdir}/usr/lib/"
  install -m 755 "${srcdir}/cnijfilter-source-${_pkgrealver}-${_pkgrealrel}/356/${libdir}/libcnbpo356.so.1.0.2" \
    "${pkgdir}/usr/lib/"
  install -m 755 "${srcdir}/cnijfilter-source-${_pkgrealver}-${_pkgrealrel}/com/${libdir}/libcnnet.so.1.2.0" \
    "${pkgdir}/usr/lib/"

  cd "${pkgdir}/usr/lib/"
  ln -s libcnbpcmcm356.so.8.0.1 libcnbpcmcm356.so
  ln -s libcnbpcnclapi356.so.3.5.0 libcnbpcnclapi356.so
  ln -s libcnbpcnclbjcmd356.so.3.3.0 libcnbpcnclbjcmd356.so
  ln -s libcnbpcnclui356.so.3.6.0 libcnbpcnclui356.so
  ln -s libcnbpess356.so.3.3.3 libcnbpess356.so
  ln -s libcnbpo356.so.1.0.2 libcnbpo356.so
  ln -s libcnnet.so.1.2.0 libcnnet.so

  cd "${srcdir}/cnijfilter-source-${_pkgrealver}-${_pkgrealrel}"
  install -D "LICENSE-cnijfilter-${_pkgrealver}EN.txt" \
    "${pkgdir}/usr/share/licenses/${pkgname}/LICENSE-cnijfilter-${_pkgrealver}EN.txt"

}

Questions:

* Is the PKGBUILD all right?

* The PKGBUILD apparently needs some patches. Unfortunately I don't code so I don't understand what their effect is. As far as I can tell, automake_fix.patch isn't needed anymore: I actually had to remove it to make the package build. Can someone confirm that it is safe to remove automake_fix.patch? What about the other patches? The package seems to build fine without libpng.patch and fix.patch, but since I don't know what they do I cannot really evaluate the impact of removing them.

* namcap outputs some warnings about missing libraries. I'm not sure how to proceed here. Here is the output:

cnijfilter-mp250 W: Referenced library 'libcnbpess356.so' is an uninstalled dependency
cnijfilter-mp250 W: Referenced library 'libcnnet.so' is an uninstalled dependency
cnijfilter-mp250 W: Referenced library 'libcnbpcmcm356.so' is an uninstalled dependency
cnijfilter-mp250 W: Referenced library 'libcnbpcnclbjcmd356.so' is an uninstalled dependency
cnijfilter-mp250 W: Referenced library 'libcnbpcnclapi356.so' is an uninstalled dependency
cnijfilter-mp250 W: Referenced library 'libcnbpcnclui356.so' is an uninstalled dependency

On the other hand, if I try to search (with find) for the name of the library in the package, I can see them:

./src/cnijfilter-source-3.40-1/356/libs_bin32/libcnbpess356.so
./src/cnijfilter-source-3.40-1/356/libs_bin64/libcnbpess356.so
./pkg/cnijfilter-mp250/usr/lib/libcnbpess356.so

./src/cnijfilter-source-3.40-1/com/libs_bin32/libcnnet.so
./src/cnijfilter-source-3.40-1/com/libs_bin64/libcnnet.so
./pkg/cnijfilter-mp250/usr/lib/libcnnet.so

./src/cnijfilter-source-3.40-1/356/libs_bin32/libcnbpcmcm356.so
./src/cnijfilter-source-3.40-1/356/libs_bin64/libcnbpcmcm356.so
./pkg/cnijfilter-mp250/usr/lib/libcnbpcmcm356.so

./src/cnijfilter-source-3.40-1/356/libs_bin32/libcnbpcnclbjcmd356.so
./src/cnijfilter-source-3.40-1/356/libs_bin64/libcnbpcnclbjcmd356.so
./pkg/cnijfilter-mp250/usr/lib/libcnbpcnclbjcmd356.so

./src/cnijfilter-source-3.40-1/356/libs_bin32/libcnbpcnclapi356.so
./src/cnijfilter-source-3.40-1/356/libs_bin64/libcnbpcnclapi356.so
./pkg/cnijfilter-mp250/usr/lib/libcnbpcnclapi356.so

./src/cnijfilter-source-3.40-1/356/libs_bin32/libcnbpcnclui356.so
./src/cnijfilter-source-3.40-1/356/libs_bin64/libcnbpcnclui356.so
./pkg/cnijfilter-mp250/usr/lib/libcnbpcnclui356.so

So, all I can guess is that they're not in the correct place... Some of these "missing" libraries are moved around in the pkgbuild. Maybe I should move them in another dir...?

There are other warnings in namcap; I'm inclined to ignore these:

cnijfilter-mp250 W: Dependency libcups included but already satisfied
cnijfilter-mp250 W: Dependency included and not needed ('cups')
cnijfilter-mp250 W: Dependency included and not needed ('ghostscript')
cnijfilter-mp250 W: Dependency included and not needed ('gsfonts')
cnijfilter-mp250 W: Dependency included and not needed ('atk')
cnijfilter-mp250 W: Dependency included and not needed ('gtk2')
cnijfilter-mp250 W: Dependency included and not needed ('pango')
cnijfilter-mp250 W: Dependency libpng included but already satisfied
cnijfilter-mp250 W: Dependency libtiff included but already satisfied
cnijfilter-mp250 W: Dependency included and not needed ('cairo')
cnijfilter-mp250 W: Dependency included and not needed ('libxml2')
cnijfilter-mp250 W: Dependency included and not needed ('fontconfig')
cnijfilter-mp250 W: Dependency included and not needed ('libxinerama')

* now the *really* noob question... My understanding is that the PKGBUILD contains instructions to produce a binary from source. What it's still mysterious to me is how to write these instruction *in practice*. E.g. in this PKGBUILD I see a lot of things copied/installed around, but how the user that originally wrote the PKGBUILD came to determine what to move and where, is beyond me. If I were to write a PKGBUILD from scratch now, how should I know that I need to  e.g.

 cp "${srcdir}/cnijfilter-source-${_pkgrealver}-${_pkgrealrel}"/cnijfilter/src/config* \
    "${srcdir}/cnijfilter-source-${_pkgrealver}-${_pkgrealrel}"/cngpijmon/cnijnpr/cnijnpr/

Thanks to those who will find the time/patience to respond, and sorry for the long post.

Last edited by greymatter (2014-04-06 13:06:27)

Offline

#2 2014-04-05 13:04:50

Lone_Wolf
Member
From: Netherlands, Europe
Registered: 2005-10-04
Posts: 4,217

Re: [SOLVED] Asking for help and reviews for a PKGBUILD (cnijfilter-mp250)

* namcap outputs some warnings about missing libraries. I'm not sure how to proceed here. Here is the output:

This is normal behaviour for namcap, it detects that files in the package need those libraries , but doesn't know any package that supplies them.
so it just lists the libraries as uninstalled dependencies.
If you install the package, then run namcap again it will no longer report the libraries as uninstalled.
NOTE : afaict this is not a namcap bug, but a consequence of the way namcap is designed.

* now the *really* noob question... My understanding is that the PKGBUILD contains instructions to produce a binary from source. What it's still mysterious to me is how to write these instruction *in practice*. E.g. in this PKGBUILD I see a lot of things copied/installed around, but how the user that originally wrote the PKGBUILD came to determine what to move and where, is beyond me. If I were to write a PKGBUILD from scratch now, how should I know that I need to  e.g.

cp "${srcdir}/cnijfilter-source-${_pkgrealver}-${_pkgrealrel}"/cnijfilter/src/config* \
    "${srcdir}/cnijfilter-source-${_pkgrealver}-${_pkgrealrel}"/cngpijmon/cnijnpr/cnijnpr/

look at cnijfilter-source-3.40-1/cnijfilter-common.spec ,

It's the file canon itself uses to build their binary debian packages.

If you want an example of how to translate such a file into arch  build/package functions, check the capt-src or cndrvcups-lb packages and compare the *.spec files with the pkgbuilds.


Booting with apg Openrc, NOT systemd.
Automounting : not needed, i prefer pmount
Aur helpers : makepkg + my own local repo === rarely need them

Offline

#3 2014-04-05 16:29:55

Scimmia
Bug Wrangler
Registered: 2012-09-01
Posts: 4,900

Re: [SOLVED] Asking for help and reviews for a PKGBUILD (cnijfilter-mp250)

Wow, so much could be simplified with a few cd's and a few for loops.

Yes, it's OK. Not great, but OK.

The patches, build fails here without fix.patch and libpng.patch. Make sure to delete your src dir before rebuilding, you probably still have the patches applied from a previous run. It works for now without the automake patch, but it may be needed again in the future. It would be much better done with sed than a patch, though.

Edit: first attempt at a major cleanup

# Maintainer: Alireza Savand <alireza.savand@gmail.com>
# Special thanks to: olive, mirrr, GUiHKX, alessiofachechi, jeremy33,
#                    jstitch, plv
pkgname=cnijfilter-mp250
pkgver=3.40.1
pkgrel=5.1
_pkgrealver=3.40
_pkgrealrel=1
pkgdesc="Canon IJ Printer Driver (MP250 series)"
url="http://support-au.canon.com.au/contents/AU/EN/0100302002.html"
arch=('i686' 'x86_64')
license=('custom')
depends=(
    'libcups'
    'cups'
    'popt'
    'ghostscript'
    'gsfonts'
    'atk'
    'gtk2'
    'pango'
    'libpng'
    'libtiff'
    'cairo'
    'libxml2'
    'fontconfig'
    'libxinerama'
)
conflicts=('cnijfilter-common')
install=cnijfilter-mp250.install
source=(
    'http://gdlp01.c-wss.com/gds/0/0100003020/01/cnijfilter-source-3.40-1.tar.gz'
    'fix.patch'
    'libpng.patch'
    'automake_fix.patch'
)
md5sums=(
    '609975a05d6050fcca88f312d3f35c6a'
    'ba9c7ec49e76bf74cc50702e362aba7b'
    '15e417cd427a920c83e4f28e225e428e'
    '07f698d8987632d9bb427d3f4a42a29a'
)

prepare() {
  cd "${srcdir}/cnijfilter-source-${_pkgrealver}-${_pkgrealrel}/"
  patch -p0 < "${srcdir}/fix.patch"
  patch -p0 < "${srcdir}/libpng.patch"
  #patch -p0 < "${srcdir}/automake_fix.patch"
}

build() {
  for i in libs cngpij cnijfilter pstocanonij lgmon ppd backend backendnet; do
    cd "${srcdir}/cnijfilter-source-${_pkgrealver}-${_pkgrealrel}/${i}"
    ./autogen.sh --prefix=/usr --program-suffix=mp250 --enable-progpath=/usr/bin
    make
  done

  cd "${srcdir}/cnijfilter-source-${_pkgrealver}-${_pkgrealrel}/cngpijmon/cnijnpr"
  ./autogen.sh --prefix=/usr --program-suffix=mp250 --enable-progpath=/usr/bin LIBS="-ldl"
  make
}

package() {
  for i in libs cngpij cnijfilter pstocanonij lgmon ppd backend backendnet cngpijmon/cnijnpr; do
    cd "${srcdir}/cnijfilter-source-${_pkgrealver}-${_pkgrealrel}/${i}"
    make DESTDIR="${pkgdir}" install
  done

  cd "${srcdir}/cnijfilter-source-${_pkgrealver}-${_pkgrealrel}"
  install -d "${pkgdir}/usr/lib/bjlib"
  install -m 755 356/database/* "${pkgdir}/usr/lib/bjlib"
  install -D "LICENSE-cnijfilter-${_pkgrealver}EN.txt" \
    "${pkgdir}/usr/share/licenses/${pkgname}/LICENSE-cnijfilter-${_pkgrealver}EN.txt"

  if [ "$CARCH" == "x86_64" ]; then
    local _libdir=libs_bin64
  else
    local _libdir=libs_bin32
  fi

  cd "${srcdir}/cnijfilter-source-${_pkgrealver}-${_pkgrealrel}/356/${_libdir}/"
  install -m 755 -t "${pkgdir}/usr/lib/" \
    libcnbpcmcm356.so* \
    libcnbpcnclapi356.so* \
    libcnbpcnclbjcmd356.so* \
    libcnbpcnclui356.so* \
    libcnbpess356.so* \
    libcnbpo356.so* \
    "${srcdir}/cnijfilter-source-${_pkgrealver}-${_pkgrealrel}/com/${_libdir}/"libcnnet.so*
}

Things to note:
1. Versions are not needed on the deps unless it needs something different than what is in the main repos
2. Anything included in base-devel should not be in the makedeps.
3. The libdir variable was changed to _libdir and declared local. Need to avoid conflicting with other potential variables from the environment.

Last edited by Scimmia (2014-04-05 18:04:26)

Online

#4 2014-04-05 19:35:05

greymatter
Member
Registered: 2014-04-05
Posts: 5

Re: [SOLVED] Asking for help and reviews for a PKGBUILD (cnijfilter-mp250)

Lone_Wolf wrote:

* namcap outputs some warnings about missing libraries. I'm not sure how to proceed here. Here is the output:

This is normal behaviour for namcap, it detects that files in the package need those libraries , but doesn't know any package that supplies them.
so it just lists the libraries as uninstalled dependencies.

Understood. Thank you for the explanation.

Lone_Wolf wrote:

look at cnijfilter-source-3.40-1/cnijfilter-common.spec ,

It's the file canon itself uses to build their binary debian packages.

If you want an example of how to translate such a file into arch  build/package functions, check the capt-src or cndrvcups-lb packages and compare the *.spec files with the pkgbuilds.

Thanks! That makes it a bit less mysterious smile

Scimmia wrote:

Wow, so much could be simplified with a few cd's and a few for loops.

Edit: first attempt at a major cleanup

[snip]

Thank you for showing me! I didn't think to use a for loop... it is cleaner and easier to read now.

I have a couple of questions (just for my understanding). It could be that I'm missing it, but in the code above I don't see the symlinks:

 cd "${pkgdir}/usr/lib/"
  ln -s libcnbpcmcm356.so.8.0.1 libcnbpcmcm356.so
  ln -s libcnbpcnclapi356.so.3.5.0 libcnbpcnclapi356.so
  ln -s libcnbpcnclbjcmd356.so.3.3.0 libcnbpcnclbjcmd356.so
  ln -s libcnbpcnclui356.so.3.6.0 libcnbpcnclui356.so
  ln -s libcnbpess356.so.3.3.3 libcnbpess356.so
  ln -s libcnbpo356.so.1.0.2 libcnbpo356.so
  ln -s libcnnet.so.1.2.0 libcnnet.so

and

  cp "${srcdir}/cnijfilter-source-${_pkgrealver}-${_pkgrealrel}"/cnijfilter/src/config* \
    "${srcdir}/cnijfilter-source-${_pkgrealver}-${_pkgrealrel}"/lgmon/src/
  cp "${srcdir}/cnijfilter-source-${_pkgrealver}-${_pkgrealrel}"/cnijfilter/src/config* \
    "${srcdir}/cnijfilter-source-${_pkgrealver}-${_pkgrealrel}"/cngpijmon/cnijnpr/cnijnpr/

Is it it because they're not needed? or I overlooked something?

Scimmia wrote:

Things to note:
1. Versions are not needed on the deps unless it needs something different than what is in the main repos
2. Anything included in base-devel should not be in the makedeps.
3. The libdir variable was changed to _libdir and declared local. Need to avoid conflicting with other potential variables from the environment.

Ok, thanks smile For the next time: how can I know if a variable could conflict with other variables? You know it from experience or I missed some clue?

Offline

#5 2014-04-05 20:39:17

Psykorgasm
Member
From: England, UK
Registered: 2011-11-24
Posts: 158

Re: [SOLVED] Asking for help and reviews for a PKGBUILD (cnijfilter-mp250)

Something you may be interested in knowing:: I have 3 MP-250 (PIXMA) printers at work and they have always worked the past few years on openSUSE using gutenprint.
Not sure about the scanner part, we have separate HW for that.

Offline

#6 2014-04-05 20:46:29

progandy
Member
Registered: 2012-05-17
Posts: 2,146

Re: [SOLVED] Asking for help and reviews for a PKGBUILD (cnijfilter-mp250)

greymatter wrote:

Ok, thanks smile For the next time: how can I know if a variable could conflict with other variables? You know it from experience or I missed some clue?

Simply start all your variable names with an underscore.

PKGBUILD(5) wrote:

       If you need to create any custom variables for use in your build
       process, it is recommended to prefix their name with an _
       (underscore). This will prevent any possible name clashes with
       internal makepkg variables. For example, to store the base kernel
       version in a variable, use something similar to $_basekernver.

Last edited by progandy (2014-04-05 20:46:54)

Offline

#7 2014-04-05 22:12:26

Scimmia
Bug Wrangler
Registered: 2012-09-01
Posts: 4,900

Re: [SOLVED] Asking for help and reviews for a PKGBUILD (cnijfilter-mp250)

greymatter wrote:
Scimmia wrote:

Wow, so much could be simplified with a few cd's and a few for loops.

Edit: first attempt at a major cleanup

[snip]

Thank you for showing me! I didn't think to use a for loop... it is cleaner and easier to read now.

I have a couple of questions (just for my understanding). It could be that I'm missing it, but in the code above I don't see the symlinks:

 cd "${pkgdir}/usr/lib/"
  ln -s libcnbpcmcm356.so.8.0.1 libcnbpcmcm356.so
  ln -s libcnbpcnclapi356.so.3.5.0 libcnbpcnclapi356.so
  ln -s libcnbpcnclbjcmd356.so.3.3.0 libcnbpcnclbjcmd356.so
  ln -s libcnbpcnclui356.so.3.6.0 libcnbpcnclui356.so
  ln -s libcnbpess356.so.3.3.3 libcnbpess356.so
  ln -s libcnbpo356.so.1.0.2 libcnbpo356.so
  ln -s libcnnet.so.1.2.0 libcnnet.so

and

  cp "${srcdir}/cnijfilter-source-${_pkgrealver}-${_pkgrealrel}"/cnijfilter/src/config* \
    "${srcdir}/cnijfilter-source-${_pkgrealver}-${_pkgrealrel}"/lgmon/src/
  cp "${srcdir}/cnijfilter-source-${_pkgrealver}-${_pkgrealrel}"/cnijfilter/src/config* \
    "${srcdir}/cnijfilter-source-${_pkgrealver}-${_pkgrealrel}"/cngpijmon/cnijnpr/cnijnpr/

Is it it because they're not needed? or I overlooked something?

The symlinks are created when you run make. Instead of installing just the .so.x.x.x file in the previous block, I changed that to .so* so that it grabs both the library and the symlink. Taking another look at it, it didn't work like I was expecting. You end up with two copies of the library, so it may be better to just do the symlinks manually.

I removed the other block you mentioned because it installs files to $srcdir and then never does anything with them as far as I can tell. If it was done before the make installs, it could potentially have an effect, but where it's at, it does nothing.

Last edited by Scimmia (2014-04-06 03:52:14)

Online

#8 2014-04-06 13:05:54

greymatter
Member
Registered: 2014-04-05
Posts: 5

Re: [SOLVED] Asking for help and reviews for a PKGBUILD (cnijfilter-mp250)

Psykorgasm wrote:

Something you may be interested in knowing:: I have 3 MP-250 (PIXMA) printers at work and they have always worked the past few years on openSUSE using gutenprint.
Not sure about the scanner part, we have separate HW for that.

Thanks smile IIRC, to get the scanner working properly I had to install cnijfilter-mp250. Anyway I'll keep that in mind, it's nice to know that the printer works with gutenprint.


progandy wrote:

Simply start all your variable names with an underscore.

PKGBUILD(5) wrote:

       If you need to create any custom variables for use in your build
       process, it is recommended to prefix their name with an _
       (underscore). This will prevent any possible name clashes with
       internal makepkg variables. For example, to store the base kernel
       version in a variable, use something similar to $_basekernver.

I've yet to read PKGBUILD manpage. Thanks for the pointer.

Scimmia wrote:

The symlinks are created when you run make. Instead of installing just the .so.x.x.x file in the previous block, I changed that to .so* so that it grabs both the library and the symlink. Taking another look at it, it didn't work like I was expecting. You end up with two copies of the library, so it may be better to just do the symlinks manually.

I removed the other block you mentioned because it installs files to $srcdir and then never does anything with them as far as I can tell. If it was done before the make installs, it could potentially have an effect, but where it's at, it does nothing.

Thanks for the explanations smile Now I'll have to read a bit about compiling programs and how 'make' and 'make install' work.

I'm going to email the new pkgbuild to Alireza. Thanks to everyone who responded smile In a couple of days I'll try to write a PKGBUILD from scratch smile

Offline

Board footer

Powered by FluxBB