Bay 12 Games Forum

Please login or register.

Login with username, password and session length
Advanced search  
Pages: [1] 2

Author Topic: [Linux] MDF V4j for linux  (Read 7386 times)

urmane

  • Bay Watcher
    • View Profile
[Linux] MDF V4j for linux
« on: May 02, 2014, 05:06:09 pm »

Available here: http://dffd.wimbli.com/file.php?id=8548

MasterworkDF V4j
df_linux 34.11
dfhack r4 git on May 1
Dwarf-Therapist git on May 1 (requires QT5)
soundSense (removed all the soundpacks, as they add 300MB - you can autodownload them once it's running)
all of Putnam's scripts git on May 1: badThoughtCheck, itemsyndrome, projectileExpansion, moddableGods, force, instant_transmission, shapechange, take-slave, teleport, Spawnunit, skilroll, hackWish, skillChange (none have been tested, tho)

Changes:
Windowed mode on by default
Truetype mode off by default
Default path costs changed from 1:1:5:25 to 1:2:5:25
"cls" commented out of dfhack.init
keybindings rearranged for easier reading (but now that it's done, maybe not ...)

Let me know what you think.
Logged

Thelo

  • Bay Watcher
    • View Profile
Re: [Linux] MDF V4j for linux
« Reply #1 on: May 04, 2014, 04:24:12 am »

I downloaded and can't find the launcher anywhere.
Logged

Meph

  • Bay Watcher
    • View Profile
    • worldbicyclist
Re: [Linux] MDF V4j for linux
« Reply #2 on: May 04, 2014, 05:42:08 am »

The launcher will probably not work on linux.

Urmane, could you enable all civs manually and reupload it? This way linux players would have access to Orcs, Kobolds, Warlocks and Gnomes, although I have no idea how the different scripts work or not work on linux.

I will add this to the first post, it has been a while that linux or mac versions had been made, thank you. :)
Logged
::: ☼Meph Tileset☼☼Map Tileset☼- 32x graphic sets with TWBT :::
::: ☼MASTERWORK DF☼ - A comprehensive mod pack now on Patreon - 250.000+ downloads and counting :::
::: WorldBicyclist.com - Follow my bike tours around the world - 148 countries visited :::

Thelo

  • Bay Watcher
    • View Profile
Re: [Linux] MDF V4j for linux
« Reply #3 on: May 04, 2014, 07:21:47 am »

Hmmm... then... a little help about how to configure and launch? :)
Logged

urmane

  • Bay Watcher
    • View Profile
Re: [Linux] MDF V4j for linux
« Reply #4 on: May 04, 2014, 09:55:27 am »

Until the launcher works, do what I do - use three terminals:

To launch the game:
cd Dwarf\ Fortress
./dfhack

To launch soundSense use another window:
cd MasterworkDwarfFortress/Utilities/soundSense
./soundSense.sh ../../../Dwarf\ Fortress/gamelog.txt

To launch therapist use another window:
cd MasterworkDwarfFortress/Utilities/DwarfTherapist
sudo ./DwarfTherapist
Logged

Thelo

  • Bay Watcher
    • View Profile
Re: [Linux] MDF V4j for linux
« Reply #5 on: May 04, 2014, 10:00:53 am »

I'm using Mint, and I think I will have problems with ptrace. I haven't been able to solve them in the past, what makes the use of Therapist impossible. :(
Logged

urmane

  • Bay Watcher
    • View Profile
Re: [Linux] MDF V4j for linux
« Reply #6 on: May 04, 2014, 10:30:33 am »

The launcher will probably not work on linux.

Urmane, could you enable all civs manually and reupload it? This way linux players would have access to Orcs, Kobolds, Warlocks and Gnomes, although I have no idea how the different scripts work or not work on linux.

I will add this to the first post, it has been a while that linux or mac versions had been made, thank you. :)

Will do, Meph.

I cannot for the life of me get dotnet40 working on linux - must be some mental block.  I'll add back what appears to be needed for launching / settings, and hopefully others can use them.  The current file has all dll and exe removed to save space - to keep launcher / settings, please verify this list of files looks right for that:
Spoiler (click to show/hide)

Also, please verify what the GUI does to turn on/off settings - I want to make sure any changes that I package are done correctly.  It appears to me that for FEATURE one does a mass search-and-replace in raw/objects from "YESFEATURE[" to "!NOFEATURE!" or vice-versa.  Is that right?

Last question - is there a version of raw/objects/plant_standard.txt with the original GROWDURs?  I cannot see how to change plant harvest times from MDF-standard one year duration back to vanilla-standard one season-ish durations - those don't appear to be attached to a YESx or !NOx!
Logged

Meph

  • Bay Watcher
    • View Profile
    • worldbicyclist
Re: [Linux] MDF V4j for linux
« Reply #7 on: May 04, 2014, 10:51:50 am »

There are literally hundretd of setting. I would say that the only important ones are in the entity files. Just add the missin [ to the Object:Entity and the Controllable. That should add them to the worldgen and make them selectable.

Your idea about the yes/no is correct, but not all work like this.

The list of files looks like it includes everything thats needed. :)
Logged
::: ☼Meph Tileset☼☼Map Tileset☼- 32x graphic sets with TWBT :::
::: ☼MASTERWORK DF☼ - A comprehensive mod pack now on Patreon - 250.000+ downloads and counting :::
::: WorldBicyclist.com - Follow my bike tours around the world - 148 countries visited :::

urmane

  • Bay Watcher
    • View Profile
Re: [Linux] MDF V4j for linux
« Reply #8 on: May 06, 2014, 01:31:05 pm »

Done.

