How do I build Unity from source?

htorque

I'd like to know how I would build Unity from source code in the current development release. Please cover the following topics:

  • Which packages are needed to compile Unity?
  • Where would I get the current source code?
  • What are the steps to actually configure and compile Unity?
  • Is it possible to safely run the latest version alongside the version from the repositories?
Stefano Candori

Building Unity from Source

In this guide you will build a separated version of Unity trunk (locally installed to your home directory), so you don't need to worry about corrupting the version from the Ubuntu repositories and you also won't need to get root permissions throughout the whole process (except for installing the build dependencies).

0. Installing build dependencies

You'll need to run this once to install all necessary build dependencies:

sudo apt-get install bzr cmake compiz-dev gnome-common libbamf3-dev libboost-dev \
libboost-serialization-dev libgconf2-dev libgdu-dev libglewmx1.6-dev \
libgnome-desktop-3-dev libibus-1.0-dev libindicator3-dev libjson-glib-dev \
libnotify-dev libnux-2.0-dev libpci-dev libsigc++-2.0-dev libunity-dev \
libunity-misc-dev libutouch-geis-dev libxxf86vm-dev libzeitgeist-dev xsltproc

If you have source code repositories (aka deb-src) enabled, you can instead use:

sudo apt-get build-dep unity

1. Preparing the environment

Replace SOURCE and PREFIX with the directories you'd like the source and build files to go. In this example I put both in my home directory:

export SOURCE=$HOME/source/unity
export PREFIX=$HOME/build/unity

export PKG_CONFIG_PATH="$PREFIX/lib/pkgconfig:$PKG_CONFIG_PATH"
export LD_LIBRARY_PATH="$PREFIX/lib:$LD_LIBRARY_PATH"
export LD_RUN_PATH="$PREFIX/lib:$LD_RUN_PATH"
export XDG_DATA_DIRS="$PREFIX/share:$XDG_DATA_DIRS"

mkdir -p "$PREFIX"
mkdir -p "$SOURCE"
cd "$SOURCE"

2. Building Nux

You will probably need to grab the latest version of Nux to get Unity trunk to compile:

bzr branch lp:nux
cd nux
./autogen.sh --disable-examples --disable-gputests --disable-tests --prefix="$PREFIX"
make -j4
make install
cd ..

Tip: Most modern desktops and laptops have several cores. You can greatly speed up the compilation by taking advantage of this. The make command has build-in support for this which you can activate using the -jN switch where N is the number of jobs to run in parallel. A good rule of thumb is to run 2 times the number of cores on your processor. Thus, on a normal dual core computer you should run make -j4 to minimize the compilation time.

3. Building Unity

Now grab the latest Unity code and build it:

bzr branch lp:unity
cd unity
mkdir build
cd build
cmake .. -DCMAKE_BUILD_TYPE=Debug -DCOMPIZ_PLUGIN_INSTALL_TYPE=local -DGSETTINGS_LOCALINSTALL=ON -DCMAKE_INSTALL_PREFIX="$PREFIX"
make -j4
make install

That's it, log out and back in again and you should be running the latest Unity. Alternatively, you can run

setsid $PREFIX/bin/unity

4. Updating

Make sure to prepare the environment like described in step 1, then simply enter both top-level directories nux and unity, run bzr pull, rebuild, and reinstall.

I suggest removing and recreating the build directory in the unity directory, to make sure no old files are messing with your build.

5. Removing Unity

Remove the three directories $SOURCE, $PREFIX and ~/.compiz-1.


Useful Link:

Collected from the Internet

Please contact [email protected] to delete if infringement.

edited at
0

Comments

0 comments
Login to comment

Related

From Dev

How do I build Boost from github?

From Dev

How do I build Libgdx.so from source for Android with gdb tracing enabled?

From Dev

How do I build and install a Puppet module locally from source?

From Dev

How can I build KDE Dolphin from its source code?

From Dev

How do I refresh/reload my DataTable from HTML source

From Dev

How do I create an Akka Source[String] from a text file?

From Dev

How do I fetch Cake Build prerelease addin from alternative source?

From Dev

How do I build Nautilus 3.70/3.80 from source?

From Dev

How do I compile the latest gvim from source

From Dev

How do I update Ubuntu packages from source?

From Dev

How do I make a Theme from scratch for Unity?

From Dev

How do I build libcurl from source?

From Dev

How do I use the output of a program from an earlier part of a Stack/Cabal build as source in a later part of the same build?

From Dev

How do I build Nautilus 3.70/3.80 from source?

From Dev

How do I compile the latest gvim from source

From Dev

How do I update Ubuntu packages from source?

From Dev

How do I build libcurl from source?

From Dev

How do I make a Theme from scratch for Unity?

From Dev

How do I extract the source MAC from a [UFW BLOCK] entry?

From Dev

How do I finish the installation of a program from source?

From Dev

How do I build Boost from github?

From Dev

How do I build Libgdx.so from source for Android with gdb tracing enabled?

From Dev

How do I compile from source on github?

From Dev

How do I build Tmux from source without root access with a custom-built libevent 2.1?

From Dev

How do I switch from Unity 8 in Ubuntu 16.10?

From Dev

How do I build a Virtual Reality videoplayer without Unity?

From Dev

How do I uninstall Unity 8 from my desktop computer?

From Dev

How to build Compiz from source?

From Dev

What is the advantage to build unity from source

Related Related

  1. 1

    How do I build Boost from github?

  2. 2

    How do I build Libgdx.so from source for Android with gdb tracing enabled?

  3. 3

    How do I build and install a Puppet module locally from source?

  4. 4

    How can I build KDE Dolphin from its source code?

  5. 5

    How do I refresh/reload my DataTable from HTML source

  6. 6

    How do I create an Akka Source[String] from a text file?

  7. 7

    How do I fetch Cake Build prerelease addin from alternative source?

  8. 8

    How do I build Nautilus 3.70/3.80 from source?

  9. 9

    How do I compile the latest gvim from source

  10. 10

    How do I update Ubuntu packages from source?

  11. 11

    How do I make a Theme from scratch for Unity?

  12. 12

    How do I build libcurl from source?

  13. 13

    How do I use the output of a program from an earlier part of a Stack/Cabal build as source in a later part of the same build?

  14. 14

    How do I build Nautilus 3.70/3.80 from source?

  15. 15

    How do I compile the latest gvim from source

  16. 16

    How do I update Ubuntu packages from source?

  17. 17

    How do I build libcurl from source?

  18. 18

    How do I make a Theme from scratch for Unity?

  19. 19

    How do I extract the source MAC from a [UFW BLOCK] entry?

  20. 20

    How do I finish the installation of a program from source?

  21. 21

    How do I build Boost from github?

  22. 22

    How do I build Libgdx.so from source for Android with gdb tracing enabled?

  23. 23

    How do I compile from source on github?

  24. 24

    How do I build Tmux from source without root access with a custom-built libevent 2.1?

  25. 25

    How do I switch from Unity 8 in Ubuntu 16.10?

  26. 26

    How do I build a Virtual Reality videoplayer without Unity?

  27. 27

    How do I uninstall Unity 8 from my desktop computer?

  28. 28

    How to build Compiz from source?

  29. 29

    What is the advantage to build unity from source

HotTag

Archive