compiling wine
script: compile_wine

https://gitlab.com/version2013/puppylinux/tree/master/wine

------------
begin script
------------
#!/bin/sh

# 2018 Jul 16

# https://www.winehq.org/
# https://dl.winehq.org/wine/source/
# http://sourceforge.net/projects/wine/files/Source/
# http://mirrors.ibiblio.org/wine/source/
# https://wiki.winehq.org/Building_Wine
# https://gcc.gnu.org/install/configure.html
# https://wiki.winehq.org/Packaging#WoW64_Workarounds
# http://tldp.org/LDP/Bash-Beginners-Guide/html/sect_02_03.html
# https://stackoverflow.com/questions/5898601/filename-not-printing-correctly-with-underscore-in-bash
# http://wiki.bash-hackers.org/syntax/pe#simple_usage
# http://tldp.org/HOWTO/Bash-Prog-Intro-HOWTO-5.html
# https://unix.stackexchange.com/a/47585
# https://stackoverflow.com/a/29505062
# https://stackoverflow.com/a/13296965
# https://stackoverflow.com/a/226724

# on command line: ./compile_wine ${1} ${2}
#
# replace variables, ${1} ${2}, with appropriate version numbers.
# ${1} = wine version
# ${2} = puppy distro version
# valid puppy distro versions: 1.1 1.2 2.1 2.2 3.1 3.2 4.1
# example command: ./compile_wine 3.3 3.1


# Depending on your CPU speed, compiling could take a while.

if [ ! -d /mnt/home/compile/temp/ ]; then
mkdir /mnt/home/compile/temp/
fi

if [ ! -d /mnt/home/compile/wine/ ]; then
mkdir /mnt/home/compile/wine/
fi

if [ ! -d /mnt/home/compile/wine/${1} ]; then
mkdir /mnt/home/compile/wine/${1}
fi

ln -s /mnt/home/compile/wine-${1} /opt/wine-${1}
mkdir /opt/wine-${1}_build
cd /opt/wine-${1}_build

if [ ${2} == 1.1 ] || [ ${2} == 2.1 ]; then
../wine-${1}/configure --prefix=/usr --sysconfdir=/etc --localstatedir=/var --x-includes=/usr/X11R7/include --x-libraries=/usr/X11R7/lib --with-x --libdir=/usr/lib32 CFLAGS="-O2 -march=i486 -mtune=i686" | tee /mnt/home/compile/wine/${1}/config_wine-${1}_v${2}.log
fi

if [ ${2} == 1.2 ] || [ ${2} == 2.2 ]; then
../wine-${1}/configure --prefix=/usr --sysconfdir=/etc --localstatedir=/var --x-includes=/usr/X11R7/include --x-libraries=/usr/X11R7/lib --with-x --libdir=/usr/lib32 CFLAGS="-g -O0 -fno-optimize-sibling-calls -fno-omit-frame-pointer -fno-inline -march=i486 -mtune=i686" | tee /mnt/home/compile/wine/${1}/config_wine-${1}_v${2}.log
fi

if [ ${2} == 3.1 ]; then
../wine-${1}/configure --prefix=/usr --sysconfdir=/etc --localstatedir=/var --with-x --libdir=/usr/lib32 CFLAGS="-O2 -march=i486 -mtune=i686" | tee /mnt/home/compile/wine/${1}/config_wine-${1}_v${2}.log
fi

if [ ${2} == 3.2 ]; then
../wine-${1}/configure --prefix=/usr --sysconfdir=/etc --localstatedir=/var --with-x --libdir=/usr/lib32 CFLAGS="-g -O0 -fno-optimize-sibling-calls -fno-omit-frame-pointer -fno-inline -march=i486 -mtune=i686" | tee /mnt/home/compile/wine/${1}/config_wine-${1}_v${2}.log
fi

if [ ${2} == 4.1 ]; then
../wine-${1}/configure --prefix=/usr --sysconfdir=/etc --localstatedir=/var --with-x --enable-win64 --libdir=/usr/lib64 CFLAGS="-O2" | tee /mnt/home/compile/wine/${1}/config_wine-${1}_v${2}.log
fi

make

echo
echo "If 'Wine build complete', then success."
echo
echo "Continue script and create .pet files?
On keyboard, press 1 or 2, then enter."
select yn in "Yes" "No"; do
    case $yn in
        Yes ) break;;
        No ) echo "exiting"; exit;;
    esac
done

cd /opt/wine-${1}_build/
make DESTDIR=/opt/temp/wine-${1} install
cd /opt/temp/
ln -s /mnt/home/compile/splitpkg.sh /opt/temp/splitpkg.sh
./splitpkg.sh wine-${1}/

if [ ${2} == 1.1 ] || [ ${2} == 2.1 ] || [ ${2} == 3.1 ] || [ ${2} == 4.1 ]; then
# http://serverfault.com/a/450133
find . -type f -exec file {} + | grep ELF > files.txt

# http://stackoverflow.com/a/11265458
# delete file descriptions and leave only file paths and file names.
cat files.txt | sed 's/:.*//' > files1.txt

# http://unix.stackexchange.com/a/65668
# strip files that are listed in a file
strip --strip-unneeded $(< files1.txt)

echo Done - stripped executables.
fi

# Copy dev and doc directories to '/mnt/home/compile/temp/' for later hash compare.
# First run does not need "--checksum", as there is no destination files to compare checksums against.
rsync --archive --progress --stats --whole-file --verbose ./wine_DEV-${1} /mnt/home/compile/temp/dev${2}
rsync --archive --checksum --progress --stats --whole-file --verbose ./wine_DEV-${1} /mnt/home/compile/temp/dev${2}
rsync --archive --progress --stats --whole-file --verbose ./wine_DOC-${1} /mnt/home/compile/temp/doc${2}
rsync --archive --checksum --progress --stats --whole-file --verbose ./wine_DOC-${1} /mnt/home/compile/temp/doc${2}

# copy wine.desktop to '/mnt/home/compile/' for later compare against wine.desktop in extras .pet
cp /opt/temp/wine-${1}/usr/share/applications/wine.desktop /mnt/home/compile/wine.desktop

rm --verbose --recursive /opt/temp/wine-${1}/usr/share/applications

rsync --archive --progress --stats --whole-file --verbose /mnt/home/compile/wine_extras_v1/ /opt/temp/wine-${1}/
rsync --archive --checksum --progress --stats --whole-file --verbose /mnt/home/compile/wine_extras_v1/ /opt/temp/wine-${1}/

if [ ${2} == 4.1 ]; then
cd /mnt/home/compile/wine/${1}/
rsync --archive --progress --stats --whole-file --verbose ./wine-${1}_v3.1.pet /opt/temp/
rsync --archive --checksum --progress --stats --whole-file --verbose ./wine-${1}_v3.1.pet /opt/temp/
cd /opt/temp/
pet2tgz wine-${1}_v3.1.pet
tar xfJv wine-${1}_v3.1.tar.xz
mv ./wine-${1}_v3.1/usr/lib32 ./wine-${1}/usr/
mv ./wine-${1}_v3.1/usr/bin/wineserver ./wine-${1}/usr/bin/.wineserver
mv ./wine-${1}_v3.1/usr/bin/wine ./wine-${1}/usr/bin/wine
mv ./wine-${1}_v3.1/usr/bin/wine-preloader ./wine-${1}/usr/bin/wine-preloader
fi

if [ ${2} == 1.1 ] || [ ${2} == 1.2 ] || [ ${2} == 2.1 ] || [ ${2} == 2.2 ] || [ ${2} == 3.1 ] || [ ${2} == 3.2 ]; then
mv wine-${1} wine-${1}_v${2}
mv wine_DEV-${1} wine_DEV-${1}_v${2}
fi

if [ ${2} == 4.1 ]; then
mv wine-${1} wine64-${1}_v${2}
mv wine_DEV-${1} wine64_DEV-${1}
mv wine_DOC-${1} wine64_DOC-${1}
fi

# note: new dir2pet does not add 'K' to size in petspecs.
# ./dir2pet -h

ln -s /mnt/home/compile/dir2pet /opt/temp/dir2pet

if [ ${2} == 1.1 ] || [ ${2} == 1.2 ] || [ ${2} == 2.1 ] || [ ${2} == 2.2 ]; then
./dir2pet -g -s -w="Wine Windows Program Loader" -c=Utility -p=wine-${1}_v${2}
./dir2pet -g -s -w="Wine Windows Program Loader" -p=wine_DEV-${1}_v${2}
./dir2pet -g -s -w="Wine Windows Program Loader" -p=wine_DOC-${1}
fi

if [ ${2} == 3.1 ] || [ ${2} == 3.2 ]; then
./dir2pet -x -s -w="Wine Windows Program Loader" -c=Utility -p=wine-${1}_v${2}
./dir2pet -x -s -w="Wine Windows Program Loader" -p=wine_DEV-${1}_v${2}
./dir2pet -x -s -w="Wine Windows Program Loader" -p=wine_DOC-${1}
fi

if [ ${2} == 4.1 ]; then
./dir2pet -x -s -w="Wine Windows Program Loader" -c=Utility -p=wine64-${1}_v${2}
./dir2pet -x -s -w="Wine Windows Program Loader" -p=wine64_DEV-${1}
./dir2pet -x -s -w="Wine Windows Program Loader" -p=wine64_DOC-${1}
fi

