[commit: ghc] master: iOS: generate archive files when compiling. (288ca49)
git at git.haskell.org
git at git.haskell.org
Wed Aug 14 07:43:44 CEST 2013
Repository : ssh://git@git.haskell.org/ghc
On branch : master
Link : http://ghc.haskell.org/trac/ghc/changeset/288ca49c93d5bc8fe42f9a823ed6555334762769/ghc
>---------------------------------------------------------------
commit 288ca49c93d5bc8fe42f9a823ed6555334762769
Author: Austin Seipp <aseipp at pobox.com>
Date: Tue Aug 13 16:40:37 2013 -0500
iOS: generate archive files when compiling.
When cross compiling to iOS, we generate archive files which are linked
into the final executable. We already *did* generate archive files -
just with the wrong suffix.
Fixes #8125.
Authored-by: Stephen Blackheath <... at blacksapphire.com>
Signed-off-by: Austin Seipp <aseipp at pobox.com>
>---------------------------------------------------------------
288ca49c93d5bc8fe42f9a823ed6555334762769
aclocal.m4 | 51 ++++++++++++++++++++++++++-------------
compiler/main/DriverPipeline.hs | 11 +++++----
mk/project.mk.in | 10 ++++----
3 files changed, 45 insertions(+), 27 deletions(-)
diff --git a/aclocal.m4 b/aclocal.m4
index 0852dbf..d604cc0 100644
--- a/aclocal.m4
+++ b/aclocal.m4
@@ -4,6 +4,34 @@
# ensure we don't clash with any pre-supplied autoconf ones.
+AC_DEFUN([GHC_SELECT_FILE_EXTENSIONS],
+[
+ $2=''
+ $3='.so'
+ case $1 in
+ *-unknown-cygwin32)
+ AC_MSG_WARN([GHC does not support the Cygwin target at the moment])
+ AC_MSG_WARN([I'm assuming you wanted to build for i386-unknown-mingw32])
+ exit 1
+ ;;
+ *-unknown-mingw32)
+ windows=YES
+ $2='.exe'
+ $3='.dll'
+ ;;
+ i386-apple-darwin|powerpc-apple-darwin)
+ $3='.dylib'
+ ;;
+ x86_64-apple-darwin)
+ $3='.dylib'
+ ;;
+ arm-apple-darwin10)
+ $2='.a'
+ $3='.dylib'
+ ;;
+ esac
+])
+
# FPTOOLS_SET_PLATFORM_VARS
# ----------------------------------
# Set the platform variables
@@ -86,25 +114,12 @@ AC_DEFUN([FPTOOLS_SET_PLATFORM_VARS],
GHC_CONVERT_OS([$target_os], [$TargetArch], [TargetOS])
fi
+ GHC_SELECT_FILE_EXTENSIONS([$host], [exeext_host], [soext_host])
+ GHC_SELECT_FILE_EXTENSIONS([$target], [exeext_target], [soext_target])
windows=NO
- exeext=''
- soext='.so'
case $host in
- *-unknown-cygwin32)
- AC_MSG_WARN([GHC does not support the Cygwin target at the moment])
- AC_MSG_WARN([I'm assuming you wanted to build for i386-unknown-mingw32])
- exit 1
- ;;
*-unknown-mingw32)
windows=YES
- exeext='.exe'
- soext='.dll'
- ;;
- i386-apple-darwin|powerpc-apple-darwin)
- soext='.dylib'
- ;;
- x86_64-apple-darwin)
- soext='.dylib'
;;
esac
@@ -149,8 +164,10 @@ AC_DEFUN([FPTOOLS_SET_PLATFORM_VARS],
AC_SUBST(BuildVendor_CPP)
AC_SUBST(TargetVendor_CPP)
- AC_SUBST(exeext)
- AC_SUBST(soext)
+ AC_SUBST(exeext_host)
+ AC_SUBST(exeext_target)
+ AC_SUBST(soext_host)
+ AC_SUBST(soext_target)
])
diff --git a/compiler/main/DriverPipeline.hs b/compiler/main/DriverPipeline.hs
index aa49e70..c5bcdc7 100644
--- a/compiler/main/DriverPipeline.hs
+++ b/compiler/main/DriverPipeline.hs
@@ -1938,15 +1938,16 @@ linkBinary dflags o_files dep_packages = do
exeFileName :: DynFlags -> FilePath
exeFileName dflags
| Just s <- outputFile dflags =
- if platformOS (targetPlatform dflags) == OSMinGW32
- then if null (takeExtension s)
- then s <.> "exe"
- else s
- else s
+ case platformOS (targetPlatform dflags) of
+ OSMinGW32 -> s <?.> "exe"
+ OSiOS -> s <?.> "a"
+ _ -> s
| otherwise =
if platformOS (targetPlatform dflags) == OSMinGW32
then "main.exe"
else "a.out"
+ where s <?.> ext | null (takeExtension s) = s <.> ext
+ | otherwise = s
maybeCreateManifest
:: DynFlags
diff --git a/mk/project.mk.in b/mk/project.mk.in
index 7b25368..28692d4 100644
--- a/mk/project.mk.in
+++ b/mk/project.mk.in
@@ -125,11 +125,11 @@ BuildVendor_CPP = @BuildVendor_CPP@
LeadingUnderscore=@LeadingUnderscore@
# Pin a suffix on executables? If so, what (Windows only).
-exeext0=@exeext@
-exeext1=@exeext@
-exeext2=@exeext@
-exeext3=@exeext@
-soext=@soext@
+exeext0=@exeext_host@
+exeext1=@exeext_target@
+exeext2=@exeext_target@
+exeext3=@exeext_target@
+soext=@soext_target@
# Windows_Host=YES if on a Windows platform
ifneq "$(findstring $(HostOS_CPP), mingw32 cygwin32)" ""
More information about the ghc-commits
mailing list