Compare commits

...

4 Commits

Author SHA1 Message Date
c0dev0id
1aa45e36d8 Cleanup 2026-03-23 19:45:35 +01:00
c0dev0id
980fa44c50 Support correct geometric placement, independent of the font size 2026-03-23 19:43:58 +01:00
c0dev0id
64358a4a80 mapforge: patch Gemfile to accept ruby >= 4.0.0 2026-03-23 19:43:00 +01:00
c0dev0id
a05011396f add mapforge: web-based GIS vector editor
Ruby on Rails 8.1 app backed by MongoDB and Redis. Git snapshot
from 2026-03-22 (no upstream releases yet). Requires Ruby 4.0,
libproj (rgeo-proj4 C ext), and ImageMagick (rszr C ext).
2026-03-23 19:38:22 +01:00
13 changed files with 295 additions and 1 deletions

78
geo/mapforge/Makefile Normal file
View File

@ -0,0 +1,78 @@
COMMENT = open source web-based GIS vector editor
# No upstream releases; pin to a git snapshot
GIT_COMMIT = 0c0e1387da1910a2a3b60c6d7c48d0552c701a3c
SNAP = 20260322
PKGNAME = mapforge-0.${SNAP}
DIST_TUPLE = github mapforge-org mapforge ${GIT_COMMIT} .
CATEGORIES = geo www
HOMEPAGE = https://github.com/mapforge-org/mapforge
# AGPLv3 (source), MPL-2.0 (vendor/javascript)
PERMIT_PACKAGE = Yes
MODULES = lang/ruby
MODRUBY_REV = 4.0
MODRUBY_HANDLE_FLAVORS = No
BUNDLE = ${LOCALBASE}/bin/bundle${MODRUBY_BINREV}
CONFIGURE_STYLE = none
NO_TEST = Yes
# C extensions (rgeo, rgeo-proj4, rszr) make the package arch-dependent
COMPILER = base-clang ports-gcc
COMPILER_LANGS = c
# git-sourced gems in Gemfile require git at bundle-install time
BUILD_DEPENDS += devel/git
# rgeo-proj4 C extension links against libproj
LIB_DEPENDS += devel/proj
# rszr C extension links against ImageMagick
LIB_DEPENDS += graphics/ImageMagick
WANTLIB += proj MagickCore-6.Q16 MagickWand-6.Q16
# mongod and redis servers are needed at runtime
RUN_DEPENDS += databases/mongodb/80 \
databases/redis
APP_DIR = ${PREFIX}/share/mapforge
DATA_DIR = ${LOCALSTATEDIR}/mapforge
SUBST_VARS += APP_DIR DATA_DIR MODRUBY_BINREV
# --- Gem vendor cache ---
# The gem vendor cache must be pre-generated and added as a distfile
# before this port can build offline. Steps after "make extract":
#
# cd ${WRKDIST}
# bundle _4.0.3_ config set --local without "development test"
# bundle _4.0.3_ package --all --all-platforms --no-install
# tar czf ${DISTDIR}/mapforge-gems-${SNAP}.tar.gz vendor/cache/
#
# Then add to DISTFILES and re-run "make makesum". Until the cache
# is generated, bundle install will fetch gems from rubygems.org.
do-build:
cd ${WRKSRC} && \
${BUNDLE} config set --local without "development test" && \
${BUNDLE} config set --local deployment true && \
${BUNDLE} install && \
${RUBY} ./bin/bootsnap precompile --gemfile app/ lib/
do-install:
${INSTALL_DATA_DIR} ${WRKINST}${APP_DIR}
cd ${WRKSRC} && pax -rw . ${WRKINST}${APP_DIR}/
${INSTALL_DATA_DIR} ${WRKINST}${DATA_DIR}/log
${INSTALL_DATA_DIR} ${WRKINST}${DATA_DIR}/storage
${INSTALL_DATA_DIR} ${WRKINST}${DATA_DIR}/tmp
${INSTALL_DATA_DIR} ${WRKINST}${PREFIX}/share/examples/mapforge
${INSTALL_SCRIPT} ${FILESDIR}/mapforge.rc \
${WRKINST}${PREFIX}/share/examples/mapforge/
.include <bsd.port.mk>

