UP

# TUTORIAL: INSTALL XSCHEM

This short tutorial will illustrate all the steps needed to install XSCHEM on a linux system, getting the files from the SVN repository.

1. Remove all previous xschem related data from old installs, i assume here previous stuff was in `/usr/local`, if not change the root prefix accordingly:

       schippes@mazinga:~$ sudo rm -rf /usr/local/share/xschem/ /usr/local/share/doc/xschem/
       schippes@mazinga:~$ rm -f  ~/xschemrc ~/.xschem/xschemrc

2. Create a build directory (here i use ~/build, choose whatever name you like):

       schippes@mazinga:~$ mkdir build

3. Go into the build directory

       schippes@mazinga:~$ cd build

4. Checkout xschem from the svn repository:

       schippes@mazinga:~/build$ svn checkout svn://repo.hu/xschem/trunk

5. Cd into trunk directory:

       schippes@mazinga:~/build$ cd trunk

6. Configure xschem. In this tutorial we want xschem to be installed in `/usr/local/bin`, xschem data installed in `/usr/local/share/xschem`, xschem documentation and example circuits installed in `/usr/local/share/doc/xschem`, xschem system-wide component symbols installed in `/usr/local/share/xschem/xschem_library` and xschem user configuration stored in user's home directory under `~/.xschem`:

       schippes@mazinga:~/build/trunk$ ./configure --prefix=/usr/local --user-conf-dir=~/.xschem \
       --user-lib-path=~/share/xschem/xschem_library \
       --sys-lib-path=/usr/local/share/xschem/xschem_library

7. If all required libraries, header files and tools that are needed to build xschem are present on the system, the configuration will end with this message (details may vary depending on the host system):

       ...
       ...
       --- Generating build and config files
       config.h:      ok
       Makefile.conf: ok
       src/Makefile:  ok

       =====================
       Configuration summary
       =====================

       Compilation:
        CC:        gcc
        debug:     no
        profiling: no

       Paths:
        prefix:        /usr/local
        user-conf-dir: ~/.xschem
        user-lib-path: ~/share/xschem/xschem_library
        sys-lib-path:  /usr/local/share/xschem/xschem_library

       Libs & features:
        tcl:       -ltcl8.6
        tk:        -ltcl8.6  -ltk8.6
        cairo:     yes
        xrender:   yes
        xcb:       yes

       Configuration complete, ready to compile.

       schippes@mazinga:~/build/trunk$

8. Build xschem by running 'make'

       schippes@mazinga:~/build/trunk$ make

9. If compilation of source files completed with no errors xschem will be ready for installation:

       schippes@mazinga:~/build/trunk$ sudo make install

   Note that since we are installing in /usr/local we need root rights (sudo) for doing the installation.
10. Test xschem by launching 'xschem' from the terminal:

        schippes@mazinga:~/build/trunk$ cd
        schippes@mazinga:~$ xschem

    if /usr/local/bin is not in your PATH variable use the full xschem path:

        schippes@mazinga:~$ /usr/local/bin/xschem

11. Close xschem (menu `File - Exit`)
12. Copy the xschemrc file in the `trunk/src` directory to the `~/.xschem` directory. If `~/.xschem` does not exist create it with `mkdir ~/.xschem`

        schippes@mazinga:~$ cp build/trunk/src/xschemrc ~/.xschem

    The `~/.xschem/xschemrc` is the user xschem configuration file. You may change it later to change xschem defaults or add / remove / change component and schematic directories. For first tests it is recommended to leave xschemrc as it is.
13. Run xschem again to try some schematic load tests:

        schippes@mazinga:~$ xschem

14. Select menu `File - Open` and navigate to `/usr/local/share/doc/xschem/examples`:
15. Select `0_examples_top.sch` and press 'OK':
16. This schematic contains a set of sub-schematics. Select one of them by clicking it with the left mouse button (test_lm324 in this example) and press the `Alt-e` key combination: another xschem window will be opened with the schematic view of the selected symbol:
17. Click on the lm324 symbol, it can now be edited using the `Alt-i` key combination:
18. Now close all xschem windows and restart a new xschem instance from terminal:

        schippes@mazinga:~$ xschem

19. We want to create a simple circuit in this empty schematic window: press the `Insert` key (this is used to place components) in the file selector navigate to `/usr/local/share/xschem/xschem_library` and select `res.sym`:
20. Lets add another component: press `Insert` key again and navigate to `/usr/local/share/doc/xschem/examples` and select `lm324.sym`:
21. Select (click on it) the lm324 symbol and move it by pressing the `m` key:
22. Place the lm324 component where you want in the schematic by placing the mouse and clicking the left button:
23. The lm324.sym component has a schematic (`.sch`) representation, while the resistor is a primitive, it has only a symbol view (`.sym`). you can see the schematic of the lm324 by selecting it and pressing `Alt-e`:
24. Close the lm324.sch window and view the symbol view of the resistor by selecting it and pressing `Alt-i`:

### This concludes the tutorial, if all the steps were successful there is a good probability that xschem is correctly installed on your system.