From bbf5a8a861d91d67dca91e2518722a54b7365935 Mon Sep 17 00:00:00 2001 From: Delan Azabani Date: Sun, 21 Jul 2019 20:04:30 +1000 Subject: [PATCH] fxlinuxprintutil: init at 1.1.1-1 --- pkgs/tools/misc/fxlinuxprintutil/default.nix | 59 +++++++++++++++++++ .../fxlinuxprintutil/fxlocalechk.tcl.patch | 18 ++++++ .../misc/fxlinuxprintutil/fxlputil.patch | 28 +++++++++ .../misc/fxlinuxprintutil/fxlputil.tcl.patch | 21 +++++++ pkgs/top-level/all-packages.nix | 2 + 5 files changed, 128 insertions(+) create mode 100644 pkgs/tools/misc/fxlinuxprintutil/default.nix create mode 100644 pkgs/tools/misc/fxlinuxprintutil/fxlocalechk.tcl.patch create mode 100644 pkgs/tools/misc/fxlinuxprintutil/fxlputil.patch create mode 100644 pkgs/tools/misc/fxlinuxprintutil/fxlputil.tcl.patch diff --git a/pkgs/tools/misc/fxlinuxprintutil/default.nix b/pkgs/tools/misc/fxlinuxprintutil/default.nix new file mode 100644 index 000000000000..7965b591afbb --- /dev/null +++ b/pkgs/tools/misc/fxlinuxprintutil/default.nix @@ -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 X11’s 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; + }; +} diff --git a/pkgs/tools/misc/fxlinuxprintutil/fxlocalechk.tcl.patch b/pkgs/tools/misc/fxlinuxprintutil/fxlocalechk.tcl.patch new file mode 100644 index 000000000000..fbf211065e9b --- /dev/null +++ b/pkgs/tools/misc/fxlinuxprintutil/fxlocalechk.tcl.patch @@ -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 diff --git a/pkgs/tools/misc/fxlinuxprintutil/fxlputil.patch b/pkgs/tools/misc/fxlinuxprintutil/fxlputil.patch new file mode 100644 index 000000000000..972152b2cc3e --- /dev/null +++ b/pkgs/tools/misc/fxlinuxprintutil/fxlputil.patch @@ -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 diff --git a/pkgs/tools/misc/fxlinuxprintutil/fxlputil.tcl.patch b/pkgs/tools/misc/fxlinuxprintutil/fxlputil.tcl.patch new file mode 100644 index 000000000000..2bfbab450cb0 --- /dev/null +++ b/pkgs/tools/misc/fxlinuxprintutil/fxlputil.tcl.patch @@ -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 + diff --git a/pkgs/top-level/all-packages.nix b/pkgs/top-level/all-packages.nix index 635942018ebd..1dff6fdf6d42 100644 --- a/pkgs/top-level/all-packages.nix +++ b/pkgs/top-level/all-packages.nix @@ -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 { };