Browse Source

Merge pull request #65250 from delan/fxlinuxprintutil

fxlinuxprintutil: init at 1.1.1-1
pleroma
worldofpeace 1 year ago
parent
commit
1e06e1d2b8
No account linked to committer's email address

+ 59
- 0
pkgs/tools/misc/fxlinuxprintutil/default.nix View File

@@ -0,0 +1,59 @@
1
+{ stdenv, lib, fetchzip, substituteAll, dpkg, autoPatchelfHook, cups, tcl, tk, xorg, makeWrapper }:
2
+let
3
+  debPlatform =
4
+    if stdenv.hostPlatform.system == "x86_64-linux" then "amd64"
5
+    else if stdenv.hostPlatform.system == "i686-linux" then "i386"
6
+         else throw "Unsupported system: ${stdenv.hostPlatform.system}";
7
+in
8
+stdenv.mkDerivation rec {
9
+  pname = "fxlinuxprintutil";
10
+  version = "1.1.1-1";
11
+
12
+  src = fetchzip {
13
+    url = "https://onlinesupport.fujixerox.com/driver_downloads/fxlinuxpdf112119031.zip";
14
+    sha256 = "1mv07ch6ysk9bknfmjqsgxb803sj6vfin29s9knaqv17jvgyh0n3";
15
+    curlOpts = "--user-agent Mozilla/5.0";  # HTTP 410 otherwise
16
+  };
17
+
18
+  patches = [
19
+    # replaces references to “path/to/fxlputil” via $0 that are broken by our wrapProgram
20
+    # with /nix/store/fxlinuxprintutil/bin/fxlputil
21
+    ./fxlputil.patch
22
+
23
+    # replaces the code that looks for Tcl packages in the working directory and /usr/lib
24
+    # or /usr/lib64 with /nix/store/fxlinuxprintutil/lib
25
+    ./fxlputil.tcl.patch
26
+
27
+    # replaces the code that looks for X11’s locale.alias in /usr/share/X11/locale or
28
+    # /usr/lib/X11/locale with /nix/store/libX11/share/X11/locale
29
+    (substituteAll {
30
+      src = ./fxlocalechk.tcl.patch;
31
+      inherit (xorg) libX11;
32
+    })
33
+  ];
34
+
35
+  nativeBuildInputs = [ dpkg autoPatchelfHook makeWrapper ];
36
+  buildInputs = [ cups tcl tk ];
37
+
38
+  sourceRoot = ".";
39
+  unpackCmd = "dpkg-deb -x $curSrc/${pname}_${version}_${debPlatform}.deb .";
40
+
41
+  dontConfigure = true;
42
+  dontBuild = true;
43
+
44
+  installPhase = ''
45
+    mkdir -p $out
46
+    mv usr/bin $out
47
+    mv usr/lib $out
48
+
49
+    wrapProgram $out/bin/fxlputil --prefix PATH : ${lib.makeBinPath [ tcl tk ]}
50
+  '';
51
+
52
+  meta = with stdenv.lib; {
53
+    description = "Optional configuration tool for fxlinuxprint";
54
+    homepage = https://onlinesupport.fujixerox.com;
55
+    license = licenses.unfree;
56
+    maintainers = with maintainers; [ delan ];
57
+    platforms = platforms.linux;
58
+  };
59
+}

+ 18
- 0
pkgs/tools/misc/fxlinuxprintutil/fxlocalechk.tcl.patch View File

@@ -0,0 +1,18 @@
1
+diff --git a/usr/bin/fxlocalechk.tcl b/usr/bin/fxlocalechk.tcl
2
+index f0ebc6c..c3486fe 100755
3
+--- a/usr/bin/fxlocalechk.tcl
4
++++ b/usr/bin/fxlocalechk.tcl
5
+@@ -12,12 +12,7 @@
6
+ #THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "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 COPYRIGHT OWNER OR CONTRIBUTORS 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.
7
+ 
8
+ #i18N
9
+-#---- check locale with environment variable
10
+-set locale_alias_path  /usr/share/X11/locale
11
+-
12
+-if {[file exists $locale_alias_path/locale.alias] != 1} {
13
+-    set locale_alias_path /usr/lib/X11/locale
14
+-}
15
++set locale_alias_path @libX11@/share/X11/locale
16
+ 
17
+ proc conv_locale {alias} {
18
+     global env envL locale_alias_path

+ 28
- 0
pkgs/tools/misc/fxlinuxprintutil/fxlputil.patch View File

@@ -0,0 +1,28 @@
1
+diff --git a/usr/bin/fxlputil b/usr/bin/fxlputil
2
+index cdac66d..aa86d02 100755
3
+--- a/usr/bin/fxlputil
4
++++ b/usr/bin/fxlputil
5
+@@ -7,17 +7,19 @@
6
+ #	TCL=`which fxlputil`
7
+ #fi
8
+ 
9
++wrapper=$(dirname $0)/fxlputil
10
++
11
+ #set LC_ALL
12
+-locale=`tclsh $0lo.tcl`
13
++locale=`tclsh ${wrapper}lo.tcl`
14
+ 
15
+ case $locale in
16
+ 	"ja")
17
+-		env LC_ALL=ja_JP.UTF-8 wish $0.tcl $1
18
++		env LC_ALL=ja_JP.UTF-8 wish ${wrapper}.tcl $1
19
+ 		;;
20
+ 	"en")
21
+-		env LC_ALL=en_US.ISO8859-1 wish $0.tcl $1
22
++		env LC_ALL=en_US.ISO8859-1 wish ${wrapper}.tcl $1
23
+ 		;;
24
+ 	*)
25
+-		env LC_ALL=C wish $0.tcl $1
26
++		env LC_ALL=C wish ${wrapper}.tcl $1
27
+ 		;;
28
+ esac

+ 21
- 0
pkgs/tools/misc/fxlinuxprintutil/fxlputil.tcl.patch View File

@@ -0,0 +1,21 @@
1
+diff --git a/usr/bin/fxlputil.tcl b/usr/bin/fxlputil.tcl
2
+index 02eeaf6..788ed5a 100755
3
+--- a/usr/bin/fxlputil.tcl
4
++++ b/usr/bin/fxlputil.tcl
5
+@@ -25,14 +25,8 @@ catch {namespace import combobox::*}
6
+ 
7
+ 
8
+ 
9
+-lappend auto_path $cwd
10
+-
11
+-if {[lsearch $auto_path /usr/lib] == -1} {
12
+-	lappend auto_path /usr/lib
13
+-}
14
+-if {[lsearch $auto_path /usr/lib64] == -1} {
15
+-	lappend auto_path /usr/lib64
16
+-}
17
++# https://stackoverflow.com/a/23287132
18
++lappend auto_path [file join [file dirname [file dirname [info script]]] lib]
19
+ 
20
+ package require fxlputil
21
+ 

+ 2
- 0
pkgs/top-level/all-packages.nix View File

@@ -782,6 +782,8 @@ in
782 782
 
783 783
   ezstream = callPackage ../tools/audio/ezstream { };
784 784
 
785
+  fxlinuxprintutil = callPackage ../tools/misc/fxlinuxprintutil { };
786
+
785 787
   genymotion = callPackage ../development/mobile/genymotion { };
786 788
 
787 789
   gamecube-tools = callPackage ../development/tools/gamecube-tools { };

Loading…
Cancel
Save