1 | #!/usr/bin/env bash
|
---|
2 | set -eu
|
---|
3 |
|
---|
4 | if [ ! -v SCRIPTS_DIR ]; then
|
---|
5 | SCRIPTS_DIR=$(cd $(dirname $0);pwd)
|
---|
6 | fi
|
---|
7 |
|
---|
8 | if [ ! -v WORK_DIR ]; then
|
---|
9 | WORK_DIR=$HOME/workdir
|
---|
10 | fi
|
---|
11 |
|
---|
12 | SSP_DIR=$WORK_DIR/ssp
|
---|
13 | SSP_PACKAGE=ssp-1.3.0.tar.gz
|
---|
14 | SSP_DOWNLOAD_URL=http://www.toppers.jp/download.cgi/$SSP_PACKAGE
|
---|
15 | SSP_TARGET_NAME=cq_frk_fm3_gcc
|
---|
16 |
|
---|
17 | ASP3_DIR=$WORK_DIR/asp3
|
---|
18 | ASP3_PACKAGE=asp3-3.1.0.tar.gz
|
---|
19 | ASP3_DOWNLOAD_URL=https://www.toppers.jp/download.cgi/$ASP3_PACKAGE
|
---|
20 |
|
---|
21 |
|
---|
22 | : "setup tools (compiler, emulator, etc.)" && {
|
---|
23 | $SCRIPTS_DIR/setup_tools.sh
|
---|
24 | . $HOME/.profile
|
---|
25 | }
|
---|
26 |
|
---|
27 | : "Download TOPPERS/ASP3 package to get a configurator files" && {
|
---|
28 | cd $WORK_DIR
|
---|
29 | if [ ! -e $ASP3_DIR ]; then
|
---|
30 | if [ ! -e $ASP3_PACKAGE ]; then
|
---|
31 | curl $ASP3_DOWNLOAD_URL -o $ASP3_PACKAGE
|
---|
32 | fi
|
---|
33 | tar xvf $ASP3_PACKAGE
|
---|
34 | fi
|
---|
35 | }
|
---|
36 |
|
---|
37 | : "if ssp directory already exists, rename it and create new directory" && {
|
---|
38 | cd $WORK_DIR
|
---|
39 | if [ -e $SSP_DIR ]; then
|
---|
40 | mv $SSP_DIR $SSP_DIR.$(date +%Y%m%d_%H%M%S)
|
---|
41 | fi
|
---|
42 |
|
---|
43 | if [ ! -e $SSP_PACKAGE ]; then
|
---|
44 | curl $SSP_DOWNLOAD_URL -o $SSP_PACKAGE
|
---|
45 | fi
|
---|
46 |
|
---|
47 | mkdir $SSP_DIR
|
---|
48 | tar xvf $SSP_PACKAGE -C $SSP_DIR --strip-components 2
|
---|
49 | }
|
---|
50 |
|
---|
51 | : "setup source code(convert to UTF8, patch, etc.)" && {
|
---|
52 | for i in `find $SSP_DIR -type f` ; do nkf --overwrite --oc=UTF-8 $i; done
|
---|
53 | cp -a $ASP3_DIR/sample/Makefile $SSP_DIR/sample
|
---|
54 |
|
---|
55 | $SCRIPTS_DIR/install.sh $SSP_DIR
|
---|
56 |
|
---|
57 | cd $SSP_DIR
|
---|
58 | ln -s $ASP3_DIR/configure.rb configure.rb
|
---|
59 | ln -s $ASP3_DIR/cfg cfg
|
---|
60 | }
|
---|
61 |
|
---|
62 | : "build a kernel" && {
|
---|
63 | cd $SSP_DIR
|
---|
64 | if [ -e build ]; then
|
---|
65 | mv build build.$(date +%Y%m%d_%H%M%S)
|
---|
66 | fi
|
---|
67 | mkdir build
|
---|
68 | cd build
|
---|
69 | ../configure.rb -T $SSP_TARGET_NAME -w
|
---|
70 | make
|
---|
71 | }
|
---|
72 |
|
---|
73 | exit 0
|
---|