[mingw-llvm] Initial import (#819670).

Eric Smith brouhaha at fedoraproject.org
Wed Jul 11 06:57:54 UTC 2012


commit 7ef9826109fcee3d7b36033a65a1749768bfba80
Author: Eric Smith <eric at p1.brouhaha.com>
Date:   Wed Jul 11 00:58:53 2012 -0600

    Initial import (#819670).

 .gitignore                      |    1 +
 llvm-2.6-timestamp.patch        |   11 +++
 llvm-3.0-mingw-config-dir.patch |   47 +++++++++++++
 llvm-3.0-mingw-undef.patch      |   21 ++++++
 mingw-llvm.spec                 |  141 +++++++++++++++++++++++++++++++++++++++
 sources                         |    1 +
 6 files changed, 222 insertions(+), 0 deletions(-)
---
diff --git a/.gitignore b/.gitignore
index e69de29..bd678c4 100644
--- a/.gitignore
+++ b/.gitignore
@@ -0,0 +1 @@
+/llvm-3.0.tar.gz
diff --git a/llvm-2.6-timestamp.patch b/llvm-2.6-timestamp.patch
new file mode 100644
index 0000000..ab0979e
--- /dev/null
+++ b/llvm-2.6-timestamp.patch
@@ -0,0 +1,11 @@
+--- llvm-2.6/Makefile.rules.timestamp	2009-08-19 18:04:44.000000000 -0400
++++ llvm-2.6/Makefile.rules	2009-09-09 02:10:38.287389725 -0400
+@@ -672,7 +672,7 @@
+ 
+ ProgInstall   = $(INSTALL) $(Install.StripFlag) -m 0755
+ ScriptInstall = $(INSTALL) -m 0755
+-DataInstall   = $(INSTALL) -m 0644
++DataInstall   = $(INSTALL) -p -m 0644
+ 
+ # When compiling under Mingw/Cygwin, the tblgen tool expects Windows
+ # paths. In this case, the SYSPATH function (defined in
diff --git a/llvm-3.0-mingw-config-dir.patch b/llvm-3.0-mingw-config-dir.patch
new file mode 100644
index 0000000..a828931
--- /dev/null
+++ b/llvm-3.0-mingw-config-dir.patch
@@ -0,0 +1,47 @@
+diff -up llvm-3.0.src/tools/llvm-config/llvm-config.in.in.mingw-config-dir llvm-3.0.src/tools/llvm-config/llvm-config.in.in
+--- llvm-3.0.src/tools/llvm-config/llvm-config.in.in.mingw-config-dir	2010-11-14 11:10:47.000000000 -0800
++++ llvm-3.0.src/tools/llvm-config/llvm-config.in.in	2012-05-10 23:51:53.788762327 -0700
+@@ -47,38 +47,12 @@ my $SYSTEM_LIBS         = q{@LIBS@};
+ my $LLVM_BUILDMODE      = q{@LLVM_BUILDMODE@};
+ #---- end Makefile values ----
+ 
+-# Figure out where llvm-config is being run from.  Primarily, we care if it has
+-# been installed, or is running from the build directory, which changes the
+-# locations of some files.
+-
+-# Convert the current executable name into its directory (e.g. ".").
+-my ($RUN_DIR) = ($0 =~ /^(.*)\/.*$/);
+-
+-# Turn the directory into an absolute directory on the file system, also pop up
+-# from "bin" into the build or prefix dir.
+-my $ABS_RUN_DIR = abs_path("$RUN_DIR/..");
+-chomp($ABS_RUN_DIR);
+-
+-# Compute the absolute object directory build, e.g. "foo/llvm/Debug".
+-my $ABS_OBJ_ROOT = "$LLVM_OBJ_ROOT/$LLVM_BUILDMODE";
+-$ABS_OBJ_ROOT = abs_path("$ABS_OBJ_ROOT") if (-d $ABS_OBJ_ROOT);
+-chomp($ABS_OBJ_ROOT);
+-
+-my $INCLUDEDIR = "$ABS_RUN_DIR/include";
++# Modified for Fedora install to NOT try to figure out where llvm-config
++# is being run from.  Always use PREFIX.
++my $INCLUDEDIR = "$PREFIX/include";
+ my $INCLUDEOPTION = "-I$INCLUDEDIR";
+-my $LIBDIR     = "$ABS_RUN_DIR/lib";
+-my $BINDIR     = "$ABS_RUN_DIR/bin";
+-if ($ABS_RUN_DIR eq $ABS_OBJ_ROOT) {
+-  # If we are running out of the build directory, the include dir is in the
+-  # srcdir.
+-  $INCLUDEDIR = "$LLVM_SRC_ROOT/include";
+-  # We need include files from both the srcdir and objdir.
+-  $INCLUDEOPTION = "-I$INCLUDEDIR -I$LLVM_OBJ_ROOT/include"
+-} else {
+-  # If installed, ignore the prefix the tree was configured with, use the
+-  # current prefix.
+-  $PREFIX = $ABS_RUN_DIR;
+-}
++my $LIBDIR     = "$PREFIX/lib";
++my $BINDIR     = "$PREFIX/bin";
+ 
+ sub usage;
+ sub fix_library_names (@);
diff --git a/llvm-3.0-mingw-undef.patch b/llvm-3.0-mingw-undef.patch
new file mode 100644
index 0000000..3c22781
--- /dev/null
+++ b/llvm-3.0-mingw-undef.patch
@@ -0,0 +1,21 @@
+diff -up llvm-3.0.src/configure.undef llvm-3.0.src/configure
+--- llvm-3.0.src/configure.undef	2012-05-06 19:45:39.331055473 -0700
++++ llvm-3.0.src/configure	2012-05-06 19:49:00.216072254 -0700
+@@ -10,6 +10,17 @@
+ # gives unlimited permission to copy, distribute and modify it.
+ #
+ # Copyright (c) 2003-2011 University of Illinois at Urbana-Champaign.
++
++# Undefine useless environment variables defined by Fedora RPM
++# %mingw_confingure script.  Not only do thaey not help, they actually
++# break the build.
++for v in ADDR2LINE AR AS CXX CXXFILT CPP DLLTOOL DLLWRAP ELFEDIT \
++	GXX GCC GCOV GPROF LD LD_BFD NM OBJCOPY RANLIB READELF \
++	SIZE STRINGS STRIP WINDMC WINDRES CC CXX
++do
++    unset $v
++done
++
+ ## --------------------- ##
+ ## M4sh Initialization.  ##
+ ## --------------------- ##
diff --git a/mingw-llvm.spec b/mingw-llvm.spec
new file mode 100644
index 0000000..91161ea
--- /dev/null
+++ b/mingw-llvm.spec
@@ -0,0 +1,141 @@
+%{?mingw_package_header}
+%global mingw_build_win64 0
+# As of 06-May-2012, LLVM 3.0 doesn't seem to build for win64. It gets
+# a lot of undefined symbols in the "Linking Release Shared Library
+# LLVM-3.0.dll" phase.  I'll need help from upstream to deal with that,
+# so for now, only build for win32.
+
+
+#global prerel rcX
+%global downloadurl http://llvm.org/%{?prerel:pre-}releases/%{version}%{?prerel:/%{prerel}}
+
+Name:           mingw-llvm
+Version:        3.0
+Release:        3%{?dist}
+Summary:        MinGW LLVM (Low Level Virtual Machine)
+
+Group:          Development/Libraries
+License:        NCSA
+URL:            http://llvm.org/
+Source0:        %{downloadurl}/llvm-%{version}%{?prerel:%{prerel}.src}.tar.gz
+
+
+# Data files should be installed with timestamps preserved.
+Patch0:         llvm-2.6-timestamp.patch
+
+# Fedora MinGW-specific patch to undef environment variables
+# set by mingw_configure macro.  The env vars simplify making
+# most packages build for MinGW.  The LLVM build system is
+# already MinGW-aware, so the evn vars not only don't help,
+# they actually break the build by preventing some necessary
+# build-host tools from building correctly.
+Patch100:       llvm-3.0-mingw-undef.patch
+
+# Fedora MinGW-specific patch to remove llvm-config logic that
+# tries to figure out where llvm-config is running from.  We
+# *ALWAYS* use the configured PREFIX.
+Patch101:       llvm-3.0-mingw-config-dir.patch
+
+BuildArch:      noarch
+
+BuildRequires:  mingw32-filesystem >= 95
+BuildRequires:  mingw32-gcc-c++
+BuildRequires:  mingw32-binutils
+BuildRequires:  mingw32-libffi
+
+
+%description
+LLVM is a compiler infrastructure designed for compile-time,
+link-time, runtime, and idle-time optimization of programs from
+arbitrary programming languages.  The compiler infrastructure includes
+mirror sets of programming tools as well as libraries with equivalent
+functionality.
+
+
+%package -n mingw32-llvm
+Summary:        %{summary}
+Group:          Development/Libraries
+
+%description -n mingw32-llvm
+MingGW shared libraries for the LLVM compiler infrastructure.
+
+
+%package -n mingw32-llvm-static
+Summary:        %{summary} static libraries
+Group:          Development/Libraries
+
+%description -n mingw32-llvm-static
+MingGW static libraries for the LLVM compiler infrastructure.
+
+
+%{?mingw_debug_package}
+
+%prep
+%setup -q -n llvm-%{version}%{?prerel}.src
+rm -rf tools/clang
+
+# llvm patches
+%patch0 -p1 -b .timestamp
+%patch100 -p1 -b .mingw-undef
+%patch101 -p1 -b .mingw-config-dir
+
+
+%build
+%mingw_configure \
+  --enable-debug-runtime \
+  --enable-jit \
+  --enable-libffi \
+  --enable-shared \
+  --enable-bindings=none \
+  --enable-docs=no
+
+# NOTE: docs are available in native llvm and llvm-doc packages.
+
+%mingw_make %{?_smp_mflags} \
+  OPTIMIZE_OPTION="%{mingw32_cflags}" \
+  KEEP_SYMBOLS=1
+
+
+%install
+%mingw_make_install "DESTDIR=%{buildroot}"
+
+# Libraries shouldn't have execute permission!
+chmod a-x %{buildroot}%{mingw32_libdir}/*.a
+
+# Move and rename the llvm-config script, because it runs on
+# the build host, not on Windows.
+mkdir -p %{buildroot}%{_bindir}
+mv %{buildroot}%{mingw32_bindir}/llvm-config \
+   %{buildroot}%{_bindir}/%{mingw32_host}-llvm-config
+
+
+%files -n mingw32-llvm
+%doc CREDITS.TXT LICENSE.TXT README.txt
+%{mingw32_bindir}/bugpoint.exe
+%{mingw32_bindir}/llc.exe
+%{mingw32_bindir}/lli.exe
+%{mingw32_bindir}/llvm*.exe
+%{mingw32_bindir}/macho-dump.exe
+%{mingw32_bindir}/opt.exe
+%{mingw32_bindir}/LLVM-3.0.dll
+%{mingw32_bindir}/BugpointPasses.dll
+%{mingw32_bindir}/LTO.dll
+%{mingw32_includedir}/llvm/
+%{mingw32_includedir}/llvm-c/
+%{_bindir}/%{mingw32_host}-llvm-config
+
+%files -n mingw32-llvm-static
+%{mingw32_libdir}/*.a
+
+
+%changelog
+* Thu May 10 2012 Eric Smith <eric at brouhaha.com> - 3.0-3
+- Add patch to force llvm-config to always use PREFIX, rather than
+  trying to figure out whether it has been installed.
+
+* Mon May 07 2012 Eric Smith <eric at brouhaha.com> - 3.0-2
+- Add OPTIMIZE_OPTION and KEEP_SYMBOLS to make command line to prevent
+  symbols from being stripped, in order to get usable debuginfo package.
+
+* Sun May 06 2012 Eric Smith <eric at brouhaha.com> - 3.0-1
+- Initial version
diff --git a/sources b/sources
index e69de29..e51ba48 100644
--- a/sources
+++ b/sources
@@ -0,0 +1 @@
+a8e5f5f1c1adebae7b4a654c376a6005  llvm-3.0.tar.gz


More information about the scm-commits mailing list