sugar-run-from-journal: fix for old sugar versions
[sugaredwine.git] / build.sh
blobc10604cf1ee50d17e912a1fe1052e67d6a2f68fd
1 #!/bin/sh
3 ORIG_DIR=${PWD}
4 BUILD_DIR=$(mktemp -d)
5 WINE_ORIGIN=git://source.winehq.org/git/wine.git
6 WINE_BASE=12c809056eafceb3c1ff85fe90b1400739ed00f1
7 WINE_COMMIT=c0f4c2e82b87411000b622f7d6ac0beab0c1ed6d
9 mkdir "${BUILD_DIR}"/Wine.activity
11 cp -r app activity patches setup.py wineactivity.py build.sh "${BUILD_DIR}"/Wine.activity
13 mkdir "${BUILD_DIR}"/Wine.activity/bin
15 cp bin/sugar-start-uri bin/sugar-run-from-journal "${BUILD_DIR}"/Wine.activity/bin
17 if test x = x"${WINE_TREE}"; then
18 WINE_TREE="${BUILD_DIR}"/wine
21 if test -e "${WINE_TREE}"/.git; then
22 cd "${WINE_TREE}"
24 if test x != x"${WINE_NEWTREE}"; then
25 WINE_ORIGIN=$(git config remote.origin.url)
26 WINE_BASE=$(git merge-base HEAD origin/master)
27 WINE_COMMIT=$(git show HEAD --pretty='format:%H'|head -n 1)
28 rm "${BUILD_DIR}"/Wine.activity/patches/*
29 git format-patch -o "${BUILD_DIR}"/Wine.activity/patches "${WINE_BASE}" || exit 1
31 else
32 git clone "${WINE_ORIGIN}" "${WINE_TREE}" || exit 1
34 cd "${WINE_TREE}"
36 git config user.email nobody@nowhere || exit 1
37 git config user.name nobody || exit 1
40 (git checkout "${WINE_COMMIT}" && test -z "$(git diff "${WINE_COMMIT}")") || \
41 (git fetch && git checkout "${WINE_BASE}" && git am "${BUILD_DIR}"/Wine.activity/patches/*.patch && test -z "$(git diff)") || \
42 exit 1
44 sed 's,^WINE_ORIGIN=.*$,WINE_ORIGIN='"${WINE_ORIGIN}"',' --in-place "${BUILD_DIR}"/Wine.activity/build.sh
45 sed 's,^WINE_BASE=.*$,WINE_BASE='"${WINE_BASE}"',' --in-place "${BUILD_DIR}"/Wine.activity/build.sh
46 sed 's,^WINE_COMMIT=.*$,WINE_COMMIT='"${WINE_COMMIT}"',' --in-place "${BUILD_DIR}"/Wine.activity/build.sh
48 ./configure --prefix "${BUILD_DIR}"/Wine.activity ${CONFIG_OPTS:-CFLAGS=-Os} || exit 1
49 make ${MAKE_OPTS} || exit 1
50 make install-lib || exit 1
52 cd "${BUILD_DIR}"/Wine.activity
54 if test x = x"${DEBUG}"; then
55 find bin lib|xargs strip -g
58 find . -type f | sed 's,^./,,g' > MANIFEST
60 ./setup.py dist || exit 1
62 PACKAGE_FILENAME=*.xo
64 mv *.xo "${ORIG_DIR}" || exit 1
66 cd "${ORIG_DIR}"
68 rm -rf "${BUILD_DIR}"
70 echo Activity bundle created at ${ORIG_DIR}/${PACKAGE_FILENAME}