if [ ${2} == 1.1 ] || [ ${2} == 1.2 ] || [ ${2} == 2.1 ] || [ ${2} == 2.2 ] || [ ${2} == 3.1 ] || [ ${2} == 3.2 ]; then
rsync --archive --progress --stats --whole-file --verbose ./wine-${1}_v${2}.pet /mnt/home/compile/wine/${1}/
rsync --archive --checksum --progress --stats --whole-file --verbose ./wine-${1}_v${2}.pet /mnt/home/compile/wine/${1}/
rsync --archive --progress --stats --whole-file --verbose ./wine_DEV-${1}_v${2}.pet /mnt/home/compile/wine/${1}/
rsync --archive --checksum --progress --stats --whole-file --verbose ./wine_DEV-${1}_v${2}.pet /mnt/home/compile/wine/${1}/
rsync --archive --progress --stats --whole-file --verbose ./wine_DOC-${1}.pet /mnt/home/compile/wine/${1}/
rsync --archive --checksum --progress --stats --whole-file --verbose ./wine_DOC-${1}.pet /mnt/home/compile/wine/${1}/
fi

if [ ${2} == 4.1 ]; then
rsync --archive --progress --stats --whole-file --verbose ./wine64-${1}_v${2}.pet /mnt/home/compile/wine/${1}/
rsync --archive --checksum --progress --stats --whole-file --verbose ./wine64-${1}_v${2}.pet /mnt/home/compile/wine/${1}/
rsync --archive --progress --stats --whole-file --verbose ./wine64_DEV-${1}.pet /mnt/home/compile/wine/${1}/
rsync --archive --checksum --progress --stats --whole-file --verbose ./wine64_DEV-${1}.pet /mnt/home/compile/wine/${1}/
rsync --archive --progress --stats --whole-file --verbose ./wine64_DOC-${1}.pet /mnt/home/compile/wine/${1}/
rsync --archive --checksum --progress --stats --whole-file --verbose ./wine64_DOC-${1}.pet /mnt/home/compile/wine/${1}/
fi

echo 
echo ".pet creation finished"
echo



----------
end script
----------

Copy contents of 'compile_wine', paste into a new file with same name, and place in /mnt/home/compile
Give the file execute permission.
- right-click 'compile_wine', click 'Permissions', click 'Yes'


This script is geared toward my puppy linux frugal installs.
It is partially automated.
Wine is compiled in the directory /opt
Wine .pet files are copied to the directory, /mnt/home/compile
Wine dev and doc files are copied to the directory, /mnt/home/compile/temp, for later hash (checksum) compare.

wine source file.
https://dl.winehq.org/wine/source/
http://sourceforge.net/projects/wine/files/Source/
Extract contents of file and place in /mnt/home/compile


wine_extras_v1.tar.gz
https://gitlab.com/version2013/puppylinux/blob/master/wine/wine_extras_v1.tar.gz
Extract contents of file and place in /mnt/home/compile


dir2pet
https://gitlab.com/version2013/puppylinux/blob/master/dir2pet
https://github.com/puppylinux-woof-CE/woof-CE/blob/testing/woof-code/rootfs-skeleton/usr/bin/dir2pet
Copy contents of 'dir2pet', paste into a new file with same name, and place in /mnt/home/compile
Give the file execute permission.
- right-click 'dir2pet', click 'Permissions', click 'Yes'


splitpkg.sh
https://gitlab.com/version2013/puppylinux/blob/master/splitpkg.sh
Copy contents of 'splitpkg.sh', paste into a new file with same name, and place in /mnt/home/compile
Give the file execute permission.
- right-click 'splitpkg.sh', click 'Permissions', click 'Yes'
http://www.murga-linux.com/puppy/viewtopic.php?p=905715#905715
Or download 'splitpkg.tar.gz', extract and place in /mnt/home/compile



--- other links ---
http://murga-linux.com/puppy/viewtopic.php?t=88711
http://puppylinux.com/woof-ce.html
http://murga-linux.com/puppy/viewtopic.php?t=109895
http://www.murga-linux.com/puppy/viewtopic.php?t=96027


using 'compile_wine' on command line: ./compile_wine ${1} ${2}
replace variables, ${1} ${2}, with appropriate version numbers.
${1} = wine version
${2} = puppy distro version
valid puppy distro versions: 1.1, 1.2, 2.1, 2.2, 3.1, 3.2, 4.1
example command: ./compile_wine 3.12 4.1

Depending on your CPU speed, compiling could take a while.


-------------------
Edited 2018 Jul 16
-------------------