wine: rearrange patches to a more sensible order
[sugaredwine.git] / build.sh
blobfedf5a7ba70564db7c36ecfbf2eb18a9b2e80ca8
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=7832378658339165d5f06972315a834e0bbddf16
23 WINE_COMMIT=4113108f6e486993171a261773afd83dc933bbbb
25 mkdir "${BUILD_DIR}"/Wine.activity
27 cp -r app activity patches setup.py wineactivity.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 merge-base HEAD origin/master)
43 WINE_COMMIT=$(git show HEAD --pretty='format:%H'|head -n 1)
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}