forked from vieter-v/vieter
Compare commits
No commits in common. "78e343fae23c7300ce56596218830bbf21588c38" and "bca53f6ea4c815fd73e0d63c0548b15aee491a76" have entirely different histories.
78e343fae2
...
bca53f6ea4
|
|
@ -2,4 +2,3 @@
|
||||||
|
|
||||||
!src/
|
!src/
|
||||||
!Makefile
|
!Makefile
|
||||||
!patches/
|
|
||||||
|
|
|
||||||
|
|
@ -15,6 +15,3 @@ vieter.log
|
||||||
# External lib; gets added by Makefile
|
# External lib; gets added by Makefile
|
||||||
libarchive-*
|
libarchive-*
|
||||||
test/
|
test/
|
||||||
|
|
||||||
# V compiler directory
|
|
||||||
v-*/
|
|
||||||
|
|
|
||||||
|
|
@ -12,7 +12,4 @@ pipeline:
|
||||||
platforms: [ linux/arm/v7, linux/arm64/v8, linux/amd64 ]
|
platforms: [ linux/arm/v7, linux/arm64/v8, linux/amd64 ]
|
||||||
when:
|
when:
|
||||||
event: push
|
event: push
|
||||||
path:
|
path: Dockerfile.builder
|
||||||
- Dockerfile.builder
|
|
||||||
- patches/*
|
|
||||||
- Makefile
|
|
||||||
|
|
|
||||||
|
|
@ -1,4 +1,4 @@
|
||||||
FROM alpine:3.15
|
FROM alpine:3.12
|
||||||
|
|
||||||
ARG TARGETPLATFORM
|
ARG TARGETPLATFORM
|
||||||
|
|
||||||
|
|
@ -8,7 +8,8 @@ ENV VVV /opt/vlang
|
||||||
ENV PATH /opt/vlang:/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin
|
ENV PATH /opt/vlang:/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin
|
||||||
ENV VFLAGS -cc gcc
|
ENV VFLAGS -cc gcc
|
||||||
|
|
||||||
RUN ln -s /opt/vlang/v /usr/bin/v && \
|
RUN mkdir -p /opt/vlang && \
|
||||||
|
ln -s /opt/vlang/v /usr/bin/v && \
|
||||||
apk --no-cache add \
|
apk --no-cache add \
|
||||||
git make gcc curl openssl \
|
git make gcc curl openssl \
|
||||||
musl-dev \
|
musl-dev \
|
||||||
|
|
@ -19,16 +20,20 @@ RUN ln -s /opt/vlang/v /usr/bin/v && \
|
||||||
libarchive-static libarchive-dev \
|
libarchive-static libarchive-dev \
|
||||||
diffutils
|
diffutils
|
||||||
|
|
||||||
COPY patches ./patches
|
|
||||||
COPY Makefile ./
|
|
||||||
|
|
||||||
RUN make v && \
|
|
||||||
mv v-*/* /opt/vlang && \
|
|
||||||
v -version
|
|
||||||
|
|
||||||
RUN if [ "$TARGETPLATFORM" = 'linux/amd64' ]; then \
|
RUN if [ "$TARGETPLATFORM" = 'linux/amd64' ]; then \
|
||||||
wget -O /usr/local/bin/mc https://dl.min.io/client/mc/release/linux-amd64/mc && \
|
wget -O /usr/local/bin/mc https://dl.min.io/client/mc/release/linux-amd64/mc && \
|
||||||
chmod +x /usr/local/bin/mc ; \
|
chmod +x /usr/local/bin/mc ; \
|
||||||
fi
|
fi
|
||||||
|
|
||||||
|
|
||||||
|
COPY . /vlang-local
|
||||||
|
|
||||||
|
RUN git clone \
|
||||||
|
'https://github.com/ChewingBever/v/' \
|
||||||
|
-b vweb-streaming \
|
||||||
|
--single-branch \
|
||||||
|
'/opt/vlang' && \
|
||||||
|
rm -rf '/vlang-local' && \
|
||||||
|
make && v -version
|
||||||
|
|
||||||
CMD ["v"]
|
CMD ["v"]
|
||||||
|
|
|
||||||
31
Makefile
31
Makefile
|
|
@ -6,11 +6,9 @@ LARCHIVE_VER := 3.5.2
|
||||||
LARCHIVE_DIR := libarchive-$(LARCHIVE_VER)
|
LARCHIVE_DIR := libarchive-$(LARCHIVE_VER)
|
||||||
LARCHIVE_LIB := $(LARCHIVE_DIR)/libarchive/libarchive.so
|
LARCHIVE_LIB := $(LARCHIVE_DIR)/libarchive/libarchive.so
|
||||||
|
|
||||||
V_RELEASE := weekly.2022.04
|
|
||||||
|
|
||||||
# Custom V command for linking libarchive
|
# Custom V command for linking libarchive
|
||||||
# V := LDFLAGS=$(PWD)/$(LARCHIVE_LIB) v -cflags '-I$(PWD)/$(LARCHIVE_DIR) -I $(PWD)/$(LARCHIVE_DIR)'
|
# V := LDFLAGS=$(PWD)/$(LARCHIVE_LIB) v -cflags '-I$(PWD)/$(LARCHIVE_DIR) -I $(PWD)/$(LARCHIVE_DIR)'
|
||||||
V := v-$(V_RELEASE)/v -showcc
|
V := v -showcc
|
||||||
|
|
||||||
all: vieter
|
all: vieter
|
||||||
|
|
||||||
|
|
@ -66,13 +64,24 @@ fmt:
|
||||||
vet:
|
vet:
|
||||||
$(V) vet -W $(SRC_DIR)
|
$(V) vet -W $(SRC_DIR)
|
||||||
|
|
||||||
# Build & patch the V compiler
|
# Pulls & builds my personal build of the v compiler, required for this project to function
|
||||||
.PHONY: v
|
.PHONY: customv
|
||||||
v: v-$(V_RELEASE)/v
|
customv:
|
||||||
v-$(V_RELEASE)/v:
|
rm -rf v-jjr
|
||||||
curl -Lo - 'https://github.com/vlang/v/archive/refs/tags/$(V_RELEASE).tar.gz' | tar xzf -
|
git clone \
|
||||||
cd patches && ./patch.sh '../v-$(V_RELEASE)'
|
-b vweb-streaming \
|
||||||
'$(MAKE)' -C 'v-$(V_RELEASE)'
|
--single-branch \
|
||||||
|
https://github.com/ChewingBever/v jjr-v
|
||||||
|
'$(MAKE)' -C jjr-v
|
||||||
|
|
||||||
|
|
||||||
|
# =====LIBARCHIVE=====
|
||||||
|
.PHONY: libarchive
|
||||||
|
libarchive: $(LARCHIVE_LIB)
|
||||||
|
$(LARCHIVE_LIB):
|
||||||
|
curl -o - "https://libarchive.org/downloads/libarchive-${LARCHIVE_VER}.tar.gz" | tar xzf -
|
||||||
|
cd "libarchive-${LARCHIVE_VER}" && cmake .
|
||||||
|
'$(MAKE)' -C "libarchive-${LARCHIVE_VER}"
|
||||||
|
|
||||||
clean:
|
clean:
|
||||||
rm -rf '$(LARCHIVE_DIR)' 'data' 'vieter' 'dvieter' 'pvieter' 'vieter.c' 'v-$(V_RELEASE)'
|
rm -rf '$(LARCHIVE_DIR)' 'data' 'vieter' 'dvieter' 'pvieter' 'vieter.c'
|
||||||
|
|
|
||||||
|
|
@ -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,7 +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
|
|
||||||
|
|
@ -143,17 +143,16 @@ pub fn read_pkg(pkg_path string) ?Pkg {
|
||||||
|
|
||||||
// TODO can this unsafe block be avoided?
|
// TODO can this unsafe block be avoided?
|
||||||
buf = unsafe { malloc(size) }
|
buf = unsafe { malloc(size) }
|
||||||
defer {
|
|
||||||
unsafe {
|
|
||||||
free(buf)
|
|
||||||
}
|
|
||||||
}
|
|
||||||
C.archive_read_data(a, buf, size)
|
C.archive_read_data(a, buf, size)
|
||||||
|
|
||||||
unsafe {
|
unsafe {
|
||||||
println(cstring_to_vstring(buf))
|
println(cstring_to_vstring(buf))
|
||||||
}
|
}
|
||||||
pkg_info = parse_pkg_info_string(unsafe { cstring_to_vstring(buf) }) ?
|
pkg_info = parse_pkg_info_string(unsafe { cstring_to_vstring(buf) }) ?
|
||||||
|
|
||||||
|
unsafe {
|
||||||
|
free(buf)
|
||||||
|
}
|
||||||
} else {
|
} else {
|
||||||
C.archive_read_data_skip(a)
|
C.archive_read_data_skip(a)
|
||||||
}
|
}
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue