kicad/kicad-library-repos-install.patch
Dmitry Roshchin db9811936e Accepting request 346954 from home:Dmitry_R:branches:electronics
- Update to version 4.0.0
  Changes from previous stable release:
  * New graphics rendering backend GAL (OpenGL and Cairo)
  * New s-expression based pcb format (.kicad_pcb)
  * New footprint library format (.pretty folder with .kicad_mod footprints)
  * Updated footprint editor
  * More advanced footprint manager concept called footprint library table (fp-lib-table)
  * Ability to download footprints on the fly from git repositories
  * Official libraries are now stored on github and regularly updated
  * Awesome/Advanced Push and Shove (PnS) router (only usable with GAL renderer)
  * Interactive differential trace routing and tuning
  * Interactive trace length tuning
  * Much more realistic 3D board rendering
  * Intelligent library search with preview in Eeschema
  * Initial Python api for Pcbnew

OBS-URL: https://build.opensuse.org/request/show/346954
OBS-URL: https://build.opensuse.org/package/show/electronics/kicad?expand=0&rev=11
2015-12-01 08:13:43 +00:00

114 lines
4.5 KiB
Diff

Index: kicad-4.0.0/scripts/library-repos-install.sh
===================================================================
--- kicad-4.0.0.orig/scripts/library-repos-install.sh
+++ kicad-4.0.0/scripts/library-repos-install.sh
@@ -24,7 +24,8 @@
# Set where the library repos will go, use a full path
-WORKING_TREES=${WORKING_TREES:-~/kicad_sources}
+WORKING_TREES=~/.local/share/kicad
+KICAD_CONFIG_COMMON=~/.config/kicad/kicad_common
usage()
@@ -32,50 +33,35 @@ usage()
echo ""
echo " usage:"
echo ""
- echo "./library-sources-install.sh <cmd>"
+ echo "kicad-library-install.sh <cmd>"
echo " where <cmd> is one of:"
- echo " --install-prerequisites (install command tools needed here, run once first.)"
echo " --install-or-update (from github, the library sources.)"
+ echo " --download-all-libraries (download library sources from GitHub.)"
echo " --remove-all-libraries (remove all *.pretty from $WORKING_TREES/library-repos/. )"
echo " --remove-orphaned-libraries (remove local libraries which have been deleted or renamed at github.)"
echo " --list-libraries (show the full list of github libraries.)"
echo " --create-bat-file (cat a windows batch file, redirect to capture to disk.)"
echo ""
- echo "examples (with --install-prerequisites once first):"
- echo ' $ ./library-sources-install.sh --install-prerequisites'
- echo ' $ ./library-sources-install.sh --install-or-update'
+ echo "Default library directory is $WORKING_TREES/library-repos/"
}
-install_prerequisites()
-{
- # Find a package manager, PM
- PM=$( command -v yum || command -v apt-get )
-
- # assume all these Debian, Mint, Ubuntu systems have same prerequisites
- if [ "$(expr match "$PM" '.*\(apt-get\)')" == "apt-get" ]; then
- #echo "debian compatible system"
- sudo apt-get install \
- git \
- curl \
- sed
-
- # assume all yum systems have same prerequisites
- elif [ "$(expr match "$PM" '.*\(yum\)')" == "yum" ]; then
- #echo "red hat compatible system"
- # Note: if you find this list not to be accurate, please submit a patch:
- sudo yum install \
- git \
- curl \
- sed
+add_libraries_config()
+{
+ # Add libraries to config file
+ if [ ! -d "$KICAD_CONFIG_COMMON" ]; then
+ echo "[EnvironmentVariables]" > $KICAD_CONFIG_COMMON
+ echo "KIGITHUB=$WORKING_TREES/library-repos/" >> $KICAD_CONFIG_COMMON
+ echo "KISYSMOD=$WORKING_TREES/library-repos/kicad-library/modules/" >> $KICAD_CONFIG_COMMON
+ echo "KISYS3DMOD=$WORKING_TREES/library-repos/kicad-library/modules/packages3d/" >> $KICAD_CONFIG_COMMON
+ echo "KICAD_PTEMPLATES=$WORKING_TREES/library-repos/kicad-library/template/" >> $KICAD_CONFIG_COMMON
else
- echo
- echo "Incompatible System. Neither 'yum' nor 'apt-get' found. Not possible to"
- echo "continue. Please make sure to install git, curl, and sed before using this"
- echo "script."
- echo
- exit 1
+ sed -i 's|^KIGITHUB.*|KIGITHUB='$WORKING_TREES'/library-repos/|' $KICAD_CONFIG_COMMON
+ sed -i 's|^KISYSMOD.*|KISYSMOD='$WORKING_TREES'/library-repos/kicad-library/modules/|' $KICAD_CONFIG_COMMON
+ sed -i 's|^KISYS3DMOD.*|KISYS3DMOD='$WORKING_TREES'/library-repos/kicad-library/modules/packages3d/|' $KICAD_CONFIG_COMMON
+ sed -i 's|^KICAD_PTEMPLATES.*|KICAD_PTEMPLATES='$WORKING_TREES'/library-repos/kicad-library/template/|' $KICAD_CONFIG_COMMON
fi
+ cp $WORKING_TREES/library-repos/kicad-library/template/fp-lib-table.for-pretty ~/.config/kicad/fp-lib-table
}
@@ -138,9 +124,7 @@ detect_pretty_repos()
checkout_or_update_libraries()
{
if [ ! -d "$WORKING_TREES" ]; then
- sudo mkdir -p "$WORKING_TREES"
- echo " mark $WORKING_TREES as owned by me"
- sudo chown -R `whoami` "$WORKING_TREES"
+ mkdir -p "$WORKING_TREES"
fi
cd $WORKING_TREES
@@ -217,6 +201,7 @@ remove_orphaned_libraries()
if [ $# -eq 1 -a "$1" == "--install-or-update" ]; then
checkout_or_update_libraries
+ add_libraries_config
exit
fi
@@ -233,11 +218,6 @@ if [ $# -eq 1 -a "$1" == "--remove-all-l
fi
-if [ $# -eq 1 -a "$1" == "--install-prerequisites" ]; then
- install_prerequisites
- exit
-fi
-
if [ $# -eq 1 -a "$1" == "--list-libraries" ]; then
# use github API to get repos into PRETTY_REPOS var