Remove Perl dependency from the build
From bugzilla bug 13467¹: The modeline2c script is the only part of the Xorg server that requires Perl. [This] is a simpler replacement that works with any normal AWK. 1] http://bugs.freedesktop.org/show_bug.cgi?id=13467 Bug was posted by Joerg Sonnenberger <joerg@NetBSD.org>.
This commit is contained in:
		
							parent
							
								
									60086d9016
								
							
						
					
					
						commit
						aa0dfb3f42
					
				| 
						 | 
				
			
			@ -23,8 +23,8 @@ BUSSOURCES = xf86isaBus.c xf86pciBus.c xf86fbBus.c xf86noBus.c $(SBUS_SOURCES)
 | 
			
		|||
 | 
			
		||||
MODEDEFSOURCES = $(srcdir)/vesamodes $(srcdir)/extramodes
 | 
			
		||||
 | 
			
		||||
xf86DefModeSet.c: $(srcdir)/modeline2c.pl $(MODEDEFSOURCES)
 | 
			
		||||
	cat $(MODEDEFSOURCES) | $(PERL) $(srcdir)/modeline2c.pl > $@
 | 
			
		||||
xf86DefModeSet.c: $(srcdir)/modeline2c.awk $(MODEDEFSOURCES)
 | 
			
		||||
	cat $(MODEDEFSOURCES) | $(AWK) -f $(srcdir)/modeline2c.awk > $@
 | 
			
		||||
 | 
			
		||||
BUILT_SOURCES = xf86DefModeSet.c
 | 
			
		||||
 | 
			
		||||
| 
						 | 
				
			
			
 | 
			
		|||
| 
						 | 
				
			
			@ -0,0 +1,97 @@
 | 
			
		|||
#!/usr/bin/awk -f
 | 
			
		||||
#
 | 
			
		||||
# Copyright (c) 2007 Joerg Sonnenberger <joerg@NetBSD.org>.
 | 
			
		||||
# All rights reserved.
 | 
			
		||||
#
 | 
			
		||||
# Based on Perl script by Dirk Hohndel.
 | 
			
		||||
#
 | 
			
		||||
# Redistribution and use in source and binary forms, with or without
 | 
			
		||||
# modification, are permitted provided that the following conditions
 | 
			
		||||
# are met:
 | 
			
		||||
#
 | 
			
		||||
# 1. Redistributions of source code must retain the above copyright
 | 
			
		||||
#    notice, this list of conditions and the following disclaimer.
 | 
			
		||||
# 2. Redistributions in binary form must reproduce the above copyright
 | 
			
		||||
#    notice, this list of conditions and the following disclaimer in
 | 
			
		||||
#    the documentation and/or other materials provided with the
 | 
			
		||||
#    distribution.
 | 
			
		||||
#
 | 
			
		||||
# THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
 | 
			
		||||
# ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
 | 
			
		||||
# LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS
 | 
			
		||||
# FOR A PARTICULAR PURPOSE ARE DISCLAIMED.  IN NO EVENT SHALL THE
 | 
			
		||||
# COPYRIGHT HOLDERS OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT,
 | 
			
		||||
# INCIDENTAL, SPECIAL, EXEMPLARY OR CONSEQUENTIAL DAMAGES (INCLUDING,
 | 
			
		||||
# BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
 | 
			
		||||
# LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED
 | 
			
		||||
# AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY,
 | 
			
		||||
# OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT
 | 
			
		||||
# OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
 | 
			
		||||
# SUCH DAMAGE.
 | 
			
		||||
#
 | 
			
		||||
# Usage: modeline2c.awk < modefile > xf86DefModes.c
 | 
			
		||||
#
 | 
			
		||||
 | 
			
		||||
