From 0a1a8ce68c7b27cc4e86e9fab71a99e311d9e7d0 Mon Sep 17 00:00:00 2001 From: Ralph Amissah Date: Tue, 7 May 2024 10:11:24 -0400 Subject: configuration a& build related --- org/config_dub.org | 13 +++++----- org/config_env.org | 31 +++++++++++++++++----- org/config_make.org | 10 ++----- org/config_nix.org | 75 ++++++++++++++++++++++++++++++++++------------------- 4 files changed, 82 insertions(+), 47 deletions(-) (limited to 'org') diff --git a/org/config_dub.org b/org/config_dub.org index 42c5f6f..61405f6 100644 --- a/org/config_dub.org +++ b/org/config_dub.org @@ -54,33 +54,34 @@ "homepage": "https://sisudoc.org", "license": "AGPL-3.0+", "targetPath": "./cgi-bin", - "sourcePaths": [ "./src" ], + "sourcePaths": [ "./src/sisudoc" ], + "importPaths": [ "./views" ], "stringImportPaths": [ "./views" ], "buildRequirements": [ "allowWarnings" ], "targetType": "executable", "buildTypes": { "dmd": { - "dflags": [ "-J=views", "-I=src" ], + "dflags": [ "-O", "-J=views", "-I=src/sisudoc" ], "buildOptions": [ "inline", "verbose" ], "buildRequirements": [ "allowWarnings" ] }, "ldc2": { - "dflags": [ "-O2", "-J=views", "-I=src" ], + "lflags": [ "-O2", "-I=src/sisudoc" ], "buildOptions": [ "optimize", "inline", "verbose" ], "buildRequirements": [ "allowWarnings" ] }, "ldmd2": { - "dflags": [ "-O2", "-boundscheck=on", "-J=views", "-I=src", "-color=on" ], + "dflags": [ "-O", "-J=views", "-I=src/sisudoc" ], "buildOptions": [ "optimize", "inline", "verbose" ], "buildRequirements": [ "allowWarnings" ] }, "gdc": { - "dflags": [ "-O2", "-J=views", "-I=src" ], + "lflags": [ "-O2", "-J=views", "-I=src/sisudoc" ], "buildOptions": [ "optimize", "inline" ], "buildRequirements": [ "allowWarnings" ] }, "gdmd": { - "dflags": [ "-O2", "-J=views", "-I=src" ], + "dflags": [ "-O", "-J=views", "-I=src/sisudoc" ], "buildOptions": [ "optimize", "inline" ], "buildRequirements": [ "allowWarnings" ] } diff --git a/org/config_env.org b/org/config_env.org index 6f1c1c7..dab1d81 100644 --- a/org/config_env.org +++ b/org/config_env.org @@ -76,22 +76,38 @@ echo ' ❯❯ nix flake show ❯❯ nix flake update && nix flake check && nix flake show -- for a dev shell: +- for a dev shell (development environment): ❯❯ nix develop ❯❯ nix develop ".#" --print-build-logs -c zsh + ❯❯ nix develop ".#dsh-nixpkgs-dmd-dub" --print-build-logs -c zsh + ❯❯ nix develop ".#dsh-overlay-dmd-dub" --print-build-logs -c zsh + ❯❯ nix develop ".#dsh-nixpkgs-ldc-dub" --print-build-logs -c zsh + ❯❯ nix develop ".#dsh-overlay-ldc-dub" --print-build-logs -c zsh - to build project: ❯❯ nix build --print-build-logs ❯❯ nix build ".#" --print-build-logs + +- to build project (for build dependencies select appropriate dev env & build): + ❯❯ nix build ".#spine-search-nixpkgs-dmd" --print-build-logs ❯❯ nix build ".#spine-search-overlay-dmd" --print-build-logs + ❯❯ nix build ".#spine-search-nixpkgs-ldc" --print-build-logs ❯❯ nix build ".#spine-search-overlay-ldc" --print-build-logs - - (see nix other/additional build options): - ❯❯ nix flake show - ❯❯ nix flake update && nix flake check --show-trace && nix flake show && nix develop ".#devShell" -c zsh - ❯❯ dub build --compiler=ldmd --build=release --combined --skip-registry=all +- to build using dub on nix (get dependencies by setting your development environment): + + ❯❯ nix develop ".#dsh-nixpkgs-dmd-dub" --print-build-logs -c zsh + ❯❯ dub run --compiler=dmd --config=dmd --combined --skip-registry=all + + ❯❯ nix develop ".#dsh-nixpkgs-ldc-dub" --print-build-logs -c zsh + ❯❯ dub run --compiler=ldmd2 --config=ldmd2 --combined --skip-registry=all + +- for develop environment & build options + ❯❯ nix flake show + ❯❯ nix flake update && nix flake check && nix flake show + ' #+END_SRC @@ -164,9 +180,10 @@ fi #+HEADER: :tangle ../.envrc-local #+HEADER: :noweb yes #+BEGIN_SRC sh -export DFLAGS="-O2 -inline -boundscheck=on -color=on" export SpineVER=$(git describe --long --tags | sed 's/^[ a-z_-]\+\([0-9.]\+\)/\1/;s/\([^-]*-g\)/r\1/;s/-/./g') export SpineSearchBIN=result/share/cgi-bin -export SpineCGIbin=/var/www/cgi/cgi-bin +# ❯❯ cgi search form name: export SpineCGIform='spine_search' +# ❯❯ configuration cgi search form path: +export SpineCGIbin=/var/www/cgi/cgi-bin #+END_SRC diff --git a/org/config_make.org b/org/config_make.org index 3f97ff4..2c7e8d9 100644 --- a/org/config_make.org +++ b/org/config_make.org @@ -49,13 +49,7 @@ #+HEADER: :tangle ../makefile #+HEADER: :noweb yes #+BEGIN_SRC makefile -include .envrc-local -#SpineBIN := "${SpineBIN}" # 'result/bin' -#SpineOUT := "${SpineOUT}" # '/srv/www/spine' -#SpinePOD := "${SpinePOD}" # '~/grotto/repo/git.repo/projects/project-spine/doc-reform-markup/spine-markup-samples/markup/pod' -#SpineSearchAction := 'https://sisudoc.org/spine_search' -#SpineCGIform := 'spine_search' -#SpineSQLdb := 'spine.search.db' +#include .envrc-local PROG_VER_GIT :=$(shell echo `git describe --long --tags | sed -e "s/^[ a-z_-]\+\([0-9.]\+\)/\1/;s/\([^-]*-g\)/r\1/;s/-/./g"`) PROG_VER_DECLARED :=$(shell echo `cat ./views/version.txt | grep --color=never "enum" | sed 's/.\+(\([0-9]\+\),[ \t]\+\([0-9]\+\),[ \t]\+\([0-9]\+\)[ \t]*).\+/\1.\2.\3/g'`) @@ -71,7 +65,7 @@ flake-check: echo -e '❯❯ nix build ".#spine-ldc" --print-build-logs |& nom\n❯❯ nix build ".#spine-dmd" --print-build-logs |& nom\n'; \ echo -e '❯❯ make -s\n❯❯ make -s nix-build-ldc\n❯❯ make -s nix-build-dmd\n'; \ echo -e '❯❯ make -s ldc\n❯❯ make -s dmd\n'; \ - echo -e '❯❯ $(DUB) --compiler=ldc2 --build=ldc2\n❯❯ $(DUB) --compiler=dmd --build=dmd\n'; + echo -e '❯❯ $(DUB) --compiler=ldmd2 --build=ldmd2\n❯❯ $(DUB) --compiler=dmd --build=dmd\n'; nix-devshell: echo -ne '\n❯❯ nix flake update && nix flake check --show-trace && nix flake show && nix develop ".#devShell"\n\n❯❯ nix build ".#default" --print-build-logs\n❯❯ nix build ".#spine-search-dmd" --print-build-logs\n❯❯ nix build ".#spine-search-ldc" --print-build-logs\n❯❯ nix build ".#spine-search-gdc" --print-build-logs\n\n'; \ diff --git a/org/config_nix.org b/org/config_nix.org index 0bf2362..3eb9498 100644 --- a/org/config_nix.org +++ b/org/config_nix.org @@ -56,7 +56,7 @@ ldc = prev.callPackage ./nix-overlays/ldc { }; dmd = prev.callPackage ./nix-overlays/dmd { }; dub = prev.callPackage ./nix-overlays/dub { }; - #gdc = prev.callPackage ./nix-overlays/gdc { }; # empty + #gdc = prev.callPackage ./nix-overlays/gdc { }; }); pkgsForSystem = system: import nixpkgs { overlays = [ @@ -81,7 +81,7 @@ pkgs-ovl = pkgsForSystem system; pkgs-nix = nixpkgsFor.${system}; in - with pkgs-ovl; { + with pkgs-nix; { default = stdenv.mkDerivation { inherit pname; inherit version; @@ -100,7 +100,7 @@ done if [ "$DC" == "" ]; then exit "Error: could not find D compiler"; fi echo "$DC_ used as D compiler to build $pname" - buildCMD="dub build --cache=local --compiler=$DC --build=$DC_ --combined --skip-registry=all" + buildCMD="dub run --cache=local --compiler=$DC --build=$DC_ --combined --skip-registry=all" echo $buildCMD $buildCMD echo $buildCMD @@ -119,11 +119,11 @@ src = self; inherit shell; inherit devEnv; - buildInputs = with pkgs-nix; [sqlite]; - nativeBuildInputs = with pkgs-nix; [dub dmd gnumake]; + buildInputs = [sqlite]; + nativeBuildInputs = [dub dmd gnumake]; buildPhase = '' runHook preBuild - buildCMD="dub build --cache=local --compiler=$(type -P dmd) --build=dmd --combined --skip-registry=all" + buildCMD="dub run --cache=local --compiler=$(type -P dmd) --build=dmd --combined --skip-registry=all" echo $buildCMD $buildCMD echo $buildCMD @@ -142,11 +142,11 @@ src = self; inherit shell; inherit devEnv; - buildInputs = with pkgs-nix; [sqlite]; - nativeBuildInputs = with pkgs-nix; [dub ldc gnumake]; + buildInputs = [sqlite]; + nativeBuildInputs = [dub ldc gnumake]; buildPhase = '' runHook preBuild - buildCMD="dub build --cache=local --compiler=$(type -P ldc2) --build=ldc2 --combined --skip-registry=all" + buildCMD="dub run --cache=local --compiler=$(type -P ldmd2) --build=ldmd2 --combined --skip-registry=all" echo $buildCMD $buildCMD echo $buildCMD @@ -165,11 +165,11 @@ src = self; inherit shell; inherit devEnv; - buildInputs = [sqlite]; - nativeBuildInputs = [dub dmd gnumake]; + buildInputs = with pkgs-ovl; [sqlite]; + nativeBuildInputs = with pkgs-ovl; [dub dmd gnumake]; buildPhase = '' runHook preBuild - buildCMD="dub build --cache=local --compiler=$(type -P dmd) --build=dmd --combined --skip-registry=all" + buildCMD="dub run --cache=local --compiler=$(type -P dmd) --build=dmd --combined --skip-registry=all" echo $buildCMD $buildCMD echo $buildCMD @@ -188,11 +188,11 @@ src = self; inherit shell; inherit devEnv; - buildInputs = [sqlite]; - nativeBuildInputs = [dub ldc gnumake]; + buildInputs = with pkgs-ovl; [sqlite]; + nativeBuildInputs = with pkgs-ovl; [dub ldc gnumake]; buildPhase = '' runHook preBuild - buildCMD="dub build --cache=local --compiler=$(type -P ldc2) --build=ldc2 --combined --skip-registry=all" + buildCMD="dub run --cache=local --compiler=$(type -P ldmd2) --build=ldmd2 --combined --skip-registry=all" echo $buildCMD $buildCMD echo $buildCMD @@ -211,11 +211,11 @@ # src = self; # inherit shell; # inherit devEnv; - # buildInputs = [ sqlite ]; - # nativeBuildInputs = [ dub gdc gnumake ]; + # buildInputs = with pkgs-ovl; [ sqlite ]; + # nativeBuildInputs = with pkgs-ovl; [ dub gdc gnumake ]; # buildPhase = '' # runHook preBuild - # dub build --cache=local --compiler=$(type -P gdc) --build=gdc --combined --skip-registry=all + # dub run --cache=local --compiler=$(type -P gdc) --build=gdc --combined --skip-registry=all # runHook postBuild # ''; # inherit preBuild; @@ -229,17 +229,17 @@ pkgs-ovl = pkgsForSystem system; pkgs-nix = nixpkgsFor.${system}; shellHook = '' - export DFLAGS="-O2 -boundscheck=on" export Date=`date "+%Y%m%d"` ## set local values in .envrc-local (or here if you must) ''; in - with pkgs-ovl; { + with pkgs-nix; { + dsh-d-overlay = d-overlay.devShells.${system}.default; dsh-overlay = mkShell { name = "spine base dev shell"; inherit shell; inherit devEnv; - packages = [ + packages = with pkgs-ovl; [ ldc #dmd dub @@ -248,8 +248,7 @@ ]; inherit shellHook; }; - dsh-d-overlay = d-overlay.devShells.${system}.default; - dsh-overlay-dmd-dub = mkShell { + dsh-nixpkgs-dmd-dub = mkShell { name = "spine base dev shell"; inherit shell; inherit devEnv; @@ -262,10 +261,34 @@ inherit shellHook; }; dsh-nixpkgs-ldc-dub = mkShell { - name = "nixpkgs - ldc - dub"; + name = "spine base dev shell"; + inherit shell; + inherit devEnv; + packages = [ + ldc + dub + gnumake + sqlite + ]; + inherit shellHook; + }; + dsh-overlay-dmd-dub = mkShell { + name = "spine base dev shell"; + inherit shell; + inherit devEnv; + packages = with pkgs-ovl; [ + dmd + dub + gnumake + sqlite + ]; + inherit shellHook; + }; + dsh-overlay-ldc-dub = mkShell { + name = "spine base dev shell"; inherit shell; inherit devEnv; - packages = with pkgs-nix; [ + packages = with pkgs-ovl; [ ldc dub gnumake @@ -480,7 +503,7 @@ with ( 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 + dub run --compiler=$DC --build=release --combined --skip-registry=all runHook postBuild ''; checkPhase = '' -- cgit v1.2.3