Browse Source

Something that build with waf and nix.

main
Ben Niemann 3 months ago
parent
commit
7e5718d9b5
  1. 2
      .gitignore
  2. 24
      default.nix
  3. 45
      noisicaa.nix
  4. 27
      shell.nix
  5. 7
      src/core/hello.cpp
  6. 24
      src/core/wscript
  7. 23
      src/wscript
  8. 173
      waf
  9. 34
      wscript

2
.gitignore

@ -3,3 +3,5 @@
.nobackup
/.waf*
/.lock-waf*
/build/
/result

24
default.nix

@ -0,0 +1,24 @@
# @begin:license
#
# Copyright (c) 2015-2021, Ben Niemann <pink@odahoda.de>
#
# This program is free software; you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
# the Free Software Foundation; either version 2 of the License, or
# (at your option) any later version.
#
# This program is distributed in the hope that it will be useful,
# but WITHOUT ANY WARRANTY; without even the implied warranty of
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
# GNU General Public License for more details.
#
# You should have received a copy of the GNU General Public License along
# with this program; if not, write to the Free Software Foundation, Inc.,
# 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
#
# @end:license
let
nixpkgs = import <nixpkgs> {};
noisicaa = nixpkgs.callPackage ./noisicaa.nix {};
in noisicaa

45
noisicaa.nix

@ -0,0 +1,45 @@
# @begin:license
#
# Copyright (c) 2015-2021, Ben Niemann <pink@odahoda.de>
#
# This program is free software; you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
# the Free Software Foundation; either version 2 of the License, or
# (at your option) any later version.
#
# This program is distributed in the hope that it will be useful,
# but WITHOUT ANY WARRANTY; without even the implied warranty of
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
# GNU General Public License for more details.
#
# You should have received a copy of the GNU General Public License along
# with this program; if not, write to the Free Software Foundation, Inc.,
# 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
#
# @end:license
{ lib
, stdenv
, fetchFromGitHub
, python3
, wafHook
}:
let
gitignoreSrc = fetchFromGitHub {
owner = "hercules-ci";
repo = "gitignore.nix";
rev = "9e80c4d83026fa6548bc53b1a6fab8549a6991f6"; # 2021-10-16
sha256 = "sha256:04n9chlpbifgc5pa3zx6ff3rji9am6msrbn1z3x1iinjz2xjfp4p";
};
inherit (import gitignoreSrc { inherit lib; }) gitignoreSource;
in stdenv.mkDerivation {
pname = "noisicaa";
version = "0.1";
src = gitignoreSource ./.;
nativeBuildInputs = [
python3
wafHook
];
}

27
shell.nix

@ -0,0 +1,27 @@
# @begin:license
#
# Copyright (c) 2015-2021, Ben Niemann <pink@odahoda.de>
#
# This program is free software; you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
# the Free Software Foundation; either version 2 of the License, or
# (at your option) any later version.
#
# This program is distributed in the hope that it will be useful,
# but WITHOUT ANY WARRANTY; without even the implied warranty of
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
# GNU General Public License for more details.
#
# You should have received a copy of the GNU General Public License along
# with this program; if not, write to the Free Software Foundation, Inc.,
# 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
#
# @end:license
let
nixpkgs = import <nixpkgs> {};
noisicaa = import ./default.nix;
in nixpkgs.mkShell {
inputsFrom = [ noisicaa ];
}

7
src/core/hello.cpp

@ -0,0 +1,7 @@
#include <iostream>
int main() {
std::cout << "hello world\n";
return 0;
}

24
src/core/wscript

@ -0,0 +1,24 @@
# @begin:license
#
# Copyright (c) 2015-2021, Ben Niemann <pink@odahoda.de>
#
# This program is free software; you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
# the Free Software Foundation; either version 2 of the License, or
# (at your option) any later version.
#
# This program is distributed in the hope that it will be useful,
# but WITHOUT ANY WARRANTY; without even the implied warranty of
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
# GNU General Public License for more details.
#
# You should have received a copy of the GNU General Public License along
# with this program; if not, write to the Free Software Foundation, Inc.,
# 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
#
# @end:license
def build(ctx):
ctx.program(source='hello.cpp', target='hello')

23
src/wscript

@ -0,0 +1,23 @@
# @begin:license
#
# Copyright (c) 2015-2021, Ben Niemann <pink@odahoda.de>
#
# This program is free software; you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
# the Free Software Foundation; either version 2 of the License, or
# (at your option) any later version.
#
# This program is distributed in the hope that it will be useful,
# but WITHOUT ANY WARRANTY; without even the implied warranty of
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
# GNU General Public License for more details.
#
# You should have received a copy of the GNU General Public License along
# with this program; if not, write to the Free Software Foundation, Inc.,
# 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
#
# @end:license
def build(ctx):
ctx.recurse('core')

173
waf

File diff suppressed because one or more lines are too long

34
wscript

@ -0,0 +1,34 @@
# @begin:license
#
# Copyright (c) 2015-2021, Ben Niemann <pink@odahoda.de>
#
# This program is free software; you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
# the Free Software Foundation; either version 2 of the License, or
# (at your option) any later version.
#
# This program is distributed in the hope that it will be useful,
# but WITHOUT ANY WARRANTY; without even the implied warranty of
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
# GNU General Public License for more details.
#
# You should have received a copy of the GNU General Public License along
# with this program; if not, write to the Free Software Foundation, Inc.,
# 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
#
# @end:license
top = '.'
out = 'build'
def options(ctx):
ctx.load('compiler_cxx')
def configure(ctx):
ctx.load('compiler_cxx')
ctx.check(header_name='stdio.h', features='cxx cxxprogram', mandatory=False)
def build(ctx):
ctx(rule='touch ${TGT}', target='.nobackup')
ctx.recurse('src')
Loading…
Cancel
Save