How To Compile Everything

From OpenHatch wiki
(Redirected from How to compile everything)
  • Is there a README?
    • Read it.

Dynamic languages

  • Is it mostly PHP?
    • Does it need PHP libraries?
    • It probably needs a web server
    • Does it need a database?
  • Is it mostly Python?
    • Is there a setup.py?
      • virtualenv . ; bin/python setup.py develop, I think.
    • Is there a requirements.txt?
      • Install the things there, maybe with pip or something??
    • Does it need a web server? (Does it need a web server, or does a builtin one suffice?)
    • Does it need a database? (Does it need a database, or does SQLite suffice?)
  • Is it mostly Ruby?
    • Ask someone not me.
    • Someone not me says:
      • Does it have a Gemfile, or a .gemspec? Run bundle.
      • Is it Rails? Run rake. (Did you bundle install?) Now do ./script/server (Rails 2.x) or rails server (Rails >=3). Consider making someone else host it - Heroku?
      • Is it not Rails? Does it have a Rakefile? Run rake.
      • No Rakefile? Are you sure this is ruby?
  • Is it mostly Perl?
    • Is there a Makefile.PL at the top level, and no Makefile?
      • Run perl Makefile.PL, then follow the Makefile instructions.
      • If you want to set a prefix, run perl Makefile.PL PREFIX=/home/geofft. You don't need to pass the prefix to any other commands.

C

  • Is there a Makefile or GNUmakefile?
    • Usually you can just run make to compile it.
    • Often you can also run sudo make install to install it systemwide. Sometimes this won't exist, and all you get is compiled code in the same directory.
    • If you want to install it, but not systemwide, generally you can use a prefix variable to make it install elsewhere; for instance I might want to set the prefix to /home/geofft so things are in /home/geofft/bin, etc. If there was just a Makefile and nothing special, try running make PREFIX=/home/geofft and make install PREFIX=/home/geofft, without sudo. Or read the Makefile or README.
  • Is there a configure?
    • Usually you can just run ./configure, followed by make and sudo make install, as per the Makefile decision branch.
    • To set a prefix, run ./configure --prefix=/home/geofft.
    • Running configure will error out if it requires something you don't have installed. But check its output, as it might be skipping something optional but useful, that you should have installed.
  • Is there a autogen.sh, but no configure (with no extension)? Sometimes autogen.sh is called bootstrap or something.
    • Make sure you have autoconf and automake installed.
    • Run ./autogen.sh, then start from the configure decision branch.
    • Rarely, autogen.sh will also run configure for you; if you want to pass options, you can either rerun ./configure yourself, or pass them to ./autogen.sh.
  • Is there a configure.ac or configure.in, but no autogen.sh? (If there is one, prefer that)
    • Make sure you have autoconf and automake installed.
    • Run autoreconf -fvi, then start from the configure decision branch.

Java

  • Is there a build.xml?
    • Are there files with Android-y names?
      • Install the Android utilities, then run android update project --path . so that your paths to the Android SDK are set. You'll probably need to specify the full path to the android command, like ~/Downloads/adt-bundle-something/sdk/tools/android update project --path ..
      • If it tells you to use
      • Run ant debug, to make a debug build. (See the output of ant to see the list of options.)
      • You can try using ant install to run it on the currently-running simulator, or the currently-plugged in device. You might have more luck with the adb command directly, though.
    • Run ant, which should either work or give you a list of options. ant build might be the option that you want.
  • Is there a pom.xml?
    • Curse at Maven a bit, then run mvn compile and hope for the best
    • Consider using Eclipse
  • Sometimes Java programs are servlets, which you can tell by, like, WEB-INF directories or web.xml files running around
    • You'll want a "servlet container" like Tomcat or Jetty, which is a fancy word for a web server that runs Java servlets
    • Jetty can run standalone, with no advance setup, and there's often a Maven target for that

Other things

  • Is there a debian directory? Are you building something Debian-specific?
    • Make sure everything in the Build-Depends line of debian/control is installed. If the package is in the Debian/Ubuntu archive, the easiest way to do this is sudo apt-get build-dep package. This works even if you're building a package from a slightly different source than the one in the archive; it'll get you at least 90% of the way there.
    • Run debuild, which is in the devscripts package.