diff --git a/racket2nix b/racket2nix index c1ba8ca..b1ff7d5 100755 --- a/racket2nix +++ b/racket2nix @@ -6,6 +6,8 @@ (define never-dependency-names '("racket")) (define always-build-inputs '("racket")) (define terminal-package-names '("racket-lib")) +(define remove-dependencies-for-package '#hash( + ("htdp-lib" . ("deinprogramm-signature")))) (define header-template #< {} @@ -14,6 +16,20 @@ , racket ? pkgs.racket-minimal , racket-lib ? racket , unzip ? pkgs.unzip +, racketIndexPatch ? builtins.toFile "racket-index.patch" '' + diff --git a/pkgs/racket-index/setup/scribble.rkt b/pkgs/racket-index/setup/scribble.rkt + index c79af9bf85..e4a1cf93e3 100644 + --- a/pkgs/racket-index/setup/scribble.rkt + +++ b/pkgs/racket-index/setup/scribble.rkt + @@ -874,6 +874,7 @@ + [(not latex-dest) (build-path (doc-dest-dir doc) file)])) + + (define (find-doc-db-path latex-dest user? main-doc-exists?) + + (set! main-doc-exists? #t) + (cond + [latex-dest + (build-path latex-dest "docindex.sqlite")] + '' }: @@ -30,8 +46,24 @@ stdenv.mkDerivation rec { buildInputs = [ unzip ~a ]; circularBuildInputs = [ ~a ]; + circularBuildInputsStr = stdenv.lib.concatStringsSep " " circularBuildInputs; + + unpackPhase = '' + unzip $src -d $name + case $name in + htdp-lib) + unzip ${_deinprogramm-signature.src} -d deinprogramm-signature + ;; + esac + ''; - unpackPhase = "unzip $src -d $name"; + patchPhase = '' + case $name in + racket-index) + ( cd racket-index && patch -p3 < ${racketIndexPatch} ) + ;; + esac + ''; dontBuild = true; @@ -44,9 +76,10 @@ stdenv.mkDerivation rec { racketConfig = '' #hash( (share-dir . "$out/share/racket") - (links-search-files . ( "$out/share/racket" ~a )) + (links-search-files . ( "$out/share/racket/links.rktd" ~a )) (pkgs-search-dirs . ( "$out/share/racket/pkgs" ~a )) (collects-search-dirs . ( "$out/share/racket/collects" ~a )) + (doc-search-dirs . ( "$out/share/racket/doc" ~a )) (absolute-installation . #t) (installation-name . ".") ) @@ -67,7 +100,7 @@ stdenv.mkDerivation rec { mkdir -p $out/etc/racket $out/share/racket sed -e 's|$out|'"$out|g" > $out/etc/racket/config.rktd < $racketConfigPath - remove_deps="${stdenv.lib.concatStringsSep " " circularBuildInputs}" + remove_deps="${circularBuildInputsStr}" if [[ -n $remove_deps ]]; then sed -i $(printf -- '-e s/"%s"//g ' $remove_deps) $name/info.rkt fi @@ -82,29 +115,18 @@ stdenv.mkDerivation rec { find $out/share/racket/collects -type d -exec chmod 755 {} + # install and link us - if ${racket-cmd} -e "(require pkg/lib) (exit (if (member \"$name\" (installed-pkg-names #:scope (bytes->path (string->bytes/utf-8 \"${_racket-lib.out}/share/racket/pkgs\")))) 1 0))"; then - ${raco} pkg install --no-setup --copy --deps fail --fail-fast --scope installation ./$name - collection_name=$(${racket-cmd} -e "(require setup/getinfo) ((get-info/full \"$name\") 'collection)") - ( - shopt -s nullglob - case "$collection_name" in - "'multi") - collection_names=$(for collection_path in $out/share/racket/pkgs/$name/*/; do - basename $collection_path; done) - ;; - "'use-pkg-name") - collection_names=$name - ;; - '"'*'"') - collection_names=$(echo $collection_name | tr -d '"') - ;; + if ${racket-cmd} -e "(require pkg/lib) (exit (if (member \"$name\" (installed-pkg-names #:scope (bytes->path (string->bytes/utf-8 \"${_racket-lib.out}/share/racket/pkgs\")))) 1 0))" && + [ -z "${circularBuildInputsStr}" ]; then + install_names=$(for install_info in ./*/info.rkt; do echo ''${install_info%/info.rkt}; done) + ${raco} pkg install --no-setup --copy --deps fail --fail-fast --scope installation $install_names + for install_name in $install_names; do + case $install_name in + racket-doc|drracket) ;; *) - echo >&2 "Unexpected info.rkt value: ('collection . $collection_name)" - exit 2 + ${raco} setup --no-user --no-pkg-deps --fail-fast --only --pkgs ''${install_name#./} + ;; esac - mkdir -p $(printf "$out/share/racket/collects/%s " $collection_names) - ) - ${raco} setup --no-user --no-pkg-deps --fail-fast --only --pkgs $name + done fi find $out/share/racket/collects -lname '${_racket-lib.out}/share/racket/collects/*' -delete find $out/share/racket/collects -type d -empty -delete @@ -113,7 +135,10 @@ stdenv.mkDerivation rec { EOM ) -(define (derivation name url sha1 dependency-names circular-dependency-names) +(define (derivation name url sha1 raw-dependency-names circular-dependency-names) + (define dependency-names (remove* (hash-ref remove-dependencies-for-package name + (lambda () '())) + raw-dependency-names)) (define build-inputs (string-join (append always-build-inputs @@ -123,10 +148,10 @@ EOM (string-join (for/list ((name circular-dependency-names)) (format "\"~a\"" name)))) - (define link-dirs + (define link-files (string-join (for/list ((name dependency-names)) - (format "\"${_~a.out}/share/racket\"" name)))) + (format "\"${_~a.out}/share/racket/links.rktd\"" name)))) (define pkgs-dirs (string-join (for/list ((name dependency-names)) @@ -135,9 +160,13 @@ EOM (string-join (for/list ((name dependency-names)) (format "\"${_~a.out}/share/racket/collects\"" name)))) + (define doc-dirs + (string-join + (for/list ((name dependency-names)) + (format "\"${_~a.out}/share/racket/doc\"" name)))) (format derivation-template name url sha1 build-inputs circular-build-inputs - link-dirs pkgs-dirs collects-dirs)) + link-files pkgs-dirs collects-dirs doc-dirs)) (define (header) header-template)