Skip to content

Commit

Permalink
Public release of woce-build, enjoy!
Browse files Browse the repository at this point in the history
  • Loading branch information
dtzWill committed Jun 27, 2012
1 parent df3a519 commit ee09939
Show file tree
Hide file tree
Showing 31 changed files with 2,824 additions and 1 deletion.
46 changes: 46 additions & 0 deletions Makefile
Original file line number Diff line number Diff line change
@@ -0,0 +1,46 @@
# Build WOCE goodness

WOCE_TOOLCHAIN=arm-2009q1
WOCE_ARCH=armv7

LEVEL = .

.PHONY: woce-toolchain woce-headers clobber
.PHONY: qt4 luna-sysmgr

# To build packages, we need the toolchain and the staging dir setup
# For now, just list packages to be built here, in a working order.
build:: linkdirs
$(MAKE) woce-toolchain woce-headers
$(MAKE) luna-sysmgr
@echo
@echo "Build Success! New LunaSysMgr available at:"
@echo `readlink -f packages/sysmgr/luna-sysmgr/build/armv7-stage/release-topaz/LunaSysMgr`
@echo

# For now, manually create phony targets for building each package,
# and also manually manage dependencies.
# Grabbing WIDK's DEPENDS and automatic target creation support
# should be done once this gets non-trivial to do by hand.
qt4:
$(MAKE) -C packages/sysmgr/qt4

luna-sysmgr: qt4
$(MAKE) -C packages/sysmgr/luna-sysmgr

# Download and extract the toolchain
woce-toolchain: toolchain/$(WOCE_TOOLCHAIN)/.unpacked

# Grab the rootfs, stage it, and add our required headers
woce-headers: staging/$(WOCE_ARCH)/usr/include/.staged
$(MAKE) -C packages/web/webcore
$(MAKE) -C packages/web/webkit

include $(LEVEL)/Makefile.common

# Cleanup everything other than the downloads (which are sacred)
clobber::
rm -rf rootfs
rm -rf staging
rm -rf packages/sysmgr/*/build
rm -rf packages/web/*/build
40 changes: 40 additions & 0 deletions Makefile.common
Original file line number Diff line number Diff line change
@@ -0,0 +1,40 @@
# Common paths, rules, etc

# Default rule
.PHONY: build unpack
build::

# LEVEL should be set by every Makefile
ifndef LEVEL
$(error "LEVEL not set in Makefile!")
endif

# Paths to common directories
DL_DIR=$(LEVEL)/downloads
DOCTOR_DIR=$(LEVEL)/doctors
TOOLCHAIN_DIR=$(LEVEL)/toolchain

# Include rules for re-using global directories
# for downloads and doctors, if they already exist
include $(LEVEL)/support/srvln.mk

# Include rules for building download targets
include $(LEVEL)/support/dl.mk

# Include information used for cross-compiling
include $(LEVEL)/support/cross-compile.mk

# Include rules for downloading doctor files
include $(LEVEL)/support/doctors.mk

# Include rules for extracting rootfs from doctors
include $(LEVEL)/support/rootfs.mk

# Include rules for downloading and extracting toolchains
include $(LEVEL)/support/toolchains.mk

# Include rules for downloading the WOCE release tarballs
include $(LEVEL)/support/woce-dl.mk

# Include rules for bootstrapping headers
include $(LEVEL)/support/install-headers.mk
4 changes: 3 additions & 1 deletion README.md
Original file line number Diff line number Diff line change
@@ -1,4 +1,6 @@
woce-build
==========

Coming soon to a repo near you? woce-build! A fully working script to (initially) build LunaSysMgr and end up with an installable target!
Build a Touchpad-compatible LunaSysMgr from source!

