New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
cnijfilter: add 3.80 #65469
cnijfilter: add 3.80 #65469
Conversation
Current build state
|
bscc2sts seems to be in |
I went further with this patch: diff --git a/pkgs/misc/cups/drivers/cnijfilter_3_80/default.nix b/pkgs/misc/cups/drivers/cnijfilter_3_80/default.nix
index 70a6bc0f130..e7c46b4705f 100644
--- a/pkgs/misc/cups/drivers/cnijfilter_3_80/default.nix
+++ b/pkgs/misc/cups/drivers/cnijfilter_3_80/default.nix
@@ -1,6 +1,6 @@
-{ stdenv, lib, fetchzip,
- autoconf, automake, libtool,
- cups, popt, libtiff, libpng,
+{ stdenv, lib, fetchzip, breakpointHook,
+ autoconf, automake, libtool, gtk2,
+ cups, popt, libtiff, libpng, pkg-config,
ghostscript, glib, libusb, libxml2 }:
/* this derivation is basically just a transcription of the rpm .spec
@@ -30,8 +30,8 @@ in stdenv.mkDerivation rec {
sha256 = "03v4yn346xn4hk498lzz8ykdbhd4l8qna909fmr0qrkypyhd4627";
};
- buildInputs = [ autoconf libtool automake
- cups popt libtiff libpng
+ nativeBuildInputs = [ autoconf automake libtool pkg-config ];
+ buildInputs = [ cups popt libtiff libpng gtk2
ghostscript glib libusb libxml2 ];
# patches from https://github.com/tokiclover/bar-overlay/tree/master/net-print/cnijfilter
@@ -69,12 +69,22 @@ in stdenv.mkDerivation rec {
cd ../backendnet
./autogen.sh --prefix=$out --enable-libpath=$out/lib/bjlib --enable-progpath=$out/bin
+ cd ../lgmon
+ # no --prefix=$out because it builds a static library that the build system looks for in lgmon/src
+ ./autogen.sh
+
cd ../cngpijmon/cnijnpr
./autogen.sh --prefix=$out --enable-libpath=$out/lib/bjlib
cd ../..;
'';
+ preBuild = ''
+ pushd lgmon
+ make
+ popd
+ '';
+
preInstall = ''
mkdir -p $out/bin $out/lib/cups/filter $out/share/cups/model;
'';
|
This should fix the build: 076186a Also a nitpick: please use fetchpatch for patches which exist elsewhere on the internet. |
Thank you @symphorien I will try this out with my printer to see if it works all the way. I had the build step of the lgmon but missed the stuff with the static library so didn't come as far as you did. Regarding using fetchpatch, some of them were from elsewhere, but most of them I had to modify in some way to make them apply. Patches not applying:
Patches applying:
I could use the fetchpatch for those three, but the other ones I think requires a local copy with adjustments. |
I have now tested the driver and successfully printed using duplex and borderless and seems to work well. Only thing is I couldn't combine borderless and duplex, but that is probably a limitation on the printer side. So this is basically ready. Should I squash the commits? Is this fetchpatch usage good? I went with a specific commit, since technically master could change, and used the referred repository as I am not sure where these patches originally originated from. Thanks for the help @symphorien 🙇♂️ |
pkgs/top-level/all-packages.nix
Outdated
storeDir = config.nix.storeDir or "/nix/store"; | ||
stateDir = config.nix.stateDir or "/nix/var"; | ||
boehmgc = boehmgc.override { enableLargeConfig = true; }; | ||
}) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Can you drop the whitespace-only changes in this file ?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Ah, sorry about that, had auto-formatting enabled for nix files, will ensure that is not part of the final squash
I left a nitpick, but it looks good to me overall. I have a slight preference for squashing the commits together, but it is not so important I guess. |
When I went through the checklist I noticed the binaries cnijnetprn and cnijnpr complained about Debian has a rule such as:
It seems to be linked via via the LDFLAGS, but I guess that doesn't ensure it is part of the build.
I am not so familiar with this, but will have a look at how other packages do to copy lib files. Perhaps something similar to what we do here already: |
Added this I also fixed the whitespace/styling changes to all-packages. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This is awesome! I tried to do this myself (#85325) and ran into similar problems, but I didn't get as far as you. What is missing here until it can be merged?
make install; | ||
|
||
cd ../cnijfilter; | ||
./autogen.sh --prefix=$out --program-suffix=$pr --enable-libpath=/var/lib/cups/path/lib/bjlib --enable-binpath=$out/bin; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
./autogen.sh --prefix=$out --program-suffix=$pr --enable-libpath=/var/lib/cups/path/lib/bjlib --enable-binpath=$out/bin; | |
./autogen.sh --prefix=$out --program-suffix=$pr --enable-libpath=$out/lib/bjlib --enable-binpath=$out/bin; |
Thank you for the feedback, as far as I am aware this was working, it just has to be rebased and updated, if I remember correctly one of the patches stopped wokring due to the upstream having a change. Since I waited quite a bit, I didn't push and update those changes. If there is interested, I think we can revive this and get it past the finish-line. Do you want to do it, or should I take a stab at it again? Also good to have more people testing it, so feel free to test if this is working (if you haven't already) |
Hi, it looks like on Arch there's a common package and the printer-specific PKGBUILDs don't really do much: https://aur.archlinux.org/packages/cnijfilter-common/ Do you think we could copy their approach instead of going through this misery for every printer? I also remember Gentoo had some kind of generic cnijfilter ebuild, but I can't find it any more. |
@terlar Good to hear back :)
Either way is fine for me. I rebased and fixed the hashes here: https://github.com/turion/nixpkgs/tree/cnijfilter-3.80 I'm not a C dev though, so I won't be of much use fixing anything related to that. I can confirm that it builds and the driver shows up, but I haven't yet managed to print with it. (I'll restart my system and try again) |
That would be great. But it seems like that Arch Linux package is only for the 4.10 version? I.e. only for some particular printers? |
@terlar How did you test? USB connection? IPP? If the latter, how did you set it up? |
I updated mine as well. Some of these patches come from a gentoo overlay ebuild: I have only tried to print via Wi-Fi. So IPP via cups I guess. At the time I remember looking at the PKGBUILD as well, but not sure how it translates to the nix world and as @turion mentioned, I also don't know much about the details of printer drivers and C development. |
I added the printer via CUPS and inserted |
@terlar I tried again with your branch, same thing. Does it still work for you? Can you share your CUPS config? |
@terlar what happens if you run I get:
But no Idea whether that's important |
I also got the "Filter failed" message once now. |
If you look at what depends on this package in AUR, those packages seem to have the printer-specific versions (for example this one). Their PKGBUILDs seem very simple. I think @momeni wrote the PKGBUILD, maybe he could shed some light on the situation? |
Ah the generic implementation I was thinking of was actually in Ubuntu, not Gentoo: https://github.com/endlessm/cnijfilter-common |
Here's the Gentoo version I was thinking of: https://github.com/tokiclover/bar-overlay/tree/master/net-print/cnijfilter And the generic bit: https://github.com/tokiclover/bar-overlay/blob/d67a915387d359a2c3a7158b8d995c03d3390293/eclass/ecnij.eclass |
I've ported the Gentoo build script and added 3.80 with it here: chpatrick@b65d189 It builds for me but it seems to add some extra junk in $out/usr/..., which should be fixed. I haven't tried it with a printer. If we get it working it should be easy to port the other driver versions too. |
About the ArchLinux packages, the common build code recursively builds a subset of source folders which can be used as shared libraries. They are independent of printer version. Another set of folders (lgmon, ppd, cnijfilter, printui, cngpijmon) must be compiled once for each printer version as their |
@terlar Are you still active here? In principle this looks good, except for that it doesn't work in my case. |
@chpatrick I tried building your approach, it doesn't compile yet. Do you want to open a PR and I'll review? |
@turion Sorry, yes, I was updating it and testing it and then it didn't work. But I was suspecting user error on my part (new computer). But then I got swamped with other stuff so never followed up. I would hope the @chpatrick solution was the way to go. If you want something other working in the meantime the gutenprint should work, although does not have the same config settings, so I still think it is valid to get this to work. |
I will close this in favor of the other one. I have yet to test that, but I think it is wise to go with the more generic approach. |
Motivation for this change
I have a IP7200 printer and cannot get it working well with the gutenprint drivers (borderless and duplex printing). I would like to give the proprietary drivers a go. This adds support for the following printers: MP430 MG2200 E510 MG3200 MG4200 MG5400 MG6300 and IP7200 series
The versioning of the cnijfilter is not in the way where more and more support is added, so therefore I cannot use the later or earlier versions. As support for previous printers is removed.
Things done
This PR is not fully ready yet, as I got stuck during the build process. But I open this PR here early in hopes that someone might have an idea. It is based on the cnijfilter_4_00 but there seems to be no
bscc2sts
in the source, but it is part of the dependencies, so not sure how to get that working, currently this is where it complains.[UPDATE]: Working and tried with the printer IP7250.
sandbox
innix.conf
on non-NixOS)nix-shell -p nix-review --run "nix-review wip"
./result/bin/
)nix path-info -S
before and after)