Commit 75d6d930 authored by sebt3's avatar sebt3
Browse files

Build a dbp out of this

parent 28eb8240
Loading
Loading
Loading
Loading
+65 −5
Original line number Diff line number Diff line
@@ -23,7 +23,7 @@ export PKG_CONFIG_PATH=$PYRA_ROOTFS/usr/lib/pkgconfig
export CPATH="$PYRA_ROOTFS/usr/include:$CPATH" 
export PATH="$TOOLCHAIN_ROOT/bin:$PATH"
export HOST_CC=gcc HOST_CXX=g++
addfastmath() {
pyra_addfastmath() {
	export CXXFLAGS="$CXXFLAGS -O3 -ffast-math"
	export CPPFLAGS="$CXXFLAGS" CFLAGS="$CXXFLAGS"
}
@@ -35,19 +35,51 @@ pyra_unset() {
pyra_setprj() {
	export PRJ=$1;
	if [ ! -z "$PRJ" ];then
		export LDFLAGS="-L$PYRA_BASEDIR/$PRJ/lib -Wl,-rpath,$PYRA_BASEDIR/$PRJ/lib $LDFLAGS" CXXFLAGS="$CXXFLAGS -I$PYRA_BASEDIR/$PRJ/include" PKG_CONFIG_PATH="$PYRA_BASEDIR/$PRJ/lib/pkgconfig:$PKG_CONFIG_PATH" CPATH="$PYRA_BASEDIR/$PRJ/include:$PYRA_ROOTFS/usr/include"
		if [ -d $PROJECTS_BASEDIR/$PRJ ];then
		export PRJ_ROOT=$PROJECTS_BASEDIR/$PRJ
		export PRJ_TARGET=$PRJ_ROOT/target
		export LDFLAGS="-L$PRJ_TARGET/lib -Wl,-rpath,$PRJ_TARGET/lib $LDFLAGS" CXXFLAGS="$CXXFLAGS -I$PRJ_TARGET/include" PKG_CONFIG_PATH="$PRJ_TARGET/lib/pkgconfig:$PKG_CONFIG_PATH" CPATH="$PRJ_TARGET/include:$PYRA_ROOTFS/usr/include"
		if [ -d "$PROJECTS_BASEDIR/$PRJ" ];then
			cd $PROJECTS_BASEDIR/$PRJ
		fi
	fi
}

pyra_makeprj() {
	local PRJ=$1
	[ $# -lt 1 ] && return 1
	if [ ! -d "$PROJECTS_BASEDIR/$PRJ" ];then
		mkdir -p "$PROJECTS_BASEDIR/$PRJ/target/meta" "$PROJECTS_BASEDIR/$PRJ/target/icons" "$PROJECTS_BASEDIR/$PRJ/target/root"
		cat >"$PROJECTS_BASEDIR/$PRJ/target/meta/default.desktop" <<ENDDESK
[Desktop Entry]
Version=
Type=Application
Categories=
Name=$PRJ
Comment=
Exec=$PRJ
Icon=${PRJ}.png
Terminal=false
StartupNotify=false
X-MultipleArgs=false

[Package Entry]
Id=$PRJ
Arch=armhf
Exec=$PRJ
Name=
Version=
Icon=${PRJ}.png
ENDDESK
	fi
	pyra_setprj $PRJ
}

# Help to configure stuff
#-------------------------

pyra_configure() {
	if [ -z "$PRJ" ];then
		echo "You should Configure your project (using the setprj <project> command)"
		echo "You should configure your project (using the pyra_setprj <project> command)"
		./configure --host=$TARGET_SYS $@
	else
		./configure --host=$TARGET_SYS --prefix=$PYRA_BASEDIR/$PRJ $@
@@ -56,12 +88,40 @@ pyra_configure() {

pyra_cmake() {
	if [ -z "$PRJ" ];then
		echo "You should Configure your project (using the setprj <project> command)"
		echo "You should configure your project (using the pyra_setprj <project> command)"
		SDLDIR="${PYRA_ROOTFS}/usr" cmake -DCMAKE_TOOLCHAIN_FILE=$CMAKETOOLCHAINFILE $@
	else
		SDLDIR="${PYRA_ROOTFS}/usr" cmake -DCMAKE_TOOLCHAIN_FILE=$CMAKETOOLCHAINFILE -DPRJ_PREFIX=$PYRA_BASEDIR/$PRJ -DCMAKE_INSTALL_PREFIX=$PYRA_BASEDIR/$PRJ $@
	fi
}
pyra_makeinstall() {
	make DESTDIR="$PROJECTS_BASEDIR/$PRJ/target/root" prefix=/ install
}

pyra_makedbp() {
	local R=0
	cd "$PROJECTS_BASEDIR/$PRJ/target"
	chmod -R go+rx "$PROJECTS_BASEDIR/$PRJ/target/root/"
	mksquashfs root $PRJ.squash -all-root -force-gid 0;R=$?
	if [ $R -ne 0 ];then
		echo ERROR: mksquashfs failed
		return $R
	fi
	zip -r $PRJ.zip meta icons;R=$?
	if [ $R -ne 0 ];then
		echo ERROR: zip failed
		return $R
	fi
	if [ ! -f $PRJ.zip ] || [ ! -f $PRJ.squash ];then
		echo ERROR: Some missing data
		return 1
	fi
	mkdir -p $DBPS_TARGETDIR
	cat $PRJ.squash $PRJ.zip >$DBPS_TARGETDIR/$PRJ.dbp
	rm $PRJ.squash $PRJ.zip
	echo $DBPS_TARGETDIR/$PRJ.dbp generated
}


#pndqmake() {
#	qmake-qt4 -spec $TOOLCHAIN_ROOT/arm/share/qt4/mkspecs/linux-pandora-g++ $@
+4 −0
Original line number Diff line number Diff line
@@ -426,6 +426,10 @@ setup.bashrc() {
	if ! grep -q "export TOOLCHAIN_ROOT" $back;then
		cat>>$HOME/.bashrc <<ENDRC
export TOOLCHAIN_ROOT=$DEST
pyra_makeprj() {
	. \$TOOLCHAIN_ROOT/environment-setup
	pyra_makeprj "\$@"
}
pyra_setprj() {
	. \$TOOLCHAIN_ROOT/environment-setup
	pyra_setprj "\$@"