3
3

Delete article

Deleted articles cannot be recovered.

Draft of this article would be also deleted.

Are you sure you want to delete this article?

More than 3 years have passed since last update.

PDP-11のgccクロスコンパイル環境の構築メモ

Last updated at Posted at 2014-12-29

PDP-11用のgccクロスコンパイラ環境の構築メモ。
結局、必要な情報はツールのURLとビルドオプションだったりするが、
メモ代わりにシェルスクリプトを書く。(注:bashでしか試していない)

スクリプト:

  • pkginst.sh
  • pkg-binutil.sh
  • pkg-gcc.sh
  • pkg-gmp.sh
  • pkg-mpc.sh
  • pkg-mpfr.sh

####実行手順

  1. pkginst.shをPATHの通ったフォルダーに置く
  2. 以下の順番に実行
 $ pkg-binutil.sh
 $ pkg-gmp.sh
 $ pkg-mpfr.sh
 $ pkg-mpc.sh
 $ pkg-gcc.sh

####コード

pkginst.sh
#!/bin/sh

download(){
	URL=$1
	FILE=`basename $URL`
	if [ ! -e $FILE ] ;then
		curl -O $URL
	fi
	echo $FILE
}
expand(){
	FILE=$1
	case $FILE in
		*\.gz)
			tar xfz $FILE
			;;
		*\.bz2)
			tar xfj $FILE
			;;
	esac
	echo $FILE | sed -e "s/.tar.*//g"
}
mkinst(){
	DIR=$1
	FLGS=$2
	OPTS=$3
	pushd $DIR
	mkdir build; cd build
	echo "configure ..."
	CFLAGS=$FLGS ../configure $OPTS
	echo "make ..."
	make
	sudo make install
	popd
}

FILE=`download $1`
DIR=`expand $FILE`
mkinst $DIR "$2" "$3"
pkg-binutils.sh
#!/bin/sh
pkginst "http://www.ring.gr.jp/archives/GNU/binutils/binutils-2.25.tar.bz2" \
	"-Wno-error=deprecated-declarations" \
	"--target=pdp11-aout --disable-nls --prefix=/usr/local/pdp11-aout"
pkg-gmp.sh
#!/bin/sh
pkginst "http://www.ring.gr.jp/archives/GNU/gmp/gmp-5.1.3.tar.bz2" \
	"" \
	"--prefix=/usr/local/gmp"
pkg-mpfr.sh
#!/bin/sh
pkginst "http://www.ring.gr.jp/archives/GNU/mpfr/mpfr-3.1.2.tar.bz2" \
	"" \
	"--prefix=/usr/local/mpfr --with-gmp=/usr/local/gmp"
pkg-mpc.sh
#!/bin/sh
pkginst "http://ftp.gnu.org/gnu/mpc/mpc-1.0.1" \
	"" \
	"--prefix=/usr/local/mpc --with-gmp=/usr/local/gmp --with-mpfr=/usr/local/mpfr"
pkg-gcc.sh
#!/bin/sh
pkginst "http://www.ring.gr.jp/archives/GNU/gcc/gcc-4.9.2/gcc-4.9.2.tar.bz2" \
	"" \
	"--target=pdp11-aout \
	--disable-nls \
	--disable-threads \
	--disable-shared \
	--disable-libssp \
	--enable-languages=c \
	--with-gmp=/usr/local/gmp \
	--with-mpfr=/usr/local/mpfr \
	--with-mpc=/usr/local/mpc \
	--prefix=/usr/local/pdp11-aout"

以上。


(2020/10/3修正:mpcのダウンロード先変更)

3
3
0

Register as a new user and use Qiita more conveniently

  1. You get articles that match your needs
  2. You can efficiently read back useful information
  3. You can use dark theme
What you can do with signing up
3
3

Delete article

Deleted articles cannot be recovered.

Draft of this article would be also deleted.

Are you sure you want to delete this article?