aboutsummaryrefslogtreecommitdiff
path: root/tools/darwin/depends/configure.in
blob: de0c3532eb96231e0d7c482e534d757e995c5baf (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
AC_PREREQ(2.59)
AC_INIT([darwin-depends], [2.00], [http://trac.xbmc.org])

AC_ARG_WITH([darwin],
  [AS_HELP_STRING([--with-darwin],
  [build depend libs for darwin osx (default) or ios.])],
  [use_darwin=$withval],
  [use_darwin=missing])

AC_ARG_WITH([arch],
  [AS_HELP_STRING([--with-arch],
  [build depend libs for arch i386 (default osx), x86_64, ppc or armv7 (default ios).])],
  [use_arch=$withval],)

AC_ARG_WITH([sdk],
  [AS_HELP_STRING([--with-sdk],
  [build depend libs using sdk 10.6 (default osx) or 4.2 (default ios).])],
  [use_sdk=$withval],)

use_staging="/Users/Shared/xbmc-depends"

# find xcodebuild, test in Xcode.app, if not there, fall back to normal location
use_xcodepath="/Applications/Xcode.app/Contents/Developer"
use_xcodebuild="/Applications/Xcode.app/Contents/Developer/usr/bin/xcodebuild"
if [[ ! -f "$use_xcodebuild" ]]; then
  use_xcodepath="/Developer"
  use_xcodebuild="/usr/bin/xcodebuild"  
fi
AC_MSG_RESULT(found xcodebuild at $use_xcodebuild)
use_xcode=[`$use_xcodebuild -version | grep Xcode | awk '{ print $2}'`]

OUTPUT_FILES="Makefile Makefile.include"
case $use_darwin in
  osx)
     use_arch="${use_arch:-i386}"
     if test "$use_arch" = "armv7"; then
       AC_MSG_ERROR(error in configure of --with-arch=$use_arch)
     fi
     found_sdk_version=[`$use_xcodebuild -showsdks | grep macosx | sort |  tail -n 1 | grep -oE 'macosx[0-9.0-9]+' | cut -c 7-$NF`]
     use_sdk="${use_sdk:-$found_sdk_version}"
     case $use_sdk in
     10.5);;
     10.6);;
     10.7);;
     10.8);;
     *)
       AC_MSG_ERROR(error in configure of --with-sdk=$use_sdk)
     esac
     sdk_name=macosx$use_sdk
     use_prefix=${use_staging}/${sdk_name}_${use_arch}
     CONFIG_SITE=" [config.site:config.site_osx.in]"
     MK_CONFIG_SITE=" [config.site.mk:config.site_osx.mk.in]"
     ;;
  ios)
     use_arch="${use_arch:-armv7}"
     if test "$use_arch" != "armv7"; then
       AC_MSG_ERROR(error in configure of --with-arch=$use_arch)
     fi
     found_sdk_version=[`$use_xcodebuild -showsdks | grep iphoneos | sort | tail -n 1 | awk '{ print $2}'`]
     use_sdk="${use_sdk:-$found_sdk_version}"
     case $use_sdk in
     4.*);;
     5.*);;
     *)
       AC_MSG_ERROR(error in configure of --with-sdk=$use_sdk)
     esac
     sdk_name=iphoneos$use_sdk
     use_prefix=${use_staging}/${sdk_name}_${use_arch}
     CONFIG_SITE=" [config.site:config.site_ios.in]"
     MK_CONFIG_SITE=" [config.site.mk:config.site_ios.mk.in]"
     ;;
  *)
     AC_MSG_ERROR([error in configure, missing or incorrect --with-darwin arg])
     ;;
esac

use_sdk_path=[`$use_xcodebuild -version -sdk $sdk_name | grep ^Path | awk '{ print $2}'`]

AC_MSG_RESULT(configuring for darwin $sdk_name)
AC_MSG_RESULT(using the sdk path of $use_sdk_path)
AC_MSG_RESULT(creating hostroot at $use_staging)

OUTPUT_FILES+=${CONFIG_SITE}
OUTPUT_FILES+=${MK_CONFIG_SITE}

use_toolchain=${use_staging}/toolchain
AC_MSG_RESULT(creating build toolchain at $use_toolchain)
mkdir -p ${use_toolchain}

AC_MSG_RESULT(creating tarball storage at $use_staging/tarballs)
mkdir -p ${use_staging}/tarballs

AC_MSG_RESULT(creating hostroot directories at $use_prefix)
mkdir -p ${use_prefix}/bin
mkdir -p ${use_prefix}/lib
mkdir -p ${use_prefix}/slib
mkdir -p ${use_prefix}/share
mkdir -p ${use_prefix}/share/aclocal
mkdir -p ${use_prefix}/include


AC_SUBST(use_xcode)
AC_SUBST(use_xcodepath)

AC_SUBST(use_sdk)
AC_SUBST(use_arch)
AC_SUBST(use_darwin)
AC_SUBST(use_prefix)
AC_SUBST(use_staging)
AC_SUBST(use_sdk_path)
AC_SUBST(use_toolchain)

AC_CONFIG_FILES([${OUTPUT_FILES}])

AC_OUTPUT

AC_MSG_RESULT(setting up config.site files)
cp config.site ${use_prefix}/share/config.site

AC_MSG_RESULT(setting up python26 Makefile)
cp python26/Makefile.${use_darwin} python26/Makefile