Scheduled Maintenance: We are aware of an issue with Google, AOL, and Yahoo services as email providers which are blocking new registrations. We are trying to fix the issue and we have several internal and external support tickets in process to resolve the issue. Please see: viewtopic.php?t=158230

 

 

 

Compiled my first game from source

Off-Topic discussions about science, technology, and non Debian specific topics.
Post Reply
Message
Author
Wheelerof4te
Posts: 1454
Joined: 2015-08-30 20:14

Compiled my first game from source

#1 Post by Wheelerof4te »

I just compiled 0.a.d from source, and the feeling is...wonderful. Yes, it did take a while, yes there is a faster way. But damn, that was cool. There are some questions for those more experienced, so here I go:
1) Will my game compile itself all over when packagers release new version? Or will only changed code re-complile?
2) How to overwrite sources when new version comes? Should I just re-dowload and extract over the old directories before I re-compile it all over?
3) I understand that most newer software can be compiled from source and be run on an older system. For example, 0.a.d build manual mentions Debian Jessie. Are there specific build instructions for most popular software online? In other words, if build tools support it, I could run newer software even on old systems.

Compiling was done on fixed Ubuntu 17.10.1. Stretch is too buggy right now and I didn't have time for setting it up again.
*uck the PPAs, who needs them? :D
EDIT:
This is what I have in 0.a.d folder:

Code: Select all

~/0ad/0ad-0.0.22-alpha$ ls
binaries   license_dbghelp.txt   license_mit.txt  source
build      license_gpl-2.0.txt   LICENSE.txt
libraries  license_lgpl-2.1.txt  README.txt
What can I remove, since all this is taking up over 6.6 GB? Do I need only binaries for now?

User avatar
pylkko
Posts: 1802
Joined: 2014-11-06 19:02

Re: Compiled my first game from source

#2 Post by pylkko »

The answers are "it depends".

How did you compile from what? Did you make a Debian package or did you just compile e.g C source code to a binary. There is a guide on this forum called "compiling for debian the smart way" or sometihng to that extent that tells how to make a .deb

1) Normally when you compile e.g. C source code, you input the source and the compiler prepares the binary/binaries. If you then need to change something, you need to recompile the entire binary from scratch. You can, of course, script a setup where you pull a source code and have it compiled in the case there is a diff. You could also use the Open build system.

2) There are many ways. One is to simply decompress files on top of older ones. Then there are version management systems like git, so that you can have many versions of the same code and automatically "sync" the code with another location and so on.

3) It depends on how the build is done. For example, if the build links in a lib that is not present in the ols system, then you will either need to also get that lib on the older system or recompile against what is present on the old system

Wheelerof4te
Posts: 1454
Joined: 2015-08-30 20:14

Re: Compiled my first game from source

#3 Post by Wheelerof4te »

Thank you for the detailed answer. All I did is

Code: Select all

make -j3
as the last step to get the game and run binaries/system/pyrogenesis from the main directory. I didn't build the package, but from your answer I should have.
Nevermind that, it was a nice experience. I'm on Sid now.

User avatar
stevepusser
Posts: 12930
Joined: 2009-10-06 05:53
Has thanked: 41 times
Been thanked: 71 times

Re: Compiled my first game from source

#4 Post by stevepusser »

Yes, it's much better to build Debian packages from "debianized" source files: http://forums.debian.net/viewtopic.php?t=38976

You can also set up pbuilds for other releases or even Ubuntu on your Debian install...such as compile Stretch packages on Sid, or vice versa. Most packages build correctly in a pbuild for me, but some are...troublesome. You can even hook and unhook other derivative distro's repositories to a basic Debian one to convert them quickly back and forth, or use a folder on your machine as a local repository for the pbuilds: https://forum.mxlinux.org/viewtopic.php?f=86&t=42763

Another way is to use the free openSUSE Build Service to build packages from debianized sources for you in the "cloud" and host them for the world to use, like this repo I have for the Featherpad text editor: https://build.opensuse.org/package/show ... featherpad
MX Linux packager and developer

User avatar
pylkko
Posts: 1802
Joined: 2014-11-06 19:02

Re: Compiled my first game from source

#5 Post by pylkko »

OK, so you used a make file. If you look at the file, you will see that it is a script (kind of like a bash script) that performs all the commands needed to get the source compiled. https://en.m.wikipedia.org/wiki/Makefile

There is no reason that you should not search for / create code that can be made into debs other than it is really handy. When you start adding progrmas all over your system and recompiling newer and modified versions you might easily loose track of what you have ahead and even possibly loose some software for ever when you reinstall the OS and forget that something important is there or whatever

User avatar
stevepusser
Posts: 12930
Joined: 2009-10-06 05:53
Has thanked: 41 times
Been thanked: 71 times

Re: Compiled my first game from source

#6 Post by stevepusser »

One of the best reasons to use debianized source is that it often includes patches or build tweaks that fix bugs or build problems that will have you tearing your hair out otherwise. Since you are on Sid and use the very latest gcc version, I think you'll eventually find a lot of programs that won't compile with that gcc without fixes.

Right now I'm really having trouble building Pale Moon packages on Debian testing and Ubuntu 17.10 with gcc-4.9 (the recommended way), since their libc6 2.26 causes a build failure with an "isinfinite" function. I can build PM with gcc-6 on those platforms, but then testers report that the browser crashes a lot. But if I ever do figure it out, then anyone that uses my debianized source automatically gets the fix.
MX Linux packager and developer

Wheelerof4te
Posts: 1454
Joined: 2015-08-30 20:14

Re: Compiled my first game from source

#7 Post by Wheelerof4te »

Thanks steve for the link to building the .debs from source. I'm amazed the procedure has remained almost the same for so long. So, source has to be pulled from Sid or Testing via

Code: Select all

apt-get source <packagename>
in order to build a backported version? Then why would one want to pull source from Stable? I guess for patching leftover bugs...

User avatar
Head_on_a_Stick
Posts: 14114
Joined: 2014-06-01 17:46
Location: London, England
Has thanked: 81 times
Been thanked: 132 times

Re: Compiled my first game from source

#8 Post by Head_on_a_Stick »

Wheelerof4te wrote:why would one want to pull source from Stable?
In case you wanted to apply different compile-time options (or add patches, as you note) — for example, I like a very specific set of ./configure options for urxvt and I can build a custom package by editing debian/rules and changing the flags.

Have you tried apt-build(1) yet?
apt-build - Fetch sources and build packages optimized for your architecture.
This command will rebuild your entire system from source with architecture-optimised compilation flags (just like Gentoo):

Code: Select all

# apt-build world
How cool is that?

EDIT: dammit there goes the palindrome :cry:
deadbang

Wheelerof4te
Posts: 1454
Joined: 2015-08-30 20:14

Re: Compiled my first game from source

#9 Post by Wheelerof4te »

Head_on_a_Stick wrote:This command will rebuild your entire system from source with architecture-optimised compilation flags:

Code: Select all

apt-build world
Head_on_a_Stick wrote:How cool is that?
Really cool :D How long would it take, though? Days?

Now I understand much better why FF57+ can't be built for Stable, because there is no required dependency rust. Can rust itself be built and then backported via point release to, say, Debian 9.5? That would make sense to me now, unless rust could break some things in Stable.

User avatar
Head_on_a_Stick
Posts: 14114
Joined: 2014-06-01 17:46
Location: London, England
Has thanked: 81 times
Been thanked: 132 times

Re: Compiled my first game from source

#10 Post by Head_on_a_Stick »

Wheelerof4te wrote:How long would it take, though?
Please post the output of

Code: Select all

# time apt-build world
:mrgreen:
deadbang

Wheelerof4te
Posts: 1454
Joined: 2015-08-30 20:14

Re: Compiled my first game from source

#11 Post by Wheelerof4te »

Installing apt-build pulls in a bunch of libs. Won't risk it right now on Sid:

Code: Select all

The following NEW packages will be installed:
  apt-build at autoconf automake autopoint autotools-dev build-essential
  dctrl-tools debhelper debian-keyring devscripts dh-autoreconf
  dh-strip-nondeterminism diffstat dpkg-dev dput equivs exim4-base
  exim4-config exim4-daemon-light g++ g++-7 gettext git git-man guile-2.0-libs
..cue a bunch more lib packages
But it's nice to have an easier option.

User avatar
stevepusser
Posts: 12930
Joined: 2009-10-06 05:53
Has thanked: 41 times
Been thanked: 71 times

Re: Compiled my first game from source

#12 Post by stevepusser »

You can automate getting the sources with the commands in that guide, but I don't like adding and removing repos to my sources, so just I download the sources directly from packages.debian.org and extract them with

Code: Select all

dpkg-source -x <name-of-.dsc-file>
Tab-complete will save you typing in the name of the .dsc file.

The same procedure works with Ubuntu repos, or others such as PPAs. You can download the source files directly from the repository for PPAs, such as the 0ad PPA: http://ppa.launchpad.net/wfg/0ad/ubuntu/pool/main/0/
MX Linux packager and developer

Post Reply