The Design and Implementation of the FreeBSD Operating System, Second Edition
Now available: The Design and Implementation of the FreeBSD Operating System (Second Edition)


[ source navigation ] [ diff markup ] [ identifier search ] [ freetext search ] [ file search ] [ list types ] [ track identifier ]

FreeBSD/Linux Kernel Cross Reference
sys/contrib/libsodium/regen-msvc/regen-msvc.py

Version: -  FREEBSD  -  FREEBSD-13-STABLE  -  FREEBSD-13-0  -  FREEBSD-12-STABLE  -  FREEBSD-12-0  -  FREEBSD-11-STABLE  -  FREEBSD-11-0  -  FREEBSD-10-STABLE  -  FREEBSD-10-0  -  FREEBSD-9-STABLE  -  FREEBSD-9-0  -  FREEBSD-8-STABLE  -  FREEBSD-8-0  -  FREEBSD-7-STABLE  -  FREEBSD-7-0  -  FREEBSD-6-STABLE  -  FREEBSD-6-0  -  FREEBSD-5-STABLE  -  FREEBSD-5-0  -  FREEBSD-4-STABLE  -  FREEBSD-3-STABLE  -  FREEBSD22  -  l41  -  OPENBSD  -  linux-2.6  -  MK84  -  PLAN9  -  xnu-8792 
SearchContext: -  none  -  3  -  10 

    1 #! /usr/bin/env python3
    2 
    3 import fileinput
    4 import glob
    5 import os
    6 import uuid
    7 
    8 dirs = set()
    9 
   10 tlv1 = ""
   11 for file in glob.iglob("src/libsodium/**/*.c", recursive=True):
   12     file = file.replace("/", "\\")
   13     tlv1 = tlv1 + "    <ClCompile Include=\"{}\" />\r\n".format(file)
   14 
   15 tlv2 = ""
   16 for file in glob.iglob("src/libsodium/**/*.h", recursive=True):
   17     file = file.replace("/", "\\")
   18     tlv2 = tlv2 + "    <ClInclude Include=\"{}\" />\r\n".format(file)
   19 
   20 tlf1 = ""
   21 for file in glob.iglob("src/libsodium/**/*.c", recursive=True):
   22     file = file.replace("/", "\\")
   23     tlf1 = tlf1 + "    <ClCompile Include=\"{}\">\r\n".format(file)
   24     tlf1 = tlf1 + "      <Filter>Source Files</Filter>\r\n"
   25     tlf1 = tlf1 + "    </ClCompile>\r\n"
   26 
   27 tlf2 = ""
   28 for file in glob.iglob("src/libsodium/**/*.h", recursive=True):
   29     file = file.replace("/", "\\")
   30     tlf2 = tlf2 + "    <ClInclude Include=\"{}\">\r\n".format(file)
   31     tlf2 = tlf2 + "      <Filter>Header Files</Filter>\r\n"
   32     tlf2 = tlf2 + "    </ClInclude>\r\n"
   33 
   34 v1 = ""
   35 for file in glob.iglob("src/libsodium/**/*.c", recursive=True):
   36     file = file.replace("/", "\\")
   37     v1 = v1 + \
   38         "    <ClCompile Include=\"..\\..\\..\\..\\{}\" />\r\n".format(file)
   39 
   40 v2 = ""
   41 for file in glob.iglob("src/libsodium/**/*.h", recursive=True):
   42     file = file.replace("/", "\\")
   43     v2 = v2 + \
   44         "    <ClInclude Include=\"..\\..\\..\\..\\{}\" />\r\n".format(file)
   45 
   46 f1 = ""
   47 for file in glob.iglob("src/libsodium/**/*.c", recursive=True):
   48     basedir = os.path.dirname(file).replace("src/libsodium/", "")
   49     t = basedir
   50     while t != '':
   51         dirs.add(t)
   52         t = os.path.dirname(t)
   53     basedir = basedir.replace("/", "\\")
   54     file = file.replace("/", "\\")
   55     f1 = f1 + "    <ClCompile Include=\"..\\..\\..\\..\\{}\">\r\n".format(file)
   56     f1 = f1 + "      <Filter>{}</Filter>\r\n".format(basedir)
   57     f1 = f1 + "    </ClCompile>\r\n"
   58 
   59 f2 = ""
   60 for file in glob.iglob("src/libsodium/**/*.h", recursive=True):
   61     basedir = os.path.dirname(file).replace("src/libsodium/", "")
   62     t = basedir
   63     while t != '':
   64         dirs.add(t)
   65         t = os.path.dirname(t)
   66     basedir = basedir.replace("/", "\\")
   67     file = file.replace("/", "\\")
   68     f2 = f2 + "    <ClInclude Include=\"..\\..\\..\\..\\{}\">\r\n".format(file)
   69     f2 = f2 + "      <Filter>{}</Filter>\r\n".format(basedir)
   70     f2 = f2 + "    </ClInclude>\r\n"
   71 
   72 fd = ""
   73 dirs = list(dirs)
   74 dirs.sort()
   75 for dir in dirs:
   76     dir = dir.replace("/", "\\")
   77     uid = uuid.uuid3(uuid.UUID(bytes=b'LibSodiumMSVCUID'), dir)
   78     fd = fd + "    <Filter Include=\"{}\">\r\n".format(dir)
   79     fd = fd + \
   80         "      <UniqueIdentifier>{{{}}}</UniqueIdentifier>\r\n".format(uid)
   81     fd = fd + "    </Filter>\r\n"
   82 
   83 
   84 def apply_template(tplfile, outfile, sbox):
   85     tpl = ""
   86     with open(tplfile, 'rb') as fd:
   87         tpl = fd.read()
   88     for s in sbox.keys():
   89         tpl = tpl.replace(str.encode(
   90             "{{" + s + "}}", "utf8"), str.encode(str.strip(sbox[s]), "utf8"))
   91 
   92     with open(outfile, 'wb') as fd:
   93         fd.write(tpl)
   94 
   95 sbox = {"tlv1": tlv1, "tlv2": tlv2, "tlf1": tlf1, "tlf2": tlf2, "v1": v1,
   96         "v2": v2, "f1": f1, "f2": f2, "fd": fd}
   97 
   98 sd = os.path.dirname(os.path.realpath(__file__))
   99 
  100 apply_template(sd + "/tl_libsodium.vcxproj.filters.tpl",
  101                "libsodium.vcxproj.filters", sbox)
  102 
  103 sbox.update({"platform": "v140"})
  104 apply_template(sd + "/tl_libsodium.vcxproj.tpl",
  105                "libsodium.vcxproj", sbox)
  106 
  107 apply_template(sd + "/libsodium.vcxproj.filters.tpl",
  108                "builds/msvc/vs2017/libsodium/libsodium.vcxproj.filters", sbox)
  109 apply_template(sd + "/libsodium.vcxproj.filters.tpl",
  110                "builds/msvc/vs2015/libsodium/libsodium.vcxproj.filters", sbox)
  111 apply_template(sd + "/libsodium.vcxproj.filters.tpl",
  112                "builds/msvc/vs2013/libsodium/libsodium.vcxproj.filters", sbox)
  113 apply_template(sd + "/libsodium.vcxproj.filters.tpl",
  114                "builds/msvc/vs2012/libsodium/libsodium.vcxproj.filters", sbox)
  115 apply_template(sd + "/libsodium.vcxproj.filters.tpl",
  116                "builds/msvc/vs2010/libsodium/libsodium.vcxproj.filters", sbox)
  117 
  118 sbox.update({"platform": "v141"})
  119 apply_template(sd + "/libsodium.vcxproj.tpl",
  120                "builds/msvc/vs2017/libsodium/libsodium.vcxproj", sbox)
  121 
  122 sbox.update({"platform": "v140"})
  123 apply_template(sd + "/libsodium.vcxproj.tpl",
  124                "builds/msvc/vs2015/libsodium/libsodium.vcxproj", sbox)
  125 
  126 sbox.update({"platform": "v120"})
  127 apply_template(sd + "/libsodium.vcxproj.tpl",
  128                "builds/msvc/vs2013/libsodium/libsodium.vcxproj", sbox)
  129 
  130 sbox.update({"platform": "v110"})
  131 apply_template(sd + "/libsodium.vcxproj.tpl",
  132                "builds/msvc/vs2012/libsodium/libsodium.vcxproj", sbox)
  133 
  134 sbox.update({"platform": "v100"})
  135 apply_template(sd + "/libsodium.vcxproj.tpl",
  136                "builds/msvc/vs2010/libsodium/libsodium.vcxproj", sbox)

Cache object: 996769736d97ba902f9b574561729a39


[ source navigation ] [ diff markup ] [ identifier search ] [ freetext search ] [ file search ] [ list types ] [ track identifier ]


This page is part of the FreeBSD/Linux Linux Kernel Cross-Reference, and was automatically generated using a modified version of the LXR engine.