build.sh: use git describe to get prettier names for wine revisions
[sugaredwine.git] / build.sh
blobe74460a2b93d779a3c0e75a63fc1e6b3eb291a6f
1 #!/bin/sh
2 # Copyright (C) 2008, Vincent Povirk for CodeWeavers
4 # This library is free software; you can redistribute it and/or
5 # modify it under the terms of the GNU Lesser General Public
6 # License as published by the Free Software Foundation; either
7 # version 2 of the License, or (at your option) any later version.
9 # This library is distributed in the hope that it will be useful,
10 # but WITHOUT ANY WARRANTY; without even the implied warranty of
11 # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
12 # Lesser General Public License for more details.
14 # You should have received a copy of the GNU Lesser General Public
15 # License along with this library; if not, write to the
16 # Free Software Foundation, Inc., 59 Temple Place - Suite 330,
17 # Boston, MA 02111-1307, USA.
19 ORIG_DIR=${PWD}
20 BUILD_DIR=$(mktemp -d)
21 WINE_ORIGIN=git://source.winehq.org/git/wine.git
22 WINE_BASE=b79639699766e7c8f3e236f3fef54e5daac0e5f9
23 WINE_COMMIT=983e36a75c6d088d4c04491c1e3d4db0bf8823fc
25 mkdir "${BUILD_DIR}"/Wine.activity
27 cp -r app activity patches setup.py wineactivity.py filenames.py build.sh "${BUILD_DIR}"/Wine.activity
29 mkdir "${BUILD_DIR}"/Wine.activity/bin
31 cp bin/sugar-start-uri bin/sugar-run-from-journal "${BUILD_DIR}"/Wine.activity/bin
33 if test x = x"${WINE_TREE}"; then
34 WINE_TREE="${BUILD_DIR}"/wine
37 if test -e "${WINE_TREE}"/.git; then
38 cd "${WINE_TREE}"
40 if test x != x"${WINE_NEWTREE}"; then
41 WINE_ORIGIN=$(git config remote.origin.url)
42 WINE_BASE=$(git describe $(git merge-base HEAD origin/master))
43 WINE_COMMIT=$(git describe HEAD)
44 rm "${BUILD_DIR}"/Wine.activity/patches/*
45 git format-patch -o "${BUILD_DIR}"/Wine.activity/patches "${WINE_BASE}" || exit 1
47 else
48 git clone "${WINE_ORIGIN}" "${WINE_TREE}" || exit 1
50 cd "${WINE_TREE}"
52 git config user.email nobody@nowhere || exit 1
53 git config user.name nobody || exit 1
56 (git checkout "${WINE_COMMIT}" && test -z "$(git diff "${WINE_COMMIT}")") || \
57 (git fetch && git checkout "${WINE_BASE}" && git am "${BUILD_DIR}"/Wine.activity/patches/*.patch && test -z "$(git diff)") || \
58 exit 1
60 sed 's,^WINE_ORIGIN=.*$,WINE_ORIGIN='"${WINE_ORIGIN}"',' --in-place "${BUILD_DIR}"/Wine.activity/build.sh
61 sed 's,^WINE_BASE=.*$,WINE_BASE='"${WINE_BASE}"',' --in-place "${BUILD_DIR}"/Wine.activity/build.sh
62 sed 's,^WINE_COMMIT=.*$,WINE_COMMIT='"${WINE_COMMIT}"',' --in-place "${BUILD_DIR}"/Wine.activity/build.sh
64 ./configure --prefix "${BUILD_DIR}"/Wine.activity ${CONFIG_OPTS:-CFLAGS=-Os} || exit 1
65 make ${MAKE_OPTS} || exit 1
66 make install-lib || exit 1
68 cd "${BUILD_DIR}"/Wine.activity
70 # winemenubuilder is needed on Linux to create freedesktop menus; it doesn't make sense on sugar
71 rm lib/wine/winemenubuilder.exe.so
73 if test x = x"${DEBUG}"; then
74 find bin lib|xargs strip -g
77 find . -type f | sed 's,^./,,g' > MANIFEST
79 ./setup.py dist || exit 1
81 PACKAGE_FILENAME=*.xo
83 mv *.xo "${ORIG_DIR}" || exit 1
85 cd "${ORIG_DIR}"
87 rm -rf "${BUILD_DIR}"
89 echo Activity bundle created at ${ORIG_DIR}/${PACKAGE_FILENAME}