[ovs-dev] [PATCH V2 2/2] cccl: A wrapper that calls visual c++ compiler.

Gurucharan Shetty shettyg at nicira.com
Mon Nov 18 21:30:41 UTC 2013


One option to compile Open vSwitch code in windows
is to use Visual c++ compiler.

>From http://cccl.sourceforge.net/ :
"cccl is a wrapper around Microsoft Visual C++'s cl.exe
and link.exe.  It converts Unix compiler parameters
into parameters understood by cl and link.  cccl's main
use is for using Unix build processes with Microsoft
compilers. Using cccl in conjunction with ports of Unix
utilities, it is possible to build many Unix packages
using MSVC, without modifying the build process."

There are couple of forks of the project in the internet.
This particular piece is copied from:
https://gitorious.org/swift/swift/source/\
cf9b391b40a9c59a620c8093d438370381949c60:autoconf/cccl

Signed-off-by: Gurucharan Shetty <gshetty at nicira.com>
---
 AUTHORS             |    3 +
 COPYING             |    3 +
 Makefile.am         |    1 +
 build-aux/cccl      |  201 +++++++++++++++++++++++++++++++++++++++++++++++++++
 debian/copyright.in |    6 ++
 5 files changed, 214 insertions(+)
 create mode 100644 build-aux/cccl

diff --git a/AUTHORS b/AUTHORS
index 1b508af..76951e7 100644
--- a/AUTHORS
+++ b/AUTHORS
@@ -40,6 +40,7 @@ Ethan Jackson           ethan at nicira.com
 Flavio Leitner          fbl at redhat.com
 FUJITA Tomonori         fujita.tomonori at lab.ntt.co.jp
 Gaetano Catalli         gaetano.catalli at gmail.com
+Geoffrey Wossum         gwossum at acm.org
 Giuseppe Lettieri       g.lettieri at iet.unipi.it
 Glen Gibb               grg at stanford.edu
 Guolin Yang             gyang at nicira.com
@@ -83,6 +84,7 @@ Pravin B Shelar         pshelar at nicira.com
 Raju Subramanian        rsubramanian at nicira.com
 Ravi Kerur              Ravi.Kerur at telekom.com
 Reid Price              reid at nicira.com
+Remko Tronçon           git at el-tramo.be
 Rich Lane               rlane at bigswitch.com
 Rob Hoes                rob.hoes at citrix.com
 Romain Lenglet          romain.lenglet at berabera.info
@@ -106,6 +108,7 @@ Tyler Coumbes           coumbes at gmail.com
 Valient Gough           vgough at pobox.com
 Vivien Bernet-Rollande  vbr at soprive.net
 Wei Yongjun             yjwei at cn.fujitsu.com
+William Fulton
 Yasuhito Takamiya       yasuhito at gmail.com
 Yu Zhiguo               yuzg at cn.fujitsu.com
 ZhengLingyun            konghuarukhr at 163.com
diff --git a/COPYING b/COPYING
index 22c9341..6b28b0e 100644
--- a/COPYING
+++ b/COPYING
@@ -19,6 +19,9 @@ Most files are licensed under the Apache License, Version 2.0:
 Files under the datapath directory are licensed under the GNU General
 Public License, version 2.
 
+File build-aux/cccl is licensed under the GNU General Public
+License, version 2.
+
 Files under the xenserver directory are licensed on a file-by-file
 basis.  Refer to each file for details.
 
diff --git a/Makefile.am b/Makefile.am
index f2d1294..3d2165f 100644
--- a/Makefile.am
+++ b/Makefile.am
@@ -70,6 +70,7 @@ EXTRA_DIST = \
 	SubmittingPatches \
 	WHY-OVS \
 	boot.sh \
+	build-aux/cccl \
 	build-aux/sodepends.pl \
 	build-aux/soexpand.pl \
 	$(MAN_FRAGMENTS) \
