[WIP] Fix git gettext/libintl handling (builds on ubuntu) (#6859)
* Fix git on ubuntu, first cut Spack needs to pass information about where the linker can find `libintl`. We're currently using `LDFLAGS` to do so. The `LDFLAGS` info is pasted into the command line upstream of the a file (`libgit.a`) that includes unresolved symbols that need that library. This fails on Ubuntu, although it seems to work on CentOS (see #6841). This change allows git to build on a Ubuntu 16.04.3 droplet. TODO: test on other platforms... * Add a bit of useful commentary
This commit is contained in:
		 George Hartzell
					George Hartzell
				
			
				
					committed by
					
						 Adam J. Stewart
						Adam J. Stewart
					
				
			
			
				
	
			
			
			 Adam J. Stewart
						Adam J. Stewart
					
				
			
						parent
						
							43f98dc0d5
						
					
				
				
					commit
					ffa20d2171
				
			| @@ -165,13 +165,29 @@ class Git(AutotoolsPackage): | |||||||
|     depends_on('libtool',  type='build') |     depends_on('libtool',  type='build') | ||||||
|     depends_on('m4',       type='build') |     depends_on('m4',       type='build') | ||||||
|  |  | ||||||
|  |     # See the comment in setup_environment re EXTLIBS. | ||||||
|  |     def patch(self): | ||||||
|  |         filter_file(r'^EXTLIBS =$', | ||||||
|  |                     '#EXTLIBS =', | ||||||
|  |                     'Makefile') | ||||||
|  |  | ||||||
|     def setup_environment(self, spack_env, run_env): |     def setup_environment(self, spack_env, run_env): | ||||||
|         # This is done to avoid failures when git is an external package. |         # We use EXTLIBS rather than LDFLAGS so that git's Makefile | ||||||
|  |         # inserts the information into the proper place in the link commands | ||||||
|  |         # (alongside the # other libraries/paths that configure discovers). | ||||||
|  |         # LDFLAGS is inserted *before* libgit.a, which requires libintl. | ||||||
|  |         # EXTFLAGS is inserted *after* libgit.a. | ||||||
|  |         # This depends on the patch method above, which keeps the Makefile | ||||||
|  |         # from stepping on the value that we pass in via the environment. | ||||||
|  |         # | ||||||
|  |         # The test avoids failures when git is an external package. | ||||||
|         # In that case the node in the DAG gets truncated and git DOES NOT |         # In that case the node in the DAG gets truncated and git DOES NOT | ||||||
|         # have a gettext dependency. |         # have a gettext dependency. | ||||||
|         if 'gettext' in self.spec: |         if 'gettext' in self.spec: | ||||||
|             spack_env.append_flags('LDFLAGS', '-L{0} -lintl'.format( |             spack_env.append_flags('EXTLIBS', '-L{0} -lintl'.format( | ||||||
|                 self.spec['gettext'].prefix.lib)) |                 self.spec['gettext'].prefix.lib)) | ||||||
|  |             spack_env.append_flags('CFLAGS', '-I{0}'.format( | ||||||
|  |                 self.spec['gettext'].prefix.include)) | ||||||
|  |  | ||||||
|     def configure_args(self): |     def configure_args(self): | ||||||
|         spec = self.spec |         spec = self.spec | ||||||
|   | |||||||
		Reference in New Issue
	
	Block a user