Linux stuff pt.2

This commit is contained in:
ROllerozxa 2022-08-09 15:05:07 +02:00
commit 39c5dd2b6d
11 changed files with 33 additions and 30 deletions

View file

@ -62,29 +62,31 @@ $ ./go
Principia will launch if everything was successful. Note that the compilation might take up to 10 minutes depending on your system.
## Building on Linux (Debian)
## Building on Linux
Install dependencies:
Install dependencies (example is for Debian-based packages):
$ sudo apt-get install automake libgtk2.0-dev libgl-dev libxss-dev libxxf86vm-dev libasound2-dev libudev-dev valgrind
$ sudo apt-get install automake libgtk2.0-dev libgl-dev libxss-dev libxxf86vm-dev libasound2-dev libudev-dev valgrind
Navigate to the build-linux directory and start the building process:
$ cd build-linux;
$ cd build-linux;
$ ./autogen.sh
$ ./configure
$ ./go
$ ./autogen.sh
If everything goes well, Principia will start by default unless `--silent` is passed to the `go` script.
$ ./configure
### Packaging for Linux
When building Principia for packaging, you would want to use the following command to replace the above. It will clean the source tree, build a release version and not automatically run Principia.
$ ./go
./go --clean --release --silent
If everything goes well, Principia will start but then freeze at the loading screen due some uninitialize directories. Terminate Principia by replying 'y' in the gdb prompt in the terminal, then in the same terminal, go up a directory and launch it from the parent directory instead:
$ cd ..
$ build-linux/apparatus2
Right now Principia needs to be installed with its executable next to the data directories. Putting all of that in `/opt/principia/` and symlinking `/usr/bin/principia` => `/opt/principia/principia` should do for now.
(this bug will be fixed in short)
The `build-linux` directory contains desktop files and an usable icon, which can be installed into `/usr/share/applications/` and `/usr/share/pixmaps` respectively. `principia-url-handler.desktop` is for handling principia:// protocol links and is confirmed to work on at least Firefox and Chromium.
## Building for Android (on Linux)

View file

@ -1 +0,0 @@
../data-pc

1
build-linux/data-pc Symbolic link
View file

@ -0,0 +1 @@
../data-pc/

View file

@ -1 +0,0 @@
../data-shared

1
build-linux/data-shared Symbolic link
View file

@ -0,0 +1 @@
../data-shared/

View file

@ -148,10 +148,8 @@ if [ "$run" -eq "1" ]; then
elif [ "$debug" -eq "4" ]; then # --leak
valgrind --suppressions=./valgrind.supp --tool=memcheck --leak-check=full --show-possibly-lost=yes --track-origins=yes ./apparatus2
elif [ "$debug" -eq "1" ]; then
cd ../
gdb -ex run -ex quit build-linux/apparatus2
gdb -ex run -ex quit ./apparatus2
else
cd ../
build-linux/apparatus2
./apparatus2
fi
fi

View file

@ -1,5 +0,0 @@
#!/bin/sh
gconftool-2 -t string -s /desktop/gnome/url-handlers/principia/command "`pwd`/principia %s"
gconftool-2 -s /desktop/gnome/url-handlers/principia/needs_terminal false -t bool
gconftool-2 -t bool -s /desktop/gnome/url-handlers/principia/enabled true

0
build-screenshot-linux/autogen.sh Normal file → Executable file
View file

View file

@ -1 +0,0 @@
../data-pc

View file

@ -0,0 +1 @@
../data-pc/

View file

@ -1 +0,0 @@
../data-shared

View file

@ -0,0 +1 @@
../data-shared/

0
build-screenshot-linux/go Normal file → Executable file
View file

View file

@ -6,6 +6,8 @@
#include <sys/types.h>
#include <pwd.h>
#include <cxxabi.h>
#include <unistd.h>
#include <libgen.h>
#include <tms/core/project.h>
#include <tms/core/event.h>
@ -46,8 +48,8 @@ int _pipe_listener(void *p)
ssize_t sz;
while (1) {
tms_infof("attempting to open principia.run O_RDONLY");
while ((pipe_h = open("principia.run", O_RDONLY)) == -1) {
tms_infof("attempting to open /tmp/principia.run O_RDONLY");
while ((pipe_h = open("/tmp/principia.run", O_RDONLY)) == -1) {
if (errno != EINTR)
return 1;
}
@ -57,7 +59,7 @@ int _pipe_listener(void *p)
if (sz > 0) {
buf[sz] = '\0';
_args[1] = buf;
_args[1] = buf;
tproject_set_args(2, _args);
}
}
@ -78,7 +80,7 @@ main(int argc, char **argv)
SDL_Event ev;
int done = 0;
int status = mkfifo("principia.run", S_IWUSR | S_IRUSR);
int status = mkfifo("/tmp/principia.run", S_IWUSR | S_IRUSR);
int skip_pipe = 0;
if (status == 0) {
@ -89,9 +91,9 @@ main(int argc, char **argv)
skip_pipe = 1;
}
}
if (!skip_pipe) {
if ((pipe_h = open("principia.run", O_WRONLY | O_NONBLOCK)) == -1) {
if ((pipe_h = open("/tmp/principia.run", O_WRONLY | O_NONBLOCK)) == -1) {
if (errno != ENXIO) {
skip_pipe = 1;
tms_infof("error: %s", strerror(errno));
@ -116,6 +118,12 @@ main(int argc, char **argv)
SDL_CreateThread(_pipe_listener, "_pipe_listener", 0);
}
char buf[512];
readlink("/proc/self/exe", buf, 511);
dirname(buf);
tms_infof("chdirring to %s", buf);
chdir(buf);
char path[512];
const char *storage = tbackend_get_storage_path();
static const char *dirs[] = {

View file

@ -1 +0,0 @@
../

View file

@ -0,0 +1 @@
../