# DIY upgrade of i386-wine amd64 package with poudriere



## zirias@ (Mar 28, 2021)

I'll use paths and jail names from my machine. To follow this little guide, you should be familiar with poudriere and know yourself what you have to change to match your environment. You should also be patient, there's a lot to build 

*1. Create a poudriere i386 jail matching your amd64 version*

You'll probably do this with poudriere-jail(8). Using the `http` method, this will be a single command. I'm building base from source, so here's what I did instead:

```
cd /usr/src
make -j8 TARGET=i386 buildworld
zfs create zroot/poudriere/jail/i386
make TARGET=i386 DESTDIR=/usr/local/poudriere/jail/i386 installworld
make TARGET=i386 DESTDIR=/usr/local/poudriere/jail/i386 distrib-dirs
make TARGET=i386 DESTDIR=/usr/local/poudriere/jail/i386 distribution
poudriere jail -c -j i386 -v 13.0-RC3 -a i386 -m null -M /usr/local/poudriere/jail/i386 -S /usr/src
```

*2. Make changes to the i386-wine port*

Change `PORTREVISION` in Makefile to match that of emulators/wine
Here, I removed it, as currently there is no revision in wine

Change `DISTVERSION` in Makefile.amd64 to match that of emulators/wine
Here, I set it to `5.0.4`

For now, delete distinfo and pkg-plist, we will re-create them later
*3. Create a make.conf for your new jail*

I recommend to use a file specific for your i386 jail, e.g. /usr/local/etc/poudriere.d/i386-make.conf
You *MUST* put `WINE_CROSS_BUILD=yes` there
Optionally also set build options for wine, e.g. I used `emulators_i386-wine_SET+= CUPS LIBXSLT MPG123`
*4. Build the i386 package of i386-wine, using your i386 jail*


```
poudriere bulk -j i386 -p default emulators/i386-wine
```
This step will probably take a *long* time for building all the dependencies.
Then, copy the resulting package to your poudriere distfiles:

```
cp /usr/local/poudriere/data/packages/i386-default/All/i386-wine-5.0.4,1.txz /usr/local/poudriere/distfiles/FreeBSD:13:amd64/
```

*5. Re-create distinfo*


```
# Bourne shell:
# export PORTSDIR=/usr/local/poudriere/ports/default
# export DISTDIR=/usr/local/poudriere/distfiles
# C shell:
setenv PORTSDIR /usr/local/poudriere/ports/default
setenv DISTDIR /usr/local/poudriere/distfiles

cd ${PORTSDIR}/emulators/i386-wine
make makesum
```

*6. Re-create pkg-plist, using poudriere testport*

Do this with your normal amd64 jail, mine is named "def":

```
poudriere testport -j def -p default -i emulators/i386-wine
```
This will eventually fail for the missing pkg-plist and drop you to a shell inside the build jail. There you can create a new pkg-plist:

```
cd /usr/ports/emulators/i386-wine
make makeplist >/wrkdirs/usr/ports/emulators/i386-wine/work/pkg-plist
```
*While the builder jail is still running*, do the following on a second terminal to copy the new pkg-plist to its correct location:

```
cd /usr/local/poudriere/ports/default/emulators/i386-wine
cp /usr/local/poudriere/data/.m/def-default/ref/wrkdirs/usr/ports/emulators/i386-wine/work/pkg-plist .
```
Now, edit pkg-plist and remove the following lines:

The first one that's just a warning
Every line with `%%PORTDOCS%%` in it
The one line with `ldconfig32` in it
Now, you can stop your builder jail (just hit `Ctrl+D`).

*7. Build the amd64 package of i386-wine, using your normal amd64 jail*


```
poudriere bulk -j def -p default emulators/i386-wine
```

You should now have an i386-wine package in your repository that's up to date with emulators/wine. Mine is now version 5.0.4 and works as expected


----------



## zirias@ (Mar 28, 2021)

I have to add: this is an ugly mess. I'm not surprised this port (emulators/i386-wine) isn't that well-maintained  I will probably experiment a bit for a way to at least generate that plist on-the-fly, to have a chance to automate the process a bit. Will update here if successful


----------



## Alexander88207 (Mar 28, 2021)

I wanted to take a look at emulators/i386-wine anyway after I had updated the binaries for emulators/i386-wine-devel.


----------



## zirias@ (Mar 28, 2021)

Alexander88207 said:


> I wanted to take a look at emulators/i386-wine anyway after I had updated the binaries for emulators/i386-wine-devel.


I think the persisting problem* will be that someone has to build these, so I'd always expect a more or less substantial delay. The guide above is maybe a first step to at least "brew your own at home", therefore also looking for ways to at least automate that a bit…

---
*) and no idea how to really solve that, without a way to cross-compile ports and, ideally, some kind of "multilib" support in `pkg` that would e.g. allow to only package libraries and binaries in lib32/bin32 and depending on the native amd64 package for the rest. But hey, nowadays 32bit Windows programs are probably the only usecase still left for such a thing, so I wouldn't expect a solution any more…


----------



## shkhln (Mar 28, 2021)

This is downright disturbing.


----------



## zirias@ (Mar 29, 2021)

shkhln said:


> This is downright disturbing.


It _is_ an ugly mess right now. There's no maintainer, which is the first obvious problem. And then, maintaining is painful, which is the second. At least, this guide should be helpful for anyone wanting his emulators/i386-wine up to date.

But the general idea for building 32bit wine seems to be quite appropriate in absence of any multilib/multiarch support in ports and from `pkg`. So one should evaluate how to improve the mess it currently is.


----------

