Hi,
I'm trying to package vlang for my linux distribution (slackware) and everything works pretty well, but i have two questions:
1) under what license can I redistribute the generated c source of vlang?!?!? I need it because it's currently impossible to compile a specific version from source.
2) by installing vlang as a system application it's possible to disable in some way the command up !?!?! Or I need to use external patches?!?!
Thanks in advance
Michele
Turning off v up was discussed in #2824.
Thanks @alexesprit,
this is my build script with the following relevant parts:
# build compiler
gcc $SLKCFLAGS -o v v.c -lm
# build tools
cat > tools/vup.v << EOF
fn main(){
println('This is a packaged v installation. v up is disabled')
}
EOF
for tool in tools/vrepl.v tools/vtest.v tools/vfmt.v tools/vcreate.v tools/vup.v; do
echo "build $tool"
./v build $tool
done
# build libraries
for lib in thirdparty/cJSON/cJSON thirdparty/bignum/bn thirdparty/glad/glad thirdparty/zip/zip ; do
(
cd ${lib%/*}
echo "build $lib.c"
gcc $SLKCFLAGS -I. -c ${lib##*/}.c -o ${lib##*/}.o
)
done
# install wrapper
mkdir -p $PKG/usr/bin
cat > $PKG/usr/bin/v << EOF
#!/bin/sh
/usr/lib$LIBDIRSUFFIX/$PRGNAM-$VERSION/v \$@
EOF
chmod 0755 $PKG/usr/bin/v
# update timestamps of executables post install to avoid recompilation of some tools
cat > $PKG/install/doinst.sh << EOF
touch /usr/lib$LIBDIRSUFFIX/$PRGNAM-$VERSION/tools/vrepl
touch /usr/lib$LIBDIRSUFFIX/$PRGNAM-$VERSION/tools/vtest
touch /usr/lib$LIBDIRSUFFIX/$PRGNAM-$VERSION/tools/vcreate
touch /usr/lib$LIBDIRSUFFIX/$PRGNAM-$VERSION/tools/vfmt
touch /usr/lib$LIBDIRSUFFIX/$PRGNAM-$VERSION/tools/vup
EOF
the resulting package is
`-- usr
|-- bin
| `-- v
`-- lib64
`-- v-0.1.24
|-- thirdparty
|-- tools
|-- v
`-- vlib
that seems to work fine (for now).
Thanks
@ilmich , great work!
You may need to edit your build script a little, since tools/ was recently moved to cmd/tools/ .
Also, the command to build the cmd/tools/vfmt.v tool is slightly different than the others:
./v -d vfmt cmd/tools/vfmt.v
Soon it will be just like the others, but for now you will have to modify your script to acomodate it.
About:
under what license can I redistribute the generated c source of vlang?!?!? I need it because it's currently impossible to compile a specific version from source.
I think it is also MIT.
NB: it is possible to compile a specific version (given a commit hash) from the source:
0[19:47:39]delian@nemesis: /v/nv $ cmd/tools/oldv 7bf49ab
################# context.commit_v: 7bf49ab #####################
# v commit hash: 7bf49aba54a3372c9c3cb4b51d47f76e454b97ac
# checkout folder: /home/delian/.cache/v_at_7bf49ab
0[19:49:09]delian@nemesis: /v/nv $ /home/delian/.cache/v_at_7bf49ab/v version
V 0.1.24 7882312
0[19:50:14]delian@nemesis: /v/nv $ ./v version
V 0.1.25 5142747
0[19:50:22]delian@nemesis: /v/nv $
^ Here, cmd/tools/oldv (which you can compile with v cmd/tools/oldv.v, just like the other tools) made a new checkout from v's commit 7bf49ab, then compiled it using a vc, made by commit 7882312 (the one before 7bf49ab), just like it would have done at 2020-01-09 when the commit 7bf49ab was added. See cmd/tools/oldv --help for more details about oldv.
Note: oldv needs to have internet access by default because it clones https://github.com/vlang/v and https://github.com/vlang/vc (although you can clone them locally then tell it to use the local folders if you want).
@ilmich THank you for your script and hard work, I'm very likely going to add Vlang to https://github.com/prologic/ulinux based on your script. Thanks heaps!
Most helpful comment
Thanks @alexesprit,
this is my build script with the following relevant parts:
the resulting package is
that seems to work fine (for now).
Thanks