diff options
Diffstat (limited to 'org')
-rw-r--r-- | org/spine_build_scaffold.org | 742 |
1 files changed, 244 insertions, 498 deletions
diff --git a/org/spine_build_scaffold.org b/org/spine_build_scaffold.org index be0bbab..0b8f763 100644 --- a/org/spine_build_scaffold.org +++ b/org/spine_build_scaffold.org @@ -394,25 +394,6 @@ get_depends: fi; \ fi; \ done; \ - ewd="$${hwd}/src/build_depends" && \ - dirs=$$(echo `ls -gx $${ewd}`) && \ - cd $${ewd} && \ - for dir in $${dirs}; do \ - if [ -d $${dir} ]; then \ - echo $${dir} && \ - if [[ "dub2nix" == $${dir} ]]; then \ - echo $${dir} && \ - rm -rf $${dir} && \ - git clone --depth=1 https://github.com/lionello/$${dir} && \ - cd $${dir} && \ - echo "$${dir} `git rev-parse HEAD | cut -c 1-8`" > ../$${dir}.meta && \ - echo "https://github.com/lionello/$${dir}" >> ../$${dir}.meta && \ - echo "MIT License" >> ../$${dir}.meta && \ - cd $${ewd} && \ - rm -rf $${dir}/.git; \ - fi; \ - fi; \ - done; \ cd $${hwd} set_depends: get_depends dub describe | sed 's~$(shell echo `pwd | sed 's_/_\\/_g'`)~.~g' > dub_describe.json @@ -2052,67 +2033,6 @@ tinyendian_dep = declare_dependency( - default.nix - shell.nix -- dub2.nix - -** dub2nix notes (from author (Lionello Lunesu) email reply, 2020-10-12) NOTE - -- https://github.com/lionello/dub2nix - -- see shell.nix minimal content: - -- run: nix-shell - -- run: dub init - -- add d2sqlite3 dependency (provide as dependency during “dub init” or add it to - the dub.json manually) - -#+BEGIN_SRC json :NO-tangle ../dub.json -{ - "authors": [ - "Ralph Amissah" - ], - "copyright": "Copyright © 2021, Ralph Amissah", - "description": "A minimal D application.", - "license": "AGPL-3", - "name": "d2sqlite3_dub2nix", - "dependencies": { - "d2sqlite3": "~><<version_d2sqlite3>>" - }, - "subConfigurations": { - "d2sqlite3": "with-lib" - } -} -#+END_SRC - -- run: dub build - -- run: dub2nix save - creates: dub.selections.nix - -- Create a new file default.nix with this content: - -#+BEGIN_SRC nix :NO-tangle default.nix -{ pkgs ? import <nixpkgs> {} }: -with import ./mkDub.nix { inherit pkgs; }; -mkDubDerivation { - src = ./.; - buildInputs = [ - pkgs.sqlite - ]; -} -#+END_SRC - -- Copy mkDub.nix from the dub2nix project. - -#+BEGIN_SRC sh -aria2c https://raw.githubusercontent.com/lionello/dub2nix/master/mkDub.nix -#+END_SRC - -make modificatons if desired - -- run: nix-build - nix-build -I nixpkgs=[path-to]/nixpkgs ** envrc :envrc: *** .envrc @@ -2179,6 +2099,7 @@ fi export NIX_PATH=/nix/var/nix/profiles/per-user/root/channels/nixos #export NIX_PATH=nixpkgs=<<nixpkgs_path>> ## reload when these files change +use flake watch_file flake.nix # watch_file flake.lock ## load the flake devShell @@ -2188,6 +2109,7 @@ export SpineVER=$(git describe --long --tags | sed 's/^[ a-z_-]\+\([0-9.]\+\)/\1 export SpineSRC=<<project_path_local_src>> export SpineDOC=<<project_path_local_doc>> export SpineOUT=<<project_path_local_out>> +export SpineOUTstatic=<<project_path_local_out_static>> echo '-*- mode: org -*- @@ -2209,6 +2131,8 @@ echo ' nix-instantiate | nix-build nix build `nix-instantiate` + nix develop + nix-instantiate | nix show-derivation | jq nix-instantiate | nix show-derivation --recursive | jq @@ -2224,6 +2148,7 @@ echo ' SpineSRC=<<project_path_local_src>> SpineDOC=<<project_path_local_doc>> SpineOUT=<<project_path_local_out>> + SpineOUTstatic=<<project_path_local_out_static>> ,* spine run instruction examples ,** parallelized tasks @@ -2264,14 +2189,38 @@ echo ' - composite command: source pod, html, epub, harvest, sqlite $SpineSRC/result/bin/spine --verbose --no-parallel --dark --pod --epub --html --html-link-harvest --harvest --sqlite-discrete --output="$SpineOUT" $SpineDOC/markup/pod/* -,** config [./pod/].dr/config_local_site +,** cgi operations (output to $SpineOUTstatic /var/www) cat $SpineDOC/markup/pod/.dr/config_local_site $SpineSRC/result/bin/spine --show-config $SpineDOC/markup/pod $SpineSRC/result/bin/spine --show-config --output="$SpineOUT" $SpineDOC/markup/pod +,** cgi operations (output to /var/www) + + $SpineSRC/result/bin/spine --very-verbose --sqlite-db-create --output="$SpineOUTstatic" $SpineDOC/markup/pod/* + + $SpineSRC/result/bin/spine -v --cgi-search-form-codegen --output=$SpineOUTstatic/html $SpineDOC/markup/pod/* + + $SpineSRC/result/bin/spine -v --show-config --config=$SpineDOC/markup/pod/.dr + + $SpineSRC/result/bin/spine --html $SpineDOC/markup/pod/* + + $SpineSRC/result/bin/spine -v --sqlite-db-create --sqlite-filename="spine.search.db" --output="$SpineOUTstatic/html" $SpineDOC/markup/pod/* + + $SpineSRC/result/bin/spine -v --sqlite-db-create --sqlite-filename="spine.search.db" --cgi-sqlite-search-filename="spine-search" --output=$SpineOUTstatic/html $SpineDOC/markup/pod/* + + $SpineSRC/result/bin/spine -v --sqlite-db-recreate --sqlite-filename="spine.search.db" --cgi-sqlite-search-filename="spine-search" --output=$SpineOUTstatic/html $SpineDOC/markup/pod/* + + $SpineSRC/result/bin/spine -v --sqlite-update --sqlite-filename="spine.search.db" --output=$SpineOUTstatic/html $SpineDOC/markup/pod/* + + - make search form + $SpineSRC/result/bin/spine -v --cgi-search-form-codegen --config=$SpineDOC/markup/pod/.dr/config_local_site + - generate html linked to search form + $SpineSRC/result/bin/spine -v --html --html-link-search --html-link-harvest --harvest --output=$SpineOUTstatic/html $SpineDOC/markup/pod/* + ' >> SHELL_NIX_NOTE_ cat SHELL_NIX_NOTE_ +echo "cat SHELL_NIX_NOTE_" #+END_SRC @@ -2318,6 +2267,11 @@ cat SHELL_NIX_NOTE_ /tmp/spine/$SpineVER/www #+END_SRC +#+NAME: project_path_local_out_static +#+BEGIN_SRC nix +/var/www +#+END_SRC + ** flake :flake: - flake.nix @@ -2327,9 +2281,7 @@ cat SHELL_NIX_NOTE_ ./pkgs/shell-pkgs.nix - pkgs/shell-pkgs.nix - default.nix - ./nix/mkDub.nix - - mkdub.nix - ./nix/dub.selections.nix + ./nix/dub.selections.nix # - dub.selections.nix nix develop @@ -2342,12 +2294,8 @@ nix flake update inputs = { flake-utils.url = "github:numtide/flake-utils"; nixpkgs.url = "/nixpkgs-ra/nixpkgs"; - dub2nix-src = { - url = "github:lionello/dub2nix"; - flake = false; - }; }; - outputs = { self, dub2nix-src, nixpkgs, flake-utils }: + outputs = { self, nixpkgs, flake-utils }: let pkgs = nixpkgs.legacyPackages.x86_64-linux; in { @@ -2387,12 +2335,8 @@ nix flake update url = "github:lgvz/imageformats"; flake = false; }; - dub2nix-src = { - url = "github:lionello/dub2nix"; - flake = false; - }; }; - outputs = { self, d2sqlite3, tinyendian, dyaml, imageformats, dub2nix-src, nixpkgs, flake-utils }: + outputs = { self, d2sqlite3, tinyendian, dyaml, imageformats, nixpkgs, flake-utils }: let pkgs = nixpkgs.legacyPackages.x86_64-linux; in { @@ -2479,7 +2423,19 @@ nix flake update { pkgs ? import <nixpkgs> {} }: pkgs.mkShell { buildInputs = with pkgs; [ - (import ./nix/pkglst/shell-pkgs.nix { inherit pkgs; }) + ( + with pkgs; [ + nixFlakes + rund + dub + ldc + sqlite + nix-prefetch-git + validatePkgConfig + jq + git + ] + ) ]; shellHook = '' if [[ -e ".envrc" ]]; then @@ -2489,7 +2445,6 @@ pkgs.mkShell { } #+END_SRC - #+BEGIN_SRC nix :NO-tangle ../shell.nix :tangle-mode (identity #o755) :-shebang "#!/usr/bin/env -S nix-shell" { pkgs ? import <nixpkgs> {} }: pkgs.mkShell { @@ -2505,101 +2460,6 @@ pkgs.mkShell { nix-instantiate | nix show-derivation | jq ''; } - -nix-shell nix/shell/shell_spine.nix --pure - -#+BEGIN_SRC nix :tangle ../nix/shell/shell_spine.nix :tangle-mode (identity #o755) :-shebang "#!/usr/bin/env -S nix-shell" -{ pkgs ? import <nixpkgs> {} }: -pkgs.mkShell { - buildInputs = with pkgs; [ - (import ../pkglst/shell-pkgs.nix { inherit pkgs; }) - ]; - buildPhase = "nix build -f default.nix"; - shellHook = '' - if [[ -e ".envrc" ]]; then - source .envrc - fi - nix-build - RUN="./result/bin/spine --very-verbose --theme-light --html --epub --sqlite-discrete --output=/tmp/www ./data/pod/sisu-spine-markup" - $RUN - echo "built spine ... @ ./result/bin/spine" - echo "& (tested with) run:" - echo " $RUN" - ''; -} -#+END_SRC - -- combining shell.nix & default.nix to build package: - -#+BEGIN_SRC nix :NO-tangle ../shell.nix :tangle-mode (identity #o755) :shebang "#!/usr/bin/env -S nix-shell" -#!/usr/bin/env -S nix-shell -{ pkgs ? import <nixpkgs> {} }: -with import ./nix/mkDub.nix { inherit pkgs; }; -mkDubDerivation rec { - name = "spine-${version}"; - version = "<<version_spine>>"; - src = ./.; - buildInputs = with pkgs; [( - import ./nix/pkglst/shell-pkgs.nix - { inherit pkgs; } - )]; - meta = with pkgs.lib; { - homepage = https://sisudoc.org; - description = "a sisu like document parser"; - license = licenses.agpl3Plus; - platforms = platforms.linux; - maintainers = [ RalphAmissah ]; - }; -} -#+END_SRC - -- package import incorporated, all in one file - -#+BEGIN_SRC nix :NO-tangle ../shell.nix :tangle-mode (identity #o755) :shebang "#!/usr/bin/env -S nix-shell" -{ pkgs ? import <nixpkgs> {}, - stdenv ? pkgs.stdenv, -}: -with import ./nix/mkDub.nix { inherit pkgs; }; -mkDubDerivation rec { - name = "spine-${version}"; - version = "<<version_spine>>"; - src = ./.; - buildInputs = [ - pkgs.sqlite - ( - let - dub2nix-src = fetchTarball { - url = "https://github.com/lionello/dub2nix/archive/master.tar.gz"; - }; - dub2nix = (import dub2nix-src) { inherit pkgs; }; - in - with pkgs; [ - nixFlakes - dub - ldc - sqlite - nix-prefetch-git - validatePkgConfig - ] - ) - ]; - shellHook = '' - # nix-build -I nixpkgs=<provide local nix path> - nix-build - echo "built spine" - ''; - installPhase = '' - install -m755 -D spine $out/bin/spine - echo "built $out/bin/spine" - ''; - meta = with pkgs.lib; { - homepage = https://sisudoc.org; - description = "a sisu like document parser"; - license = licenses.agpl3Plus; - platforms = platforms.linux; - maintainers = [ RalphAmissah ]; - }; -} #+END_SRC ** default.nix :default: @@ -2621,52 +2481,7 @@ mkDubDerivation rec { nix build -f project.nix nix build -f spine.nix -#+BEGIN_SRC nix :tangle ../default.nix :tangle-mode (identity #o755) :-shebang "#!/usr/bin/env -S nix-build" -{ pkgs ? import <nixpkgs> {} }: -with import ./nix/mkDub.nix { inherit pkgs; }; -mkDubDerivation rec { - name = "spine-${version}"; - version = "<<version_spine>>"; - src = ./.; - buildInputs = [ - pkgs.sqlite - (import ./nix/pkglst/shell-pkgs.nix { inherit pkgs; }) - ]; - # installPhase = '' - # install -m755 -D spine $out/bin/spine - # echo "built $out/bin/spine" - # ''; - <<nix_project_meta>> -} -#+END_SRC - -** project.nix :project: - -#+BEGIN_SRC nix :tangle ../project.nix :tangle-mode (identity #o755) :shebang "#!/usr/bin/env -S nix-build" -{ pkgs ? import <nixpkgs> {} }: -with import ./nix/mkDub.nix { inherit pkgs; }; -mkDubDerivation rec { - name = "spine-${version}"; - version = "<<version_spine>>"; - src = ./.; - buildInputs = [ - pkgs.sqlite - ( - <<nix_dub2nix_with_pkgs>> - ) - ]; - # buildPhase = [ ]; - installPhase = '' - install -m755 -D spine $out/bin/spine - echo "built $out/bin/spine" - ''; - <<nix_project_meta>> -} -#+END_SRC - -** spine.nix (project.nix including import mkDub.nix) :project: - -#+BEGIN_SRC nix :tangle ../spine.nix :tangle-mode (identity #o755) :shebang "#!/usr/bin/env -S nix-build" +#+BEGIN_SRC nix :tangle ../default.nix :tangle-mode (identity #o755) :shebang "#!/usr/bin/env -S nix-build" { pkgs ? import <nixpkgs> {}, stdenv ? pkgs.stdenv, lib ? pkgs.lib, @@ -2675,9 +2490,77 @@ mkDubDerivation rec { dub ? pkgs.dub }: assert dcompiler != null; -#with import ./nix/mkDub.nix { inherit pkgs; }; -with ( # mkDub.nix - <<mkDub_nix>> +with ( + assert dcompiler != null; + with lib; + let + # Filter function to remove the .dub package folder from src + filterDub = name: type: let baseName = baseNameOf (toString name); in ! ( + type == "directory" && baseName == ".dub" + ); + targetOf = package: "${package.targetPath or "."}/${package.targetName or package.name}"; + # Remove reference to build tools and library sources + disallowedReferences = deps: [ dcompiler dub ]; + removeExpr = refs: ''remove-references-to ${lib.concatMapStrings (ref: " -t ${ref}") refs}''; + in { + mkDubDerivation = lib.makeOverridable ({ + src, + nativeBuildInputs ? [], + dubJSON ? src + "/dub.json", + passthru ? {}, + package ? lib.importJSON dubJSON, + ... + } @ attrs: stdenv.mkDerivation (attrs // { + pname = package.name; + nativeBuildInputs = [ dcompiler dub pkgs.removeReferencesTo ] ++ nativeBuildInputs; + disallowedReferences = disallowedReferences deps; + passthru = passthru // { + inherit dub dcompiler pkgs; + }; + src = lib.cleanSourceWith { + filter = filterDub; + src = lib.cleanSource src; + }; + preFixup = '' + find $out/bin -type f -exec ${removeExpr (disallowedReferences deps)} '{}' + || true + ''; + buildPhase = '' + runHook preBuild + export HOME=$PWD + for dc_ in dmd ldmd2 gdmd; do + echo "- check for D compiler $dc_" + dc=$(type -P $dc_ || echo "") + if [ ! "$dc" == "" ]; then + break + fi + done + if [ "$dc" == "" ]; then + exit "Error: could not find D compiler" + fi + echo "$dc_ used as D compiler to build $pname" + dub build --compiler=$dc --build=release --combined --skip-registry=all + runHook postBuild + ''; + checkPhase = '' + runHook preCheck + export HOME=$PWD + dub test --combined --skip-registry=all + runHook postCheck + ''; + installPhase = '' + runHook preInstall + mkdir -p $out/bin + cp -r "${targetOf package}" $out/bin + runHook postInstall + ''; + meta = lib.optionalAttrs (package ? description) { + description = package.description; + } // attrs.meta or {}; + } // lib.optionalAttrs (!(attrs ? version)) { + # Use name from dub.json, unless pname and version are specified + name = package.name; + })); + } ); mkDubDerivation rec { name = "spine-${version}"; @@ -2686,7 +2569,13 @@ mkDubDerivation rec { buildInputs = [ pkgs.sqlite ( - <<nix_dub2nix_with_pkgs>> + with pkgs; [ + nixFlakes + rund + dub + ldc + sqlite + ] ) ]; # buildPhase = [ ]; @@ -2714,149 +2603,14 @@ installPhase = '' #+NAME: nix_project_meta #+BEGIN_SRC nix meta = with pkgs.lib; { - homepage = https://sisudoc.org; + homepage = https://sisudoc.org; description = "a sisu like document parser"; - license = licenses.agpl3Plus; - platforms = platforms.linux; + license = licenses.agpl3Plus; + platforms = platforms.linux; maintainers = [ RalphAmissah ]; }; #+END_SRC -** mkDub.nix :mkDub: - -Get current mkDub.nix from the dub2nix project: - -#+BEGIN_SRC sh -aria2c https://raw.githubusercontent.com/lionello/dub2nix/master/mkDub.nix ./nix/. -#+END_SRC - -*** dub2nix - -#+BEGIN_SRC nix :tangle ../nix/pkglst/shell-pkgs.nix -{ pkgs ? import <nixpkgs> {} }: -<<nix_dub2nix_with_pkgs>> -#+END_SRC - -*** mkDub - -#+BEGIN_SRC nix :tangle ../nix/mkDub.nix -{ pkgs ? import <nixpkgs> {}, - stdenv ? pkgs.stdenv, - lib ? pkgs.lib, - ldc ? null, - dcompiler ? pkgs.ldc, - dub ? pkgs.dub -}: -<<mkDub_nix>> -#+END_SRC - -** mkDub.nix shared - -#+NAME: mkDub_nix -#+BEGIN_SRC nix -assert dcompiler != null; -with stdenv lib; -let - # Filter function to remove the .dub package folder from src - filterDub = name: type: let baseName = baseNameOf (toString name); in ! ( - type == "directory" && baseName == ".dub" - ); - # Convert a GIT rev string (tag) to a simple semver version - rev-to-version = builtins.replaceStrings ["v" "refs/tags/v"] ["" ""]; - dep2src = dubDep: pkgs.fetchgit { inherit (dubDep.fetch) url rev sha256 fetchSubmodules; }; - # Fetch a dependency (source only for now) - fromDub = dubDep: mkDerivation rec { - name = "${src.name}-${version}"; - version = rev-to-version dubDep.fetch.rev; - nativeBuildInputs = [ dcompiler dub ]; - src = dep2src dubDep; - buildPhase = '' - runHook preBuild - export HOME=$NIX_BUILD_TOP - #export HOME=$PWD - dub build -b=release - runHook postBuild - ''; - # outputs = [ "lib" ]; - # installPhase = '' - # runHook preInstall - # mkdir -p $out/bin - # runHook postInstall - # ''; - }; - # Adds a local package directory (e.g. a git repository) to Dub - dub-add-local = dubDep: "dub add-local ${(fromDub dubDep).src.outPath} ${rev-to-version dubDep.fetch.rev}"; - # The target output of the Dub package - targetOf = package: "${package.targetPath or "."}/${package.targetName or package.name}"; - # Remove reference to build tools and library sources - disallowedReferences = deps: [ dcompiler dub ] ++ builtins.map dep2src deps; - removeExpr = refs: ''remove-references-to ${lib.concatMapStrings (ref: " -t ${ref}") refs}''; -in { - inherit fromDub; - mkDubDerivation = lib.makeOverridable ({ - src, - nativeBuildInputs ? [], - dubJSON ? src + "/dub.json", - selections ? src + "/nix/dub.selections.nix", - deps ? import selections, - passthru ? {}, - package ? lib.importJSON dubJSON, - ... - } @ attrs: stdenv.mkDerivation (attrs // { - pname = package.name; - nativeBuildInputs = [ dcompiler dub pkgs.removeReferencesTo ] ++ nativeBuildInputs; - disallowedReferences = disallowedReferences deps; - passthru = passthru // { - inherit dub dcompiler pkgs; - }; - src = lib.cleanSourceWith { - filter = filterDub; - src = lib.cleanSource src; - }; - preFixup = '' - find $out/bin -type f -exec ${removeExpr (disallowedReferences deps)} '{}' + || true - ''; - buildPhase = '' - runHook preBuild - export HOME=$PWD - ${lib.concatMapStringsSep "\n" dub-add-local deps} - for dc_ in dmd ldmd2 gdmd; do - echo "- check for D compiler $dc_" - dc=$(type -P $dc_ || echo "") - if [ ! "$dc" == "" ]; then - break - fi - done - if [ "$dc" == "" ]; then - exit "Error: could not find D compiler" - fi - echo "$dc_ used as D compiler to build $pname" - dub build --compiler=$dc --build=release --combined --skip-registry=all - runHook postBuild - ''; - checkPhase = '' - runHook preCheck - export HOME=$PWD - ${lib.concatMapStringsSep "\n" dub-add-local deps} - dub test --combined --skip-registry=all - runHook postCheck - ''; - installPhase = '' - runHook preInstall - mkdir -p $out/bin - cp -r "${targetOf package}" $out/bin - runHook postInstall - ''; - meta = lib.optionalAttrs (package ? description) { - description = package.description; - } // attrs.meta or {}; - } // lib.optionalAttrs (!(attrs ? version)) { - # Use name from dub.json, unless pname and version are specified - name = package.name; - })); -} -#+END_SRC - ** dub.selections.json #+BEGIN_SRC nix :NO-tangle ../dub.selections.json @@ -2929,35 +2683,13 @@ in { ** dub2nix & shared pkgs SHARED *** dub2nix with pkgs shared -#+NAME: nix_dub2nix_with_pkgs +#+NAME: nix_with_pkgs #+BEGIN_SRC nix -let - <<nix_shell_dub2nix_srcLocalPreFetched>> -in with pkgs; [ <<nix_shell_with_pkgs_list>> ] #+END_SRC -*** get dub2nix -**** source local - -#+NAME: nix_shell_dub2nix_srcLocalPreFetched -#+BEGIN_SRC nix -dub2nix-src = ./src/build_depends/dub2nix/.; -dub2nix = (import dub2nix-src) { inherit pkgs; }; -#+END_SRC - -**** source remote (github) - -#+NAME: nix_shell_dub2nix_srcRemoteGitHub -#+BEGIN_SRC nix -dub2nix-src = fetchTarball { - url = "https://github.com/lionello/dub2nix/archive/master.tar.gz"; -}; -dub2nix = (import dub2nix-src) { inherit pkgs; }; -#+END_SRC - *** with pkgs list #+NAME: nix_shell_with_pkgs_list @@ -3386,16 +3118,54 @@ table toc #+END_SRC +** dub REFERENCE +*** SET version + +#+NAME: version_dub +#+BEGIN_SRC nix +<<version_dub_next>> +#+END_SRC + +#+NAME: nix_sha_dub +#+BEGIN_SRC nix +<<nix_sha_dub_next>> +#+END_SRC + +*** SELECT version +**** dub 1.24.0 + +#+NAME: version_dub_next +#+BEGIN_SRC nix +1.24.0 +#+END_SRC + +#+NAME: nix_sha_dub_next +#+BEGIN_SRC nix +0wirm6msz8kw2a7v2ax9ab6i48cmfv6qjwpfrl9vrr4k4xdg3vn6 +#+END_SRC + +**** dub 1.23.0 + +#+NAME: version_dub_current +#+BEGIN_SRC nix +1.23.0 +#+END_SRC + +#+NAME: nix_sha_dub_current +#+BEGIN_SRC nix +06a4whsl1m600k096nwif83n7za3vr7pj1xwapncy5fcad1gmady +#+END_SRC + *** dub (using ldc rather than dmd) overlay REFERENCE :overlay: #+BEGIN_SRC nix :NO-tangle ~/nixpkgs/pkgs/development/tools/build-managers/dub/default.nix -{ lib, stdenv, fetchFromGitHub, curl, libevent, rsync, ldc ? null, dcompiler ? ldc }: +{ lib, stdenv, fetchFromGitHub, curl, libevent, rsync, ldc, dcompiler ? ldc }: assert dcompiler != null; stdenv.mkDerivation rec { pname = "dub"; - version = "1.23.0"; + version = "<<version_dub>>"; enableParallelBuilding = true; @@ -3403,8 +3173,7 @@ stdenv.mkDerivation rec { owner = "dlang"; repo = "dub"; rev = "v${version}"; - sha256 = "06a4whsl1m600k096nwif83n7za3vr7pj1xwapncy5fcad1gmady"; - # nix-prefetch-url https://github.com/dlang/dub/archive/v1.23.0.tar.gz + sha256 = "<<nix_sha_dub>>"; }; postUnpack = '' @@ -3423,7 +3192,7 @@ stdenv.mkDerivation rec { buildPhase = '' for dc_ in dmd ldmd2 gdmd; do - echo "- check for D compiler $dc_" + echo "... check for D compiler $dc_ ..." dc=$(type -P $dc_ || echo "") if [ ! "$dc" == "" ]; then break @@ -3432,7 +3201,8 @@ stdenv.mkDerivation rec { if [ "$dc" == "" ]; then exit "Error: could not find D compiler" fi - echo "$dc_ used as D compiler to build $pname" + export DC_NAME=$dc_ + echo "$dc_ found and used as D compiler to build $pname" $dc ./build.d ./build ''; @@ -3442,104 +3212,18 @@ stdenv.mkDerivation rec { checkPhase = '' export DUB=$NIX_BUILD_TOP/source/bin/dub export PATH=$PATH:$NIX_BUILD_TOP/source/bin/ - export DC=${dcompiler.out}/bin/${dcompiler.pname} + export DC=${dcompiler.out}/bin/$DC_NAME echo "DC out --> $DC" export HOME=$TMP - #rm -rf test/* - rm -rf test/issue502-root-import - rm test/issue674-concurrent-dub.sh - rm test/issue672-upgrade-optional.sh - rm test/issue990-download-optional-selected.sh - rm test/issue877-auto-fetch-package-on-run.sh - rm test/issue1037-better-dependency-messages.sh - # rm test/issue1040-run-with-ver.sh - rm test/issue1416-maven-repo-pkg-supplier.sh - rm test/issue1180-local-cache-broken.sh - rm test/issue1574-addcommand.sh - rm test/issue1524-maven-upgrade-dependency-tree.sh - rm test/issue1773-lint.sh - rm test/ddox.sh - rm test/fetchzip.sh - rm test/feat663-search.sh - rm -rf test/git-dependency - rm test/interactive-remove.sh - rm test/timeout.sh - rm test/version-spec.sh - rm test/0-init-multi.sh - rm test/4-describe-data-1-list.sh - rm test/4-describe-data-3-zero-delim.sh - rm test/4-describe-import-paths.sh - rm test/4-describe-string-import-paths.sh - rm test/4-describe-json.sh - rm test/5-convert-stdout.sh - rm test/0-init-multi-json.sh - rm test/issue1003-check-empty-ld-flags.sh - rm test/issue103-single-file-package.sh - rm test/issue1040-run-with-ver.sh - rm test/issue1091-bogus-rebuild.sh - # rm test/issue1180-local-cache-broken.sh - rm test/issue1194-warn-wrong-subconfig.sh - rm test/issue1277.sh - rm test/issue1372-ignore-files-in-hidden-dirs.sh - rm test/issue1447-build-settings-vars.sh - rm test/issue1531-toolchain-requirements.sh - # rm test/issue1773-lint.sh - rm test/issue346-redundant-flags.sh - rm test/issue361-optional-deps.sh - rm test/issue564-invalid-upgrade-dependency.sh - rm test/issue586-subpack-dep.sh - rm test/issue616-describe-vs-generate-commands.sh - rm test/issue686-multiple-march.sh - rm test/issue813-fixed-dependency.sh - rm test/issue813-pure-sub-dependency.sh - rm test/issue820-extra-fields-after-convert.sh - # rm test/issue877-auto-fetch-package-on-run.sh - rm test/issue923-subpackage-deps.sh - rm test/single-file-sdl-default-name.sh - rm test/subpackage-common-with-sourcefile-globbing.sh - rm test/issue934-path-dep.sh - # rm test/version-spec.sh - rm -rf test/1-dynLib-simple - rm -rf test/1-exec-simple-package-json - rm -rf test/1-exec-simple - rm -rf test/1-staticLib-simple - rm -rf test/2-dynLib-dep - rm -rf test/2-staticLib-dep - rm -rf test/2-dynLib-with-staticLib-dep - rm -rf test/2-sourceLib-dep/ - rm -rf test/3-copyFiles - rm -rf test/custom-source-main-bug487 - rm -rf test/custom-unittest - rm -rf test/issue1262-version-inheritance-diamond - rm -rf test/git-dependency - rm -rf test/issue1003-check-empty-ld-flags - rm -rf test/ignore-hidden-1 - rm -rf test/ignore-hidden-2 - rm -rf test/issue1427-betterC - rm -rf test/issue130-unicode-* - rm -rf test/issue1262-version-inheritance - rm -rf test/issue1372-ignore-files-in-hidden-dirs - rm -rf test/issue1350-transitive-none-deps - rm -rf test/issue1775 - rm -rf test/issue1447-build-settings-vars - rm -rf test/issue1408-inherit-linker-files - rm -rf test/issue1551-var-escaping - rm -rf test/issue754-path-selection-fail - rm -rf test/issue1788-incomplete-string-import-override - rm -rf test/subpackage-ref - rm -rf test/issue777-bogus-path-dependency - rm -rf test/issue959-path-based-subpack-dep - rm -rf test/issue97-targettype-none-nodeps - rm -rf test/issue97-targettype-none-onerecipe - rm -rf test/path-subpackage-ref - rm -rf test/sdl-package-simple + + <<build_dub_tests>> + ./test/run-unittest.sh ''; installPhase = '' mkdir -p $out/bin cp bin/dub $out/bin - #cp $NIX_BUILD_TOP/dub $out/bin ''; meta = with lib; { @@ -3551,3 +3235,65 @@ stdenv.mkDerivation rec { }; } #+END_SRC + +***** removed failing tests + +#+NAME: build_dub_tests +#+BEGIN_SRC nix +rm test/0-init-multi.sh +rm test/0-init-multi-json.sh +rm test/5-convert-stdout.sh +rm test/dc-env.sh +rm test/ddox.sh +rm test/feat663-search.sh +rm test/fetchzip.sh +rm test/interactive-remove.sh +rm test/issue672-upgrade-optional.sh +rm test/issue674-concurrent-dub.sh +rm test/issue820-extra-fields-after-convert.sh +rm test/issue877-auto-fetch-package-on-run.sh +rm test/issue990-download-optional-selected.sh +rm test/issue1003-check-empty-ld-flags.sh +rm test/issue1037-better-dependency-messages.sh +rm test/issue1040-run-with-ver.sh +rm test/issue1091-bogus-rebuild.sh +rm test/issue1180-local-cache-broken.sh +rm test/issue1194-warn-wrong-subconfig.sh +rm test/issue1277.sh +rm test/issue1372-ignore-files-in-hidden-dirs.sh +rm test/issue1416-maven-repo-pkg-supplier.sh +rm test/issue1447-build-settings-vars.sh +rm test/issue1574-addcommand.sh +rm test/issue1524-maven-upgrade-dependency-tree.sh +rm test/issue1773-lint.sh +rm test/removed-dub-obj.sh +rm test/version-spec.sh +rm -r test/git-dependency +rm -r test/issue502-root-import +#+END_SRC + +* NOTE +** manually set version + +DRV=0.10.0; git tag -f doc-reform_v\${DRV} -m\"doc-reform spine-\${DRV}\" e5452d46475785c78fe4462717bdb74f17c4197 + +V_MAJOR=0; V_MINOR=10; V_PATCH=0 +for i in org/spine.org; do; sed -i "s/Version(\s*[0-9]\+,\s\+[0-9]\+,\s\+[0-9]\+\s*)/Version(${V_MAJOR}, ${V_MINOR}, ${V_PATCH})/g" $i; done +for i in org/spine_build_scaffold.org; do; sed -i "0,/\(version:\)\s\+['][0-9]\+\.[0-9]\+\.[0-9]\+['],/s//\1 \'${V_MAJOR}.${V_MINOR}.${V_PATCH}\',/g" $i; done + +** check cgi build operations + +~dr/bin/spine-ldc -v --cgi-search-form-codegen --output=/var/www/html ~grotto/repo/git.repo/code/project-spine/doc-reform-markup/markup_samples/markup/pod + +~dr/bin/spine-ldc -v --show-config --config=/grotto/repo/git.repo/code/project-spine/doc-reform-markup/markup_samples/markup/pod/.dr +~dr/bin/spine-ldc --show-config --html ~grotto/repo/git.repo/code/project-spine/doc-reform-markup/markup_samples/markup/pod/* + +~dr/bin/spine-ldc -v --sqlite-db-create --sqlite-filename="spine.search.db" --output=/var/www/html ~grotto/repo/git.repo/code/project-spine/doc-reform-markup/markup_samples/markup/pod +~dr/bin/spine-ldc -v --sqlite-db-create --sqlite-filename="spine.search.db" --cgi-sqlite-search-filename="spine-search" --output=/var/www/html ~grotto/repo/git.repo/code/project-spine/doc-reform-markup/markup_samples/markup/pod +~dr/bin/spine-ldc -v --sqlite-db-recreate --sqlite-filename="spine.search.db" --cgi-sqlite-search-filename="spine-search" --output=/var/www/html ~grotto/repo/git.repo/code/project-spine/doc-reform-markup/markup_samples/markup/pod + +~dr/bin/spine-ldc -v --sqlite-update --sqlite-filename="spine.search.db" --output=/var/www/html ~grotto/repo/git.repo/code/project-spine/doc-reform-markup/markup_samples/markup/pod/* + +~dr/bin/spine-ldc -v --cgi-search-form-codegen --config=/grotto/repo/git.repo/code/project-spine/doc-reform-markup/markup_samples/markup/pod/.dr/config_local_site + +~dr/bin/spine-ldc -v --html --html-link-search --html-link-harvest --harvest --output=/var/www/html ~grotto/repo/git.repo/code/project-spine/doc-reform-markup/markup_samples/markup/pod/* |