Replies: 29 comments 81 replies
|
Can you tell me where I can help? (here or at the FreeBSD forum) |
|
Hi Patrick, From the forum they are suggesting to create a port for the Is that assumption correct for you? |
|
Hi Patrick, I am circling around without getting anything. Is this the code to create the sp binary? |
|
Hi Patrick, this has been a little bit frustrating, "vibe coding", hasn't been a pleasant activity. I believe these scripts work fine now, the main one creates the libraries and the binary, plus some instructions for the distribution on where copies the files created; the second one is to clean up with mess. It couldn't be possible to create a single script cause even DeepSeek doesn't have enough memory to store all that characters. If you don't mind to check these scripts it would be really beneficial, so I can start moving on the FreeBSD part! 🙏 |
|
Scripts are too long to be pasted. |
|
Hi Patrick, Claude looks better. Is this correct? |
|
Hi Patrick, Good news, it looks like I have a fully shell script that works: #!/bin/sh
#
# sphelper.sh - FreeBSD build and installation helper for speedata Publisher
# POSIX-compliant shell script
#
# Exit on error
set -e
# Default configuration
: ${BASEDIR:=$(pwd)}
: ${BUILDDIR:=${BASEDIR}/build}
: ${SRCDIR:=${BASEDIR}/src}
: ${PREFIX:=/usr/local}
: ${BINDIR:=${PREFIX}/bin}
: ${SHAREDIR:=${PREFIX}/share/speedata-publisher}
: ${LIBDIR:=${SHAREDIR}/lib}
: ${SWDIR:=${SHAREDIR}/sw}
: ${SCHEMADIR:=${SHAREDIR}/schema}
: ${DYLIBBUILD:=${BUILDDIR}/dylib}
# Detect version from version file if not set
if [ -z "${VERSION}" ]; then
if [ -f "${BASEDIR}/version" ]; then
VERSION=$(grep '^publisher_version=' "${BASEDIR}/version" | cut -d'=' -f2 | tr -d '[:space:]')
else
VERSION="unknown"
fi
# If still empty, set to unknown
if [ -z "${VERSION}" ]; then
VERSION="unknown"
fi
fi
: ${SDPRO:="no"}
# FreeBSD specific settings
GOOS="freebsd"
GOARCH=$(uname -m)
case "${GOARCH}" in
amd64|x86_64)
GOARCH="amd64"
;;
i386|i686)
GOARCH="386"
;;
aarch64|arm64)
GOARCH="arm64"
;;
armv7*)
GOARCH="arm"
;;
*)
echo "Unsupported architecture: ${GOARCH}"
exit 1
;;
esac
# Lua include path for FreeBSD
LUA_INCLUDE="/usr/local/include/lua53"
# Display usage information
usage() {
cat << EOF
Usage: $(basename "$0") <command> [options]
Commands:
build Build sp binary for FreeBSD
buildlib Build sp libraries for FreeBSD
install Install speedata Publisher to ${PREFIX}
uninstall Uninstall speedata Publisher from ${PREFIX}
clean Clean all build artifacts and downloads
Environment Variables:
BASEDIR Base directory (default: current directory)
BUILDDIR Build output directory (default: \$BASEDIR/build)
SRCDIR Source directory (default: \$BASEDIR/src)
PREFIX Installation prefix (default: /usr/local)
SDPRO Build Pro version (yes/no, default: no)
VERSION Publisher version (auto-detected from version file)
Examples:
$(basename "$0") buildlib
$(basename "$0") build
SDPRO=yes $(basename "$0") build
sudo $(basename "$0") install
sudo $(basename "$0") uninstall
$(basename "$0") clean
EOF
}
# Create sdluatex symbolic link
create_sdluatex_link() {
if [ ! -e "${BINDIR}/sdluatex" ]; then
echo "Creating symbolic link: ${BINDIR}/sdluatex -> ${BINDIR}/luahbtex"
ln -sf "${BINDIR}/luahbtex" "${BINDIR}/sdluatex"
fi
}
# Build the main sp binary
build_sp() {
local destdir="$1"
local target_os="${2:-${GOOS}}"
local target_arch="${3:-${GOARCH}}"
echo "Building sp binary for ${target_os}/${target_arch}"
# Ensure destination directory exists
mkdir -p "${destdir}"
# Verify source directory exists and find the correct build path
sp_source_dir=""
if [ -d "${SRCDIR}/go/sp/sp" ] && [ -n "$(find "${SRCDIR}/go/sp/sp" -maxdepth 1 -name "*.go" -type f 2>/dev/null)" ]; then
sp_source_dir="${SRCDIR}/go/sp/sp"
elif [ -f "${SRCDIR}/go/sp/main.go" ]; then
sp_source_dir="${SRCDIR}/go/sp"
else
echo "Error: Cannot find sp source directory with .go files"
echo "Tried:"
echo " ${SRCDIR}/go/sp/sp/"
echo " ${SRCDIR}/go/sp/main.go"
exit 1
fi
echo " Source: ${sp_source_dir}"
# Set Go build environment
export GOOS="${target_os}"
export GOARCH="${target_arch}"
export CGO_ENABLED=1
# Build flags - inject paths and version for custom mode
ldflags="-X main.dest=custom"
ldflags="${ldflags} -X main.version=${VERSION}"
ldflags="${ldflags} -X main.libdir=${LIBDIR}"
ldflags="${ldflags} -X main.srcdir=${SWDIR}"
# Add Pro flag if enabled
if [ "${SDPRO}" = "yes" ]; then
ldflags="${ldflags} -X main.pro=yes"
fi
# Strip symbols for smaller binary
ldflags="${ldflags} -s"
# Debug output
echo "Build environment:"
echo " BASEDIR=${BASEDIR}"
echo " GOOS=${GOOS}"
echo " GOARCH=${GOARCH}"
echo " CGO_ENABLED=${CGO_ENABLED}"
echo " Version=${VERSION}"
echo " Pro=${SDPRO}"
echo " libdir=${LIBDIR}"
echo " srcdir=${SWDIR}"
echo " Output: ${destdir}/sp"
# Navigate to source directory
cd "${sp_source_dir}" || {
echo "Error: Cannot cd to sp source directory: ${sp_source_dir}"
exit 1
}
# Build the sp binary
echo "Running: go build -ldflags \"${ldflags}\" -o \"${destdir}/sp\""
go build -ldflags "${ldflags}" -o "${destdir}/sp"
build_result=$?
if [ ${build_result} -eq 0 ]; then
chmod +x "${destdir}/sp"
echo "Successfully built sp binary: ${destdir}/sp"
# Verify the binary
if [ ! -f "${destdir}/sp" ]; then
echo "Error: Binary file was not created"
exit 1
fi
# Check if it's a valid ELF binary
file "${destdir}/sp" | grep -q "ELF"
if [ $? -ne 0 ]; then
echo "Warning: Output file may not be a valid ELF binary"
file "${destdir}/sp"
fi
echo ""
echo "Build complete!"
else
echo "Error: Failed to build sp binary (exit code: ${build_result})"
exit 1
fi
}
# Build the Go dynamic library (libsplib.so)
build_go_lib() {
local target_os="$1"
local target_arch="$2"
echo "Building dynamic library for ${target_os} ${target_arch}"
# Ensure dylib build directory exists
mkdir -p "${DYLIBBUILD}"
# Set environment for CGO
export GOOS="${target_os}"
export GOARCH="${target_arch}"
export CGO_ENABLED=1
export CGO_CFLAGS="-I${LUA_INCLUDE}"
# Navigate to splib source
cd "${SRCDIR}/go/splib" || {
echo "Error: Cannot find splib source directory"
exit 1
}
# Build the shared library
go build -buildmode=c-shared -o "${DYLIBBUILD}/libsplib.so" .
if [ $? -eq 0 ]; then
echo "Successfully built libsplib.so"
else
echo "Error: Failed to build libsplib.so"
exit 1
fi
}
# Build the C glue library (luaglue.so)
build_c_lib() {
local target_os="$1"
local target_arch="$2"
echo "Building dynamic lua glue library for ${target_os} ${target_arch}"
# Ensure dylib build directory exists
mkdir -p "${DYLIBBUILD}"
# Navigate to C source directory
cd "${SRCDIR}/c" || {
echo "Error: Cannot find C source directory"
exit 1
}
# Compile the C glue library
case "${target_os}" in
freebsd)
cc -shared -fPIC -o "${DYLIBBUILD}/luaglue.so" \
luaglue.c -I"${LUA_INCLUDE}"
;;
*)
echo "Error: Unsupported OS for C library: ${target_os}"
exit 1
;;
esac
if [ $? -eq 0 ]; then
echo "Successfully built luaglue.so"
else
echo "Error: Failed to build luaglue.so"
exit 1
fi
}
# Build both libraries
build_libraries() {
local target_os="${1:-${GOOS}}"
local target_arch="${2:-${GOARCH}}"
build_go_lib "${target_os}" "${target_arch}"
build_c_lib "${target_os}" "${target_arch}"
echo "Libraries built successfully in ${DYLIBBUILD}"
echo ""
echo "Next step: Build the sp binary with:"
echo " ./sphelper.sh build"
}
# Install speedata Publisher
install_publisher() {
echo "Installing speedata Publisher to ${PREFIX}"
echo ""
# Check if we have the necessary files
if [ ! -f "${BASEDIR}/bin/sp" ]; then
echo "Error: sp binary not found. Run './sphelper.sh build' first."
exit 1
fi
if [ ! -f "${DYLIBBUILD}/libsplib.so" ] || [ ! -f "${DYLIBBUILD}/luaglue.so" ]; then
echo "Error: Libraries not found. Run './sphelper.sh buildlib' first."
exit 1
fi
# Create directory structure
echo "Creating directory structure..."
mkdir -p "${BINDIR}"
mkdir -p "${LIBDIR}/lib"
mkdir -p "${SCHEMADIR}"
mkdir -p "${SWDIR}/colorprofiles"
mkdir -p "${SWDIR}/fonts"
mkdir -p "${SWDIR}/hyphenation"
mkdir -p "${SWDIR}/img"
mkdir -p "${SWDIR}/lua"
mkdir -p "${SWDIR}/metapost"
mkdir -p "${SWDIR}/tex"
# Install binary
echo "Installing binary..."
install -m 755 "${BASEDIR}/bin/sp" "${BINDIR}/sp"
# Create sdluatex symlink
create_sdluatex_link
# Install libraries
echo "Installing libraries..."
install -m 644 "${DYLIBBUILD}/libsplib.so" "${LIBDIR}/libsplib.so"
install -m 644 "${DYLIBBUILD}/luaglue.so" "${LIBDIR}/luaglue.so"
# Install JAR files
echo "Installing JAR utilities..."
install -m 644 "${BASEDIR}/lib/jing.jar" "${LIBDIR}/jing.jar"
install -m 644 "${BASEDIR}/lib/saxon-he-12.9.jar" "${LIBDIR}/saxon-he-12.9.jar"
install -m 644 "${BASEDIR}/lib/trang.jar" "${LIBDIR}/trang.jar"
install -m 644 "${BASEDIR}/lib/lib/xmlresolver-5.3.3-data.jar" "${LIBDIR}/lib/xmlresolver-5.3.3-data.jar"
install -m 644 "${BASEDIR}/lib/lib/xmlresolver-5.3.3.jar" "${LIBDIR}/lib/xmlresolver-5.3.3.jar"
# Install schema files
echo "Installing schema files..."
install -m 644 "${BASEDIR}/schema/catalog-schema-de.xml" "${SCHEMADIR}/"
install -m 644 "${BASEDIR}/schema/catalog-schema-en.xml" "${SCHEMADIR}/"
install -m 644 "${BASEDIR}/schema/layoutschema-de.rng" "${SCHEMADIR}/"
install -m 644 "${BASEDIR}/schema/layoutschema-de.xsd" "${SCHEMADIR}/"
install -m 644 "${BASEDIR}/schema/layoutschema-en.rng" "${SCHEMADIR}/"
install -m 644 "${BASEDIR}/schema/layoutschema-en.xsd" "${SCHEMADIR}/"
# Install sw files
echo "Installing source files to ${SWDIR}..."
# colorprofiles
cp -R "${SRCDIR}/colorprofiles/"* "${SWDIR}/colorprofiles/"
# fonts
cp -R "${BASEDIR}/fonts/"* "${SWDIR}/fonts/"
# hyphenation
cp -R "${SRCDIR}/hyphenation/"* "${SWDIR}/hyphenation/"
# img
cp -R "${BASEDIR}/img/"* "${SWDIR}/img/"
# lua (recursive)
cp -R "${SRCDIR}/lua/"* "${SWDIR}/lua/"
# metapost
cp -R "${SRCDIR}/metapost/"* "${SWDIR}/metapost/"
# tex
cp -R "${SRCDIR}/tex/"* "${SWDIR}/tex/"
echo ""
echo "Installation complete!"
echo ""
echo "speedata Publisher ${VERSION} installed to ${PREFIX}"
echo ""
echo "To verify installation:"
echo " sp --version"
echo ""
}
# Uninstall speedata Publisher
uninstall_publisher() {
echo "Uninstalling speedata Publisher from ${PREFIX}"
echo ""
# Remove binary
echo "Removing binary..."
rm -f "${BINDIR}/sp"
rm -f "${BINDIR}/sdluatex"
# Remove entire speedata-publisher directory
echo "Removing installation directory..."
rm -rf "${SHAREDIR}"
echo ""
echo "Uninstallation complete!"
echo "speedata Publisher has been removed from ${PREFIX}"
echo ""
}
# Clean build artifacts
clean_build() {
echo "Cleaning build artifacts..."
echo ""
# Remove build directory
if [ -d "${BUILDDIR}" ]; then
echo "Removing ${BUILDDIR}"
rm -rf "${BUILDDIR}"
fi
# Remove built binaries
if [ -f "${BASEDIR}/bin/sp" ]; then
echo "Removing ${BASEDIR}/bin/sp"
rm -f "${BASEDIR}/bin/sp"
fi
# Remove Go build cache and downloaded modules
echo "Cleaning Go cache..."
go clean -cache -modcache 2>/dev/null || true
echo ""
echo "Clean complete!"
echo "All build artifacts have been removed."
echo ""
}
# Main command dispatcher
main() {
if [ $# -eq 0 ]; then
usage
exit 1
fi
command="$1"
shift
case "${command}" in
build)
# Build the sp binary
build_sp "${BASEDIR}/bin"
;;
buildlib)
# Build libraries for current architecture
build_libraries
;;
install)
# Install speedata Publisher
install_publisher
;;
uninstall)
# Uninstall speedata Publisher
uninstall_publisher
;;
clean)
# Clean build artifacts
clean_build
;;
help|--help|-h)
usage
exit 0
;;
*)
echo "Error: Unknown command '${command}'"
echo ""
usage
exit 1
;;
esac
}
# Run main function
main "$@" |
|
Try the https://github.com/speedata/examples/tree/master/shakespeare example: run Other tools (really system depending) for example the charts (read svg files with inkscape) |
|
I got some errors in some files:
|
|
Good news, I created a local port that builds Publisher. |
|
Congrats for 5.4... 🍾🍾🍾 This is very good also to test my ports out. |
|
Good news Patrick! I was finally able to build I am going to perform some tests, and hopefully I can submit the port on Monday... 🙏 |
|
Hi Patrick, I have publisher stable and publisher devel ready for review. I need to re-run them into the examples directory. Thanks... 🙏 |
|
Hi Patrick, so far this is the only document where I fail. jsonreader ) sp --version
Version: 5.4.0 (Pro)
jsonreader ) sp --loglevel debug --verbose
Config files read: /home/freezr/git/examples/technical/jsonreader/publisher.cfg
[-jar /usr/local/share/speedata-publisher/lib/saxon-he-12.9.jar -xsl:json2xml.xsl -o:data.xml -it:main filename=us-500.json]
Exception in thread "main" java.lang.NoClassDefFoundError: org/xmlresolver/Resolver
at net.sf.saxon.lib.CatalogResourceResolver.<init>(CatalogResourceResolver.java:46)
at net.sf.saxon.Configuration.init(Configuration.java:387)
at net.sf.saxon.Configuration.<init>(Configuration.java:234)
at java.base/jdk.internal.reflect.DirectConstructorHandleAccessor.newInstance(Unknown Source)
at java.base/java.lang.reflect.Constructor.newInstanceWithCaller(Unknown Source)
at java.base/java.lang.reflect.ReflectAccess.newInstance(Unknown Source)
at java.base/jdk.internal.reflect.ReflectionFactory.newInstance(Unknown Source)
at java.base/java.lang.Class.newInstance(Unknown Source)
at net.sf.saxon.Configuration.newConfiguration(Configuration.java:250)
at net.sf.saxon.s9api.Processor.<init>(Processor.java:83)
at net.sf.saxon.Transform.doTransform(Transform.java:327)
at net.sf.saxon.Transform.main(Transform.java:85)
Caused by: java.lang.ClassNotFoundException: org.xmlresolver.Resolver
at java.base/jdk.internal.loader.BuiltinClassLoader.loadClass(Unknown Source)
at java.base/jdk.internal.loader.ClassLoaders$AppClassLoader.loadClass(Unknown Source)
at java.base/java.lang.ClassLoader.loadClass(Unknown Source)
... 12 more
exit status 1
java -jar /usr/local/share/speedata-publisher/lib/saxon-he-12.9.jar -xsl:json2xml.xsl -o:data.xml -it:main filename=us-500.jsonand... Perhaps I need a different version of Java, by default it is installed: |
|
Can you show the output of |
|
For some reason I created an additional dir |
|
I finally submitted the request for both stable and devel version... 🤞 |
|
Hi Patrick, I am moving forward with the port. A problem that I couldn't find a good solution is about the third parties java (jar) app. The Ports team is asking to get them from the ports. I am doing this task with Claude so it needs to verify the following:
If neither is straightforward, I ( Thanks in advance… 🙏 |
|
1: 12.8 will be fine |
|
The current version (5.5.24) has options to configure the location of the jar files: See the installation section Saxon is now version independent and falls back to 12.9 if nothing else is found. |
|
Hi Patrick, I am checking into AArch64, with the current
What's your workaround for AArch64 on Apple about this |
|
Hi Patrick, With 5.6 released the Ports Team told me that is fine if I sent patch for 5.6 rather than 5.4.3. What confused me (and Claude) is about lua-5.4 (lua54 on FreeBSD), I need some clarification about the different version of Lua-5.3 and tex-luatex (based on Lua 5.3) we'll be continued to be used to build the Publisher binary. Is that correct? Any additional information is welcomed! Thanks in advance! 🙏 |
|
Hi Patrick, great news!!! https://www.freshports.org/print/publisher/ Robert Clausecker, the guy, that was helping me in this process, made the extra-mile and fixed the last detail to make this port through so next stable will be easier to port as simple update patch! He was incredible, he lead me all way down through the process, without his help this wouldn't be possible. For the next stable the challenge would be the following:
I wonder if also for If this would result in too much work for you, maybe you can lead the path, and I will try to get there with the aid of Claude. In the meantime happy Publisher on FreeBSD!!! 🍾🍾🍾 |
|
Version 5.7.0 now looks for luahbtex if sdluatex is not found (untested though) |
|
Point claude to 12c07a1d It is sp.go line 517 and following. |
|
Hi Patrick, I was on vacation and now I am trying to catch up to push 5.6.0 and starting the process for the development version. I have a couple of questions (if you are available of course):
Thanks in advance! 🙏 |
|
I believe I pretty confused, I am sorry. You wrote:
Is this go version be build during the compilation time? Or do I need to add it as dependency in the makefile? |
|
Hi Patrick, I submitted the request for 5.6 and back ported the patch from 5.7.2 so now also the stable looks for Now the new guy assigned to review my submission told me that on his end it builds also with Lua 5.4 and he was asking me why not 5.4 instead of 5.3. I copied a comment you made, and I told him that this may lead some instabilities or missing functionalities, but I only guessed. What is your take on Lua 5.4? Thanks… 🙏 |

Uh oh!
There was an error while loading. Please reload this page.
Hi Patrick,
I've started the process to port Publisher on FreeBSD (my account on FreeBSD is still in probationary though):
https://forums.freebsd.org/threads/first-time-trying-to-create-a-port-i-need-guidance.101145/
This is the first time for me, so I am learning by doing. The documentation is very well done and the people on the forum willing to help me:
https://docs.freebsd.org/en/books/porters-handbook/porting-why/
I am opening this discussion for getting help on your side!
Thank you very much! 🙏
All reactions