forked from vieter-v/vieter
Merge pull request 'Better V Integration' (#81) from better-v-integration into dev
Reviewed-on: Chewing_Bever/vieter#81cron
commit
96c0ac3d59
|
@ -17,4 +17,4 @@ libarchive-*
|
||||||
test/
|
test/
|
||||||
|
|
||||||
# V compiler directory
|
# V compiler directory
|
||||||
v-*/
|
v/
|
||||||
|
|
|
@ -6,8 +6,6 @@ matrix:
|
||||||
|
|
||||||
# These checks already get performed on the feature branches
|
# These checks already get performed on the feature branches
|
||||||
platform: ${PLATFORM}
|
platform: ${PLATFORM}
|
||||||
depends_on:
|
|
||||||
- builder
|
|
||||||
|
|
||||||
pipeline:
|
pipeline:
|
||||||
# The default build isn't needed, as alpine switches to gcc for the compiler anyways
|
# The default build isn't needed, as alpine switches to gcc for the compiler anyways
|
||||||
|
|
|
@ -1,18 +0,0 @@
|
||||||
branches: dev
|
|
||||||
platform: linux/amd64
|
|
||||||
|
|
||||||
pipeline:
|
|
||||||
publish:
|
|
||||||
image: woodpeckerci/plugin-docker-buildx
|
|
||||||
secrets: [ docker_username, docker_password ]
|
|
||||||
settings:
|
|
||||||
repo: chewingbever/vlang
|
|
||||||
tag: latest
|
|
||||||
dockerfile: Dockerfile.builder
|
|
||||||
platforms: [ linux/arm/v7, linux/arm64/v8, linux/amd64 ]
|
|
||||||
when:
|
|
||||||
event: push
|
|
||||||
path:
|
|
||||||
- Makefile
|
|
||||||
- Dockerfile.builder
|
|
||||||
- patches/*
|
|
|
@ -1,7 +1,6 @@
|
||||||
branches: [main, dev]
|
branches: [main, dev]
|
||||||
platform: linux/amd64
|
platform: linux/amd64
|
||||||
depends_on:
|
depends_on:
|
||||||
- builder
|
|
||||||
- build
|
- build
|
||||||
|
|
||||||
pipeline:
|
pipeline:
|
||||||
|
|
|
@ -1,36 +0,0 @@
|
||||||
FROM alpine:3.12
|
|
||||||
|
|
||||||
ARG TARGETPLATFORM
|
|
||||||
|
|
||||||
WORKDIR /opt/vlang
|
|
||||||
|
|
||||||
ENV VVV /opt/vlang
|
|
||||||
ENV PATH /opt/vlang:/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin
|
|
||||||
ENV VFLAGS -cc gcc
|
|
||||||
ENV V_PATH /opt/vlang/v
|
|
||||||
|
|
||||||
RUN ln -s /opt/vlang/v /usr/bin/v && \
|
|
||||||
apk --no-cache add \
|
|
||||||
git make gcc curl openssl \
|
|
||||||
musl-dev \
|
|
||||||
openssl-libs-static openssl-dev \
|
|
||||||
zlib-static bzip2-static xz-dev expat-static zstd-static lz4-static \
|
|
||||||
sqlite-static sqlite-dev \
|
|
||||||
libx11-dev glfw-dev freetype-dev \
|
|
||||||
libarchive-static libarchive-dev \
|
|
||||||
gc-dev \
|
|
||||||
diffutils
|
|
||||||
|
|
||||||
COPY patches ./patches
|
|
||||||
COPY Makefile ./
|
|
||||||
|
|
||||||
RUN make v && \
|
|
||||||
mv v-*/* /opt/vlang && \
|
|
||||||
v -version
|
|
||||||
|
|
||||||
RUN if [ "$TARGETPLATFORM" = 'linux/amd64' ]; then \
|
|
||||||
wget -O /usr/local/bin/mc https://dl.min.io/client/mc/release/linux-amd64/mc && \
|
|
||||||
chmod +x /usr/local/bin/mc ; \
|
|
||||||
fi
|
|
||||||
|
|
||||||
CMD ["v"]
|
|
15
Makefile
15
Makefile
|
@ -2,8 +2,7 @@
|
||||||
SRC_DIR := src
|
SRC_DIR := src
|
||||||
SOURCES != find '$(SRC_DIR)' -iname '*.v'
|
SOURCES != find '$(SRC_DIR)' -iname '*.v'
|
||||||
|
|
||||||
V_RELEASE := weekly.2022.07
|
V_PATH ?= v/v
|
||||||
V_PATH ?= v-$(V_RELEASE)/v
|
|
||||||
V := $(V_PATH) -showcc -gc boehm
|
V := $(V_PATH) -showcc -gc boehm
|
||||||
|
|
||||||
all: vieter
|
all: vieter
|
||||||
|
@ -46,7 +45,6 @@ run-prod: prod
|
||||||
watch:
|
watch:
|
||||||
API_KEY=test DOWNLOAD_DIR=data/downloads REPO_DIR=data/repo PKG_DIR=data/pkgs LOG_LEVEL=DEBUG $(V) watch run vieter
|
API_KEY=test DOWNLOAD_DIR=data/downloads REPO_DIR=data/repo PKG_DIR=data/pkgs LOG_LEVEL=DEBUG $(V) watch run vieter
|
||||||
|
|
||||||
|
|
||||||
# =====OTHER=====
|
# =====OTHER=====
|
||||||
.PHONY: lint
|
.PHONY: lint
|
||||||
lint:
|
lint:
|
||||||
|
@ -63,11 +61,10 @@ vet:
|
||||||
|
|
||||||
# Build & patch the V compiler
|
# Build & patch the V compiler
|
||||||
.PHONY: v
|
.PHONY: v
|
||||||
v: v-$(V_RELEASE)/v
|
v: v/v
|
||||||
v-$(V_RELEASE)/v:
|
v/v:
|
||||||
curl -Lo - 'https://github.com/vlang/v/archive/refs/tags/$(V_RELEASE).tar.gz' | tar xzf -
|
git clone --single-branch --branch patches https://git.rustybever.be/Chewing_Bever/vieter-v v
|
||||||
cd patches && sh patch.sh '../v-$(V_RELEASE)'
|
make -C v
|
||||||
make -C 'v-$(V_RELEASE)'
|
|
||||||
|
|
||||||
clean:
|
clean:
|
||||||
rm -rf 'data' 'vieter' 'dvieter' 'pvieter' 'vieter.c' 'v-$(V_RELEASE)'
|
rm -rf 'data' 'vieter' 'dvieter' 'pvieter' 'vieter.c'
|
||||||
|
|
10
README.md
10
README.md
|
@ -16,11 +16,11 @@ that.
|
||||||
### Custom Compiler
|
### Custom Compiler
|
||||||
|
|
||||||
Currently, this program only works with a very slightly modified version of the
|
Currently, this program only works with a very slightly modified version of the
|
||||||
V standard library, and therefore the compiler. The changes that are made to
|
V standard library, and therefore the compiler. The source code for this fork
|
||||||
the standard V release can be found in the [patches](/patches) directory. You
|
can be found [here](https://git.rustybever.be/Chewing_Bever/vieter-v). You can
|
||||||
can obtain this modified version of the compiler by running `make v`, which
|
obtain this modified version of the compiler by running `make v`, which will
|
||||||
will download, patch & build the compiler. Afterwards, all make commands that
|
clone & build the compiler. Afterwards, all make commands that require the V
|
||||||
require the V compiler will use this new binary.
|
compiler will use this new binary.
|
||||||
|
|
||||||
## Features
|
## Features
|
||||||
|
|
||||||
|
|
|
@ -1,23 +0,0 @@
|
||||||
// Parse the header of a raw HTTP request into a Request object
|
|
||||||
pub fn parse_request_head(mut reader io.BufferedReader) ?Request {
|
|
||||||
// request line
|
|
||||||
mut line := reader.read_line() ?
|
|
||||||
method, target, version := parse_request_line(line) ?
|
|
||||||
|
|
||||||
// headers
|
|
||||||
mut header := new_header()
|
|
||||||
line = reader.read_line() ?
|
|
||||||
for line != '' {
|
|
||||||
key, value := parse_header(line) ?
|
|
||||||
header.add_custom(key, value) ?
|
|
||||||
line = reader.read_line() ?
|
|
||||||
}
|
|
||||||
header.coerce(canonicalize: true)
|
|
||||||
|
|
||||||
return Request{
|
|
||||||
method: method
|
|
||||||
url: target.str()
|
|
||||||
header: header
|
|
||||||
version: version
|
|
||||||
}
|
|
||||||
}
|
|
|
@ -1,13 +0,0 @@
|
||||||
#!/usr/bin/env sh
|
|
||||||
# This file patches the downloaded V version
|
|
||||||
# Should be run from within the directory it's in, as it uses relative paths to the files used for patching.
|
|
||||||
# $1 is the path to the downloaded V version
|
|
||||||
|
|
||||||
# Add parse_request_no_body
|
|
||||||
cat parse_request_no_body.v >> "$1"/vlib/net/http/request.v
|
|
||||||
|
|
||||||
# weekly.2022.07 fixes the write function being private
|
|
||||||
# Make sha256 functions public
|
|
||||||
sed -i \
|
|
||||||
-e 's/\(fn (mut d Digest) checksum(\)/pub \1/' \
|
|
||||||
"$1"/vlib/crypto/sha256/sha256.v
|
|
|
@ -22,7 +22,7 @@ pub struct Result {}
|
||||||
pub const (
|
pub const (
|
||||||
methods_with_form = [http.Method.post, .put, .patch]
|
methods_with_form = [http.Method.post, .put, .patch]
|
||||||
headers_close = http.new_custom_header_from_map({
|
headers_close = http.new_custom_header_from_map({
|
||||||
'Server': 'VWeb'
|
'Server': 'VWeb'
|
||||||
http.CommonHeader.connection.str(): 'close'
|
http.CommonHeader.connection.str(): 'close'
|
||||||
}) or { panic('should never fail') }
|
}) or { panic('should never fail') }
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue