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 | # if directory doesn't exist, it will be made
|
---|
10 | if [ ! -d $HOME/workdir ]; then
|
---|
11 | echo "$WORK_DIR doesn't exists. working directory 'toppers_workdir' will be made in current directory."
|
---|
12 | WORK_DIR=$(pwd)/toppers_workdir
|
---|
13 | mkdir -p $WORK_DIR
|
---|
14 | else
|
---|
15 | WORK_DIR=$HOME/workdir
|
---|
16 | fi
|
---|
17 | fi
|
---|
18 |
|
---|
19 | SSP_DIR=$WORK_DIR/ssp
|
---|
20 | SSP_PACKAGE=ssp-1.3.0.tar.gz
|
---|
21 | SSP_DOWNLOAD_URL=http://www.toppers.jp/download.cgi/$SSP_PACKAGE
|
---|
22 | SSP_RUBYCFG_FILES_URL=http://dev.toppers.jp/svn_user/contrib/rubycfg_ssp/trunk
|
---|
23 | SSP_TARGET_NAME=qemu_virt_gcc
|
---|
24 |
|
---|
25 | ASP3_DIR=$WORK_DIR/asp3
|
---|
26 | ASP3_PACKAGE=asp3-3.1.0.tar.gz
|
---|
27 | ASP3_DOWNLOAD_URL=https://www.toppers.jp/download.cgi/$ASP3_PACKAGE
|
---|
28 |
|
---|
29 | : "setup tools (compiler, emulator, etc.)" && {
|
---|
30 | $SCRIPTS_DIR/setup_tools.sh
|
---|
31 | . $HOME/.profile
|
---|
32 | }
|
---|
33 |
|
---|
34 | : "Download TOPPERS/ASP3 package to get a configurator files" && {
|
---|
35 | cd $WORK_DIR
|
---|
36 | if [ ! -e $ASP3_DIR ]; then
|
---|
37 | if [ ! -e $ASP3_PACKAGE ]; then
|
---|
38 | curl $ASP3_DOWNLOAD_URL -o $ASP3_PACKAGE
|
---|
39 | fi
|
---|
40 | tar xvf $ASP3_PACKAGE
|
---|
41 | fi
|
---|
42 | }
|
---|
43 |
|
---|
44 | : "if ssp directory already exists, rename it and create new directory" && {
|
---|
45 | cd $WORK_DIR
|
---|
46 | if [ -e $SSP_DIR ]; then
|
---|
47 | mv $SSP_DIR $SSP_DIR.$(date +%Y%m%d_%H%M%S)
|
---|
48 | fi
|
---|
49 |
|
---|
50 | if [ ! -e $SSP_PACKAGE ]; then
|
---|
51 | curl $SSP_DOWNLOAD_URL -o $SSP_PACKAGE
|
---|
52 | fi
|
---|
53 |
|
---|
54 | mkdir $SSP_DIR
|
---|
55 | tar xvf $SSP_PACKAGE -C $SSP_DIR --strip-components 2
|
---|
56 | }
|
---|
57 |
|
---|
58 | : "setup source code(convert to UTF8, patch, etc.)" && {
|
---|
59 | for i in `find $SSP_DIR -type f` ; do nkf --overwrite --oc=UTF-8 $i; done
|
---|
60 | cp -a $ASP3_DIR/sample/Makefile $SSP_DIR/sample
|
---|
61 |
|
---|
62 | svn co $SSP_RUBYCFG_FILES_URL rubycfg_ssp
|
---|
63 | rubycfg_ssp/install.sh $SSP_DIR
|
---|
64 |
|
---|
65 | $SCRIPTS_DIR/install.sh $SSP_DIR
|
---|
66 |
|
---|
67 | cd $SSP_DIR
|
---|
68 | ln -s $ASP3_DIR/configure.rb configure.rb
|
---|
69 | ln -s $ASP3_DIR/cfg cfg
|
---|
70 | }
|
---|
71 |
|
---|
72 | : "build a kernel" && {
|
---|
73 | cd $SSP_DIR
|
---|
74 | if [ -e build ]; then
|
---|
75 | mv build build.$(date +%Y%m%d_%H%M%S)
|
---|
76 | fi
|
---|
77 | mkdir build
|
---|
78 | cd build
|
---|
79 | ../configure.rb -T $SSP_TARGET_NAME -w
|
---|
80 | make
|
---|
81 | }
|
---|
82 |
|
---|
83 | exit 0
|
---|