2
geo/mapforge/distinfo Normal file
View File

@ -0,0 +1,2 @@
SHA256 (mapforge-org-mapforge-0c0e1387da1910a2a3b60c6d7c48d0552c701a3c.tar.gz) = O8aIwFOQBQH7Q/TcjeEreD4GYqcSMreXQKTmsXphWCc=
SIZE (mapforge-org-mapforge-0c0e1387da1910a2a3b60c6d7c48d0552c701a3c.tar.gz) = 50532678

View File

@ -0,0 +1,21 @@
#!/bin/ksh
daemon="${TRUEPREFIX}/share/mapforge/bin/thrust"
daemon_user="_mapforge"
daemon_flags=""
pexp="ruby${MODRUBY_BINREV}.*puma"
. /etc/rc.d/rc.subr
rc_bg=YES
rc_reload=NO
rc_pre() {
export RAILS_ENV=production
export RAILS_LOG_TO_STDOUT=true
export BUNDLE_PATH="${TRUEPREFIX}/share/mapforge/vendor/bundle"
cd "${TRUEPREFIX}/share/mapforge" || exit 1
}
rc_cmd $1

View File

@ -0,0 +1,10 @@
Index: Gemfile
--- Gemfile.orig
+++ Gemfile
@@ -1,5 +1,5 @@
source "https://rubygems.org"
-ruby "4.0.0"
+ruby ">= 4.0.0"
gem "rails"

9
geo/mapforge/pkg/DESCR Normal file
View File

@ -0,0 +1,9 @@
Mapforge is a self-hosted web-based GIS application for creating and sharing
geospatial data collaboratively. Users can draw shapes, import GeoJSON/GPX/KML
files, query OpenStreetMap via the Overpass API, and edit maps together in
real time using WebSockets.
The frontend uses MapLibre GL JS with Stimulus/Hotwire. The backend is a Ruby
on Rails application using MongoDB for storage and Redis for caching and
real-time synchronisation. Optionally supports GitHub, Google, and
OpenStreetMap OAuth2 login.

6
geo/mapforge/pkg/PLIST Normal file
View File

@ -0,0 +1,6 @@
@comment TODO: run "make update-plist" after a successful build to generate this file
@dir ${APP_DIR}
@dir ${DATA_DIR}/log
@dir ${DATA_DIR}/storage
@dir ${DATA_DIR}/tmp
share/examples/mapforge/mapforge.rc

View File

@ -3,7 +3,7 @@ COMMENT= simple X terminal (personalized)
V= 0.9.2 V= 0.9.2
DISTNAME= st-${V} DISTNAME= st-${V}
PKGNAME= st-sdk-${V} PKGNAME= st-sdk-${V}
REVISION= 34 REVISION= 36
DIST_SUBDIR= st DIST_SUBDIR= st
SUPDISTFILES.p= scrollback/st-scrollback-0.9.2.diff \ SUPDISTFILES.p= scrollback/st-scrollback-0.9.2.diff \

View File

@ -372,6 +372,7 @@ static Key key[] = {
{ XK_Right, XK_ANY_MOD, "\033OC", 0, +1}, { XK_Right, XK_ANY_MOD, "\033OC", 0, +1},
{ XK_ISO_Left_Tab, ShiftMask, "\033[Z", 0, 0}, { XK_ISO_Left_Tab, ShiftMask, "\033[Z", 0, 0},
{ XK_Return, Mod1Mask, "\033\r", 0, 0}, { XK_Return, Mod1Mask, "\033\r", 0, 0},
{ XK_Return, ShiftMask, "\033[13;2u", 0, 0},
{ XK_Return, XK_ANY_MOD, "\r", 0, 0}, { XK_Return, XK_ANY_MOD, "\r", 0, 0},
{ XK_Insert, ShiftMask, "\033[4l", -1, 0}, { XK_Insert, ShiftMask, "\033[4l", -1, 0},
{ XK_Insert, ShiftMask, "\033[2;2~", +1, 0}, { XK_Insert, ShiftMask, "\033[2;2~", +1, 0},

View File

@ -0,0 +1,69 @@
--- x.c.orig Fri Mar 13 08:07:14 2026
+++ x.c Fri Mar 13 08:10:58 2026
@@ -251,6 +251,7 @@
static char *opt_line = NULL;
static char *opt_name = NULL;
static char *opt_title = NULL;
+static int opt_pixelgeom = 0;
static uint buttons; /* bit field of pressed buttons */
@@ -1147,6 +1148,15 @@
usedfont = (opt_font == NULL)? font : opt_font;
xloadfonts(usedfont, 0);
+ /* -p: convert stashed pixel dimensions to cols/rows */
+ if (opt_pixelgeom && win.w > 0 && win.h > 0) {
+ cols = MAX(1, (win.w - 2 * borderpx) / win.cw);
+ rows = MAX(1, (win.h - 2 * borderpx) / win.ch);
+ tresize(cols, rows);
+ win.w = 2 * borderpx + cols * win.cw;
+ win.h = 2 * borderpx + rows * win.ch;
+ }
+
/* colors */
xw.cmap = XDefaultColormap(xw.dpy, xw.scr);
xloadcols();
@@ -2026,11 +2036,11 @@
void
usage(void)
{
- die("usage: %s [-aiv] [-c class] [-f font] [-g geometry]"
+ die("usage: %s [-aipv] [-c class] [-f font] [-g geometry]"
" [-n name] [-o file]\n"
" [-T title] [-t title] [-w windowid]"
" [[-e] command [args ...]]\n"
- " %s [-aiv] [-c class] [-f font] [-g geometry]"
+ " %s [-aipv] [-c class] [-f font] [-g geometry]"
" [-n name] [-o file]\n"
" [-T title] [-t title] [-w windowid] -l line"
" [stty_args ...]\n", argv0, argv0);
@@ -2061,6 +2071,9 @@
xw.gm = XParseGeometry(EARGF(usage()),
&xw.l, &xw.t, &cols, &rows);
break;
+ case 'p':
+ opt_pixelgeom = 1;
+ break;
case 'i':
xw.isfixed = 1;
break;
@@ -2096,6 +2109,18 @@
setlocale(LC_CTYPE, "");
XSetLocaleModifiers("");
+ if (opt_pixelgeom && cols > 0 && rows > 0) {
+ /*
+ * -p: cols/rows from -g are pixel dimensions.
+ * Stash them in win.w/win.h; use default 80x24
+ * for the initial tnew() allocation. xinit() will
+ * compute the real cols/rows after font loading.
+ */
+ win.w = cols;
+ win.h = rows;
+ cols = 80;
+ rows = 24;
+ }
cols = MAX(cols, 1);
rows = MAX(rows, 1);
tnew(cols, rows);

View File

@ -10,3 +10,11 @@ Index: config.def.h
/* 8 bright colors */ /* 8 bright colors */
"gray50", "gray50",
@@ -341,6 +341,7 @@ static Key key[] = {
{ XK_ISO_Left_Tab, ShiftMask, "\033[Z", 0, 0},
{ XK_Return, Mod1Mask, "\033\r", 0, 0},
{ XK_Return, XK_ANY_MOD, "\r", 0, 0},
+ { XK_Return, ShiftMask, "\033[13;2u", 0, 0, 0},
{ XK_Insert, ShiftMask, "\033[4l", -1, 0},
{ XK_Insert, ShiftMask, "\033[2;2~", +1, 0},
{ XK_Insert, ControlMask, "\033[L", -1, 0},

View File

@ -0,0 +1,20 @@
Index: config.def.h
--- config.def.h.orig
+++ config.def.h
@@ -106,7 +106,7 @@ static const char *colorname[] = {
"blue2",
"magenta3",
"cyan3",
- "gray90",
+ "gray",
/* 8 bright colors */
"gray50",
@@ -341,6 +341,7 @@ static Key key[] = {
{ XK_ISO_Left_Tab, ShiftMask, "\033[Z", 0, 0},
{ XK_Return, Mod1Mask, "\033\r", 0, 0},
{ XK_Return, XK_ANY_MOD, "\r", 0, 0},
+ { XK_Return, ShiftMask, "\033[13;2u", 0, 0},
{ XK_Insert, ShiftMask, "\033[4l", -1, 0},
{ XK_Insert, ShiftMask, "\033[2;2~", +1, 0},
{ XK_Insert, ControlMask, "\033[L", -1, 0},

View File

@ -0,0 +1,36 @@
Index: config.mk
--- config.mk.orig
+++ config.mk
@@ -15,10 +15,12 @@ PKG_CONFIG = pkg-config
# includes and libs
INCS = -I$(X11INC) \
`$(PKG_CONFIG) --cflags fontconfig` \
- `$(PKG_CONFIG) --cflags freetype2`
+ `$(PKG_CONFIG) --cflags freetype2` \
+ `$(PKG_CONFIG) --libs harfbuzz`
LIBS = -L$(X11LIB) -lm -lrt -lX11 -lutil -lXft -lXrender\
`$(PKG_CONFIG) --libs fontconfig` \
- `$(PKG_CONFIG) --libs freetype2`
+ `$(PKG_CONFIG) --libs freetype2` \
+ `$(PKG_CONFIG) --libs harfbuzz`
# flags
STCPPFLAGS = -DVERSION=\"$(VERSION)\" -D_XOPEN_SOURCE=600
@@ -26,11 +28,12 @@ STCFLAGS = $(INCS) $(STCPPFLAGS) $(CPPFLAGS) $(CFLAGS)
STLDFLAGS = $(LIBS) $(LDFLAGS)
# OpenBSD:
-#CPPFLAGS = -DVERSION=\"$(VERSION)\" -D_XOPEN_SOURCE=600 -D_BSD_SOURCE
-#LIBS = -L$(X11LIB) -lm -lX11 -lutil -lXft \
-# `$(PKG_CONFIG) --libs fontconfig` \
-# `$(PKG_CONFIG) --libs freetype2`
-#MANPREFIX = ${PREFIX}/man
+CPPFLAGS = -DVERSION=\"$(VERSION)\" -D_XOPEN_SOURCE=600 -D_BSD_SOURCE
+LIBS = -L$(X11LIB) -lm -lX11 -lutil -lXft \
+ `$(PKG_CONFIG) --libs fontconfig` \
+ `$(PKG_CONFIG) --libs freetype2` \
+ `$(PKG_CONFIG) --libs harfbuzz`
+MANPREFIX = ${PREFIX}/man
# compiler and linker
# CC = c99

View File

@ -0,0 +1,34 @@
Index: st.c
--- st.c.orig
+++ st.c
@@ -35,6 +35,7 @@
#define ESC_ARG_SIZ 16
#define STR_BUF_SIZ ESC_BUF_SIZ
#define STR_ARG_SIZ ESC_ARG_SIZ
+#define STR_BUF_MAX (256*1024)
#define HISTSIZE 2000
#define RESIZEBUFFER 1000
@@ -2025,7 +2026,8 @@ csihandle(void)
case 6: /* Report Cursor Position (CPR) "<row>;<column>R" */
n = snprintf(buf, sizeof(buf), "\033[%i;%iR",
term.c.y+1, term.c.x+1);
- ttywrite(buf, n, 0);
+ if (n > 0)
+ ttywrite(buf, n, 0);
break;
default:
goto unknown;
@@ -2645,8 +2647,11 @@ tputc(Rune u)
* term.esc = 0;
* strhandle();
*/
- if (strescseq.siz > (SIZE_MAX - UTF_SIZ) / 2)
+ if (strescseq.siz > (SIZE_MAX - UTF_SIZ) / 2 ||
+ strescseq.siz >= STR_BUF_MAX) {
+ strreset();
return;
+ }
strescseq.siz *= 2;
strescseq.buf = xrealloc(strescseq.buf, strescseq.siz);
}