Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Cleanup #96

Open
wants to merge 3 commits into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -5,3 +5,4 @@ include/boost/*
*.gch
dist/8
dist/*
/bitmap2component
21 changes: 12 additions & 9 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -80,6 +80,7 @@ Download and open [Example PCB](https://raw.githubusercontent.com/badgeek/svg2sh
- [KitSprint ANORG 2018](http://wiki.sgmk-ssam.ch/wiki/KitSprint_ANORG_2018#Kicad_bitmap_import_for_Shenzhen_Ready)

## Videos

- Drawing PCBs with Inkscape (FOSSDEM) with @kasbah of kitspace - https://www.youtube.com/watch?v=xXRPw7ItMaM
- Making a PCB Badge for Hackaday Supercon! - https://www.youtube.com/watch?v=YqdBiOj8uXw
- Understanding and Making PCB Art (mrtwinkletwinkle) https://www.youtube.com/watch?v=Sbkvza8cKQE
Expand All @@ -90,18 +91,20 @@ This project is developed independently and without any connection to funding or
Donation is highly appreciated.
Go to <https://www.patreon.com/badgeek> to become a patron and support this project

<a href="https://www.patreon.com/badgeek">
<img src="https://i.imgur.com/ys5X3ZP.png" >
</a>
[![](https://i.imgur.com/ys5X3ZP.png)](https://www.patreon.com/badgeek)

## Contributors

- Budi Prakosa [@badgeek](https://github.com/badgeek)
- Kaspar Emanuel [@kasbah](https://github.com/kasbah)
- Budi Prakosa [\@badgeek](https://github.com/badgeek)
- Kaspar Emanuel [\@kasbah](https://github.com/kasbah)

## Credits

* inkscape-export-layers - <https://github.com/jespino/inkscape-export-layers>
* bitmap2component (kicad) - <https://github.com/KiCad/kicad-source-mirror/tree/master/bitmap2component>
* csv_output - <https://github.com/tbekolay/csv_output>
* svg2mod - <https://github.com/svg2mod/svg2mod>
* inkscape-export-layers -
<https://github.com/jespino/inkscape-export-layers>
* bitmap2component (KiCad) -
<https://github.com/KiCad/kicad-source-mirror/tree/master/bitmap2component>
* csv_output -
<https://github.com/tbekolay/csv_output>
* svg2mod -
<https://github.com/svg2mod/svg2mod>
55 changes: 40 additions & 15 deletions build.sh
Original file line number Diff line number Diff line change
@@ -1,31 +1,56 @@
#!/bin/bash

cwd=$(pwd)
#!/usr/bin/env bash
# Creates distribution archives.
# Requires the binaries be already built (with make)
# and moved to the stageing area.

# Exit immediately on each error and unset variable;
# see: https://vaneyckt.io/posts/safer_bash_scripts_with_set_euxo_pipefail/
#set -Eeuo pipefail
set -Eeu

argv0=$(echo "$0" | sed -e 's,\\,/,g')
script_dir=$(dirname "$(readlink "$0" || echo "$argv0")")
case "$(uname -s)" in
*CYGWIN*)
script_dir=$(cygpath -w "$script_dir")
;;
Linux)
script_dir=$(dirname "$(readlink -f "$0" || echo "$argv0")")
;;
esac
script_dir_abs="$(cd "$script_dir"; pwd)"
# shellcheck source=./
root="$script_dir_abs"
cwd="$(pwd)"

BUILD_DIR=dist

BUILD_DIR_STAGING=staging

GIT_TAG_VERSION=`git describe --tag`
GIT_TAG_VERSION="$(git describe --tag)"

RELEASE_FILENAME_PREFIX=svg2shenzhen-extension
# echo "$cwd/$BUILD_DIR/$BUILD_DIR_STAGING"
# echo "$root/$BUILD_DIR/$BUILD_DIR_STAGING"
RELEASE_FILENAME_BASE="${root:?}/$BUILD_DIR/${RELEASE_FILENAME_PREFIX}-${GIT_TAG_VERSION}"

rm -fr $cwd/$BUILD_DIR/*
rm -fr "${root:?}/$BUILD_DIR/"*

mkdir -p "$cwd/$BUILD_DIR/$BUILD_DIR_STAGING"
mkdir -p "${root:?}/$BUILD_DIR/$BUILD_DIR_STAGING"

cp -r inkscape/* $cwd/$BUILD_DIR/$BUILD_DIR_STAGING
cp -r "${root:?}/inkscape/"* "${root:?}/$BUILD_DIR/$BUILD_DIR_STAGING"

find $cwd/$BUILD_DIR/$BUILD_DIR_STAGING -name *.inx -type f -exec sed -i.bak s/SVGSZ_VER/${GIT_TAG_VERSION}/g '{}' \;
find "${root:?}/$BUILD_DIR/$BUILD_DIR_STAGING" \
-name "*.inx" \
-type f \
-exec sed -i.bak "s/SVGSZ_VER/${GIT_TAG_VERSION}/g" '{}' \;

rm -fr $cwd/$BUILD_DIR/$BUILD_DIR_STAGING/*.bak
rm -fr "${root:?}/$BUILD_DIR/$BUILD_DIR_STAGING/"*.bak

cd $cwd/$BUILD_DIR/$BUILD_DIR_STAGING
cd "${root:?}/$BUILD_DIR/$BUILD_DIR_STAGING"

tar -czvf $cwd/$BUILD_DIR/${RELEASE_FILENAME_PREFIX}-${GIT_TAG_VERSION}.tar.gz .
zip -m -x .DS_Store -r $cwd/$BUILD_DIR/${RELEASE_FILENAME_PREFIX}-${GIT_TAG_VERSION}.zip .
tar -czvf "${RELEASE_FILENAME_BASE}.tar.gz" .
zip -m -x .DS_Store -r "${RELEASE_FILENAME_BASE}.zip" .

cd $cwd
cd "$cwd"

ls dist
ls "$BUILD_DIR"