Io Programming/Beginner's Guide/Getting Started

From Wikibooks, the open-content textbooks collection

Jump to: navigation, search

Contents

[edit] Getting Started

[edit] Posix Systems

The audience of this section consists of users of Linux, BSD, MacOS X, and other environments that conform to the Posix operating system standards. Most of the following material will not have to do with setup or other OS-dependent things. Due to the wide availability of Linux versus other environments, those parts that do have system-specific behavior will be explained from a Linux perspective. Most of what follows will probably work on other Unixes, Windows with Cygwin, or Mac OS X with Fink.

[edit] Download the source

First you need to download the source. It is recommended to get the code from the git repository:

$ git clone git://github.com/stevedekorte/io.git

Or. You can find the downloads at the following website: http://iolanguage.com/downloads/ .·· For example:

$ wget http://io.urbanape.com/release/Io-2008-01-07.tar.gz
$ tar zxvf Io-2008-01-07.tar.gz

[edit] Compile

The next step is to build the software.

$ cd <version>
$ make

If you have problems with compilation you may not have all the dependencies you need. Make sure you have gcc and the standard includes. For Debian/Ubuntu try:

$ apt-get install gcc libc6-dev

[edit] Install

The build system for Io assumes a shell environment variable called INSTALL_PREFIX will be set, containing the place to put its files. If this environment variable is not set, you'll end up with /usr/local as the default location. Since this is the most usual place to put Io, most users can install simply with the following command (Note: sudo is used to write to /usr/local):

$ sudo make install

Users of GoboLinux will want to merge Io into the existing program hierarchy instead. Execute these commands as super-user:

$ sudo bash
# mkdir -p /Programs/IoLanguage/<version>
# INSTALL_PREFIX=/Programs/IoLanguage/<version> make install
# SymlinkProgram IoLanguage
# exit

After installing you may need to configure ld on Linux. Add this line to /etc/ld.so.conf

include /usr/local/lib

Then reconfigure ld:

sudo ldconfig

[edit] Start Up!

Io will now be installed and can be started using the command:

io

If you type just io, you will enter the interactive interpreter. To quit the interactive interpreter, press Ctrl-D or type exit

NOTE

If you type something after io, it will be interpreted as a filename, even if it is something like --help or --version that should be interpreted as an option.

[edit] Finishing Touches

Now we can test the installation to see if everything works as expected.

$ make test

Optionally, you're free to clean up the build directory as well:

$ make clean

[edit] Windows Systems

Pre-existing binaries for Io exists at the Io downloads page . If, for some reason, you would like to continue to build from source, you may do so by the following steps.

Some Io add-ons (extensions to the core Io language; e.g., Sockets) require access to the w32api directories. If you have not yet installed the w32api package in Cygwin, you will need to do so before building and installing Io.

Next, the Io build script will not find the w32api headers and libraries in their default locations. In order to find it, spoof some symlinks in one of the build script's default search prefixes. Here, we use /usr/pkg:

$ mkdir /usr/pkg
$ ln -s /usr/include/w32api /usr/pkg/include
$ ln -s /usr/lib/w32api /usr/pkg/lib

Finally, the procedure for building Io under Posix systems applies to Windows as well, provided you're using Cygwin. The only difference is to unset the OS environment variable first. Otherwise, the build process will assume you are intending to compile with Microsoft Visual C++.

$ unset OS
$ make