fxlinuxprintutil: init at 1.1.1-1

This commit is contained in:
Delan Azabani 2019-07-21 20:04:30 +10:00
parent bc4361a540
commit bbf5a8a861
5 changed files with 128 additions and 0 deletions

View File

@ -0,0 +1,59 @@
{ stdenv, lib, fetchzip, substituteAll, dpkg, autoPatchelfHook, cups, tcl, tk, xorg, makeWrapper }:
let
debPlatform =
if stdenv.hostPlatform.system == "x86_64-linux" then "amd64"
else if stdenv.hostPlatform.system == "i686-linux" then "i386"
else throw "Unsupported system: ${stdenv.hostPlatform.system}";
in
stdenv.mkDerivation rec {
pname = "fxlinuxprintutil";
version = "1.1.1-1";
src = fetchzip {
url = "https://onlinesupport.fujixerox.com/driver_downloads/fxlinuxpdf112119031.zip";
sha256 = "1mv07ch6ysk9bknfmjqsgxb803sj6vfin29s9knaqv17jvgyh0n3";
curlOpts = "--user-agent Mozilla/5.0"; # HTTP 410 otherwise
};
patches = [
# replaces references to “path/to/fxlputil” via $0 that are broken by our wrapProgram
# with /nix/store/fxlinuxprintutil/bin/fxlputil
./fxlputil.patch
# replaces the code that looks for Tcl packages in the working directory and /usr/lib
# or /usr/lib64 with /nix/store/fxlinuxprintutil/lib
./fxlputil.tcl.patch
# replaces the code that looks for X11s locale.alias in /usr/share/X11/locale or
# /usr/lib/X11/locale with /nix/store/libX11/share/X11/locale
(substituteAll {
src = ./fxlocalechk.tcl.patch;
inherit (xorg) libX11;
})
];
nativeBuildInputs = [ dpkg autoPatchelfHook makeWrapper ];
buildInputs = [ cups tcl tk ];
sourceRoot = ".";
unpackCmd = "dpkg-deb -x $curSrc/${pname}_${version}_${debPlatform}.deb .";
dontConfigure = true;
dontBuild = true;
installPhase = ''
mkdir -p $out
mv usr/bin $out
mv usr/lib $out
wrapProgram $out/bin/fxlputil --prefix PATH : ${lib.makeBinPath [ tcl tk ]}
'';
meta = with stdenv.lib; {
description = "Optional configuration tool for fxlinuxprint";
homepage = https://onlinesupport.fujixerox.com;
license = licenses.unfree;
maintainers = with maintainers; [ delan ];
platforms = platforms.linux;
};
}

View File

@ -0,0 +1,18 @@
diff --git a/usr/bin/fxlocalechk.tcl b/usr/bin/fxlocalechk.tcl
index f0ebc6c..c3486fe 100755
--- a/usr/bin/fxlocalechk.tcl
+++ b/usr/bin/fxlocalechk.tcl
@@ -12,12 +12,7 @@
#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.
#i18N
-#---- check locale with environment variable
-set locale_alias_path /usr/share/X11/locale
-
-if {[file exists $locale_alias_path/locale.alias] != 1} {
- set locale_alias_path /usr/lib/X11/locale
-}
+set locale_alias_path @libX11@/share/X11/locale
proc conv_locale {alias} {
global env envL locale_alias_path

View File

@ -0,0 +1,28 @@
diff --git a/usr/bin/fxlputil b/usr/bin/fxlputil
index cdac66d..aa86d02 100755
--- a/usr/bin/fxlputil
+++ b/usr/bin/fxlputil
@@ -7,17 +7,19 @@
# TCL=`which fxlputil`
#fi
+wrapper=$(dirname $0)/fxlputil
+
#set LC_ALL
-locale=`tclsh $0lo.tcl`
+locale=`tclsh ${wrapper}lo.tcl`
case $locale in
"ja")
- env LC_ALL=ja_JP.UTF-8 wish $0.tcl $1
+ env LC_ALL=ja_JP.UTF-8 wish ${wrapper}.tcl $1
;;
"en")
- env LC_ALL=en_US.ISO8859-1 wish $0.tcl $1
+ env LC_ALL=en_US.ISO8859-1 wish ${wrapper}.tcl $1
;;
*)
- env LC_ALL=C wish $0.tcl $1
+ env LC_ALL=C wish ${wrapper}.tcl $1
;;
esac

View File

@ -0,0 +1,21 @@
diff --git a/usr/bin/fxlputil.tcl b/usr/bin/fxlputil.tcl
index 02eeaf6..788ed5a 100755
--- a/usr/bin/fxlputil.tcl
+++ b/usr/bin/fxlputil.tcl
@@ -25,14 +25,8 @@ catch {namespace import combobox::*}
-lappend auto_path $cwd
-
-if {[lsearch $auto_path /usr/lib] == -1} {
- lappend auto_path /usr/lib
-}
-if {[lsearch $auto_path /usr/lib64] == -1} {
- lappend auto_path /usr/lib64
-}
+# https://stackoverflow.com/a/23287132
+lappend auto_path [file join [file dirname [file dirname [info script]]] lib]
package require fxlputil

View File

@ -782,6 +782,8 @@ in
ezstream = callPackage ../tools/audio/ezstream { };
fxlinuxprintutil = callPackage ../tools/misc/fxlinuxprintutil { };
genymotion = callPackage ../development/mobile/genymotion { };
gamecube-tools = callPackage ../development/tools/gamecube-tools { };