aboutsummaryrefslogtreecommitdiffhomepage
path: root/org
diff options
context:
space:
mode:
Diffstat (limited to 'org')
-rw-r--r--org/spine_build_scaffold.org447
1 files changed, 387 insertions, 60 deletions
diff --git a/org/spine_build_scaffold.org b/org/spine_build_scaffold.org
index 6a00b30..4470d00 100644
--- a/org/spine_build_scaffold.org
+++ b/org/spine_build_scaffold.org
@@ -971,6 +971,63 @@ gitsnapshot: distclean tangle
],
"copyright": "Copyright © 2015 - 2020 Ralph Amissah",
"name": "spine",
+ "version": "0.11.1",
+ "description": "a sisu like document parser",
+ "homepage": "http://sisudoc.org",
+ "license": "AGPL-3.0+",
+ "targetPath": "./bin",
+ "sourcePaths": [ "./src/doc_reform" ],
+ "stringImportPaths": [ "./views" ],
+ "buildRequirements": [ "allowWarnings" ],
+ "targetType": "executable",
+ "platforms": [ "posix" ],
+ "buildTypes": {
+ "dmd": {
+ "dflags": [ "-J=views", "-I=src/doc_reform" ],
+ "buildOptions": [ "verbose", "inline" ],
+ "buildRequirements": [ "allowWarnings" ]
+ },
+ "ldc": {
+ "dflags": [ "-O2", "-J=views", "-I=src/doc_reform" ],
+ "buildOptions": [ "verbose", "optimize", "inline" ],
+ "buildRequirements": [ "allowWarnings" ]
+ }
+ },
+ "dependencies": {
+ "d2sqlite3": "~>0.19.1",
+ "imageformats": "~>7.0.2",
+ "dyaml": "~>0.8.0",
+ "tinyendian": "~>0.2.0"
+ },
+ "configurations": [
+ {
+ "name": "default",
+ "targetName": "spine"
+ },
+ {
+ "name": "ldc",
+ "targetName": "spine-ldc"
+ },
+ {
+ "name": "dmd",
+ "targetName": "spine-dmd"
+ }
+ ],
+ "subConfigurations": {
+ "d2sqlite3": "with-lib"
+ }
+}
+#+END_SRC
+
+** check dub.json
+
+#+BEGIN_SRC sh :NO-tangle ../dub.json
+{
+ "authors": [
+ "Ralph Amissah"
+ ],
+ "copyright": "Copyright © 2015 - 2020 Ralph Amissah",
+ "name": "spine",
"description": "a sisu like document parser",
"homepage": "http://sisudoc.org",
"license": "AGPL-3.0+",
@@ -1020,6 +1077,9 @@ gitsnapshot: distclean tangle
* dub.sdl :dub:sdl:config:
Every DUB package should contain a [[http://code.dlang.org/package-format?lang=json][dub.json]] (or [[http://code.dlang.org/package-format?lang=sdl][dub.sdl]])
+
+not configured here using dub.json for the moment
+
** header (including dependencies) :header:
#+BEGIN_SRC sh :NO-tangle ../dub.sdl :tangle-mode (identity #o755) :shebang #!/usr/bin/env dub
@@ -1563,93 +1623,357 @@ tinyendian_dep = declare_dependency(
#+END_SRC
* nix
-** envrc
+** dub2nix notes (from author (Lionello Lunesu) email reply, 2020-10-12)
+
+- https://github.com/lionello/dub2nix
+
+- see shell.nix minimal content:
+
+#+BEGIN_SRC nix :NO-tangle shell.nix
+with import <nixpkgs> {};
+let
+ dub2nix-src = fetchTarball {
+ url = "https://github.com/lionello/dub2nix/archive/master.tar.gz";
+ };
+ dub2nix = (import dub2nix-src) { inherit pkgs; };
+in mkShell {
+ buildInputs = [
+ dub dmd rdmd sqlite dub2nix nix-prefetch-git
+ ];
+}
+#+END_SRC
-#+BEGIN_SRC nix :tangle ../.envrc
-use nix
-NIX_ENFORCE_PURITY=0
+- 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 © 2020, Ralph Amissah",
+ "description": "A minimal D application.",
+ "license": "AGPL-3",
+ "name": "d2sqlite3_dub2nix",
+ "dependencies": {
+ "d2sqlite3": "~>0.19.1"
+ },
+ "subConfigurations": {
+ "d2sqlite3": "with-lib"
+ }
+}
#+END_SRC
-** shells
+- 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
+
+** envrc
+
+#+BEGIN_SRC nix :tangle ../.envrc
+if type lorri &>/dev/null; then
+ echo "direnv: using lorri from PATH ($(type -p lorri))"
+ eval "$(lorri direnv)"
+else
+ # fall back to using direnv's builtin nix support
+ # to prevent bootstrapping problems.
+ use nix
+ NIX_ENFORCE_PURITY=0
+fi
+# source an additional user-specific .envrc in ./.envrc-local
+if [ -e .envrc-local ]; then
+ source .envrc-local
+fi
+#+END_SRC
+
+** shells shell.nix
*** nix-shell shell.nix
#+BEGIN_SRC nix :tangle ../shell.nix
+<<nix_shell_with_compiler_ldc>>
+#+END_SRC
+
+*** ldc shell
+
+#+BEGIN_SRC nix :tangle ../nixDevEnv/shells/ldc.nix
+<<nix_shell_with_compiler_ldc>>
+#+END_SRC
+
+#+NAME: nix_shell_with_compiler_ldc
+#+BEGIN_SRC nix
{ pkgs ? import <nixpkgs> {
overlays = [
(import ./nixDevEnv/overlays/ldcVersion.nix)
- (import ./nixDevEnv/overlays/dmdVersion.nix)
]; }
}:
- pkgs.mkShell {
- buildInputs = with pkgs; [
- dub
- ninja
- #meson
- dmd
- ldc
- sqlite
- validatePkgConfig
+let
+ dub2nix-src = fetchTarball {
+ url = "https://github.com/lionello/dub2nix/archive/master.tar.gz";
+ };
+ dub2nix = (import dub2nix-src) { inherit pkgs; };
+in pkgs.mkShell {
+ buildInputs = with pkgs; [
+ nix
+ dub
+ ldc
+ rdmd
+ sqlite
+ dub2nix
+ nix-prefetch-git
];
}
#+END_SRC
-*** ldc shell
+*** dmd shell
-#+BEGIN_SRC nix :tangle ../nixDevEnv/shells/ldc.nix
-{ pkgs ? import <nixpkgs> { overlays = [ (import ../overlays/ldcVersion.nix) ]; } }:
- pkgs.mkShell {
- buildInputs = with pkgs; [
- dub
- ninja
- ldc
- sqlite
- validatePkgConfig
+#+BEGIN_SRC nix :tangle ../nixDevEnv/shells/dmd.nix
+<<nix_shell_with_compiler_dmd>>
+#+END_SRC
+
+#+NAME: nix_shell_with_compiler_dmd
+#+BEGIN_SRC nix
+{ pkgs ? import <nixpkgs> { overlays = []; } }:
+let
+ dub2nix-src = fetchTarball {
+ url = "https://github.com/lionello/dub2nix/archive/master.tar.gz";
+ };
+ dub2nix = (import dub2nix-src) { inherit pkgs; };
+in pkgs.mkShell {
+ buildInputs = with pkgs; [
+ nix
+ dub
+ dmd
+ rdmd
+ sqlite
+ dub2nix
+ nix-prefetch-git
];
}
#+END_SRC
-*** dmd shell
+*** dmd & ldc
-#+BEGIN_SRC nix :tangle ../nixDevEnv/shells/dmd.nix
-{ pkgs ? import <nixpkgs> { overlays = [ (import ../overlays/dmdVersion.nix) ]; } }:
- pkgs.mkShell {
- buildInputs = with pkgs; [
- dub
- ninja
- dmd
- sqlite
- validatePkgConfig
+#+NAME: nix_shell_with_compilers_dmd_and_ldc
+#+BEGIN_SRC nix
+{ pkgs ? import <nixpkgs> {
+ overlays = [
+ (import ./nixDevEnv/overlays/ldcVersion.nix)
+ ]; }
+}:
+let
+ dub2nix-src = fetchTarball {
+ url = "https://github.com/lionello/dub2nix/archive/master.tar.gz";
+ };
+ dub2nix = (import dub2nix-src) { inherit pkgs; };
+in pkgs.mkShell {
+ buildInputs = with pkgs; [
+ nix
+ dub
+ dmd
+ ldc
+ rdmd
+ sqlite
+ dub2nix
+ nix-prefetch-git
];
}
#+END_SRC
-**** OLD nix-shell shell.nix
+*** dub2nix version
-#+BEGIN_SRC nix :NO-tangle ../shell.nix
-{ pkgs ? import <nixpkgs> {} }:
+#+BEGIN_SRC nix
+ dub2nix-src = fetchTarball {
+ url = "https://github.com/lionello/dub2nix/archive/8e7c65f1fd8c1ef5b32e2bf63ba80fe4f059ec15.tar.gz";
+ sha256 = "0imlbpv40h303h4mq4vijc9psl401n4sdxn3yp6k4gp2n0853xpm";
+ };
+#+END_SRC
-with pkgs;
+** default.nix
-mkShell {
- buildInputs = with pkgs; [
- ninja dub
- meson git
- ldc #ldc dmd gdc
- sqlite
- validatePkgConfig
- #gnumake gcc gdc cmake
- #clang
- #dzen2
- ];
- shellHook = ''
- echo `ldc2 --version`
- '';
- COMPILER = "ldc2";
+#+BEGIN_SRC txt :tangle ../default.nix
+<<nix_project>>
+#+END_SRC
+
+#+BEGIN_SRC txt :tangle ../project.nix
+<<nix_project>>
+#+END_SRC
+
+#+NAME: nix_project
+#+BEGIN_SRC nix
+{ pkgs ? import <nixpkgs> {}, }:
+with import ./mkDub.nix { inherit pkgs; };
+mkDubDerivation {
+ version = "0.11.1"; # optional
+ src = ./.;
+ buildInputs = [ pkgs.sqlite ];
+}
+#+END_SRC
+
+** mkDub.nix TODO
+
+Get current mkDub.nix from the dub2nix project:
+
+#+BEGIN_SRC sh
+aria2c https://raw.githubusercontent.com/lionello/dub2nix/master/mkDub.nix
+#+END_SRC
+
+#+BEGIN_SRC nix :tangle ../mkDub.nix
+{ pkgs ? import <nixpkgs> {},
+ stdenv ? pkgs.stdenv,
+ rdmd ? pkgs.rdmd,
+ #dmd ? pkgs.dmd,
+ #gcc ? pkgs.gcc,
+ ldc ? pkgs.ldc,
+ dub ? pkgs.dub
+}:
+
+with stdenv;
+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 = [ rdmd ldc dub ];
+ src = dep2src dubDep;
+
+ buildPhase = ''
+ runHook preBuild
+ 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: [ ldc rdmd 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 + "/dub.selections.nix",
+ deps ? import selections,
+ passthru ? {},
+ package ? lib.importJSON dubJSON,
+ ...
+ } @ attrs: stdenv.mkDerivation (attrs // {
+
+ pname = package.name;
+
+ nativeBuildInputs = [ rdmd ldc dub pkgs.removeReferencesTo ] ++ nativeBuildInputs;
+ disallowedReferences = disallowedReferences deps;
+
+ passthru = passthru // {
+ inherit dub ldc rdmd 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}
+ dub build --compiler=ldc2 --build=release --combined --skip-registry=all
+ #dub build -b optimize -b inline --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
** overlays
-*** ldcVersion.nix overlay
+*** compilers (latest versions) [version information set elsewhere]
+**** ldcVersion.nix overlay
#+BEGIN_SRC nix :tangle ../nixDevEnv/overlays/ldcVersion.nix
self: super: rec {
@@ -1669,9 +1993,11 @@ self: super: rec {
}
#+END_SRC
-*** dmdVersion.nix overlay
+**** dmdVersion.nix overlay
+
+no working overlay
-#+BEGIN_SRC nix :tangle ../nixDevEnv/overlays/dmdVersion.nix
+#+BEGIN_SRC nix :NO-tangle ../nixDevEnv/overlays/dmdVersion.nix
self: super: rec {
<<dmd_version_info>>
dmd = super.dmd.overrideAttrs(oldAttrs: rec {
@@ -1692,7 +2018,8 @@ self: super: rec {
** version info TODO
https://dlang.org/download.html
-*** ldc TODO
+*** compilers (set latest versions) TODO
+**** ldc
https://github.com/ldc-developers/ldc/releases
#+NAME: ldc_version_info
@@ -1701,7 +2028,7 @@ version = "1.23.0";
sha256 = "1fdgj222x29as466vdxy9c0m82zzlsb7vnvvh89n2riszcrx463d";
#+END_SRC
-*** dmd TODO
+**** dmd
https://dlang.org/changelog/index.html
https://dlang.org/changelog/pending.html
http://downloads.dlang.org/releases/
@@ -1791,7 +2118,7 @@ tmp/**
#.reggae/**
#+END_SRC
-* sh script to batch process _emacs org babel tangle_ :shell_script:tangle:
+* sh script to batch process _emacs org babel tangle_ :shell_script:tangle:
[[http://orgmode.org/manual/Batch-execution.html]]
creates a shell batch script called "tangle", that will tangle (emacs org
babel tangle) org files in ./org/ to create .d source files in ./src/doc_reform/