Skip to content

Commit

Permalink
vlang: Remove tmp directory patch
Browse files Browse the repository at this point in the history
  • Loading branch information
harens committed Mar 31, 2022
1 parent da2c706 commit cb50057
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 41 deletions.
26 changes: 5 additions & 21 deletions lang/vlang/Portfile
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@

PortSystem 1.0
PortGroup github 1.0
PortGroup legacysupport 1.0
PortGroup legacysupport 1.1

# clock_gettime
legacysupport.newest_darwin_requires_legacy 15
Expand All @@ -23,9 +23,6 @@ license MIT
categories lang
maintainers {harens @harens} openmaintainer

# Fix location of temporary directory
patchfiles patch-tmp-location.diff

# Install the V compiler as a separate distfile.
# Based on https://github.com/macports/macports-ports/blob/master/games/minetest/Portfile
set vc_commit de63146da0a0f93628f8a65e70267e2c8d4c7ce1
Expand All @@ -51,20 +48,13 @@ checksums ${main_distfile} \
compiler.c_standard 2011
use_configure no

post-patch {
# Build process based on https://github.com/vlang/v/blob/master/Makefile
build {
# Disable vlang self update feature.
set updating_path ${worksrcpath}/cmd/tools
copy -force ${filespath}/vup.v ${worksrcpath}/cmd/tools

# Patch tmp directory, which is required during buildtime and runtime
reinplace "s|@@WORKPATH@@|${workpath}|g" ${worksrcpath}/vlib/v/util/util.v
reinplace "s|@@PREFIX@@|${prefix}|g" ${worksrcpath}/vlib/v/util/util.v
}

# Build process based on https://github.com/vlang/v/blob/master/Makefile
# Set custom cflags since `-I/opt/local/include/LegacySupport` isn't recognised
build {
set VFLAGS "-cc ${configure.cc} -cflags -Os"
set VFLAGS "-v -prod -cc ${configure.cc} -cflags [shellescape ${configure.cflags}]"

system -W ${worksrcpath} "${configure.cc} ${configure.cflags} -I ./thirdparty/stdatomic/nix -o v1 ../vc-${vc_commit}/v.c -lm -lpthread ${configure.ldflags}"
system -W ${worksrcpath} "./v1 -no-parallel -o v2 ${VFLAGS} cmd/v"
Expand Down Expand Up @@ -95,18 +85,12 @@ destroot {
fs-traverse item ${library_path} {
file attributes ${item} -group _developer -permissions g+w
}

# Manually create a tmp directory, and set writable permissions
# See https://github.com/vlang/v/issues/7713 and https://github.com/vlang/v/discussions/11796
set tmp_dir ${prefix}/var/run/vlang
file mkdir ${tmp_dir}
file attributes ${tmp_dir} -group _developer -permissions g+w
}

# Based on various Android ports - don't make files world-writable.
# e.g. https://github.com/macports/macports-ports/blob/master/java/android/Portfile
notes "
The Vlang library and cache directories are group _developer writable. You need to be a member of the
The Vlang library directory is group _developer writable. You need to be a member of the
_developer group to use Vlang. If you are not, run:
sudo dscl . append /Groups/_developer GroupMembership <username>
Expand Down
20 changes: 0 additions & 20 deletions lang/vlang/files/patch-tmp-location.diff

This file was deleted.

0 comments on commit cb50057

Please sign in to comment.