# libXaw3d port update



## sidetone (Mar 11, 2022)

The current Xaw3d in ports is an older and unmaintained version from a Slackware repository. I was able to get the official version from X.org which is newer.

```
# Created:

PORTNAME=       libXaw3d
PORTVERSION=    1.6.3
CATEGORIES=     x11-toolkits

MAINTAINER=
COMMENT=        X Athena Widgets 3D library

LICENSE=        MIT
LICENSE_FILE=   ${WRKSRC}/COPYING

USES=           gmake xorg xorg-cat:lib
USE_XORG=       x11 xau xext xmu xpm xorgproto xt xau sm ice
CONFIGURE_ARGS= --without-xmlto

post-install:
        @${STRIP_CMD} ${STAGEDIR}${PREFIX}/lib/libXaw3d.so

.include <bsd.port.mk>
```
This is all I was able to get so far. It downloads and builds from the Xorg repositories in /usr/ports/Mk/. They have the same contents as https://gitlab.freedesktop.org/xorg/lib/libxaw3d/-/tree/libXaw3d-1.6.3/src. The Makefile gets the zipped file automatically by the PORTNAME, so it doesn't need MASTER_SITES=.

After some basic porting steps, `make stage` and `make stage-qa` don't produce errors. `make` didn't produce errors either. `make package` or `make install` produce errors.

```
j-x11:/opt/libXaw3d # make package
===>  Building package for libXaw3d-1.6.3
[: =: unexpected operator
pkg-static: Invalid package: object has missing property prefix
pkg-static: the package is not valid
pkg-static: package creation failed
*** Error code 1

Stop.
make: stopped in /opt/libXaw3d
```
After this, I need to add a CONFLICTS= argument for the other xaw3d in ports. When enough works with this port, hopefully remove the obsolete or unofficial port. Without the post-install part, it causes more errors from `make stage-qa` and `make install`. I'm unsure if this installs to the correct location.

x11-toolkits/Xaw3d is the old port, and it uses http://slackware.cs.utah.edu/pub/slackware/slackware64-13.1/source/x/xaw3d/. The port description is out of date too, as maintenance of the official project has passed on to someone else, then it was maintained since 2012 by X.org. That could be fixed, but the port is more outdated than that.


----------



## diizzy (Mar 11, 2022)

Having a very quick look you probably want to pull in add these as local patches either by using make makepatch or pulled patch files from gitlab (I would recommend the latter if multiple patch files patches the same source file(s)).
You can grab patches directly but gitlab instances tends to change metadata which causes the port to fail due to checksum mismatch.









						Fix fd leak when write() fails in WriteToFile() (b1745c3e) · Commits · xorg / lib / libXaw3d · GitLab
					

Reported by parfait 1.1 bug checking tool: File Descriptor Leak: Leaked File Descriptor fd at line 1098 of src/MultiSrc.c in function 'WriteToFile'. fd initialized at line 1096 with creat fd...




					gitlab.freedesktop.org
				











						Pass correct number of atoms from SelectSave to _XawTextSaltAwaySelection (69e1e136) · Commits · xorg / lib / libXaw3d · GitLab
					

When filling in the array, we correctly limited to the 256 slots allocated but then we reset the value to an unlimited number when passing it on to the function...




					gitlab.freedesktop.org
				











						build-fixes when _CONST_X_STRING is defined (1064bad5) · Commits · xorg / lib / libXaw3d · GitLab
					

Signed-off-by: Thomas E. Dickey




					gitlab.freedesktop.org
				











						issue #4: configure doesn't fail if flex is not installed (d5d8285d) · Commits · xorg / lib / libXaw3d · GitLab
					

add a check for lex like the existing one for yacc Signed-off-by: Thomas E. Dickey




					gitlab.freedesktop.org
				




Example:
If multiple *upstream* patches modifies the same file
https://cgit.freebsd.org/ports/tree/graphics/exiv2/files?id=0317bd0d24c06dd611c764b237462c62c4b92e95 (this makes it's much easier to keep track of patches)
patch-git-02-fullhash etc

I would also advice you to use poudriere to test ports


----------



## sidetone (Mar 11, 2022)

It's in a Bastille jail. `make fetch` and `make makesum` worked. The distfile went into /usr/ports/distfiles/xorg/lib/. I made other small required steps between this for it to be able to build.

The port built, but it failed when `make install` was run, which suggests it has to do with something else needed in one of post- sections. I need to solve this first.

Those patches need to be copied to files/, then I'll `make patch` based on that? That has to be done manually from copying the files from there, and it's not done in an automatic way?


----------



## diizzy (Mar 12, 2022)

`make patch` will apply patches that are in files dir. You're looking for `make makepatch` which will generate "ports friendly" patch files based on your current workdir usually `./work/<portname>-<version>`, keep in mind that it tracks using .orig files so make sure you don't overwrite the original one if you apply multiple patches that touches the same file. If you grab the gitlab generated patch files you need to change paths so they apply using patch -p0 .

I would also recommend you do join #bsdports on EFNet which would make this process much easier 
Keep in mind that people live in different parts of the world etc so you might not get an instant reply but you'll usually get a reply within a reasonable amount of time.


----------



## sidetone (Mar 12, 2022)

https://people.freebsd.org/~tcberner/patches/0001-x11-toolkits-Xaw3d-update-to-1.6.3-and-move-to-x11-t.patch
		


Patch is likely to reach the portstree soon. The updated Makefile uses components from the libXaw Makefile. Renamed from Xaw3d to libXaw3d as the filename is in the mirror, and to match the naming convention of libXaw. Version updated from 1.5E to 1.6.3. Patch includes references in dependent ports to the updated libraries.

The source file from the Slackware repository was correct as it mirrored the official repository. It was an older version.


----------



## sidetone (Apr 15, 2022)

Can someone test this patch, and give feedback for it to be applied?


			https://people.freebsd.org/~tcberner/patches/0001-x11-toolkits-Xaw3d-update-to-1.6.3-and-move-to-x11-t.patch
		


I tested it before. It compiled every time. The applications worked on CTWM, but the borders didn't show up on a from scratch install of JWM and Xorg-minimal. Perhaps a dependency was needed for the border to show up. It was the same case for other Xaw implementations as well. They worked on a full Xorg install. I was unable to finish testing. CTWM or a full Xorg install may have had what was needed for the borders to show up on libXaw3d.

For those who are interested in seeing this applied. Thank you.


----------

