Closed Bug 641232 Opened 9 years ago Closed 9 years ago

Make HAS_XCODE_2_1 detection compatible with Xcode 4

Categories

(MailNews Core :: Build Config, defect)

x86
macOS
defect
Not set
normal

Tracking

(Not tracked)

RESOLVED FIXED
Thunderbird 7.0

People

(Reporter: Nomis101, Assigned: espindola)

Details

Attachments

(3 files)

Currently building Thunderbird with Xcode 4 is not possible, because HAS_XCODE_2_1 isn't set correctly in configure.in. And so in config.mk it uses "XCODE_PRODUCT_DIR = build" instead of "XCODE_PRODUCT_DIR = build/$ (BUILDSTYLE)". This breakes Thunderbird.mdimporter.
See also: http://groups.google.com/group/mozilla.dev.apps.thunderbird/browse_thread/thread/00bac8d69c57d679#

This is currently not a problem for mozilla-central, because XCODE_PRODUCT_DIR is unused in m-c: http://mxr.mozilla.org/mozilla-central/search?string=XCODE_PRODUCT_DIR
Hm, before Xcode 4:

checking for xargs... /usr/bin/xargs
checking for pbbuild... no
checking for xcodebuild... /Developer/usr/bin/xcodebuild
checking for sdp... /Developer/usr/bin/sdp
/Developer/temp/src/configure: line 4461: test: : integer expression expected
checking for valid compiler/Mac OS X SDK combination... yes


Now with Xcode 4:

checking for xargs... /usr/bin/xargs
checking for pbbuild... no
checking for xcodebuild... /Developer/usr/bin/xcodebuild
/Developer/temp/src/configure: line 4342: test: Xcode 4.0 Build version 4A304a: integer expression expected
checking for sdp... /Developer/usr/bin/sdp
/Developer/temp/src/configure: line 4461: test: : integer expression expected
checking for valid compiler/Mac OS X SDK combination... yes
Attached patch WorkaroundSplinter Review
This is not a fix, this is only a workaround because I have no idea how to fix this. With this patch I'm able to build Thunderbird with Xcode 4.0 on Mac OS X 10.6 and with Xcode 4.1 on Mac OS X 10.7. I hope somebody will find a proper fix for that.
$ xcodebuild -version 2>/dev/null
Xcode 4.0.2
Build version 4A2002a

Looks like the output format change completely from what configure expects. Probably the best is adding the shell equivalent of

if 'Xcode 4.' in version:
  HAS_XCODE_2_1=1

I will give that a try once I reboot my home machine into os X.
An even better fix would be to drop HAS_XCODE_2_1. Checking the version instead of directly checking the features is not the best way to write configure scripts.

Can you give instructions on how you are building thunderbird?
(In reply to comment #3)
> I will give that a try once I reboot my home machine into os X.
Thanks for looking into that. :-)


(In reply to comment #4) 
> Can you give instructions on how you are building thunderbird?

I have a bash script for that. In a nutshell the script does:

$ mkdir /Users/Nomis101/Documents/Developer/temp
$ cd /Users/Nomis101/Documents/Developer/temp
$ hg clone http://hg.mozilla.org/comm-central/ src 
$ cd src
$ cp -f /Developer/ExtraMozillaFiles/TB64/.mozconfig /Users/Nomis101/Documents/Developer/temp/src
$ python client.py checkout --mozilla-repo=http://hg.mozilla.org/mozilla-central/ --skip-chatzilla --skip-venkman
$ make -f client.mk build
$ make -C obj-x86_64-apple-darwin10.8.0/mail/installer

If you adapt the pathes you will be able to build TB in the same way.


The mozconfig is (I deleted my lines for clang and the locale to make it simple):

# Enable parallel compiling
CONCURRENCY=$(( `sysctl hw.logicalcpu | awk {'print $2'}`  * 4 ))

# Options for client.mk.
mk_add_options MOZ_MAKE_FLAGS="-j$CONCURRENCY" 
mk_add_options MOZ_OBJDIR=@TOPSRCDIR@/obj-@CONFIG_GUESS@
mk_add_options AUTOCONF=autoconf213

# Options for 'configure' (same as command-line options).
ac_add_options --with-macos-sdk=/Developer/SDKs/MacOSX10.6.sdk
ac_add_options --enable-macos-target=10.6
ac_add_options --enable-application=mail
ac_add_options --enable-optimize
ac_add_options --enable-update-packaging
ac_add_options --enable-update-channel=nightly
ac_add_options --disable-debug
ac_add_options --disable-tests


This will give you a 64bit-only TB trunk build. The problem will happen at the very end of the build process, so you need to let it build for a while.
code 2.1 is really old. My proposal is to just drop support for Xcode < 2.1. Even if we have to support Xcode 2.0, the checks should be on the Thunderbird specific files.

This patch drops unused checks from the m-c tree.
Attachment #535895 - Flags: review?(ehsan)
I'm not a build system reviewer.  For the m-c patch, you either want ted or khuey, for the comm-central patch, you probably want Callek.
Comment on attachment 535895 [details] [diff] [review]
[checked into inbound] Remove unused bits from mc

Kill it.
Attachment #535895 - Flags: review?(ehsan) → review+
(In reply to comment #6)
> Created attachment 535895 [details] [diff] [review] [review]
> Remove unused bits from mc
> 
> Xcode 2.1 is really old. My proposal is to just drop support for Xcode <
> 2.1. Even if we have to support Xcode 2.0, the checks should be on the
> Thunderbird specific files.

Thats indeed the easiest way to fix this and similar to my workaround. However, I've tested your patches (with Xcode 4.0.2) and it works for me.
Attachment #535896 - Flags: review?(ehsan) → review?(bugspam.Callek)
Comment on attachment 535896 [details] [diff] [review]
the thunderbird patch

Since I know little XCODE/mdimporter I'll feel better if Mark reviews this.

That said, in the mdimporter code, my nit is to move the BUILDSTYLE assignment above the XCODE_PRODUCT_DIR if this is even a usable solution. (I know it works fine with make syntax, but that is clearer). I would wait for Mark's review here though.

configure/etc. changes look fine and match what you patched in m-c and got review for.
Attachment #535896 - Flags: review?(mbanner)
Attachment #535896 - Flags: review?(bugspam.Callek)
Attachment #535896 - Flags: feedback+
Assignee: nobody → respindola
Comment on attachment 535895 [details] [diff] [review]
[checked into inbound] Remove unused bits from mc

Checked into mozilla-inbound: http://hg.mozilla.org/integration/mozilla-inbound/rev/c8faf1876b53
Attachment #535895 - Attachment description: Remove unused bits from mc → [checked into inbound] Remove unused bits from mc
I'll review the c-c patch later this week.
Keywords: checkin-needed
Whiteboard: [inbound]
Target Milestone: --- → Thunderbird 7.0
(In reply to comment #12)
> Comment on attachment 535895 [details] [diff] [review] [review]
> [checked into inbound] Remove unused bits from mc
> 
> Checked into mozilla-inbound:
> http://hg.mozilla.org/integration/mozilla-inbound/rev/c8faf1876b53

http://hg.mozilla.org/mozilla-central/rev/c8faf1876b53
Whiteboard: [inbound]
Attachment #535896 - Flags: review?(mbanner) → review+
I can confirm that the Thunderbird patch allows me to build using XCode 4.
Checked in: http://hg.mozilla.org/comm-central/rev/ec4f54ab8cf3
Status: NEW → RESOLVED
Closed: 9 years ago
Keywords: checkin-needed
Resolution: --- → FIXED
Flags: in-testsuite-
You need to log in before you can comment on or make changes to this bug.