Skip to content

Instantly share code, notes, and snippets.

@tenforward
Created April 13, 2021 06:02
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save tenforward/12b24914d30601c29401a6deaa2f3e6a to your computer and use it in GitHub Desktop.
Save tenforward/12b24914d30601c29401a6deaa2f3e6a to your computer and use it in GitHub Desktop.
#!/bin/sh
##############################################################
pkgbase="ncftp"
vers="3.2.6"
url="ftp://ftp.ncftp.com/ncftp/ncftp-${vers}-src.tar.gz"
verify=""
digest=""
arch=`uname -m`
build=B1
src="ncftp-${vers}"
OPT_CONFIG="--disable-static --enable-shared"
DOCS="DONATE.txt README.txt doc"
patchfiles=""
# specifies files that are not in source archive and patchfiles
addfiles=""
compress=txz
##############################################################
source /usr/share/plamobuild_functions.sh
# このスクリプトで使う1文字変数の意味
#
# $W : このスクリプトを動かすカレントディレクトリ
# $S : ソースコードのあるディレクトリ(デフォルト: $W/${src})
# $B : ビルド用ディレクトリ(デフォルト: /tmp/build)
# $P : ビルドしたファイルをインストールするディレクトリ(デフォルト: $W/work)
if [ $# -eq 0 ] ; then
opt_download=0 ; opt_config=1 ; opt_build=1 ; opt_package=1
else
opt_download=0 ; opt_config=0 ; opt_build=0 ; opt_package=0
for i in $@ ; do
case $i in
download) opt_download=1 ;;
config) opt_config=1 ;;
build) opt_build=1 ;;
package) opt_package=1 ;;
esac
done
fi
if [ $opt_download -eq 1 ] ; then
download_sources
fi
if [ $opt_config -eq 1 ] ; then
for f in $addfiles $patchfiles
do
if [ ! -f $f ]; then
echo "Required file ($f) is missing."
exit 255
fi
done
######################################################################
# out of tree build. patch apply in src dir
######################################################################
if [ -d $B ] ; then rm -rf $B ; fi ; cp -a $S $B
cd $B
for patch in $patchfiles ; do
if [ ! -f .${patch} ]; then
patch -p1 < $W/$patch
touch .${patch}
fi
done
# if [ -f autogen.sh ] ; then
# sh ./autogen.sh
# fi
export PKG_CONFIG_PATH=/usr/${libdir}/pkgconfig:/usr/share/pkgconfig
export LDFLAGS='-Wl,--as-needed'
export CFLAGS="-fcommon"
export CPP=/usr/bin/cpp
./configure --prefix=/usr --libdir=/usr/${libdir} --sysconfdir=/etc --localstatedir=/var --mandir=/usr/share/man ${OPT_CONFIG}
if [ $? != 0 ]; then
echo "configure error. $0 script stop"
exit 255
fi
fi
if [ $opt_build -eq 1 ] ; then
cd $B
export CFLAGS="-fcommon"
export LDFLAGS='-Wl,--as-needed'
make -j3
if [ $? != 0 ]; then
echo "build error. $0 script stop"
exit 255
fi
fi
if [ $opt_package -eq 1 ] ; then
check_root
if [ -d $P ] ; then rm -rf $P ; fi ; mkdir -p $P
cd $B
export LDFLAGS='-Wl,--as-needed'
make install DESTDIR=$P
################################
# install tweaks
# strip binaries, delete locale except ja, compress man,
# install docs and patches, compress them and chown root.root
################################
install_tweak
#############################
# convert symlink to null file and
# add "ln -sf" command into install/doinst.sh
################################
convert_links
cd $P
/sbin/makepkg ../$pkg.$compress <<EOF
y
1
EOF
fi
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment