System wide installation on Linux.
Moderator: Moderator
System wide installation on Linux.
Need to separate binary and data. How do i do that? As far as i understand, game looks for SELFEXE variable? Where do i change it?
BTW, when i change TENGINE_HOME_PATH in t4core.lua compiler shows many warnings. It's not neccessary, is it? Game works, no problems.
BTW, when i change TENGINE_HOME_PATH in t4core.lua compiler shows many warnings. It's not neccessary, is it? Game works, no problems.
Re: System wide installation on Linux.
Don't try so hard. Pick a place, like /opt/t-engine4 or /usr/local/t-engine4. Build the game there. Then write a script and put it in /usr/local/bin/tome4 or whatever you want to call it:
Voila.
Code: Select all
#!/bin/sh
cd /opt/t-engine4 || exit
exec ./t-engine ${1+"$@"}
Re: System wide installation on Linux.
Same thing as greycat's suggestion.Dinth wrote:http://aur.archlinux.org/packages/tome4/PKGBUILD
Wish i could move binary...

Re: System wide installation on Linux.
I did it.
With this saves will be in $GAME_STATEDIR and data (bootstrap and game folders) can be anywhere $GAMES_DATADIR points to. Doesn't matter where you place executable.

Code: Select all
#Fix saves dir
sed -i -e "s:\.t-engine:tome4:g" build/te4core.lua
sed -i -e "s:PHYSFS_getUserDir():\"${GAMES_STATEDIR}\":" src/physfs.c
#Fix data dir
sed -i \
-e "s:local dir = __SELFEXE:local dir = \"${GAMES_DATADIR}/tome4/tome4\":" \
-e 's|print(".*", dir)|print("Loading data from:", dir)|' \
-e "s:fs.mount(\"game\":fs.mount(\"${GAMES_DATADIR}/tome4/game\":" \
bootstrap/boot.lua
sed -i \
-e "s:PHYSFS_mount(selfexe:PHYSFS_mount(\"${GAMES_DATADIR}/tome4/tome4\":" \
-e "s:PHYSFS_mount(\"bootstrap\":PHYSFS_mount(\"${GAMES_DATADIR}/tome4/bootstrap\":" \
src/main.c
Re: System wide installation on Linux.
Ignoring for the moment that GNU sed's -i switch is unportable, this is a really, really bad way to make a diff. What you should do instead is make a backup copy of the source dir, edit the files, then use "diff -u -r olddir newdir" to generate a diff file showing the changes you've made in context. Context diffs (actually -u is a "unified diff" but it's similar) can be applied using patch(1).
Now, that said, the changes you've made don't really look correct to me. Among other things, you claim it "doesn't matter where you put the executable", but your sed command is putting the actual value of your variable into the source code -- it's not putting a call to "retrieve environment variable foo and use its value" in the source code. But I'm not a Lua expert, so hey... maybe there's something I don't know.
I also don't understand why you changed .t-engine to tome4.
Now, that said, the changes you've made don't really look correct to me. Among other things, you claim it "doesn't matter where you put the executable", but your sed command is putting the actual value of your variable into the source code -- it's not putting a call to "retrieve environment variable foo and use its value" in the source code. But I'm not a Lua expert, so hey... maybe there's something I don't know.
I also don't understand why you changed .t-engine to tome4.
Re: System wide installation on Linux.
Tried to do as few corrections as possible. But diff can't substitute environment variables like sed, that means writting new functions for premake, so it would accept path as option. And main source needs a few corrections...
Next, this is done for ebuild. All variables exist only in compile time, that's why i'm putting them in source. Anyway, who needs to move game folders after intstallation? Executable can be moved, but not game folders.
tome4 is an example. In ebuild it uses $PN (package name) to be consistent.
Next, this is done for ebuild. All variables exist only in compile time, that's why i'm putting them in source. Anyway, who needs to move game folders after intstallation? Executable can be moved, but not game folders.
tome4 is an example. In ebuild it uses $PN (package name) to be consistent.
Re: System wide installation on Linux.
Exactly my point! Build it where it's supposed to be in the first place, and then you won't have to move it. Or modify it.zlkndu wrote: Anyway, who needs to move game folders after intstallation? Executable can be moved, but not game folders.
Re: System wide installation on Linux.
The problems are:
1. T-engine looks for data folders in the same directory it runs from. We can't compile src in /usr/share/games than take binary and move it to /usr/games/bin
2. Save folders created in user's home dir. We can't specify folder relative to /
1. T-engine looks for data folders in the same directory it runs from. We can't compile src in /usr/share/games than take binary and move it to /usr/games/bin
2. Save folders created in user's home dir. We can't specify folder relative to /
Re: System wide installation on Linux.
Sure you can.
mkdir -p /usr/share/games && cd "$_"
extract t-engine tarball, move source dir to t-engine4, however makes sense
cd t-engine4
premake4 gmake && make
cat <<EOF >/usr/games/bin/tome4
#!/bin/sh
cd /usr/share/games/t-engine4 || exit
exec ./t-engine ${1+"$@"}
EOF
chmod +x /usr/games/bin/tome4
mkdir -p /usr/share/games && cd "$_"
extract t-engine tarball, move source dir to t-engine4, however makes sense
cd t-engine4
premake4 gmake && make
cat <<EOF >/usr/games/bin/tome4
#!/bin/sh
cd /usr/share/games/t-engine4 || exit
exec ./t-engine ${1+"$@"}
EOF
chmod +x /usr/games/bin/tome4
Re: System wide installation on Linux.
That is not executable, but a script.
And it doesn't fix save dir.

Re: System wide installation on Linux.
The save dir is not broken. Games are saved in the invoking user's home directory. I don't see what you're trying to achieve here.
Re: System wide installation on Linux.
Symbolic links?
I must admit, most of what you said doesn't make sense to me, as I am n00b with linux, but it feels like symlinks might help...
I must admit, most of what you said doesn't make sense to me, as I am n00b with linux, but it feels like symlinks might help...
Re: System wide installation on Linux.
I want saves in /var/games/tome4
Symbolic links are not good, they add unnecessary files.
Symbolic links are not good, they add unnecessary files.
Re: System wide installation on Linux.
I really don't understand why you want to write save games in a system-wide place, where you have to worry about permissions, and people deleting other people's saves, and so on. The home directory is perfect -- you don't have to do setgid games, audit the damned thing for security holes, etc. the way you'd have to do for a system-wide save location.
Granted, if you do setgid games, audit, etc., then you can stop savefile cheating. If that's even an issue. But somehow I think you are not in fact doing all that work....
Anyway. Enough of this. I've told you how it should be done. If you insist on this insanity, so be it.
Granted, if you do setgid games, audit, etc., then you can stop savefile cheating. If that's even an issue. But somehow I think you are not in fact doing all that work....
Anyway. Enough of this. I've told you how it should be done. If you insist on this insanity, so be it.