annotate build-scripts/makedep.sh @ 4324:1496aa09e41e SDL-1.2

Steven Noonan to sdl While trying to build the SDLMain.m included with SDL 1.2.14, with #define SDL_USE_NIB_FILE 1: /Users/steven/Development/darwinia/targets/macosx/Darwinia/SDLMain.m: In function '-[SDLMain fixMenu:withAppName:]': /Users/steven/Development/darwinia/targets/macosx/Darwinia/SDLMain.m:122: warning: 'sizeToFit' is deprecated (declared at /Developer/SDKs/MacOSX10.6.sdk/System/Library/Frameworks/AppKit.framework/Headers/NSMenu.h:281) /Users/steven/Development/darwinia/targets/macosx/Darwinia/SDLMain.m: In function 'main': /Users/steven/Development/darwinia/targets/macosx/Darwinia/SDLMain.m:376: warning: 'poseAsClass:' is deprecated (declared at /Developer/SDKs/MacOSX10.6.sdk/System/Library/Frameworks/Foundation.framework/Headers/NSObject.h:127) /Users/steven/Development/darwinia/targets/macosx/Darwinia/SDLMain.m:376: error: 'poseAsClass:' is unavailable (declared at /Developer/SDKs/MacOSX10.6.sdk/System/Library/Frameworks/Foundation.framework/Headers/NSObject.h:127) /Users/steven/Development/darwinia/targets/macosx/Darwinia/SDLMain.m:377: warning: passing argument 2 of 'NSApplicationMain' from incompatible pointer type Eric Wing to Sam I don't have time today to look at this in detail, but the problem is definitely the poseAsClass: method. This was deprecated in Obj-C 2.0 and not retained in 64-bit. I've never used this method and it has always been limited to esoteric uses. I think this is why Apple wanted to dump it (among complicating some other things they do). I have read about others getting bit by this when migrating. Long story short, there really isn't a migration path for this method. The question that then must be asked is why are we using it (what does it accomplish), and then figure out the 'proper' way of accomplishing that. Glancing at SDLMain.m, it's not obvious to me why it is there or what it is really accomplishing. My only speculation is that NSApplicationMain hardcodes something to look for NSApplication and a subclass (SDLApplication) fails for some reason (assuming that the original coder did this for good reason). Three thoughts come to mind. 1) The Info.plist has properties to control things related to the startup class and nib. NSPrincipalClass, NSMainNibFile Maybe principle class needs to be SDLApplication and we can delete the poseAs 2) I was told that 10.6 introduced new APIs to make programatic NIB wrangling and avoidance easier. Unfortunately, I don't know the specifics. 3) Instead of subclassing NSApplication in SDLMain.m, maybe we can just add a category. It looks like the following is the only thing that is done (quick glance): @interface SDLApplication : NSApplication @end @implementation SDLApplication /* Invoked from the Quit menu item */ - (void)terminate:(id)sender { /* Post a SDL_QUIT event */ SDL_Event event; event.type = SDL_QUIT; SDL_PushEvent(&event); } @end So instead, we change this to: (warning written in mail and untested) @interface NSApplication (SDLApplication) - (void) terminate:(id)sender; @end @implementation NSApplication (SDLApplication) /* Invoked from the Quit menu item */ - (void)terminate:(id)sender { /* Post a SDL_QUIT event */ SDL_Event event; event.type = SDL_QUIT; SDL_PushEvent(&event); } @end Then everywhere SDLApplication is used, we change it to NSApplication (and remove the poseAsClass line). Perhaps you could ask the bug reporter to try this solution (#3). And if that fails, maybe try #1. -Eric Steven Noonan to Sam The suggested change (diff below) seems to work fine. - Steven
author Sam Lantinga <slouken@libsdl.org>
date Mon, 12 Oct 2009 21:07:12 +0000
parents 5e6f2972f963
children 93994f65c74c d2517c0de52b
rev   line source
1361
19418e4422cb New configure-based build system. Still work in progress, but much improved
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
1 #!/bin/sh
19418e4422cb New configure-based build system. Still work in progress, but much improved
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
2 #
19418e4422cb New configure-based build system. Still work in progress, but much improved
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
3 # Generate dependencies from a list of source files
19418e4422cb New configure-based build system. Still work in progress, but much improved
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
4
19418e4422cb New configure-based build system. Still work in progress, but much improved
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
5 # Check to make sure our environment variables are set
1634
14f302c5b32c Don't hardcode the output directory
Sam Lantinga <slouken@libsdl.org>
parents: 1521
diff changeset
6 if test x"$INCLUDE" = x -o x"$SOURCES" = x -o x"$output" = x; then
14f302c5b32c Don't hardcode the output directory
Sam Lantinga <slouken@libsdl.org>
parents: 1521
diff changeset
7 echo "SOURCES, INCLUDE, and output needs to be set"
1361
19418e4422cb New configure-based build system. Still work in progress, but much improved
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
8 exit 1
19418e4422cb New configure-based build system. Still work in progress, but much improved
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
9 fi
19418e4422cb New configure-based build system. Still work in progress, but much improved
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
10 cache_prefix=".#$$"
19418e4422cb New configure-based build system. Still work in progress, but much improved
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
11
19418e4422cb New configure-based build system. Still work in progress, but much improved
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
12 generate_var()
19418e4422cb New configure-based build system. Still work in progress, but much improved
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
13 {
19418e4422cb New configure-based build system. Still work in progress, but much improved
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
14 echo $1 | sed -e 's|^.*/||' -e 's|\.|_|g'
19418e4422cb New configure-based build system. Still work in progress, but much improved
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
15 }
19418e4422cb New configure-based build system. Still work in progress, but much improved
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
16
19418e4422cb New configure-based build system. Still work in progress, but much improved
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
17 search_deps()
19418e4422cb New configure-based build system. Still work in progress, but much improved
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
18 {
19418e4422cb New configure-based build system. Still work in progress, but much improved
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
19 base=`echo $1 | sed 's|/[^/]*$||'`
19418e4422cb New configure-based build system. Still work in progress, but much improved
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
20 grep '#include "' <$1 | sed -e 's|.*"\([^"]*\)".*|\1|' | \
19418e4422cb New configure-based build system. Still work in progress, but much improved
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
21 while read file
19418e4422cb New configure-based build system. Still work in progress, but much improved
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
22 do cache=${cache_prefix}_`generate_var $file`
19418e4422cb New configure-based build system. Still work in progress, but much improved
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
23 if test -f $cache; then
1391
7dc446173e37 Blargle-fnargle dependencies and build rules
Sam Lantinga <slouken@libsdl.org>
parents: 1388
diff changeset
24 : # We already ahve this cached
7dc446173e37 Blargle-fnargle dependencies and build rules
Sam Lantinga <slouken@libsdl.org>
parents: 1388
diff changeset
25 else
7dc446173e37 Blargle-fnargle dependencies and build rules
Sam Lantinga <slouken@libsdl.org>
parents: 1388
diff changeset
26 : >$cache
7dc446173e37 Blargle-fnargle dependencies and build rules
Sam Lantinga <slouken@libsdl.org>
parents: 1388
diff changeset
27 for path in $base `echo $INCLUDE | sed 's|-I||g'`
7dc446173e37 Blargle-fnargle dependencies and build rules
Sam Lantinga <slouken@libsdl.org>
parents: 1388
diff changeset
28 do dep="$path/$file"
7dc446173e37 Blargle-fnargle dependencies and build rules
Sam Lantinga <slouken@libsdl.org>
parents: 1388
diff changeset
29 if test -f "$dep"; then
7dc446173e37 Blargle-fnargle dependencies and build rules
Sam Lantinga <slouken@libsdl.org>
parents: 1388
diff changeset
30 echo " $dep \\" >>$cache
7dc446173e37 Blargle-fnargle dependencies and build rules
Sam Lantinga <slouken@libsdl.org>
parents: 1388
diff changeset
31 search_deps $dep >>$cache
7dc446173e37 Blargle-fnargle dependencies and build rules
Sam Lantinga <slouken@libsdl.org>
parents: 1388
diff changeset
32 break
7dc446173e37 Blargle-fnargle dependencies and build rules
Sam Lantinga <slouken@libsdl.org>
parents: 1388
diff changeset
33 fi
7dc446173e37 Blargle-fnargle dependencies and build rules
Sam Lantinga <slouken@libsdl.org>
parents: 1388
diff changeset
34 done
1361
19418e4422cb New configure-based build system. Still work in progress, but much improved
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
35 fi
1391
7dc446173e37 Blargle-fnargle dependencies and build rules
Sam Lantinga <slouken@libsdl.org>
parents: 1388
diff changeset
36 cat $cache
1361
19418e4422cb New configure-based build system. Still work in progress, but much improved
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
37 done
19418e4422cb New configure-based build system. Still work in progress, but much improved
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
38 }
19418e4422cb New configure-based build system. Still work in progress, but much improved
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
39
19418e4422cb New configure-based build system. Still work in progress, but much improved
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
40 :>${output}.new
19418e4422cb New configure-based build system. Still work in progress, but much improved
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
41 for src in $SOURCES
19418e4422cb New configure-based build system. Still work in progress, but much improved
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
42 do echo "Generating dependencies for $src"
19418e4422cb New configure-based build system. Still work in progress, but much improved
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
43 ext=`echo $src | sed 's|.*\.\(.*\)|\1|'`
4078
5e6f2972f963 Added support for building version.rc in Windows build.
Sam Lantinga <slouken@libsdl.org>
parents: 1634
diff changeset
44 if test x"$ext" = x"rc"; then
5e6f2972f963 Added support for building version.rc in Windows build.
Sam Lantinga <slouken@libsdl.org>
parents: 1634
diff changeset
45 obj=`echo $src | sed "s|^.*/\([^ ]*\)\..*|\1.o|g"`
5e6f2972f963 Added support for building version.rc in Windows build.
Sam Lantinga <slouken@libsdl.org>
parents: 1634
diff changeset
46 else
5e6f2972f963 Added support for building version.rc in Windows build.
Sam Lantinga <slouken@libsdl.org>
parents: 1634
diff changeset
47 obj=`echo $src | sed "s|^.*/\([^ ]*\)\..*|\1.lo|g"`
5e6f2972f963 Added support for building version.rc in Windows build.
Sam Lantinga <slouken@libsdl.org>
parents: 1634
diff changeset
48 fi
1634
14f302c5b32c Don't hardcode the output directory
Sam Lantinga <slouken@libsdl.org>
parents: 1521
diff changeset
49 echo "\$(objects)/$obj: $src \\" >>${output}.new
1388
9a9b87172b4b Fixed build dependencies... ugh
Sam Lantinga <slouken@libsdl.org>
parents: 1361
diff changeset
50 search_deps $src | sort | uniq >>${output}.new
1361
19418e4422cb New configure-based build system. Still work in progress, but much improved
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
51 case $ext in
1416
a4c05c115bb7 Fixed script on mingw
Sam Lantinga <slouken@libsdl.org>
parents: 1391
diff changeset
52 c) cat >>${output}.new <<__EOF__
a4c05c115bb7 Fixed script on mingw
Sam Lantinga <slouken@libsdl.org>
parents: 1391
diff changeset
53
1521
9b9212e4810c CFLAGS are separate from EXTRA_CFLAGS
Sam Lantinga <slouken@libsdl.org>
parents: 1493
diff changeset
54 \$(LIBTOOL) --mode=compile \$(CC) \$(CFLAGS) \$(EXTRA_CFLAGS) -c $src -o \$@
1416
a4c05c115bb7 Fixed script on mingw
Sam Lantinga <slouken@libsdl.org>
parents: 1391
diff changeset
55
a4c05c115bb7 Fixed script on mingw
Sam Lantinga <slouken@libsdl.org>
parents: 1391
diff changeset
56 __EOF__
a4c05c115bb7 Fixed script on mingw
Sam Lantinga <slouken@libsdl.org>
parents: 1391
diff changeset
57 ;;
a4c05c115bb7 Fixed script on mingw
Sam Lantinga <slouken@libsdl.org>
parents: 1391
diff changeset
58 cc) cat >>${output}.new <<__EOF__
a4c05c115bb7 Fixed script on mingw
Sam Lantinga <slouken@libsdl.org>
parents: 1391
diff changeset
59
1521
9b9212e4810c CFLAGS are separate from EXTRA_CFLAGS
Sam Lantinga <slouken@libsdl.org>
parents: 1493
diff changeset
60 \$(LIBTOOL) --mode=compile \$(CC) \$(CFLAGS) \$(EXTRA_CFLAGS) -c $src -o \$@
1416
a4c05c115bb7 Fixed script on mingw
Sam Lantinga <slouken@libsdl.org>
parents: 1391
diff changeset
61
a4c05c115bb7 Fixed script on mingw
Sam Lantinga <slouken@libsdl.org>
parents: 1391
diff changeset
62 __EOF__
a4c05c115bb7 Fixed script on mingw
Sam Lantinga <slouken@libsdl.org>
parents: 1391
diff changeset
63 ;;
a4c05c115bb7 Fixed script on mingw
Sam Lantinga <slouken@libsdl.org>
parents: 1391
diff changeset
64 m) cat >>${output}.new <<__EOF__
a4c05c115bb7 Fixed script on mingw
Sam Lantinga <slouken@libsdl.org>
parents: 1391
diff changeset
65
1521
9b9212e4810c CFLAGS are separate from EXTRA_CFLAGS
Sam Lantinga <slouken@libsdl.org>
parents: 1493
diff changeset
66 \$(LIBTOOL) --mode=compile \$(CC) \$(CFLAGS) \$(EXTRA_CFLAGS) -c $src -o \$@
1416
a4c05c115bb7 Fixed script on mingw
Sam Lantinga <slouken@libsdl.org>
parents: 1391
diff changeset
67
a4c05c115bb7 Fixed script on mingw
Sam Lantinga <slouken@libsdl.org>
parents: 1391
diff changeset
68 __EOF__
a4c05c115bb7 Fixed script on mingw
Sam Lantinga <slouken@libsdl.org>
parents: 1391
diff changeset
69 ;;
a4c05c115bb7 Fixed script on mingw
Sam Lantinga <slouken@libsdl.org>
parents: 1391
diff changeset
70 asm) cat >>${output}.new <<__EOF__
a4c05c115bb7 Fixed script on mingw
Sam Lantinga <slouken@libsdl.org>
parents: 1391
diff changeset
71
1417
24fbbedd2ad6 *** empty log message ***
Sam Lantinga <slouken@libsdl.org>
parents: 1416
diff changeset
72 \$(LIBTOOL) --tag=CC --mode=compile \$(auxdir)/strip_fPIC.sh \$(NASM) $src -o \$@
1416
a4c05c115bb7 Fixed script on mingw
Sam Lantinga <slouken@libsdl.org>
parents: 1391
diff changeset
73
a4c05c115bb7 Fixed script on mingw
Sam Lantinga <slouken@libsdl.org>
parents: 1391
diff changeset
74 __EOF__
a4c05c115bb7 Fixed script on mingw
Sam Lantinga <slouken@libsdl.org>
parents: 1391
diff changeset
75 ;;
1459
1e8582152d44 Date: Wed, 01 Mar 2006 10:14:31 +0000
Sam Lantinga <slouken@libsdl.org>
parents: 1417
diff changeset
76 S) cat >>${output}.new <<__EOF__
1e8582152d44 Date: Wed, 01 Mar 2006 10:14:31 +0000
Sam Lantinga <slouken@libsdl.org>
parents: 1417
diff changeset
77
1521
9b9212e4810c CFLAGS are separate from EXTRA_CFLAGS
Sam Lantinga <slouken@libsdl.org>
parents: 1493
diff changeset
78 \$(LIBTOOL) --mode=compile \$(CC) \$(CFLAGS) \$(EXTRA_CFLAGS) -c $src -o \$@
1459
1e8582152d44 Date: Wed, 01 Mar 2006 10:14:31 +0000
Sam Lantinga <slouken@libsdl.org>
parents: 1417
diff changeset
79
1e8582152d44 Date: Wed, 01 Mar 2006 10:14:31 +0000
Sam Lantinga <slouken@libsdl.org>
parents: 1417
diff changeset
80 __EOF__
1e8582152d44 Date: Wed, 01 Mar 2006 10:14:31 +0000
Sam Lantinga <slouken@libsdl.org>
parents: 1417
diff changeset
81 ;;
4078
5e6f2972f963 Added support for building version.rc in Windows build.
Sam Lantinga <slouken@libsdl.org>
parents: 1634
diff changeset
82 rc) cat >>${output}.new <<__EOF__
5e6f2972f963 Added support for building version.rc in Windows build.
Sam Lantinga <slouken@libsdl.org>
parents: 1634
diff changeset
83
5e6f2972f963 Added support for building version.rc in Windows build.
Sam Lantinga <slouken@libsdl.org>
parents: 1634
diff changeset
84 \$(WINDRES) $src \$@
5e6f2972f963 Added support for building version.rc in Windows build.
Sam Lantinga <slouken@libsdl.org>
parents: 1634
diff changeset
85
5e6f2972f963 Added support for building version.rc in Windows build.
Sam Lantinga <slouken@libsdl.org>
parents: 1634
diff changeset
86 __EOF__
5e6f2972f963 Added support for building version.rc in Windows build.
Sam Lantinga <slouken@libsdl.org>
parents: 1634
diff changeset
87 ;;
1361
19418e4422cb New configure-based build system. Still work in progress, but much improved
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
88 *) echo "Unknown file extension: $ext";;
19418e4422cb New configure-based build system. Still work in progress, but much improved
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
89 esac
19418e4422cb New configure-based build system. Still work in progress, but much improved
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
90 echo "" >>${output}.new
19418e4422cb New configure-based build system. Still work in progress, but much improved
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
91 done
19418e4422cb New configure-based build system. Still work in progress, but much improved
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
92 mv ${output}.new ${output}
1493
ce28f14c4502 Clean up temporary files. I'm not sure how this got removed, but whatever...
Sam Lantinga <slouken@libsdl.org>
parents: 1459
diff changeset
93 rm -f ${cache_prefix}*