well, i worked a bit on it again.
adapted the script to use the 'official' stable mwdf from
http://dffd.wimbli.com/file.php?id=5315(retained the latest git SWP repo, but commented it out)
also added an option to create a new wineprefix (and install dotnet40) and so that one can run the exe launcher from there, or (if his .wine folder has dotnet40) the user can choose to run the launcher with the default wine (so no installing a new prefix)
for me, for some reason i haven't spotted yet, the new wineprefix installation wasn't able to run the exe (with dotnet40 installed), but my default wineprefix could do that so i didn't bother.
finally, i seem to have encountered a problem with yaymeh's build of therapist.
while it used to work fine about 1-2 months ago, now it crashes with an 'error while loading shared libraries: libicui18n.so.52: cannot open shared object file: No such file or directory' message.
from what i understand, the error is qt5 related.
building the latest dwarf-therapist from splinterz git, works, after patching checksum to accept mwdf.
i could add all of this to a script, but then there are going to be the dependency problems for the compiling,
and if i do upload the binary as yaymeh did, then why not just build a whole MWDF-linux package just as urmane's
so i guess this way is mostly pointless, except to make the procedure of building easier whenever a new MWDF comes out, or to use the SWP to make a new build
anyway, the modified script is here, but i did not modify the dwarf-therapist related lines...
#!/bin/zsh
### Might not work in bash. Will definitely not work in sh.
#### to be more precise: Everything except the language patch should work in bash.
echo "run this script inside a nice custom DF_Masterwork folder somewhere in your filesystem, or let it default in ~/DF_Masterwork"
# try to guess if the user moved the script to a nice custom install dir - otherwise use default $HOME/DF_Masterwork
echo $PWD | grep -qi "master\fortress\|DF\|dwarf" && installdir=$PWD || installdir="$HOME/DF_Masterwork";
# warn
{ echo "Installing DF to: $installdir \n ctrl+c to abort, ENTER to continue."; read nope; }
cp -v "$0" "$installdir/install_DF_Masterwork"
## only 64bit atm
[[ $(uname -m) == "x86_64" ]] || { echo "There is no precompiled 32-bit version of bundled libraries and Therapist available at the moment - only wine/windows version of DF might work \n ctrl+c to abort, ENTER to continue anyways."; read nope; }
#inform the user of the versions currently downloaded and how to change these
echo ""
echo ""
echo "the software in the links below will be downloaded"
echo "if there has been an update and the dl links change"
echo "we will have to point the script to the correct links"
echo "for download with wget, change the urls in the downloads list"
echo ""
echo "for git, use the git lines in the script currently commented out"
echo "git currently works and downloads the latest SWP if uncommented"
echo "with git, remember to comment out the 'http://dffd.wimbli.com/download.php?id=5315&f=MasterworkDF+V4j.rar' line so that there won't be conflicts)"
echo ""
echo "download links:
'https://dl.dropboxusercontent.com/u/60111839/template.lng'
'http://dffd.wimbli.com/download.php?id=8067&f=dfhack-0.34.11-r4-Linux.7z'
'http://mirror.selfnet.de/archlinux/multilib/os/x86_64/dwarffortress-0.34.11-4-x86_64.pkg.tar.xz'
'http://dffd.wimbli.com/download.php?id=8462&f=Dwarf-Therapist-linux-x86_64-git-20140305-2.7z'
'http://dffd.wimbli.com/download.php?id=5315&f=MasterworkDF+V4j.rar'"
{ echo "Press ctrl+c to abort, ENTER to continue."; read nope; }
#ask the user if he wants a wineprefix installed, and where
echo ""
echo ""
echo "do you want a new wineprefix installed (to run the masterwork exe for config)?"
echo "if you choose not make a new prefix, the default /home/$USER/.wine prefix will be used to launch the exe"
echo "y for new prefix, just ENTER for no new prefix, ctrl+c to abort"
read winechoice
if [ "$winechoice" = "y" ]; then
echo "specify the new full wineprefix path"
echo "or leave it blank to default to $installdir/.wine_df"
read winechoice
newwine="1"
if [ "$winechoice" = "" ]; then
wineinstalldir=$installdir/.wine_df
else
wineinstalldir=$winechoice
fi
else
newwine="0"
wineinstalldir=/home/$USER/.wine
fi
## *sigh* using archlinux package instead of official download now because it works better... uhm... on archlinux at least, that is :D if someone knows a better alternative please post it
# 'http://www.bay12games.com/dwarves/df_34_11_linux.tar.bz2'
## yaymeh: Using splintermind's git instead of 'http://dffd.wimbli.com/download.php?id=5315&f=MasterworkDF+V4i.7z' for bugfixes
## jcd: Will use the official v4j from http://dffd.wimbli.com/download.php?id=5315&f=MasterworkDF+V4j.rar since the SWP needs constant looking into
## but revert to the latest SWP in git for bugfixes if you want
downloads=(
'https://dl.dropboxusercontent.com/u/60111839/template.lng'
'http://dffd.wimbli.com/download.php?id=8067&f=dfhack-0.34.11-r4-Linux.7z'
'http://mirror.selfnet.de/archlinux/multilib/os/x86_64/dwarffortress-0.34.11-4-x86_64.pkg.tar.xz'
'http://dffd.wimbli.com/download.php?id=8462&f=Dwarf-Therapist-linux-x86_64-git-20140305-2.7z'
'http://dffd.wimbli.com/download.php?id=5315&f=MasterworkDF+V4j.rar');
# this one seems to be obsolete / segfauly: 'https://dl.dropboxusercontent.com/u/60111839/game_data.ini'
# masterword df subdirectory
masterpath='masterwork-dwarf-fortress'
# check if exists || create new
[ -d "$installdir" ] || mkdir "$installdir"
cd $installdir || exit 0
# check if we have all libraries installed & complain
for dependancy in libgail libgailutil libgdk-x11-2.0 libGLU libSDL_image-1.2 libSDL_image-1.2 libsndfile libopenal;
do
ldconfig -p | grep -q $dependancy || { echo "you might need to install a package that provides the library $dependancy \n ctrl+c to abort, ENTER to continue anyways."; read nope; }
done;
# check if we have all programs installed & complain/quit
for dependancy in wget wine winetricks unzip zsh tar 7z dos2unix git unrar;
do
which "$dependancy" || { echo "please install $dependancy, p.e.: 'sudo apt-get install $dependancy'"; exit 1; }
done;
#get and extract downloads
for download in $downloads
do
filename=$(basename "$download");
[ -f $filename ] || wget -N "$download"; #JCD wget -N doesn't redownload unless modified, still we need to change the download urls manually on version changes
case $filename in
(*.tar.bz2) tar xvjf "$filename" ;;
(*.pkg.tar.xz) tar xf "$filename" ;;
(*.zip) unzip "$filename" ;;
(*.7z) 7z x $filename ;;
(*.rar) unrar x $filename && mv MasterworkDF* $masterpath;;
esac
###JCD: commented out - i try the latest mwdf from http://dffd.wimbli.com/download.php?id=5315&f=MasterworkDF+V4j.rar
### get DF from git...
#[ -d $masterpath ] || git clone https://github.com/ppeng/masterwork-dwarf-fortress.git
### ... or update
#cd $masterpath || { echo "WTF!? can't cd into $masterpath"; exit 1; }
#git pull || { echo "git pull failed in $masterpath"; exit 1; }
### THROW AWAY ALL CHANGES
#git reset --hard
### hey, I don't know how git works, better do that one again :P
#git pull || { echo "git pull failed in $masterpath"; exit 1; }
#cd $installdir
done;
# "unfuck" (see link) the linux download a little bit. Would probably be better to do the whole https://github.com/svenstaro/dwarf_fortress_unfuck thing but... eeeh... uhm... NOPE.
## This was a baaaaaad idea :D
## Using mysterious fixed libgraphics.so instead :3 now if only I know where I got that -.- oh, it was from /opt. Thx, archlinux :D
#IFS=$(echo -en "\n\b"); for file in $(grep -l "\.png" df_linux -ri | sort -u); do sed -i 's/\.png/.bmp/g' "$file"; done;
unset IFS;
# eeeeh... I give up. Leave it like that. :P now let's <just take the archlinux package and> make a mess
# old raws need to go though. Also some configs etc.
rm opt/df_linux/raw opt/df_linux/data -r
cp -v opt/df_linux/* ./$masterpath/Dwarf\ Fortress/ -r
#patch language in DF binary (masterworks skills etc)
echo "\n\nPATCHING LANGUAGE... this could take a while..."
IFS=$(echo -en "\n\b"); for line in $(cat template.lng | tr -d "\r" | grep "|.*|.*|" | grep -v "box\|Tanner\|Cof"); do echo "$line" | IFS="|" read nope from to nope; to="${(r:${#from}:: :)${to[1,${#from}]}}"; [ "$from" != "$to" ] && { echo -n "#$from#=>#$to# //// "; sed -i "s|$from|$to|g" "./$masterpath/Dwarf Fortress/libs/Dwarf_Fortress";} done;
# and there goes dfhack...
cp -v dfhack-0.34.11-r4-Linux/* "$masterpath/Dwarf Fortress/" -r
chmod -v +x "./$masterpath/Dwarf Fortress/dfhack"
# shitty bundled version ruins everything, where did that even come from again?
#rm -v "./$masterpath/Dwarf Fortress/libs/libstdc++.so.6"
#It came from the official DF linux release, now using archlinux package ;)
md5=$(md5sum "./$masterpath/Dwarf Fortress/libs/Dwarf_Fortress" | sed "s/ .*//")
#patch new df binary md5sum into dfhack symbols.xml
sed -i "s#<md5-hash value='c55e1718c93247e702b35108c8d90e69'/>#\0\n<md5-hash value='$md5'/>#" "./$masterpath/Dwarf Fortress/hack/symbols.xml"
# wine stuff if requested
if [ "$newwine" = "1" ]; then
export WINEARCH=win32
export WINEPREFIX=$wineinstalldir/.wine_df
winetricks -q dotnet40 corefonts
fi
# therapist / patch checksum + stuff
new_weird_checksum_for_therapist="0x${md5:0:8}"
sed -i "s/0xe966ee88/$new_weird_checksum_for_therapist/g" Dwarf-Therapist/etc/memory_layouts/linux/v034.11.ini
cp -v "./$masterpath/MasterworkDwarfFortress/Utilities/DwarfTherapist/etc/game_data.ini" "./Dwarf-Therapist/etc"
cp -v "./$masterpath/MasterworkDwarfFortress/Utilities/DwarfTherapist/etc/default_gridviews.dtg" "./Dwarf-Therapist/etc/default_gridviews.dtg"
# configuration need desktop icon or something.
if [ "$newwine" = "1" ]; then
echo "
[Desktop Entry]
Name=DF Masterwork configuration (wine)
Exec=env WINEPREFIX=\"$installdir/.wine_df\" wine explorer /desktop=DFMWconfig,$(xrandr -q | grep "*" | sed "s/ *\([^ ]*\) .*/\1/") \"$installdir/$masterpath/Masterwork Dwarf Fortress.exe\"
Type=Application
StartupNotify=true
Path=$installdir/$masterpath
Icon=WHAT_I_DONT_HAVE_AN_ICON_GET_YOUR_OWN_ICON
" >| ~/Desktop/dfMasterwork_config.desktop
else
echo "
[Desktop Entry]
Name=DF Masterwork configuration (wine)
Exec= wine explorer /desktop=DFMWconfig,$(xrandr -q | grep "*" | sed "s/ *\([^ ]*\) .*/\1/") \"$installdir/$masterpath/Masterwork Dwarf Fortress.exe\"
Type=Application
StartupNotify=true
Path=$installdir/$masterpath
Icon=WHAT_I_DONT_HAVE_AN_ICON_GET_YOUR_OWN_ICON
" >| ~/Desktop/dfMasterwork_config.desktop
fi
# df needs desktop icon or something too.
echo "
[Desktop Entry]
Name=DF Masterwork (native DFhack)
Exec=\'$installdir/$masterpath/Dwarf Fortress/dfhack\'
Type=Application
StartupNotify=false
Path=$installdir/$masterpath
Icon=WHAT_I_DONT_HAVE_AN_ICON_GET_YOUR_OWN_ICON
Terminal=true
" >| ~/Desktop/dfMasterwork_native.desktop
# therapist needs desktop icon or something too too.
echo "
[Desktop Entry]
Name=Dwarf Therapist (native, Splintermind Branch)
Exec=\'$installdir/Dwarf-Therapist/DwarfTherapist\'
Type=Application
StartupNotify=false
Path=$installdir/Dwarf-Therapist
Icon=WHAT_I_DONT_HAVE_AN_ICON_GET_YOUR_OWN_ICON
Terminal=false
" >| ~/Desktop/dfMasterwork_Therapist_native.desktop
# soundsense needs desktop icon or something too too too.
echo "
[Desktop Entry]
Name=Soundsense (native)
Exec=\'$installdir/$masterpath/MasterworkDwarfFortress/Utilities/soundSense/soundSense.sh\'
Type=Application
StartupNotify=false
Path=$installdir/Dwarf-Therapist
Icon=WHAT_I_DONT_HAVE_AN_ICON_GET_YOUR_OWN_ICON
Terminal=true
" >| ~/Desktop/dfMasterwork_SOUNDSENSE.desktop
# change some default settings
## fullscreen makes your window manager sad.
sed -i "s/\[WINDOWED:NO\]/\[WINDOWED:YES\]/" "$masterpath/Dwarf Fortress/data/init/init.txt"
## truetype crashes in build menu etc
sed -i "s/\[TRUETYPE:YES\]/\[TRUETYPE:NO\]/" "$masterpath/Dwarf Fortress/data/init/init.txt"
##### This seems to have been fixed upstream, don't need those any more:
#### my mousewheel zoom was broken, this did help.
###echo "32a33,34
###> [SYM:0:Leftbracket]
###> [BUTTON:0:5]
###33a36,37
###> [SYM:0:Rightbracket]
###> [BUTTON:0:4]
###" | patch $masterpath/Dwarf\ Fortress/data/init/interface.txt
# soundsense start script is broken
dos2unix $installdir/$masterpath/MasterworkDwarfFortress/Utilities/soundSense/soundSense.sh
chmod +x $installdir/$masterpath/MasterworkDwarfFortress/Utilities/soundSense/soundSense.sh
# Therapist needs ptrace
grep -q 1 /proc/sys/kernel/yama/ptrace_scope || { echo "\n\n\nGlobal Ptrace Scope is currently set to 1. To run therapist, you need to 'sudo setcap cap_sys_ptrace=eip Dwarf-Therapist/bin/release/DwarfTherapist' (or run it as root) \n Trying now:" && sudo setcap cap_sys_ptrace=eip Dwarf-Therapist/bin/release/DwarfTherapist }
i will be monitoring and might work a little more on this script in the future.
For now urmane's build is much much easier to setupit seems to me now, that the idea of just building a linux version with each new MWDF release and provide that as the 'official' version is better that trying to create the MWDF-linux with a script for each user separately (since the script has to take into account a variety of different utilities and their different state and way of development, whenever a user builds MWDF-linux)
PS.
About soundsense,
if anyone is wondering why with *every* autoupdate after the first, it tries to download the same tracks, it is because those tracks are not in the urls provided.
After some tracking down, i was able to find them and add them to my installation, but i didn't automate the the process.
it is kind of a minor issue, as the most important sounds do work.