More to come.
115 changes: 115 additions & 0 deletions packages/sysmgr/luna-sysmgr/Makefile
Original file line number Diff line number Diff line change
@@ -0,0 +1,115 @@
### Packaging metadata
NAME = lunasysmgr-ce
TITLE = LunaSysMgr-CE
APP_ID = org.webos-community-edition.${NAME}
SIGNER = org.webos-ports
VERSION = 0.0.1
TYPE = Application
CATEGORY = System Utilities
HOMEPAGE = http://www.webos-ports.org/wiki/Application:LunaSysMgr-CE
# TODO: Fix this icon! :)
ICON = http://www.webos-internals.org/images/a/a5/X.png
MAINTAINER = WebOS Ports
DESCRIPTION = ${APPINFO_DESCRIPTION}
APPINFO_DESCRIPTION = Luna SysManager is the user interface on webOS.<br>

CHANGELOG = \
0.0.1: Initial testing release.

APPINFO_CHANGELOG = [ \
{ "version" : "0.0.1", "log" : [ "Initial testing release" ] } \

LICENSE = Apache 2.0 License
HEADLESSAPP_VERSION = 0.2.0


LEVEL=../../..

# Default goal is to build LunaSysMgr
# There's a beta 'package' target as well that
# packages it up, but it's not ready yet!
build::
package::

include $(LEVEL)/Makefile.common
include $(LEVEL)/support/package.mk
include $(LEVEL)/support/headlessapp.mk

QTPATH := $(shell readlink -f $(LEVEL)/packages/sysmgr/qt4/build/armv7)
QMAKE := $(QTPATH)/bin/qmake-palm

.PHONY: build unpack patch package
package:: ipkgs/${APP_ID}_${VERSION}_armv7.ipk
build:: build/armv7-stage/.built-${VERSION}
unpack: build/src/.unpacked

### Unpack the software and build it
build/src/.unpacked: $(WOCE_DL) sysmgr.patch
-rm -rf build
mkdir -p build/src
tar -C build/src --strip=2 -zxf $(WOCE_DL) webos-WOCE/luna-sysmgr
patch -Np2 -d build/src < sysmgr.patch
touch $@

build/armv7-stage/.built-${VERSION}: build/src/.unpacked
-rm -rf build/armv7-stage
mkdir -p build/armv7-stage
cd build/armv7-stage && \
$(CCENV) \
PATH=$(QTPATH)/bin:$$PATH \
$(QMAKE) ../src \
-spec qws/linux-armv6-g++
$(CCENV) $(MAKE) -C build/armv7-stage
touch $@

### Packaging magic
build/.built-${VERSION}: build/armv7.built-${VERSION}
touch $@

### Headless app packaging fun
build/%.built-${VERSION}: build/%-stage/.built-${VERSION} ${DL_DIR}/headlessapp-${HEADLESSAPP_VERSION}.tar.gz
rm -rf build/$*
mkdir -p build/$*/usr/palm/applications/${APP_ID}
tar -C build/$*/usr/palm/applications/${APP_ID} -xf ${DL_DIR}/headlessapp-${HEADLESSAPP_VERSION}.tar.gz
rm -rf build/$*/usr/palm/applications/${APP_ID}/.git
tar -cf - control | \
tar -C build/$*/usr/palm/applications/${APP_ID}/ -xf -
mkdir -p build/$*/usr/palm/applications/${APP_ID}/bin
tar -cf - replace.sh restore.sh | \
tar -C build/$*/usr/palm/applications/${APP_ID}/bin/ -xf -
tar -C build/$*-stage/release-topaz/ -cf - LunaSysMgr | \
tar -C build/$*/usr/palm/applications/${APP_ID}/bin/ -xf -
echo "{" > build/$*/usr/palm/applications/${APP_ID}/appinfo.json
echo "\"title\": \"${TITLE}\"," >> build/$*/usr/palm/applications/${APP_ID}/appinfo.json
echo "\"id\": \"${APP_ID}\"," >> build/$*/usr/palm/applications/${APP_ID}/appinfo.json
echo "\"version\": \"${VERSION}\"," >> build/$*/usr/palm/applications/${APP_ID}/appinfo.json
echo "\"vendor\": \"WebOS Ports\"," >> build/$*/usr/palm/applications/${APP_ID}/appinfo.json
echo "\"type\": \"web\"," >> build/$*/usr/palm/applications/${APP_ID}/appinfo.json
echo "\"main\": \"index.html\"," >> build/$*/usr/palm/applications/${APP_ID}/appinfo.json
echo "\"icon\": \"icon.png\"," >> build/$*/usr/palm/applications/${APP_ID}/appinfo.json
ifdef APPINFO_DESCRIPTION
echo '"message": "${APPINFO_DESCRIPTION}",' >> build/$*/usr/palm/applications/${APP_ID}/appinfo.json
endif
ifdef APPINFO_CHANGELOG
echo '"changeLog": ${APPINFO_CHANGELOG},' >> build/$*/usr/palm/applications/${APP_ID}/appinfo.json
endif
echo '"uiRevision": "2",' >> build/$*/usr/palm/applications/${APP_ID}/appinfo.json
echo "\"noWindow\": true" >> build/$*/usr/palm/applications/${APP_ID}/appinfo.json
echo "}" >> build/$*/usr/palm/applications/${APP_ID}/appinfo.json
touch $@

### CONTROL files
build/%/CONTROL/postinst:
rm -f $@
mkdir -p build/$*/CONTROL
install -m 0775 control/postinst build/$*/CONTROL
chmod ugo+x $@

build/%/CONTROL/prerm:
rm -f $@
mkdir -p build/$*/CONTROL
install -m 0775 control/prerm build/$*/CONTROL
chmod ugo+x $@

clobber::
rm -rf build
32 changes: 32 additions & 0 deletions packages/sysmgr/luna-sysmgr/control/postinst
Original file line number Diff line number Diff line change
@@ -0,0 +1,32 @@
#!/bin/sh

NAME=lunasysmgr-ce

APPNAME=LunaSysMgr

APPID=org.webos-community-edition.${NAME}

APPS=/media/cryptofs/apps

[ -d ${APPS} ] || { echo "Requires webOS 1.3.5 or later" ; exit 1 ; }

APPDIR=${APPS}/usr/palm/applications/${APPID}

# Create copy of existing LunaSysMgr on installation.
cp /usr/bin/LunaSysMgr ${APPDIR}/LunaSysMgr.bak

mount -o remount RW /

# Install script to swap Luna copies on shutdown
cp ${APPDIR}/bin/replace.sh /etc/init.d/replace_luna
ln -s /etc/init.d/replace_luna /etc/rc0.d/S26replace_luna
ln -s /etc/init.d/replace_luna /etc/rc6.d/S26replace_luna
ln -s /etc/init.d/replace_luna /etc/rcH.d/S26replace_luna
ln -s /etc/init.d/replace_luna /etc/rcU.d/S26replace_luna

# Install desired new copy for the replacer to find
cp ${APPDIR}/bin/LunaSysMgr /usr/bin/LunaSysMgr.new

mount -o remount RO /

exit 0
38 changes: 38 additions & 0 deletions packages/sysmgr/luna-sysmgr/control/prerm
Original file line number Diff line number Diff line change
@@ -0,0 +1,38 @@
#!/bin/sh

NAME=lunasysmgr-ce

APPNAME=LunaSysMgr

APPID=org.webos-community-edition.${NAME}

APPS=/media/cryptofs/apps

[ -d ${APPS} ] || { echo "Requires webOS 1.3.5 or later" ; exit 1 ; }

APPDIR=${APPS}/usr/palm/applications/${APPID}

mount -o remount RW /

# Remove files put onto system
if [ -e /usr/bin/LunaSysMgr.new]
rm /usr/bin/LunaSysMgr.new
fi

rm /etc/rc*.d/S26replace_luna

if [ -e ${APPDIR/LunaSysMgr.bak]
mv ${APPDIR}/LunaSysMgr.bak /usr/bin/LunaSysMgr.bak
fi
#rm /etc/init.d/replace_luna
mount -o remount RO /
# Only report success (and let this package be removed)
# if LunaSysMgr is back to its original state
# TODO: Verify md5 or similar?
# TODO: How does this happen? Button launched from app itself,
# followed by a reboot?
diff /usr/bin/LunaSysMgr ${APPDIR}/LunaSysMgr.bak
exit $?
24 changes: 24 additions & 0 deletions packages/sysmgr/luna-sysmgr/replace.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,24 @@
#!/bin/sh

# Copy our new LunaSysMgr to the system
# Meant to be invoked only when LunaSysMgr isn't running

NAME=LunaSysMgr-CE

APPNAME=LunaSysMgr

# TODO: Abort if Luna is running!

mount -o remount RW /

/sbin/stop ${APPNAME} || true

if [ -e /usr/bin/LunaSysMgr.*]
mv /usr/bin/LunaSysMgr.* /usr/bin/LunaSysMgr
fi

mount -o remount RO /

/sbin/start ${APPNAME}

exit 0
28 changes: 28 additions & 0 deletions packages/sysmgr/luna-sysmgr/restore.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,28 @@
#!/bin/sh

# Restore the original LunaSysMgr

NAME=LunaSysMgr-CE

APPNAME=LunaSysMgr

APPID=org.webos-ports.${NAME}

APPS=/media/cryptofs/apps

[ -d ${APPS} ] || { echo "Requires webOS 1.3.5 or later" ; exit 1 ; }

APPDIR=${APPS}/usr/palm/applications/${APPID}

# Stop the service if running
/sbin/stop ${APPNAME} || true

mount -o remount RW /

mv ${APPDIR}/LunaSysMgr.bak /usr/bin/LunaSysMgr

/sbin/start ${APPNAME}

mount -o remount RO /

exit 0
26 changes: 26 additions & 0 deletions packages/sysmgr/luna-sysmgr/sysmgr.patch
Original file line number Diff line number Diff line change
@@ -0,0 +1,26 @@
diff --git a/luna-sysmgr/sysmgr.pro b/luna-sysmgr/sysmgr.pro
index e68470f..f00e839 100644
--- a/luna-sysmgr/sysmgr.pro
+++ b/luna-sysmgr/sysmgr.pro
@@ -45,8 +45,10 @@ ENV_BUILD_TYPE = $$(BUILD_TYPE)
# Prevent conflict with usage of "signal" in other libraries
CONFIG += no_keywords

-CONFIG += link_pkgconfig
-PKGCONFIG = glib-2.0 gthread-2.0
+# We don't have .pc files for most things, rely on being passed
+# the needed include/library search paths
+# CONFIG += link_pkgconfig
+# PKGCONFIG = glib-2.0 gthread-2.0

QT = core gui declarative

@@ -670,7 +672,7 @@ QMAKE_CXXFLAGS += -DFIX_FOR_QT
#-DNO_WEBKIT_INIT

# Override the default (-Wall -W) from g++.conf mkspec (see linux-g++.conf)
-QMAKE_CXXFLAGS_WARN_ON += -Wno-unused-parameter -Wno-unused-variable -Wno-reorder -Wno-missing-field-initializers -Wno-extra
+QMAKE_CXXFLAGS_WARN_ON += -Wno-unused-parameter -Wno-unused-variable -Wno-reorder -Wno-missing-field-initializers -Wno-extra -Wno-strict-aliasing

LIBS += -lcjson -lLunaSysMgrIpc -lLunaKeymaps -lWebKitLuna -llunaservice -lpbnjson_cpp -lhelpers

Loading

0 comments on commit ee09939

Please sign in to comment.