# XSCHEM TUTORIAL

PREV UP NEXT

# INSTALL XSCHEM

in order to install the program run the following command:

      user:~$ cd xschem-<version>; ./configure

This will make all the necessary checks for required libraries and system tools.

for Debian and Ubuntu systems these are the packages you should check to be installed. Tck/Tk versions may vary on different systems, 8.4, 8.5, 8.6 versions are all good.

      libX11-6              libx11-dev
      libxrender1           libxrender-dev
      libxcb1               libx11-xcb-dev
      libcairo2             libcairo2-dev
      tcl8.6                tcl8.6-dev
      tk8.6                 tk8.6-dev
      flex                  bison
      libxpm4               libxpm-dev
                gawk or mawk

If configure ends with no errors we are ready to compile:

      user:~$ make

If we want to install xschem and its required files (execute as root if you plan to do a system-wide installation, for example in /usr/local):

      user:~$ make install

This will install all the runtime needed files into the locations previously configured (can be found in Makefile.conf). To change the default installation prefix (/usr/local), please replace the configure step shown above with:

       ./configure --prefix=new/prefix/path

DESTDIR is supported.

For testing purposes `xschem` can be run and invoked from the build directory `xschem-<version>/src/` without installation.

      user:~$ cd xschem-2.7.0/src && ./xschem

When xschem is running, type `puts $XSCHEM_LIBRARY_PATH` in the xschem tcl prompt to know the library search path.
Type `puts $XSCHEM_SHAREDIR` to see the installation path.

Sample user design libraries are provided and installed systemwide under `${XSCHEM_SHAREDIR/xschem_library/`. The XSCHEM_START_WINDOW specifies a schematic to preload at startup, to avoid absolute paths use a path that is relative to one of the `XSCHEM_LIBRARY_PATH` directories. XSCHEM will figure out the actual location. You may comment the definition if you don't want any schematic on startup.
If you need to override system settings, create a `~/.xschem/xschemrc`. The easiest way is to copy the system installed version from ${prefix}/share/xschem/xschemrc and then make the necessary changes

      user:$ mkdir ~/.xschem
      user:$ cp <install root>/share/xschem/xschemrc ~/.xschem/xschemrc

## -Technical information - Detailed XSCHEM startup sequence

Information here under is not meant to be executed by the user

1. If `--rcfile=<rcfile>` is given then source the specified rcfile. Do not load any other rcfile.
2. If `../src/xchem.tcl` with respect to current dir is existing and `../xschem_library` is also existing then we are starting from a build directory, set `XSCHEM_SHAREDIR` to `<current dir>` and also set
   `XSCHEM_LIBRARY_PATH` to `../xschem_library/devices`.
3. Else use compile-time (generated from configure script) provided `XSCHEM_SHAREDIR`.
4. Source system-wide xschemrc if existing: `XSCHEM_SHAREDIR/xschemrc`
5. If in current dir there is a `xschemrc` file source it.
6. Else if there is a `USER_CONF_DIR/xschemrc` file source it. `XSCHEM_SHAREDIR` and `USER_CONF_DIR` are preprocessor macros passed at compile time by the configure script. The first one will be overridden only if executing from a build directory, see item 2.
7. If `XSCHEM_SHAREDIR` not defined --> error and quit.
8. Start loading user provided schematic file or start with empty window (or filename specified in `XSCHEM_START_WINDOW` tcl variable).