flex: create variant +lex that creates symlinks for lex and libl.{a,so} (#3894)
* flex: create variant +lex that creates symlinks for lex and libl.{a,so}
* flex: enable variant +lex by default
* flex: use dso_suffix for portability; replace repetitive code with a loop
			
			
This commit is contained in:
		 Milton Woods
					Milton Woods
				
			
				
					committed by
					
						 Adam J. Stewart
						Adam J. Stewart
					
				
			
			
				
	
			
			
			 Adam J. Stewart
						Adam J. Stewart
					
				
			
						parent
						
							e4a3295c37
						
					
				
				
					commit
					ca2755d532
				
			| @@ -23,6 +23,7 @@ | ||||
| # Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA | ||||
| ############################################################################## | ||||
| from spack import * | ||||
| import os | ||||
|  | ||||
|  | ||||
| class Flex(AutotoolsPackage): | ||||
| @@ -39,6 +40,9 @@ class Flex(AutotoolsPackage): | ||||
|     version('2.6.0', '760be2ee9433e822b6eb65318311c19d') | ||||
|     version('2.5.39', '5865e76ac69c05699f476515592750d7') | ||||
|  | ||||
|     variant('lex', default=True, | ||||
|             description="Provide symlinks for lex and libl") | ||||
|  | ||||
|     depends_on('bison',         type='build') | ||||
|     depends_on('gettext@0.19:', type='build') | ||||
|     depends_on('help2man',      type='build') | ||||
| @@ -61,3 +65,16 @@ def url_for_version(self, version): | ||||
|             url += "/archive/flex-{0}.tar.gz".format(version.dashed) | ||||
|  | ||||
|         return url | ||||
|  | ||||
|     @run_after('install') | ||||
|     def symlink_lex(self): | ||||
|         if self.spec.satisfies('+lex'): | ||||
|             dso = dso_suffix | ||||
|             for dir, flex, lex in \ | ||||
|                     ((self.prefix.bin, 'flex', 'lex'), | ||||
|                      (self.prefix.lib, 'libfl.a', 'libl.a'), | ||||
|                      (self.prefix.lib, 'libfl.' + dso, 'libl.' + dso)): | ||||
|                 with working_dir(dir): | ||||
|                     if (os.path.isfile(flex) and not | ||||
|                             os.path.lexists(lex)): | ||||
|                         symlink(flex, lex) | ||||
|   | ||||
		Reference in New Issue
	
	Block a user