nongnu: nvidia-cg-toolkit: Fix i686 build.

* nongnu/packages/game-development.scm (nvidia-cg-toolkit): Extract the
  different archive sources.
  Set the supported-systems to i686-linux and x86_64-linux.
This commit is contained in:
Pierre Neidhardt 2020-01-02 12:16:45 +01:00
parent 804ff2cc2b
commit 0c7cef591b

View file

@ -27,63 +27,89 @@
#:use-module (gnu packages gl) #:use-module (gnu packages gl)
#:use-module (gnu packages xorg)) #:use-module (gnu packages xorg))
(define nvidia-cg-toolkit-version "3.1")
(define nvidia-cg-toolkit-date "April2012")
(define nvidia-cg-toolkit-i686-archive
(origin
(method url-fetch)
(uri
(string-append "http://developer.download.nvidia.com/cg/Cg_"
nvidia-cg-toolkit-version
"/Cg-" nvidia-cg-toolkit-version "_" nvidia-cg-toolkit-date "_"
"x86" ".tgz"))
(sha256
(base32 "0yc8n6vpqyb6qhcv5kwvr3h21ya271fi930fvd98hlkg8cg5kwyf"))))
(define nvidia-cg-toolkit-x86_64-archive
(origin
(method url-fetch)
(uri
(string-append "http://developer.download.nvidia.com/cg/Cg_"
nvidia-cg-toolkit-version
"/Cg-" nvidia-cg-toolkit-version "_" nvidia-cg-toolkit-date "_"
"x86_64" ".tgz"))
(sha256
(base32 "0y4qms4lm9xiix93g45337rx5nrp0y3gb0x0avyv7l9qrkk03zz8"))))
(define (lib)
(match (or (%current-target-system)
(%current-system))
("x86_64-linux" "lib64")
("i686-linux" "lib")))
(define-public nvidia-cg-toolkit (define-public nvidia-cg-toolkit
(let ((arch (match (or (%current-target-system) (package
(%current-system)) (name "nvidia-cg-toolkit")
("x86_64-linux" "x86_64") (version nvidia-cg-toolkit-version)
("i686-linux" "x86") (source #f)
(_ ""))) (build-system binary-build-system)
(lib (match (or (%current-target-system) (arguments
(%current-system)) `(#:strip-binaries? #f ; Fails with "allocated section `.dynstr' not in segment".
("x86_64-linux" "lib64") #:patchelf-plan
("i686-linux" "lib") `(("bin/cgc"
(_ ""))) ("glibc" "out"))
(date "April2012")) ("bin/cginfo"
(package ("gcc:lib" "glibc"))
(name "nvidia-cg-toolkit") ("bin/cgfxcat"
(version "3.1") ("out" "glibc" "glu" "mesa" "libice" "libsm"
(source (origin "libxmu" "libxt" "libxi" "libxext" "libx11"))
(method url-fetch) (,,(string-append (lib) "/libCg.so")
(uri ("glibc"))
(string-append "http://developer.download.nvidia.com/cg/Cg_" (,,(string-append (lib) "/libCgGL.so")
version "/Cg-" version "_" date "_" arch ".tgz")) ("out" "glibc")))
(sha256 #:install-plan
(base32 `(("bin" (".") "bin/")
"0y4qms4lm9xiix93g45337rx5nrp0y3gb0x0avyv7l9qrkk03zz8")))) (,,(lib) (".") "lib/")
(build-system binary-build-system) ("include" (".") "include/")
(arguments ("local" (".") "share/"))
`(#:strip-binaries? #f ; Fails with "allocated section `.dynstr' not in segment". #:phases
#:patchelf-plan (modify-phases %standard-phases
`(("bin/cgc" (replace 'unpack
("glibc" "out")) (lambda* (#:key inputs #:allow-other-keys)
("bin/cginfo" (let ((archive (assoc-ref inputs "nvidia-cg-toolkit-archive")))
("gcc:lib" "glibc")) (invoke "tar" "xf" archive)
("bin/cgfxcat" (chdir "usr")
("out" "glibc" "glu" "mesa" "libice" "libsm" #t))))))
"libxmu" "libxt" "libxi" "libxext" "libx11")) (native-inputs
("lib64/libCg.so" `(("nvidia-cg-toolkit-archive"
("glibc")) ,(match (or (%current-target-system) (%current-system))
("lib64/libCgGL.so" ("x86_64-linux" nvidia-cg-toolkit-x86_64-archive)
("out" "glibc"))) (_ nvidia-cg-toolkit-i686-archive)))))
#:install-plan (inputs
`(("bin" (".") "bin/") `(("gcc:lib" ,gcc "lib")
(,,lib (".") "lib/") ("glibc" ,glibc)
("include" (".") "include/") ("glu" ,glu)
("local" (".") "share/")))) ("libice" ,libice)
(inputs ("libsm" ,libsm)
`(("gcc:lib" ,gcc "lib") ("libxmu" ,libxmu)
("glibc" ,glibc) ("libxt" ,libxt)
("glu" ,glu) ("libxi" ,libxi)
("libice" ,libice) ("libxext" ,libxext)
("libsm" ,libsm) ("libx11" ,libx11)))
("libxmu" ,libxmu) (home-page "https://developer.nvidia.com/cg-toolkit")
("libxt" ,libxt) (synopsis "High-level shading language")
("libxi" ,libxi) (description "NVIDIA introduced programmable shading with Cg, which
("libxext" ,libxext)
("libx11" ,libx11)))
(home-page "https://developer.nvidia.com/cg-toolkit")
(synopsis "High-level shading language")
(description "NVIDIA introduced programmable shading with Cg, which
supported dozens of different OpenGL and DirectX profile targets. It allowed supported dozens of different OpenGL and DirectX profile targets. It allowed
developers to incorporate interactive effects within 3D applications and share developers to incorporate interactive effects within 3D applications and share
them among other Cg applications, across graphics APIs, and most operating them among other Cg applications, across graphics APIs, and most operating
@ -93,4 +119,5 @@ The Cg Toolkit is a legacy NVIDIA toolkit no longer under active development
or support. It is not recommended using it in new development projects or support. It is not recommended using it in new development projects
because future hardware features may not be supported. Going forward, new because future hardware features may not be supported. Going forward, new
development should opt for GLSL rather than Cg.") development should opt for GLSL rather than Cg.")
(license (license:nonfree "file://share/Cg/docs/license.txt"))))) (supported-systems '("i686-linux" "x86_64-linux"))
(license (license:nonfree "file://share/Cg/docs/license.txt"))))