ci: fix the vinix-build job

pull/10970/head^2
Delyan Angelov 2021-07-26 08:49:03 +03:00
parent b44f81528f
commit b666482d84
No known key found for this signature in database
GPG Key ID: 66886C0F12D595ED
3 changed files with 61 additions and 3 deletions

View File

@ -0,0 +1,56 @@
#!/bin/bash
set -e
V=$PWD/v
if [[ -x "$V" ]]
then
echo "The v executable exists."
else
echo "This script should be run from the top level folder of a V repository"
echo "i.e. the folder where your V executable is."
exit 1
fi
BUILD=$PWD/vinix_build
echo "Creating $BUILD folder..."
rm -rf $BUILD
mkdir -p $BUILD
cd $BUILD
echo "Clone current Vinix"
git clone https://github.com/vlang/vinix.git --depth=1
cd $BUILD
echo "Clone current mlibc"
git clone https://github.com/managarm/mlibc.git --depth=1
cd $BUILD
echo "Patch mlibc for Vinix"
cd mlibc
patch -p3 < ../vinix/patches/mlibc/mlibc.patch
cd $BUILD
echo "Install mlibc headers"
mkdir mlibc-build
cd mlibc-build
meson --cross-file ../vinix/cross_file.txt --prefix=/ -Dheaders_only=true ../mlibc
ninja
mkdir ../mlibc-headers
DESTDIR=`realpath ../mlibc-headers` ninja install
cd $BUILD
echo "Attempt to build the Vinix kernel (debug)"
cd vinix/kernel
make PROD=false CFLAGS="-D__vinix__ -O2 -g -pipe -I../../mlibc-headers/include"
make clean
cd $BUILD
echo "Attempt to build the Vinix kernel (prod)"
cd vinix/kernel
make PROD=true CFLAGS="-D__vinix__ -O2 -g -pipe -I../../mlibc-headers/include"
make clean
rm -rf $BUILD

View File

@ -7,7 +7,7 @@ on:
- master - master
jobs: jobs:
build: vinix-build:
runs-on: ubuntu-20.04 runs-on: ubuntu-20.04
steps: steps:
- uses: actions/checkout@v2 - uses: actions/checkout@v2
@ -24,6 +24,6 @@ jobs:
- name: Install mlibc headers - name: Install mlibc headers
run: mkdir mlibc-build && cd mlibc-build && meson --cross-file ../vinix/cross_file.txt --prefix=/ -Dheaders_only=true ../mlibc && ninja && mkdir ../mlibc-headers && DESTDIR=`realpath ../mlibc-headers` ninja install run: mkdir mlibc-build && cd mlibc-build && meson --cross-file ../vinix/cross_file.txt --prefix=/ -Dheaders_only=true ../mlibc && ninja && mkdir ../mlibc-headers && DESTDIR=`realpath ../mlibc-headers` ninja install
- name: Attempt to build the Vinix kernel (debug) - name: Attempt to build the Vinix kernel (debug)
run: cd vinix/kernel && make PROD=false CFLAGS="-O2 -g -pipe -I../mlibc-headers/include" V="../../v" && make clean run: cd vinix/kernel && make PROD=false CFLAGS="-D__vinix__ -O2 -g -pipe -I../../mlibc-headers/include" V="../../v" && make clean
- name: Attempt to build the Vinix kernel (prod) - name: Attempt to build the Vinix kernel (prod)
run: cd vinix/kernel && make PROD=true CFLAGS="-O2 -g -pipe -I../mlibc-headers/include" V="../../v" && make clean run: cd vinix/kernel && make PROD=true CFLAGS="-D__vinix__ -O2 -g -pipe -I../../mlibc-headers/include" V="../../v" && make clean

View File

@ -620,11 +620,13 @@ static inline uint64_t wyhash64(uint64_t A, uint64_t B){ A^=0xa0761d6478bd642ful
// the wyrand PRNG that pass BigCrush and PractRand // the wyrand PRNG that pass BigCrush and PractRand
static inline uint64_t wyrand(uint64_t *seed){ *seed+=0xa0761d6478bd642full; return _wymix(*seed,*seed^0xe7037ed1a0b428dbull);} static inline uint64_t wyrand(uint64_t *seed){ *seed+=0xa0761d6478bd642full; return _wymix(*seed,*seed^0xe7037ed1a0b428dbull);}
#ifndef __vinix__
// convert any 64 bit pseudo random numbers to uniform distribution [0,1). It can be combined with wyrand, wyhash64 or wyhash. // convert any 64 bit pseudo random numbers to uniform distribution [0,1). It can be combined with wyrand, wyhash64 or wyhash.
static inline double wy2u01(uint64_t r){ const double _wynorm=1.0/(1ull<<52); return (r>>12)*_wynorm;} static inline double wy2u01(uint64_t r){ const double _wynorm=1.0/(1ull<<52); return (r>>12)*_wynorm;}
// convert any 64 bit pseudo random numbers to APPROXIMATE Gaussian distribution. It can be combined with wyrand, wyhash64 or wyhash. // convert any 64 bit pseudo random numbers to APPROXIMATE Gaussian distribution. It can be combined with wyrand, wyhash64 or wyhash.
static inline double wy2gau(uint64_t r){ const double _wynorm=1.0/(1ull<<20); return ((r&0x1fffff)+((r>>21)&0x1fffff)+((r>>42)&0x1fffff))*_wynorm-3.0;} static inline double wy2gau(uint64_t r){ const double _wynorm=1.0/(1ull<<20); return ((r&0x1fffff)+((r>>21)&0x1fffff)+((r>>42)&0x1fffff))*_wynorm-3.0;}
#endif
#if(!WYHASH_32BIT_MUM) #if(!WYHASH_32BIT_MUM)
// fast range integer random number generation on [0,k) credit to Daniel Lemire. May not work when WYHASH_32BIT_MUM=1. It can be combined with wyrand, wyhash64 or wyhash. // fast range integer random number generation on [0,k) credit to Daniel Lemire. May not work when WYHASH_32BIT_MUM=1. It can be combined with wyrand, wyhash64 or wyhash.