I added in a little shell script called mdf-config that may help linux users who cannot run the GUI.  It will enable or disable features that are simple raw substitutions of YESX[ to !NOX! and vice-versa.  Be warned that it does only that - it does not know about dependencies or related features.

Example:
Code: [Select]
./mdf-config disable smelting learning warp ssc simplewood
./mdf-config enable ff_trees ff_plants allmeat gemshape tree morewood harderinvader strongtrap gem stone min
./mdf-config list
Logged

rethnor

  • Bay Watcher
    • View Profile
Re: [Linux] MDF V4j for linux
« Reply #9 on: May 07, 2014, 01:59:47 pm »

I can't wait to give this a shot. I've been wanting to do this but I don't want to take the time to learn about modding in DF.

what needs to be done to get the linux version to work? would it be possible to automate the process?
Logged

urmane

  • Bay Watcher
    • View Profile
Re: [Linux] MDF V4j for linux
« Reply #10 on: May 07, 2014, 11:05:53 pm »

what needs to be done to get the linux version to work? would it be possible to automate the process?

It works now.

Not sure what automation you want - if you have dotnet40, you should be able to run the exe with wine; if not, I added start-df, start-sound, and start-therapist scripts in the top-level directory.  Run them from three terminal windows.  Note that you'll need QT5 for therapist, and you should run the sound update to auto-download the soundpacks.
Logged

jcd

  • Bay Watcher
    • View Profile
Re: [Linux] MDF V4j for linux
« Reply #11 on: May 08, 2014, 03:44:56 am »

not exactly related to urmanes version, but this way to make mwdf-linux should also be noted:
 
I tried again yaymeh's script mentioned in the link below (with slight changes since my wine is working fine with the launcher exe, so no need for new prefix)
http://www.bay12forums.com/smf/index.php?topic=136827.0

it is important to note that the script downloads by default the SWP version from git.
from what i see though, the splintermind (https://github.com/splintermind/masterwork-dwarf-fortress) branch is old,
and by looking at the SWP thread i see that the lastest SWP is here: https://github.com/ppeng/masterwork-dwarf-fortress

so i changed the appropriate line in the script from
Code: [Select]
[ -d $masterpath ] || git clone https://github.com/splintermind/masterwork-dwarf-fortress.git
(this had latest commits 2 months ago)
to
Code: [Select]
[ -d $masterpath ] || git clone https://github.com/ppeng/masterwork-dwarf-fortress.git
(this had latest commits 8 days ago)

still, i am not certain that this is the latest or even stable.
maybe it is possible to just download win 4j, unpack in the script's install dir and then run the script, having deleted the git related lines
Code: [Select]
# 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
i haven't tested the above yet, but i think i will do that sometime soon

the script as i used it is here:

Code: [Select]
#!/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.

# 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; }

## *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'
## Using splintermind's git instead of 'http://dffd.wimbli.com/download.php?id=5315&f=MasterworkDF+V4i.7z' for bugfixes
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');
# 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;
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 "$download";
case $filename in
(*.tar.bz2) tar xvjf "$filename" ;;
(*.pkg.tar.xz) tar xf "$filename" ;;
(*.zip) unzip "$filename" ;;
(*.7z) 7z x $filename ;;
esac

# 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"

# 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.
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

# 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 }

and it works, but i sadly do not know what version of mwdf is running
i still can use the mwdf launcher exe with wine to choose what options i need, then run mwdf natively in linux,
with dfhack, soundsense and dftherapist, to boot.

it 'd be nice if we had 'official' latest (stable AND testing to choose from?) release of mwdf in git (or somewhere similar) so that we could point the script there.
that way the script would create the latest mwdf version every time.
(i admit i havent looked too closely into what versions of dfhack and dftherapist yaymeh's script downloads (it has to download them, since the mwdf includes only the windows versions of these), and script needs more polishing, e.g. to give info on what it does/downloads, but it does work for now - just remember to run it in zsh)

i'm positive, that with some more work, this will be able to install/update mwdf-linux as needed every time mwdf is updated.
maybe i will even try to do that soon :D
;)
« Last Edit: May 08, 2014, 03:54:54 am by jcd »
Logged

jcd

  • Bay Watcher
    • View Profile
Re: [Linux] MDF V4j for linux
« Reply #12 on: May 08, 2014, 10:44:21 am »

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...

Code: [Select]
#!/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 setup

it 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.
« Last Edit: May 08, 2014, 11:06:31 am by jcd »
Logged

greycat

  • Bay Watcher
    • View Profile
Re: [Linux] MDF V4j for linux
« Reply #13 on: June 05, 2014, 09:32:58 am »

Trying to run this on Debian 7.5 amd64:

Code: [Select]
~/df/MasterworkDF_linuxV4j/Dwarf Fortress$ ./dfhack
./libs/Dwarf_Fortress: /lib/i386-linux-gnu/i686/cmov/libc.so.6: version `GLIBC_2.15' not found (required by ./hack/libdfhack.so)
-e


Debian 7.x has glibc version 2.13, not 2.15.  Using nm -D on the library shows symbols like GLIBC_2.13 (and lower); nothing higher.
Logged
Hell, if nobody's suffocated because of it, it hardly counts as a bug! -- StLeibowitz

Meph

  • Bay Watcher
    • View Profile
    • worldbicyclist
Re: [Linux] MDF V4j for linux
« Reply #14 on: June 05, 2014, 09:33:56 am »

Logged
::: ☼Meph Tileset☼☼Map Tileset☼- 32x graphic sets with TWBT :::
::: ☼MASTERWORK DF☼ - A comprehensive mod pack now on Patreon - 250.000+ downloads and counting :::
::: WorldBicyclist.com - Follow my bike tours around the world - 148 countries visited :::
Pages: [1] 2