kore

An easy to use, scalable and secure web application framework for writing web APIs in C.
Commits | Files | Refs | README | LICENSE | git clone https://git.kore.io/kore.git

helpers.sh (798B)



      1 if [ -z "$ROOT" ]; then
      2 	echo "No ROOT set"
      3 	exit 1
      4 fi
      5 
      6 SOURCES=sources
      7 BUILD=$ROOT/build
      8 FAKEROOT=$ROOT/fakeroot
      9 
     10 LASTDIR=`pwd`
     11 
     12 pushd() {
     13 	LASTDIR=`pwd`
     14 	cd $1
     15 }
     16 
     17 popd() {
     18 	cd $LASTDIR
     19 }
     20 
     21 fetch() {
     22 	url=$1
     23 	name=$2
     24 
     25 	if [ -f $SOURCES/$name.tar.gz ]; then
     26 		return
     27 	fi
     28 
     29 	curl -L "$url" > $SOURCES/$name.tar.gz
     30 }
     31 
     32 default_build() {
     33 	name=$1
     34 	shift
     35 	config=$*
     36 
     37 	build $name ./configure --prefix=$FAKEROOT/$NAME $config
     38 }
     39 
     40 build() {
     41 	name=$1
     42 	shift
     43 	configcmd=$*
     44 
     45 	if [ -f $BUILD/$name/.built ]; then
     46 		return
     47 	fi
     48 
     49 	rm -rf $BUILD/$name
     50 	rm -rf $FAKEROOT/$name
     51 
     52 	tar -zvxf $SOURCES/$name.tar.gz -C $BUILD
     53 
     54 	pushd $BUILD/$name
     55 	mkdir -p $FAKEROOT/$name
     56 
     57 	$configcmd
     58 
     59 	make -j
     60 	make install
     61 	popd
     62 
     63 	touch $BUILD/$name/.built
     64 }
     65 
     66 setup() {
     67 	mkdir -p $BUILD
     68 	mkdir -p $SOURCES
     69 	mkdir -p $FAKEROOT
     70 }
     71 
     72 setup