Commit d4a5e5ac authored by jerryjacobs's avatar jerryjacobs

Added kicad helper scripts and update compiling on debian and ubuntu

parent 70aba1a8
How to build kicad on Debian Compiling KiCad on Debian & Ubuntu
============================ ==================================
First Written: 10-Mar-2009
First written: 10-Mar-2009
Updated: 31-Aug-2009
Lasted edited by: Jerry Jacobs <jerkejacobs@gmail.com> Lasted edited by: Jerry Jacobs <jerkejacobs@gmail.com>
For debian squeeze (testing) Ubuntu (8.04)
---------------------------- -----------
Original from:
http://basicubuntu.blogspot.com/2009/02/installing-kicad-on-ubuntu.html
Required software and dependencies
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
We need to install the following packages: debhelper, dpatch, libx11-dev,
libglu1-mesa-dev, libgl1-mesa-dev, mesa-common-dev, libwxbase2.8-dev,
libwxgtk2.8-dev, libboost-dev, subversion, cmake (>= 2.6.0).
---------------------------------------
sudo apt-get install debhelper dpatch libx11-dev libglu1-mesa-dev
libgl1-mesa-dev mesa-common-dev libwxbase2.8-dev libwxgtk2.8-dev
libboost-dev fakeroot subversion libboost-serialization-dev
---------------------------------------
And finally, we need cmake, but we need atleast version 2.6, the one
from the repository is not the updated one (atleast for ubuntu 8.04).
You can download version 2.6 from newer ubuntu releases.
Just search for cmake on http://packages.ubuntu.com then get a newer
cmake .deb file and install the downloaded package on the console
with:
---------------------------------------
sudo dpkg -i <packagename.deb>
---------------------------------------
But if what the repository gives you is atleast version 2.6, then
simply
---------------------------------------
sudo apt-get install cmake
---------------------------------------
Get KiCad Sourcecode
~~~~~~~~~~~~~~~~~~~~
We will be getting the source codes through subversion. Create a directory
where you'll be downloading the source codes, and go to that
directory. type the following:
---------------------------------------
svn checkout https://kicad.svn.sourceforge.net/svnroot/kicad/trunk/kicad kicad
svn checkout https://kicad.svn.sourceforge.net/svnroot/kicad/trunk/kicad-doc kicad-doc
svn checkout https://kicad.svn.sourceforge.net/svnroot/kicad/trunk/kicad-library kicad-library
---------------------------------------
Also we need the following to get the debian specific stuff
---------------------------------------
svn checkout http://svn.flexserv.de/kicad/trunk/debian
---------------------------------------
Compiling
~~~~~~~~~
To compile simply do the following on your terminal (make sure you're still in
the same directory where you did the svn)
---------------------------------------
fakeroot debian/rules binary
---------------------------------------
hopefully, there will be no errors.
You'll find the compiled version of KiCad in the following directory:
---------------------------------------
debian/kicad/usr/bin/
---------------------------------------
to complete things up, you'll need to copy the following folders
---------------------------------------
debian/kicad-common/usr/share/kicad/library
debian/kicad-common/usr/share/kicad/modules
debian/kicad-common/usr/share/kicad/template
---------------------------------------
in here
---------------------------------------
debian/kicad/usr/share
---------------------------------------
again, to run KiCad go to
---------------------------------------
cd debian/kicad/usr/bin/
---------------------------------------
and double click KiCad
Debian squeeze (testing)
------------------------
Special Note Special Note
~~~~~~~~~~~~ ~~~~~~~~~~~~
...@@ -28,25 +119,26 @@ The following packages will also be installed then ...@@ -28,25 +119,26 @@ The following packages will also be installed then
- wxwidgets development dependencies - wxwidgets development dependencies
- opengl3 (glut) development dependencies - opengl3 (glut) development dependencies
Get KiCad sourcecode
Get KiCad Sourcecode
~~~~~~~~~~~~~~~~~~~~ ~~~~~~~~~~~~~~~~~~~~
Checkout sourcecode using subversion or download latest release. Checkout sourcecode using subversion or download latest release.
*Subversion* .*Subversion*
'svn checkout https://kicad.svn.sourceforge.net/svnroot/kicad/trunk/kicad kicad' ---------------------------------------
svn checkout https://kicad.svn.sourceforge.net/svnroot/kicad/trunk/kicad kicad
*Release* ---------------------------------------
download http://iut-tice.ujf-grenoble.fr/cao/kicad-sources-yyyy-mm-dd.tgz'
'tar -xvf kicad-sources-yyyy-mm-dd.tgz'
.*Release*
---------------------------------------
wget http://iut-tice.ujf-grenoble.fr/cao/kicad-sources-2009-02-16.tar.gz
tar -xvf kicad-sources-2009-02-16.tar.gz
---------------------------------------
Compiling Compiling
~~~~~~~~~ ~~~~~~~~~
Run 'cmake .' in the root of the source directory then build the Run 'cmake .' in the root of the source directory then build the
binaries with 'make'. binaries with 'make'.
Installing Installing
~~~~~~~~~~ ~~~~~~~~~~
For installing you could use 'make install' or build a debian package. For installing you could use 'make install' or build a debian package.
#!/usr/bin/perl -w
my $vernr = "0.0.2";
my $monthshort = "Mar";
my $monthlong = "March";
my $year = "2009";
use strict;
use warnings;
use Getopt::Long;
use Pod::Usage;
###
# User defined settings
###
my $svn_path_remote = 'https://kicad.svn.sourceforge.net/svnroot/kicad/trunk';
my $svn_path_local = '/media/data/projects/applications/kicad/subversion/kicad-core';
my $build_path = '/home/jerry/builds/kicad';
## TODO
## Add debian package generation
## dh_make -e jerkejacobs@gmail.com -s -n
## debuild -us -uc
## TODO
###
# Commandline options
###
my $option_about = 0;
my $option_manual = 0;
my $option_help = 0;
my $option_build_binaries = 0;
my $option_svn_update = 0;
my $option_verbose = 1;
my $option_version = 0;
my $option_generate_makefiles = 0;
my $option_no_clear = 0;
my $option_install_binaries = 0;
my $no_options = 0; # No options given
###
# Commands
###
my $command_silent = '&> /dev/null'; # Nullify stderr and stdout from commands
my $command_cmake = "cmake -DCMAKE_BUILD_TYPE=Debug -DwxWidgets_USE_DEBUG=ON $svn_path_local"; # Where cmake looks for CMakeLists.txt
my $command_svn_update = 'svn update'; # Subversion update command
###
# Help and about messages
###
my $about_message = "KiCad Devel, version $vernr, $monthshort $year, jerkejacobs\@gmail.org\n";
my $short_help = "No options given try `kicad_devel.pl --help' for more information.\n";
###########################################
########### Commandline options ###########
###########################################
if (@ARGV == 0)
{
print $short_help;
}
else
{
GetOptions('help|?' => \$option_help,
'man' => \$option_manual,
'build-binaries|compile' => \$option_build_binaries,
'svn-update' => \$option_svn_update,
'about' => \$option_about,
'version' => \$option_version,
'generate-makefiles' => \$option_generate_makefiles,
'install|install-binaries' => \$option_install_binaries,
'no-clear' => \$option_no_clear,
# Verbose settings
'quiet|noverbose' => sub { $option_verbose = 0 });
pod2usage(1) if $option_help;
pod2usage(-verbose => 2) if $option_manual;
}
###########################
########### Main ##########
###########################
# Init main function
main();
sub
main
{
# No commandline options given
if ($no_options) {
print $short_help;
exit(0);
}
# Option svn update given
if ($option_svn_update) {
svn_update();
}
# Generate makefiles
if ($option_generate_makefiles) {
generate_makefiles();
}
# Option build binaries given
if ($option_build_binaries) {
build_binaries();
}
# Install compiled binaries
if ($option_install_binaries) {
install_binaries();
}
exit(0);
}
###
# Clear the console screen
###
sub
clear_screen {
# Clear screen if no clear option is false
if ($option_no_clear == 0)
{
print `clear`;
}
else
{
print "\n\n";
}
}
###
# Print line of $_[1] char
# $_[0] = Number of chars before newline
# $_[1] = Char to print line of
###
sub
print_line {
for(my $i = 0; $i < $_[0]; ++$i) {
print $_[1];
}
print "\n";
}
###
# Execute cmake on svn_path_local to generate makefiles
# on build_path
###
sub
generate_makefiles {
# Print settings to output
if ($option_verbose == 1)
{
clear_screen();
print_line(80, '#');
print " Generating makefiles\n";
print_line(80, '#');
print " SVN Path : $svn_path_local\n";
print " Build Path : $build_path\n";
print " CMake Command : $command_cmake\n";
print_line(80, '#');
}
###
# Execute cmake command with correct verbose level output
###
# Execute command and dump output to console
if ($option_verbose == 0)
{
chdir $build_path;
`$command_cmake $command_silent`;
}
# Execute command and display output to console
if ($option_verbose == 1)
{
chdir $build_path
or die "Can't cd to $build_path";
print `$command_cmake`;
}
# Print output
if ($option_verbose == 1)
{
print_line(80, '#');
}
}
###
# Update local subversion repository on $svn_path_local
###
sub
svn_update
{
if ($option_verbose)
{
clear_screen();
print_line(80, '#');
print "Updating local subversion repository\n";
print_line(80, '#');
print "Repository path : $svn_path_local\n";
print "SVN Command : $command_svn_update\n";
print_line(80, '#');
chdir $svn_path_local
or die "Can't cd to $svn_path_local";
print `$command_svn_update`;
print_line(80, '#');
}
else
{
chdir $svn_path_local;
`$command_svn_update $command_silent`;
}
}
###
# Build the binaries on $build_path
###
sub
build_binaries
{
chdir $build_path
or die "Can't cd to $build_path";
system("make -j 4");
}
###
# Install the compiled binaries from $build_path
###
sub
install_binaries
{
chdir $build_path
or die "Can't cd to $build_path";
system("make install");
}
######## Begin of POD manual page ########
__END__
=head1 NAME
kicad_devel - KiCad development helper program
=head1 SYNOPSIS
kicad_devel [options]
Options:
--help -? brief help message
--man -M full program manual
--verbose -V set verbosity level
--about about information
--version -v display version information
--svn-update -svn-up update kicad subversion path
--build-binaries -compile compile sourcecode in build path
--install-binaries -install install compiled binaries
--no-clear dont clear the console screen after every command is executed
=head1 OPTIONS
=head2 HELP
=head1 DESCRIPTION
B<This program> will read the given input file(s) and do something
useful with the contents thereof.
=cut
#!/bin/sh
# RSS Feed Display Script by Hellf[i]re v0.1
#
# This script is designed for most any RSS Feed. As some feeds may
# not be
# completely compliant, it may need a bit of tweaking
#
# This script depends on curl.
# Gentoo: emerge -av net-misc/curl
# Debian: apt-get install curl
# Homepage: http://curl.haxx.se/
#
# Usage:
# .conkyrc: ${execi [time] /path/to/script/conky-rss.sh}
#
# Usage Example
# ${execi 300 /home/youruser/scripts/conky-rss.sh}
#RSS Setup
URI=http://sourceforge.net/export/rss2_keepsake.php?group_id=145591 #URI of RSS Feed
FEEDFILE="/tmp/kicad-svn-`date +%y%m%d-%H%M%S`.rss"
URLFILE="/tmp/kicad-svn-`date +%y%m%d-%H%M%S`.url"
LINES=4 #Number of headlines
# Get feed and
EXEC="/usr/bin/curl -s" #Path to curl
`$EXEC $URI &> $FEEDFILE`
# Get and filter and print content
cat $FEEDFILE | grep title |\
sed -e 's/[ \t]*//' |\
sed -e 's/^<title><\!\[CDATA\[//' |\
sed -e 's/\]\]><\/title>//' |\
sed -e 's/ to the Kicad EDA SVN repository//' |\
head -n $(($LINES + 1)) |\
tail -n $(($LINES))
echo ""
# Get latest commit url
cat $FEEDFILE | grep link |\
sed -e '2 s/<link>//' |\
sed -e '/<link>/d' |\
sed -e 's/[ \t]*//' |\
sed -e 's/<\/link>//' \
&> $URLFILE
# Get commit message
URL=`cat $URLFILE`
curl -s $URL | grep vc_log |\
sed -e 's/<td><pre class=\"vc_log\">//' |\
sed -e 's/<\/pre><\/td>//'
rm $URLFILE
rm $FEEDFILE
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment