From d4a5e5acb7164c694f242edb170982f60a93c2a0 Mon Sep 17 00:00:00 2001 From: jerryjacobs Date: Fri, 4 Sep 2009 15:10:24 +0000 Subject: [PATCH] Added kicad helper scripts and update compiling on debian and ubuntu --- COMPILING-Debian.txt | 120 +++++++++++++++--- scripts/kicad-devel | 284 ++++++++++++++++++++++++++++++++++++++++++ scripts/kicad-get-rss | 56 +++++++++ 3 files changed, 446 insertions(+), 14 deletions(-) create mode 100755 scripts/kicad-devel create mode 100755 scripts/kicad-get-rss diff --git a/COMPILING-Debian.txt b/COMPILING-Debian.txt index ec88e3022c..26150c7a27 100644 --- a/COMPILING-Debian.txt +++ b/COMPILING-Debian.txt @@ -1,11 +1,102 @@ -How to build kicad on Debian -============================ -First Written: 10-Mar-2009 +Compiling KiCad on Debian & Ubuntu +================================== + +First written: 10-Mar-2009 + +Updated: 31-Aug-2009 + Lasted edited by: Jerry Jacobs -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 +--------------------------------------- + +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 ~~~~~~~~~~~~ @@ -28,25 +119,26 @@ The following packages will also be installed then - wxwidgets development dependencies - opengl3 (glut) development dependencies - -Get KiCad Sourcecode +Get KiCad sourcecode ~~~~~~~~~~~~~~~~~~~~ Checkout sourcecode using subversion or download latest release. -*Subversion* -'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' +.*Subversion* +--------------------------------------- +svn checkout https://kicad.svn.sourceforge.net/svnroot/kicad/trunk/kicad kicad +--------------------------------------- +.*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 ~~~~~~~~~ Run 'cmake .' in the root of the source directory then build the binaries with 'make'. - Installing ~~~~~~~~~~ For installing you could use 'make install' or build a debian package. diff --git a/scripts/kicad-devel b/scripts/kicad-devel new file mode 100755 index 0000000000..de065cdd0d --- /dev/null +++ b/scripts/kicad-devel @@ -0,0 +1,284 @@ +#!/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 will read the given input file(s) and do something +useful with the contents thereof. + +=cut diff --git a/scripts/kicad-get-rss b/scripts/kicad-get-rss new file mode 100755 index 0000000000..7ea99efa0a --- /dev/null +++ b/scripts/kicad-get-rss @@ -0,0 +1,56 @@ +#!/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/^<\!\[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