BEGIN {
 | 
			
		||||
	flagsdict[""] = "0"
 | 
			
		||||
 | 
			
		||||
	flagsdict["+hsync +vsync"] = "V_PHSYNC | V_PVSYNC"
 | 
			
		||||
	flagsdict["+hsync -vsync"] = "V_PHSYNC | V_NVSYNC"
 | 
			
		||||
	flagsdict["-hsync +vsync"] = "V_NHSYNC | V_PVSYNC"
 | 
			
		||||
	flagsdict["-hsync -vsync"] = "V_NHSYNC | V_NVSYNC"
 | 
			
		||||
	flagsdict["+hsync +vsync interlace"] = "V_PHSYNC | V_PVSYNC | V_INTERLACE"
 | 
			
		||||
	flagsdict["+hsync -vsync interlace"] = "V_PHSYNC | V_NVSYNC | V_INTERLACE"
 | 
			
		||||
	flagsdict["-hsync +vsync interlace"] = "V_NHSYNC | V_PVSYNC | V_INTERLACE"
 | 
			
		||||
	flagsdict["-hsync -vsync interlace"] = "V_NHSYNC | V_NVSYNC | V_INTERLACE"
 | 
			
		||||
 | 
			
		||||
	print "/* $" "XFree86$ */"
 | 
			
		||||
	print
 | 
			
		||||
	print "/* THIS FILE IS AUTOMATICALLY GENERATED -- DO NOT EDIT -- LOOK at"
 | 
			
		||||
	print " * modeline2c.awk */"
 | 
			
		||||
	print ""
 | 
			
		||||
	print "/*"
 | 
			
		||||
	print " * Author: Joerg Sonnenberger <joerg@NetBSD.org>"
 | 
			
		||||
	print " * Based on Perl script from Dirk Hohndel <hohndel@XFree86.Org>"
 | 
			
		||||
	print " */"
 | 
			
		||||
	print ""
 | 
			
		||||
	print "#ifdef HAVE_XORG_CONFIG_H"
 | 
			
		||||
	print "#include <xorg-config.h>"
 | 
			
		||||
	print "#endif"
 | 
			
		||||
	print ""
 | 
			
		||||
	print "#ifdef __UNIXOS2__"
 | 
			
		||||
	print "#define I_NEED_OS2_H"
 | 
			
		||||
	print "#endif"
 | 
			
		||||
	print "#include \"xf86.h\""
 | 
			
		||||
	print "#include \"xf86Config.h\""
 | 
			
		||||
	print "#include \"xf86Priv.h\""
 | 
			
		||||
	print "#include \"xf86_OSlib.h\""
 | 
			
		||||
	print ""
 | 
			
		||||
	print "#include \"globals.h\""
 | 
			
		||||
	print ""
 | 
			
		||||
	print "#define MODEPREFIX(name) NULL, NULL, name, MODE_OK, M_T_DEFAULT"
 | 
			
		||||
	print "#define MODESUFFIX       0,0, 0,0,0,0,0,0,0, 0,0,0,0,0,0,FALSE,FALSE,0,NULL,0,0.0,0.0"
 | 
			
		||||
	print ""
 | 
			
		||||
	print "DisplayModeRec xf86DefaultModes [] = {"
 | 
			
		||||
 | 
			
		||||
	modeline = "\t{MODEPREFIX(\"%dx%d\"),%d, %d,%d,%d,%d,0, %d,%d,%d,%d,0, %s, MODESUFFIX},\n"
 | 
			
		||||
	modeline_data = "^[a-zA-Z]+[ \t]+[^ \t]+[ \t0-9.]+"
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
/^[mM][oO][dD][eE][lL][iI][nN][eE]/ {
 | 
			
		||||
	flags = $0
 | 
			
		||||
	gsub(modeline_data, "", flags)
 | 
			
		||||
	flags = tolower(flags)
 | 
			
		||||
	printf(modeline, $4, $8, $3 * 1000, $4, $5, $6, $7,
 | 
			
		||||
	       $8, $9, $10, $11, flagsdict[flags])
 | 
			
		||||
	# Half-width double scanned modes
 | 
			
		||||
	printf(modeline, $4/2, $8/2, $3 * 500, $4/2, $5/2, $6/2, $7/2,
 | 
			
		||||
	       $8/2, $9/2, $10/2, $11/2, flagsdict[flags] " | V_DBLSCAN")
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
/^#/ {
 | 
			
		||||
	print "/*" substr($0, 2) " */"
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
END {
 | 
			
		||||
	printf("\t{MODEPREFIX(NULL),0,0,0,0,0,0,0,0,0,0,0,0,MODESUFFIX}\n};\n")
 | 
			
		||||
}
 | 
			
		||||
| 
						 | 
				
			
			@ -1,107 +0,0 @@
 | 
			
		|||
#!/usr/bin/perl
 | 
			
		||||
 | 
			
		||||
# automatically generate the xf86DefModeSet.c file from a normal
 | 
			
		||||
# XF86Config style file of Modelines
 | 
			
		||||
#
 | 
			
		||||
# run as 
 | 
			
		||||
#
 | 
			
		||||
# perl /modeline2c.pl < [modesfile] > xf86DefModes.c
 | 
			
		||||
#
 | 
			
		||||
# hackish perl - author Dirk Hohndel
 | 
			
		||||
#
 | 
			
		||||
# Copyright 1999-2003 by The XFree86 Project, Inc.
 | 
			
		||||
#
 | 
			
		||||
# Permission is hereby granted, free of charge, to any person obtaining a
 | 
			
		||||
# copy of this software and associated documentation files (the "Software"),
 | 
			
		||||
# to deal in the Software without restriction, including without limitation
 | 
			
		||||
# the rights to use, copy, modify, merge, publish, distribute, sublicense,
 | 
			
		||||
# and/or sell copies of the Software, and to permit persons to whom the
 | 
			
		||||
# Software is furnished to do so, subject to the following conditions:
 | 
			
		||||
#
 | 
			
		||||
# The above copyright notice and this permission notice shall be included in
 | 
			
		||||
# all copies or substantial portions of the Software.
 | 
			
		||||
#
 | 
			
		||||
# THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
 | 
			
		||||
# IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
 | 
			
		||||
# FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.  IN NO EVENT SHALL
 | 
			
		||||
# THE COPYRIGHT HOLDER(S) OR AUTHOR(S) BE LIABLE FOR ANY CLAIM, DAMAGES OR
 | 
			
		||||
# OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE,
 | 
			
		||||
# ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR
 | 
			
		||||
# OTHER DEALINGS IN THE SOFTWARE.
 | 
			
		||||
#
 | 
			
		||||
# Except as contained in this notice, the name of the copyright holder(s)
 | 
			
		||||
# and author(s) shall not be used in advertising or otherwise to promote
 | 
			
		||||
# the sale, use or other dealings in this Software without prior written
 | 
			
		||||
# authorization from the copyright holder(s) and author(s).
 | 
			
		||||
#
 | 
			
		||||
# $XFree86: xc/programs/Xserver/hw/xfree86/common/modeline2c.pl,v 1.10tsi Exp $
 | 
			
		||||
 | 
			
		||||
#my %flagshash;
 | 
			
		||||
$flagshash{""} = "0";
 | 
			
		||||
# $flagshash{"Interlace"} = "V_INTERLACE";
 | 
			
		||||
# $flagshash{"+hsync"} = "V_PHSYNC";
 | 
			
		||||
# $flagshash{"-hsync"} = "V_NHSYNC";
 | 
			
		||||
# $flagshash{"+vsync"} = "V_PVSYNC";
 | 
			
		||||
# $flagshash{"-vsync"} = "V_NVSYNC";
 | 
			
		||||
# XXX I'm definitely not a perl guru...   -- tsi
 | 
			
		||||
$flagshash{"+hsync +vsync"} = "V_PHSYNC | V_PVSYNC";
 | 
			
		||||
$flagshash{"+hsync -vsync"} = "V_PHSYNC | V_NVSYNC";
 | 
			
		||||
$flagshash{"-hsync +vsync"} = "V_NHSYNC | V_PVSYNC";
 | 
			
		||||
$flagshash{"-hsync -vsync"} = "V_NHSYNC | V_NVSYNC";
 | 
			
		||||
$flagshash{"+hsync +vsync interlace"} = "V_PHSYNC | V_PVSYNC | V_INTERLACE";
 | 
			
		||||
$flagshash{"+hsync -vsync interlace"} = "V_PHSYNC | V_NVSYNC | V_INTERLACE";
 | 
			
		||||
$flagshash{"-hsync +vsync interlace"} = "V_NHSYNC | V_PVSYNC | V_INTERLACE";
 | 
			
		||||
$flagshash{"-hsync -vsync interlace"} = "V_NHSYNC | V_NVSYNC | V_INTERLACE";
 | 
			
		||||
 | 
			
		||||
# stop CVS from expanding the XFree86 Id here...
 | 
			
		||||
 | 
			
		||||
$proj = "XFree86";
 | 
			
		||||
printf("/* \$$proj\$ */
 | 
			
		||||
 | 
			
		||||
/* THIS FILE IS AUTOMATICALLY GENERATED -- DO NOT EDIT -- LOOK at
 | 
			
		||||
 * modeline2c.pl */
 | 
			
		||||
 | 
			
		||||
/*
 | 
			
		||||
 * Copyright 1999-2003 by The XFree86 Project, Inc.
 | 
			
		||||
 *
 | 
			
		||||
 * Author: Dirk Hohndel <hohndel\@XFree86.Org>
 | 
			
		||||
 */
 | 
			
		||||
 | 
			
		||||
#ifdef HAVE_XORG_CONFIG_H
 | 
			
		||||
#include <xorg-config.h>
 | 
			
		||||
#endif
 | 
			
		||||
 | 
			
		||||
#include \"xf86.h\"
 | 
			
		||||
#include \"xf86Config.h\"
 | 
			
		||||
#include \"xf86Priv.h\"
 | 
			
		||||
#include \"xf86_OSlib.h\"
 | 
			
		||||
 | 
			
		||||
#include \"globals.h\"
 | 
			
		||||
 | 
			
		||||
#define MODEPREFIX(name) NULL, NULL, name, MODE_OK, M_T_DEFAULT
 | 
			
		||||
#define MODESUFFIX       0,0, 0,0,0,0,0,0,0, 0,0,0,0,0,0,FALSE,FALSE,0,NULL,0,0.0,0.0
 | 
			
		||||
 | 
			
		||||
DisplayModeRec xf86DefaultModes [] = {
 | 
			
		||||
");
 | 
			
		||||
while (<>) {
 | 
			
		||||
  if (/^\#/) {
 | 
			
		||||
    s/^\#//;
 | 
			
		||||
    chop;
 | 
			
		||||
    print "/*" . $_ . " */\n";
 | 
			
		||||
  }
 | 
			
		||||
  if (/^ModeLine\s+(\S+)\s+([\d.\s]+)(.*)/i) {
 | 
			
		||||
    $name = $1;
 | 
			
		||||
    $values = $2;
 | 
			
		||||
    $flags = $3;
 | 
			
		||||
    $flags =~ y/A-Z/a-z/;
 | 
			
		||||
    $values =~ /([\d.]+)\s+(\d+)\s+(\d+)\s+(\d+)\s+(\d+)\s+(\d+)\s+(\d+)\s+(\d+)\s+(\d+)/;
 | 
			
		||||
    printf("\t{MODEPREFIX(%s),%d, %d,%d,%d,%d,0, %d,%d,%d,%d,0, %s, MODESUFFIX},\n",
 | 
			
		||||
	   $name,$1*1000,$2,$3,$4,$5,$6,$7,$8,$9,$flagshash{$flags});
 | 
			
		||||
# Also generate half-width doublescanned modes
 | 
			
		||||
    printf("\t{MODEPREFIX(\"%dx%d\"),%d, %d,%d,%d,%d,0, %d,%d,%d,%d,0, %s | V_DBLSCAN, MODESUFFIX},\n",
 | 
			
		||||
	   $2/2,$6/2,$1*500,$2/2,$3/2,$4/2,$5/2,$6/2,$7/2,$8/2,$9/2,$flagshash{$flags});
 | 
			
		||||
  }
 | 
			
		||||
 | 
			
		||||
 | 
			
		||||
}
 | 
			
		||||
printf("\t{MODEPREFIX(NULL),0,0,0,0,0,0,0,0,0,0,0,0,MODESUFFIX}\n};\n");
 | 
			
		||||
		Loading…
	
		Reference in New Issue