diff --git a/.circleci/config.yml b/.circleci/config.yml index 1cb3375ba..03407babb 100644 --- a/.circleci/config.yml +++ b/.circleci/config.yml @@ -95,13 +95,14 @@ jobs: RUMP: "linux" <<: *do_steps - qemu-arm-linux: - docker: - - image: lkldocker/circleci-x86_64:0.5 - environment: - OS: "qemu-arm" - RUMP: "linux" - <<: *do_steps + # XXX: Forked version of QEMU is needed + # qemu-arm-linux: + # docker: + # - image: lkldocker/circleci-x86_64:0.5 + # environment: + # OS: "qemu-arm" + # RUMP: "linux" + # <<: *do_steps linux-netbsd: docker: diff --git a/.travis.yml b/.travis.yml index 00cf1c155..13e46b62d 100644 --- a/.travis.yml +++ b/.travis.yml @@ -1,8 +1,33 @@ -language: c +language: nix -compiler: - - gcc - - clang +matrix: + include: + - name: "GCC" + env: BUILD_TARGET=frankenlibc-gcc + - name: "Clang" + env: BUILD_TARGET=frankenlibc-clang + - name: "QEMU ARM" + env: BUILD_TARGET=frankenlibc-arm + +cache: + directories: + - $HOME/nix.store + +before_cache: + - rm -rf $HOME/nix.store + - mkdir -p $HOME/nix.store + - nix copy --to file://$HOME/nix.store -f default.nix buildInputs + +before_install: + - mkdir -p $HOME/.config/nix + - | + cat < $HOME/.config/nix/nix.conf + substituters = https://cache.nixos.org/ file://$HOME/nix.store + require-sigs = false + EOF + - | + git clone https://github.com/libos-nuse/nixpkgs-lkl.git \ + ~/.config/nixpkgs/overlays/nixpkgs-lkl script: - - ./build.sh + - nix-build -A "$BUILD_TARGET" diff --git a/default.nix b/default.nix new file mode 100644 index 000000000..1b1560151 --- /dev/null +++ b/default.nix @@ -0,0 +1,9 @@ +{ pkgs ? import {} }: + +with pkgs; + +{ + frankenlibc-gcc = callPackage ./frankenlibc.nix { }; + frankenlibc-clang = callPackage ./frankenlibc.nix { stdenv = clangStdenv; }; + frankenlibc-arm = callPackage ./frankenlibc.nix { armSupport = true; }; +} diff --git a/frankenlibc.nix b/frankenlibc.nix new file mode 100644 index 000000000..7f5d5840e --- /dev/null +++ b/frankenlibc.nix @@ -0,0 +1,29 @@ +{ stdenv, gcc-arm-embedded, binutils-arm-embedded, qemu-circle +, armSupport ? false +}: + +stdenv.mkDerivation { + name = "frankenlibc"; + + src = ../.; + + nativebuildInputs = + stdenv.lib.optionals armSupport [ + gcc-arm-embedded + binutils-arm-embedded + ]; + + buildInputs = stdenv.lib.optionals armSupport [ qemu-circle ]; + + buildFlags = if armSupport then [ "-k linux" "qemu-arm" ] else []; + + buildPhase = '' + ./build.sh ${buildFlags} + ''; + + installPhase = '' + cp -r . $out + ''; + + stdenv = if armSupport then overrideCC stdenv gcc-arm-embedded else stdenv; +}