[cfe-commits] r62628 - in /cfe/tags/Apple/clang: GNUSource.make Makefile clang.plist merge-lipo
Mike Stump
mrs at apple.com
Tue Jan 20 14:46:30 PST 2009
Author: mrs
Date: Tue Jan 20 16:46:30 2009
New Revision: 62628
URL: http://llvm.org/viewvc/llvm-project?rev=62628&view=rev
Log:
Clang building bits.
Added:
cfe/tags/Apple/clang/GNUSource.make
cfe/tags/Apple/clang/Makefile
cfe/tags/Apple/clang/clang.plist
cfe/tags/Apple/clang/merge-lipo (with props)
Added: cfe/tags/Apple/clang/GNUSource.make
URL: http://llvm.org/viewvc/llvm-project/cfe/tags/Apple/clang/GNUSource.make?rev=62628&view=auto
==============================================================================
--- cfe/tags/Apple/clang/GNUSource.make (added)
+++ cfe/tags/Apple/clang/GNUSource.make Tue Jan 20 16:46:30 2009
@@ -0,0 +1,177 @@
+##
+# Makefile for Apple Release Control (GNU source projects)
+#
+# Wilfredo Sanchez | wsanchez at apple.com
+# Copyright (c) 1997-1999 Apple Computer, Inc.
+#
+# @APPLE_LICENSE_HEADER_START@
+#
+# Portions Copyright (c) 1999 Apple Computer, Inc. All Rights
+# Reserved. This file contains Original Code and/or Modifications of
+# Original Code as defined in and that are subject to the Apple Public
+# Source License Version 1.1 (the "License"). You may not use this file
+# except in compliance with the License. Please obtain a copy of the
+# License at http://www.apple.com/publicsource and read it before using
+# this file.
+#
+# The Original Code and all software distributed under the License are
+# distributed on an "AS IS" basis, WITHOUT WARRANTY OF ANY KIND, EITHER
+# EXPRESS OR IMPLIED, AND APPLE HEREBY DISCLAIMS ALL SUCH WARRANTIES,
+# INCLUDING WITHOUT LIMITATION, ANY WARRANTIES OF MERCHANTABILITY,
+# FITNESS FOR A PARTICULAR PURPOSE OR NON- INFRINGEMENT. Please see the
+# License for the specific language governing rights and limitations
+# under the License.
+#
+# @APPLE_LICENSE_HEADER_END@
+##
+# Set these variables as needed, then include this file, then:
+#
+# Install_Prefix [ $(USRDIR) ]
+# Install_Man [ $(MANDIR) ]
+# Install_Info [ $(SHAREDIR)/info ]
+# Install_HTML [ <depends> ]
+# Install_Source [ $(NSSOURCEDIR)/Commands/$(ProjectName) ]
+# Configure [ $(Sources)/configure ]
+# Extra_Configure_Flags
+# Extra_Install_Flags
+# Passed_Targets [ check ]
+#
+# Additional variables inherited from ReleaseControl/Common.make
+##
+
+ifndef CoreOSMakefiles
+CoreOSMakefiles = $(MAKEFILEPATH)/CoreOS
+endif
+
+Passed_Targets += check
+
+include $(CoreOSMakefiles)/ReleaseControl/Common.make
+
+##
+# My variables
+##
+
+Sources = $(SRCROOT)/$(Project)
+ConfigStamp = $(BuildDirectory)/configure-stamp
+
+Workaround_3678855 = /BogusHTMLInstallationDir
+
+ifndef Install_Prefix
+Install_Prefix = $(USRDIR)
+endif
+ifndef Install_Man
+Install_Man = $(MANDIR)
+endif
+ifndef Install_Info
+Install_Info = $(SHAREDIR)/info
+endif
+ifndef Install_HTML
+ifeq "$(UserType)" "Developer"
+Install_HTML = $(Workaround_3678855)
+else
+Install_HTML = $(NSDOCUMENTATIONDIR)/$(ToolType)/$(ProjectName)
+endif
+endif
+ifndef Install_Source
+Install_Source = $(NSSOURCEDIR)/$(ToolType)/$(ProjectName)
+endif
+
+RC_Install_Prefix = $(DSTROOT)$(Install_Prefix)
+RC_Install_Man = $(DSTROOT)$(Install_Man)
+RC_Install_Info = $(DSTROOT)$(Install_Info)
+RC_Install_HTML = $(DSTROOT)$(Install_HTML)
+ifneq ($(Install_Source),)
+RC_Install_Source = $(DSTROOT)$(Install_Source)
+endif
+
+ifndef Configure
+Configure = $(Sources)/configure
+endif
+
+Environment += CC="$(CC) -arch $$arch" CXX="$(CXX) -arch $$arch"
+
+CC_Archs = # set by CC
+# FIXME: Common.make shouldn't be setting this in the first place.
+Extra_CC_Flags =
+
+# -arch arguments are different than configure arguments. We need to
+# translate them.
+
+TRANSLATE_ARCH=$(SED) -e s/ppc/powerpc/ -e s/i386/i686/
+# Could use config.guess here, if we had a copy available.
+BUILD=`$(ARCH) | $(TRANSLATE_ARCH)`-apple-darwin
+
+Configure_Flags = --prefix="$(Install_Prefix)" \
+ $(Extra_Configure_Flags)
+
+Install_Flags = DESTDIR=$(BuildDirectory)/install-$$arch \
+ $(Extra_Install_Flags)
+
+Install_Target = install-strip
+
+##
+# Targets
+##
+
+.PHONY: configure almostclean
+
+install:: build
+ifneq ($(GnuNoInstall),YES)
+ $(_v) for arch in $(RC_ARCHS) ; do \
+ echo "Installing $(Project) for $$arch..." && \
+ $(MKDIR) $(BuildDirectory)/install-$$arch && \
+ umask $(Install_Mask) && \
+ $(MAKE) -C $(BuildDirectory)/$$arch $(Environment) \
+ $(Install_Flags) $(Install_Target) || exit 1 ; \
+ done
+ ./merge-lipo `for arch in $(RC_ARCHS) ; do echo $(BuildDirectory)/install-$$arch ; done` $(DSTROOT)
+ $(_v) $(FIND) $(DSTROOT) $(Find_Cruft) | $(XARGS) $(RMDIR)
+ $(_v) $(FIND) $(SYMROOT) $(Find_Cruft) | $(XARGS) $(RMDIR)
+ifneq ($(GnuNoChown),YES)
+ $(_v)- $(CHOWN) -R $(Install_User):$(Install_Group) $(DSTROOT) $(SYMROOT)
+endif
+endif
+ifdef GnuAfterInstall
+ $(_v) $(MAKE) $(GnuAfterInstall)
+endif
+ $(_v) if [ -d "$(DSTROOT)$(Workaround_3678855)" ]; then \
+ $(INSTALL_DIRECTORY) "$(DSTROOT)$(SYSTEM_DEVELOPER_TOOLS_DOC_DIR)"; \
+ $(MV) "$(DSTROOT)$(Workaround_3678855)" \
+ "$(DSTROOT)$(SYSTEM_DEVELOPER_TOOLS_DOC_DIR)/$(ProjectName)"; \
+ fi
+
+SYSCTL=`sysctl -n hw.activecpu`
+
+build:: configure
+ifneq ($(GnuNoBuild),YES)
+ $(_v) for arch in $(RC_ARCHS) ; do \
+ echo "Building $(Project) for $$arch..." && \
+ $(MAKE) -j$(SYSCTL) -C $(BuildDirectory)/$$arch $(Environment) $(BuildTarget) || exit 1; \
+ done
+endif
+
+configure:: lazy_install_source $(ConfigStamp)
+
+reconfigure::
+ $(_v) $(RM) $(ConfigStamp)
+ $(_v) $(MAKE) configure
+
+$(ConfigStamp):
+ifneq ($(GnuNoConfigure),YES)
+ $(_v) $(MKDIR) $(BuildDirectory)
+ $(_v) for arch in $(RC_ARCHS) ; do \
+ echo "Configuring $(Project) for $$arch..." && \
+ $(MKDIR) $(BuildDirectory)/$$arch && \
+ cd $(BuildDirectory)/$$arch && \
+ $(Environment) $(Configure) $(Configure_Flags) || exit 1 ; \
+ done
+endif
+ $(_v) touch $@
+
+almostclean::
+ifneq ($(GnuNoClean),YES)
+ @echo "Cleaning $(Project)..."
+ $(_v) for arch in $(RC_ARCHS) ; do \
+ $(MAKE) -C $(BuildDirectory)/$$arch clean || exit 1 ; \
+ done
+endif
Added: cfe/tags/Apple/clang/Makefile
URL: http://llvm.org/viewvc/llvm-project/cfe/tags/Apple/clang/Makefile?rev=62628&view=auto
==============================================================================
--- cfe/tags/Apple/clang/Makefile (added)
+++ cfe/tags/Apple/clang/Makefile Tue Jan 20 16:46:30 2009
@@ -0,0 +1,73 @@
+##
+# cxxfilt Makefile
+##
+
+# Project info
+Project = clang
+UserType = Developer
+ToolType = Commands
+Install_Prefix = /Developer/usr
+Extra_Configure_Flags = --enable-targets=powerpc,x86,arm,cbe,cpp \
+ --enable-optimized --disable-doxygen \
+ $(HOST_TARGET_FLAGS)
+Extra_CC_Flags = -mdynamic-no-pic
+GnuAfterInstall = post-install install-plist
+CXX = g++
+CXX = g++
+
+# It's a GNU Source project
+include ./GNUSource.make
+
+CXX := g++
+
+# Automatic Extract & Patch
+#AEP = YES
+#AEP_Project = clang
+#AEP_Version = 090201
+#AEP_ProjVers = $(AEP_Project)-$(AEP_Version)
+#AEP_Filename = $(AEP_ProjVers).tar.bz2
+#AEP_ExtractDir = $(AEP_ProjVers)
+#AEP_Patches =
+
+ifeq ($(suffix $(AEP_Filename)),.bz2)
+AEP_ExtractOption = j
+else
+AEP_ExtractOption = z
+endif
+
+Install_Target = install-clang
+Build_Target = clang-only
+
+# Extract the source.
+install_source::
+ifeq ($(AEP),YES)
+ $(TAR) -C $(SRCROOT) -$(AEP_ExtractOption)xf $(SRCROOT)/$(AEP_Filename)
+ $(RMDIR) $(SRCROOT)/$(Project)
+ $(MV) $(SRCROOT)/$(AEP_ExtractDir) $(SRCROOT)/$(Project)
+ for patchfile in $(AEP_Patches); do \
+ cd $(SRCROOT)/$(Project) && \
+ patch -p0 < $(SRCROOT)/patches/$$patchfile || exit 1 ; \
+ done
+endif
+
+# Remove the parts of the destroot we don't need
+post-install:
+
+OSV = $(DSTROOT)/usr/local/OpenSourceVersions
+OSL = $(DSTROOT)/usr/local/OpenSourceLicenses
+
+install-plist:
+ $(MKDIR) $(OSV)
+ $(INSTALL_FILE) $(SRCROOT)/$(Project).plist $(OSV)/$(Project).plist
+ $(MKDIR) $(OSL)
+ $(INSTALL_FILE) $(Sources)/LICENSE.TXT $(OSL)/$(Project)-llvm.txt
+ $(INSTALL_FILE) $(Sources)/tools/clang/LICENSE.TXT $(OSL)/$(Project).txt
+
+SVN_BASE := $(shell svn info | sed -n 's/^URL: //; s,/llvm-project/.*$$,/llvm-project,p')
+SVN_CLANG := $(shell svn info | sed -n 's/^URL: //p')
+N := echo
+
+update-clang:
+ $(N) svn rm $(SVN_CLANG)/clang
+ $(N) svn cp $(SVN_BASE)/llvm/trunk $(SVN_CLANG)/clang
+ $(N) svn cp $(SVN_BASE)/clang/trunk $(SVN_CLANG)/clang/tools/clang
Added: cfe/tags/Apple/clang/clang.plist
URL: http://llvm.org/viewvc/llvm-project/cfe/tags/Apple/clang/clang.plist?rev=62628&view=auto
==============================================================================
--- cfe/tags/Apple/clang/clang.plist (added)
+++ cfe/tags/Apple/clang/clang.plist Tue Jan 20 16:46:30 2009
@@ -0,0 +1,36 @@
+<plist version="1.0">
+<array>
+<dict>
+ <key>OpenSourceImportDate</key>
+ <string>2009-02-01</string>
+ <key>OpenSourceProject</key>
+ <string>clang</string>
+ <key>OpenSourceVersion</key>
+ <string>090201</string>
+ <key>OpenSourceWebsiteURL</key>
+ <string>http://clang.llvm.org/</string>
+ <key>OpenSourceSVN</key>
+ <string>svn export http://llvm.org/svn/llvm-project/cfe/trunk</string>
+ <key>OpenSourceLicense</key>
+ <string>University of Illinois Open Source License</string>
+ <key>OpenSourceLicenseFile</key>
+ <string>clang.txt</string>
+</dict>
+<dict>
+ <key>OpenSourceImportDate</key>
+ <string>2009-02-01</string>
+ <key>OpenSourceProject</key>
+ <string>llvm</string>
+ <key>OpenSourceVersion</key>
+ <string>090201</string>
+ <key>OpenSourceWebsiteURL</key>
+ <string>http://llvm.org/</string>
+ <key>OpenSourceSVN</key>
+ <string>svn export http://llvm.org/svn/llvm-project/llvm/trunk</string>
+ <key>OpenSourceLicense</key>
+ <string>University of Illinois Open Source License</string>
+ <key>OpenSourceLicenseFile</key>
+ <string>clang-llvm.txt</string>
+</dict>
+</array>
+</plist>
Added: cfe/tags/Apple/clang/merge-lipo
URL: http://llvm.org/viewvc/llvm-project/cfe/tags/Apple/clang/merge-lipo?rev=62628&view=auto
==============================================================================
--- cfe/tags/Apple/clang/merge-lipo (added)
+++ cfe/tags/Apple/clang/merge-lipo Tue Jan 20 16:46:30 2009
@@ -0,0 +1,103 @@
+#!/usr/bin/perl -w
+
+# This script applies 'lipo' to directories. For each file present in
+# any source directory, it will create a file in the destination directory.
+# If all the copies of the file in the source directories are the same,
+# the file is copied directly to the destination. If there are different
+# files in different directories, but the files are executable,
+# lipo is run to merge the files together. Otherwise, an error is
+# produced.
+
+# Device files and pipes are not supported, but symlinks are; the script
+# will check that all the symlinks point to the same place.
+# If a file is present in only one of the source directories, it is
+# trivially the same as itself and so it is just copied to the destination.
+# If there is only one source directory, the script is just an expensive
+# version of 'cp -rp'.
+# The destination directory is not emptied by this script.
+
+use File::Find ();
+use File::Copy ();
+use File::Compare ();
+use POSIX ();
+
+if ($#ARGV < 1) {
+ print "usage: $0 <source-directories ...> <dest-directory>\n";
+ exit 1;
+}
+
+# The source directories.
+my @sources = @ARGV[0..$#ARGV-1];
+# The destination directory.
+my $dest = $ARGV[-1];
+
+# Count of errors.
+my $errors = 0;
+
+# A hash of the files that need to be lipoed. Only the keys of the
+# hash are significant.
+my %needs_lipo = ();
+
+# Print an error message.
+sub error {
+ printf STDERR "%s\n",$_[0];
+ $errors++;
+}
+
+# First, scan the directories; copy any files to the destination that are
+# identical in the source directory, print error messages, and make
+# a list of the files that need lipo-ing.
+foreach my $s (@sources)
+{
+ sub eachfile {
+ my $destname = $dest . '/' . $File::Find::name;
+ if (-d) {
+ (mkdir $destname or error ("$destname: $!")) unless (-d $destname);
+ } elsif (-l) {
+ my $link1 = readlink;
+ defined $link1 or error ("$s/$_: $!");
+ if (-l $destname) {
+ my $link2 = readlink $destname;
+ defined $link2 or error ("$destname: $!");
+ $link1 eq $link2 or error ("$destname: different symlinks");
+ } elsif (-e $destname) {
+ error ("$destname: symlink vs. real file");
+ } else {
+ symlink $link1,$destname or error ("$destname: $!");
+ }
+ } elsif (! -f) {
+ error ("$destname: no idea how to handle special file");
+ } elsif (! -f $destname) {
+ system ("cp", "-p", $_, $destname) == 0 or $errors++;
+ } elsif (File::Compare::compare ($_, $destname) != 0) {
+ $needs_lipo{$File::Find::name} = 1;
+ }
+ }
+
+ chdir $s;
+ File::Find::find (\&eachfile, '.');
+}
+
+# Run lipo.
+foreach my $l (keys %needs_lipo) {
+ # A list of the files to run lipo on.
+ my @f = ();
+ # Work out which source directories actually contain this file and
+ # fill @f.
+ foreach my $s (@sources) {
+ my $sf = $s . '/' . $l;
+ push @f,($sf) if (-f $sf);
+ }
+ die "inconsistent directories" if ($#f == -1);
+ # There might really only be one copy if the file was present
+ # in the tree before the script was started.
+ if ($#f == 0) {
+ system ("cp", "-p", $f[0], $dest . '/' . $l) == 0
+ or $errors++;
+ } else {
+ system ("lipo", "-create", "-output", $dest . '/' . $l, @f) == 0
+ or $errors++;
+ }
+}
+
+exit ($errors ? 1 : 0);
Propchange: cfe/tags/Apple/clang/merge-lipo
------------------------------------------------------------------------------
svn:executable = *
More information about the cfe-commits
mailing list