diff --git a/build-aux/cccl b/build-aux/cccl
new file mode 100644
index 0000000..a00b7f8
--- /dev/null
+++ b/build-aux/cccl
@@ -0,0 +1,201 @@
+#!/bin/sh
+
+# cccl
+# Wrapper around MS's cl.exe and link.exe to make them act more like
+# Unix cc and ld
+#
+# Copyright (C) 2000-2003 Geoffrey Wossum (gwossum at acm.org)
+#
+# This program is free software; you can redistribute it and/or modify
+# it under the terms of the GNU General Public License as published by
+# the Free Software Foundation; either version 2 of the License, or
+# (at your option) any later version.
+#
+# This program is distributed in the hope that it will be useful, but
+# WITHOUT ANY WARRANTY; without even the implied warranty of
+# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.    See the GNU
+# General Public License for more details.
+#
+# You should have received a copy of the GNU General Public License
+# along with this program; if not, write to the Free Software
+# Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
+#
+
+usage()
+{
+    cat <<EOF
+Usage: cccl [OPTIONS]
+
+cccl is a wrapper around Microsoft's cl.exe and link.exe.  It translates
+parameters that Unix cc's and ld's understand to parameters that cl and link
+understand.
+EOF
+    exit $1
+}
+
+# Put /usr/bin last in the path, to avoid clashes with MSVC's link
+# Ugly workaround, but should work
+PATH=`echo $PATH | sed -e "s#/usr/bin:##" | sed -e "s#/bin:##"`:/usr/bin
+
+case $MACHTYPE in
+    *-msys)
+        slash="//"
+        ;;
+    *)
+        slash="/"
+        ;;
+esac
+# prog specifies the program that should be run (cl.exe or link.exe)
+# We'll assume cl to start out
+prog=cl
+# opts specifies the command line to pass to the MSVC program
+clopt="${slash}nologo"
+linkopt="${slash}nologo"
+# gotparam is 0 if we didn't ever see a param, in which case we show usage()
+gotparam=
+
+# We want exceptions
+clopt="$clopt ${slash}EHsc"
+
+### Run through every option and convert it to the proper MS one
+while test $# -gt 0; do
+    case "$1" in
+    -D*) optarg= ;;
+    -*=*) optarg=`echo "$1" | sed 's/[-_a-zA-Z0-9]*=//'` ;;
+    *) optarg= ;;
+    esac
+    gotparam=1
+
+    case "$1" in
+    --version)
+        cat <<EOF
+cccl 0.03
+
+Copyright 2000-2003 Geoffrey Wossum
+This is free software; see the source for copying conditions.  There is NO
+waranty; not even for MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
+EOF
+        exit 1;
+        ;;
+
+    -ansi)
+        clopt="$clopt ${slash}Za"
+        ;;
+
+    -c)
+        # -c (compile only) is actually the same, but for clarity...
+        clopt="$clopt ${slash}c"
+        ;;
+
+    -g[0-9] | -g)
+        # cl only supports one debugging level
+        clopt="$clopt ${slash}Zi"
+        ;;
+
+    -L*)
+        path=`echo "$1" | sed 's/-L//'`
+        linkopt="$linkopt /LIBPATH:$path"
+        ;;
+
+    -l*)
+        lib=`echo "$1" | sed 's/-l//'`
+    if [ $lib != "dnsapi" -a $lib != "ws2_32" -a $lib != "wsock32" ]; then
+      lib="lib$lib.lib"
+    else
+      lib="$lib.lib"
+    fi
+
+        clopt="$clopt $lib"
+        linkopt="$linkopt $lib"
+        ;;
+
+    -m386)
+        clopt="$clopt ${slash}G3"
+        ;;
+
+    -m486)
+        clopt="$clopt ${slash}G4"
+        ;;
+
+    -mpentium)
+        clopt="$clopt ${slash}G5"
+        ;;
+
+    -mpentiumpro)
+        clopt="$clopt ${slash}G6"
+        ;;
+
+    -o)
+        # specifying output file, is it an object or an executable
+        shift
+        case "$1" in
+        *.o | *.obj)
+            clopt="$clopt ${slash}Fo$1"
+        ;;
+        *)
+            clopt="$clopt ${slash}Fe$1";
+            linkopt="$linkopt ${slash}out:$1"
+        ;;
+        esac;;
+
+    -pedantic)
+        #ignore pedantic
+        ;;
+
+    -W*)
+        #ignore warnings
+        ;;
+
+    -isystem)
+        shift
+        clopt="$clopt -I$1"
+        ;;
+
+    -MT)
+        exit 0
+        ;;
+
+    -mno-cygwin)
+        ;;
+
+    *.cc | *.cxx | *.C)
+        # C++ source file with non .cpp extension, make sure cl understand
+        # that it is C++
+        clopt="$clopt ${slash}Tp$1"
+        ;;
+
+    *.o | *.obj | *.a | *.lib)
+        # Object files/libraries seen, this command will require link
+        # Switch the prog to link
+        linkopt="$linkopt $1"
+        prog="link"
+        ;;
+
+    *)
+        clopt="$clopt $1"
+        linkopt="$linkopt $1"
+        if test x$optarg != x ; then
+            clopt="$clopt=$optarg"
+            linkopt="$linkopt=$optarg"
+        fi
+        ;;
+
+    esac
+    shift
+done
+
+if test x$gotparam = x ; then
+    usage
+    exit 1
+fi
+
+# choose which opts we built up based on which program will actually run
+if test x$prog = xcl ; then
+    opts=$clopt
+else
+    opts=$linkopt
+fi
+
+#echo "$prog $opts"
+exec $prog $opts
+exit 0
diff --git a/debian/copyright.in b/debian/copyright.in
index c6631d5..986f7a1 100644
--- a/debian/copyright.in
+++ b/debian/copyright.in
@@ -13,6 +13,7 @@ Upstream Copyright Holders:
 	Copyright (c) 2008,2009,2010 Citrix Systems, Inc.
 	and authors listed above.
 	Copyright (c) 2011 Gaetano Catalli
+	Copyright (C) 2000-2003 Geoffrey Wossum (gwossum at acm.org)
 
 License:
 
@@ -72,6 +73,11 @@ License:
   On Debian systems, the complete text of the GNU General Public License
   version 2 can be found in `/usr/share/common-licenses/GPL-2'
 
+* The following file is licensed under the GNU General Public License
+  version 2.
+
+	build-aux/cccl
+
 * The following components are dual-licensed under the
   GNU General Public License version 2 and the Apache License Version 2.0.
 
-- 
1.7.9.5




More information about the dev mailing list