Merge pull request #19 from ASoftTech/master
Pull request for a few different changes
This commit is contained in:
commit
048ebea24b
25 changed files with 874 additions and 316 deletions
|
@ -25,7 +25,7 @@ pacman -S mingw-w64-x86_64-pango mingw-w64-x86_64-atk mingw-w64-x86_64-gtk3
|
|||
|
||||
And installed the executor python module
|
||||
```
|
||||
C:\Python35\Scripts\pip.exe install executor
|
||||
C:\Python35\Scripts\pip.exe install executor yattag vsgen
|
||||
```
|
||||
|
||||
### Running Build
|
||||
|
@ -48,7 +48,7 @@ sudo apt-get install libglib2.0-dev libpango1.0-dev libatk1.0-dev libgtk-3-dev
|
|||
|
||||
Then install the executor python module
|
||||
```
|
||||
pip3 install executor
|
||||
pip3 install executor yattag vsgen
|
||||
```
|
||||
|
||||
The version of Nuget needs to be the latest for linux
|
||||
|
|
|
@ -1,21 +1,20 @@
|
|||
#!/usr/bin/python3
|
||||
"""Script to build out the .Net dll's and package them into a Nuget Package for gtksharp3"""
|
||||
import os, sys
|
||||
from pybuild.GtkSharp_Builder import GtkSharp_Builder
|
||||
from pybuild.Gtk_Builder import Gtk_Builder
|
||||
from pybuild.Helper import Helper as helpers
|
||||
from pybuild.profiles.GtkSharp import GtkSharp
|
||||
from pybuild.profiles.GtkSharp_Core import GtkSharp_Core
|
||||
from pybuild.profiles.Glue_Win32 import Glue_Win32
|
||||
from pybuild.profiles.Glue_Win64 import Glue_Win64
|
||||
from pybuild.profiles.Gtk_Win32 import Gtk_Win32
|
||||
from pybuild.profiles.Gtk_Win64 import Gtk_Win64
|
||||
|
||||
# Ideally I'd like to see the GtkSharp Build system redone via .Net Core or something other than make
|
||||
# Ideally I'd like to see the GtkSharp Build system redone via the build system of .Net core (dotnet cli tool)
|
||||
# and using Scons / Cuppa for the glue libraries
|
||||
# For now though we rely on the use of make to build the .Net dll's
|
||||
# under linux we run this natively, under windows we can use MSYS2
|
||||
|
||||
class Build(object):
|
||||
|
||||
# Class Init
|
||||
def __init__(self):
|
||||
self.GtkSharp_Builder = GtkSharp_Builder()
|
||||
self.Gtk_Builder = Gtk_Builder()
|
||||
|
||||
# Clean the Build directory
|
||||
def clean(self):
|
||||
"""Clean the build dir"""
|
||||
|
@ -26,10 +25,12 @@ class Build(object):
|
|||
def usage(self):
|
||||
print ("Please use GtkSharp3_Build.py <target> where <target> is one of")
|
||||
print (" clean to clean the output directory: ./build")
|
||||
print (" gtksharp_net45 to build ,Net libs for GtkSharp, via .Net 4.5")
|
||||
print (" gtksharp_nuget_net45 to build Nuget Packages for GtkSharp, via .Net 4.5")
|
||||
print (" gtk_nuget_win32 to build the Nuget package for GtkSharp.Win32")
|
||||
print (" gtk_nuget_win64 to build the Nuget package for GtkSharp.Win64")
|
||||
|
||||
print (" gtksharp to build .Net libs for GtkSharp, via .Net 4.5")
|
||||
print (" gtksharp_core to build .Net libs for GtkSharp, via .Net 4.5 using the dotnet cli tool")
|
||||
|
||||
print (" gtk_win32 to build the Nuget package for GtkSharp.Win32")
|
||||
print (" gtk_win64 to build the Nuget package for GtkSharp.Win64")
|
||||
print (" all to make all")
|
||||
|
||||
def main(self):
|
||||
|
@ -37,23 +38,49 @@ class Build(object):
|
|||
self.usage()
|
||||
return
|
||||
|
||||
if sys.argv[1] == "gtksharp_net45":
|
||||
self.GtkSharp_Builder.build_net45()
|
||||
if sys.argv[1] == "gtksharp_nuget_net45":
|
||||
self.GtkSharp_Builder.build_nuget_net45()
|
||||
if sys.argv[1] == "gtk_nuget_win32":
|
||||
self.Gtk_Builder.build_nuget_win32()
|
||||
if sys.argv[1] == "gtk_nuget_win64":
|
||||
self.Gtk_Builder.build_nuget_win64()
|
||||
if sys.argv[1] == 'all':
|
||||
self.runbuild('gtksharp')
|
||||
self.runbuild('gtk_win32')
|
||||
self.runbuild('gtk_win64')
|
||||
return
|
||||
|
||||
if sys.argv[1] == "all":
|
||||
self.GtkSharp_Builder.build_net45()
|
||||
self.GtkSharp_Builder.build_nuget_net45()
|
||||
self.Gtk_Builder.build_nuget_win32()
|
||||
self.Gtk_Builder.build_nuget_win64()
|
||||
self.runbuild(sys.argv[1])
|
||||
|
||||
if sys.argv[1] == "clean":
|
||||
|
||||
def runbuild(self, build_type):
|
||||
|
||||
if build_type == 'clean':
|
||||
self.clean()
|
||||
|
||||
elif build_type == 'gtksharp':
|
||||
profile = GtkSharp()
|
||||
profile.clean()
|
||||
profile.build()
|
||||
profile.copy()
|
||||
profile.build_nuget()
|
||||
|
||||
elif build_type == 'gtksharp_core':
|
||||
profile = GtkSharp_Core()
|
||||
profile.clean()
|
||||
profile.build()
|
||||
profile.copy_dll()
|
||||
profile.build_nuget()
|
||||
|
||||
elif build_type == 'gtk_win32':
|
||||
profile_glue = Glue_Win32()
|
||||
profile_glue.clean()
|
||||
profile_glue.build()
|
||||
profile_gtk = Gtk_Win32()
|
||||
profile_gtk.build()
|
||||
profile_gtk.build_nuget()
|
||||
|
||||
elif build_type == 'gtk_win64':
|
||||
profile_glue = Glue_Win64()
|
||||
profile_glue.clean()
|
||||
profile_glue.build()
|
||||
profile = Gtk_Win64()
|
||||
profile.build()
|
||||
profile.build_nuget()
|
||||
|
||||
if __name__ == "__main__":
|
||||
Build().main()
|
||||
|
|
|
@ -3,7 +3,7 @@
|
|||
<metadata>
|
||||
<id>GBD.GtkSharp</id>
|
||||
<version>3.22.0</version>
|
||||
<authors>Ric Westell</authors>
|
||||
<authors>Grbd</authors>
|
||||
<owners>grbd</owners>
|
||||
<licenseUrl>https://github.com/mono/gtk-sharp/blob/master/COPYING</licenseUrl>
|
||||
<projectUrl>https://github.com/mono/gtk-sharp</projectUrl>
|
||||
|
|
|
@ -1,85 +0,0 @@
|
|||
#! python3
|
||||
import os, shutil
|
||||
from pybuild.Settings import Settings
|
||||
from pybuild.Helper import Helper as helpers
|
||||
from os.path import join
|
||||
from xml.etree import ElementTree as et
|
||||
|
||||
class GtkSharp_Builder(object):
|
||||
|
||||
def __init__(self):
|
||||
"""Class Init"""
|
||||
self.setts = Settings()
|
||||
|
||||
def clean(self):
|
||||
"""Clean the build dir"""
|
||||
helpers.emptydir('./build')
|
||||
print ("Clean finished")
|
||||
|
||||
def build_net45(self):
|
||||
"""Build the gtksharp binaries for .Net 4.5"""
|
||||
self.clean()
|
||||
os.makedirs(self.setts.BuildDir, exist_ok=True)
|
||||
buildfile = join(self.setts.BuildDir, 'net45_build.sh')
|
||||
|
||||
# run script via MSYS for windows, or shell for linux
|
||||
if os.name == 'nt':
|
||||
print("Building .Net GtkSharp using MSYS2")
|
||||
with open(buildfile, 'w') as f:
|
||||
f.write('PATH=$PATH:/c/Program\ Files\ \(x86\)/Microsoft\ SDKs/Windows/v10.0A/bin/NETFX\ 4.6\ Tools/\n')
|
||||
f.write('PATH=$PATH:/c/Windows/Microsoft.NET/Framework/v4.0.30319/\n')
|
||||
f.write('cd ' + helpers.winpath_to_msyspath(self.setts.SrcDir + '\n'))
|
||||
f.write('./autogen.sh --prefix=/tmp/install\n')
|
||||
f.write('make clean\n')
|
||||
f.write('make\n')
|
||||
cmds = [join(self.setts.msys2path, 'usr\\bin\\bash.exe'), '--login', buildfile]
|
||||
cmd = helpers.run_cmd(cmds, self.setts.SrcDir)
|
||||
|
||||
else:
|
||||
print("Building using Linux shell")
|
||||
with open(buildfile, 'w') as f:
|
||||
f.write('cd ' + self.setts.SrcDir + '\n')
|
||||
f.write('./autogen.sh --prefix=/tmp/install\n')
|
||||
f.write('make clean\n')
|
||||
f.write('make\n')
|
||||
cmds = [self.setts.bashpath, buildfile]
|
||||
cmd = helpers.run_cmd(cmds, self.setts.SrcDir)
|
||||
|
||||
def build_nuget_net45(self):
|
||||
"""Package up a nuget file based on the default build"""
|
||||
self.clean()
|
||||
net45_build_dir = join(self.setts.BuildDir, 'build', 'net45')
|
||||
net45_lib_dir = join(self.setts.BuildDir, 'lib', 'net45')
|
||||
GtkVersion = helpers.get_gtksharp_version(self.setts.SrcDir)
|
||||
|
||||
os.makedirs(self.setts.BuildDir, exist_ok=True)
|
||||
os.makedirs(net45_build_dir, exist_ok=True)
|
||||
os.makedirs(net45_lib_dir, exist_ok=True)
|
||||
|
||||
print ('Copying Files')
|
||||
shutil.copy('./misc/GtkSharp.nuspec', self.setts.BuildDir)
|
||||
shutil.copy('./misc/GtkSharp.targets', net45_build_dir)
|
||||
|
||||
dll_list = ['atk', 'cairo', 'gdk', 'gio', 'glib', 'gtk', 'pango']
|
||||
for item in dll_list:
|
||||
shutil.copy(join(self.setts.SrcDir, item, item + "-sharp.dll"), net45_lib_dir)
|
||||
if item != 'cairo':
|
||||
shutil.copy(join(self.setts.SrcDir, item, item + '-sharp.dll.config'), net45_build_dir)
|
||||
|
||||
# Edit the XML version / package name in the .nuspec file
|
||||
nuspecfile = join(self.setts.BuildDir, 'GtkSharp.nuspec')
|
||||
et.register_namespace('', 'http://schemas.microsoft.com/packaging/2011/08/nuspec.xsd')
|
||||
tree = et.parse(nuspecfile)
|
||||
xmlns = {'nuspec': '{http://schemas.microsoft.com/packaging/2011/08/nuspec.xsd}'}
|
||||
tree.find('.//{nuspec}version'.format(**xmlns)).text = GtkVersion
|
||||
tree.find('.//{nuspec}id'.format(**xmlns)).text = self.setts.Gtksharp_PackageName
|
||||
tree.write(nuspecfile)
|
||||
|
||||
# Run Nuget
|
||||
helpers.run_cmd([self.setts.NuGetExe, 'pack', 'GtkSharp.nuspec'], self.setts.BuildDir)
|
||||
|
||||
nugetfile = join(self.setts.BuildDir, self.setts.Gtksharp_PackageName + '.' + GtkVersion + '.nupkg')
|
||||
os.makedirs(self.setts.NugetPkgs, exist_ok=True)
|
||||
shutil.copy(nugetfile, self.setts.NugetPkgs)
|
||||
|
||||
print ('Generation of Nuget package complete')
|
|
@ -1,77 +0,0 @@
|
|||
#! python3
|
||||
import os, shutil
|
||||
from pybuild.Settings import Settings
|
||||
from pybuild.Helper import Helper as helpers
|
||||
from os.path import join
|
||||
from xml.etree import ElementTree as et
|
||||
|
||||
# This script assumes the gtk libraries have already been installed via MSYS2 / MinGW32 / MinGW64
|
||||
|
||||
class Gtk_Builder(object):
|
||||
|
||||
def __init__(self):
|
||||
"""Class Init"""
|
||||
self.setts = Settings()
|
||||
|
||||
def clean(self):
|
||||
"""Clean the build dir"""
|
||||
helpers.emptydir('./build')
|
||||
print ("Clean finished")
|
||||
|
||||
def build_nuget_win32(self):
|
||||
self.build_nuget('Win32')
|
||||
|
||||
def build_nuget_win64(self):
|
||||
self.build_nuget('Win64')
|
||||
|
||||
def build_nuget(self, arch):
|
||||
"""Package up a nuget file based on the default build"""
|
||||
|
||||
if os.name != 'nt':
|
||||
print("Skipping Native Nuget package build, as this needs to be run on Windows")
|
||||
return
|
||||
|
||||
self.clean()
|
||||
net45_build_dir = join(self.setts.BuildDir, 'build', 'net45')
|
||||
if arch == 'Win32':
|
||||
mingwdir = self.setts.mingwin32path
|
||||
else:
|
||||
mingwdir = self.setts.mingwin64path
|
||||
|
||||
os.makedirs(self.setts.BuildDir, exist_ok=True)
|
||||
os.makedirs(net45_build_dir, exist_ok=True)
|
||||
|
||||
print ('Copying Files')
|
||||
shutil.copy('./misc/GtkSharp.nuspec', self.setts.BuildDir)
|
||||
shutil.copy('./misc/GtkSharp.Native.targets', join(net45_build_dir, 'GtkSharp.' + arch + '.targets'))
|
||||
|
||||
# Copy dlls
|
||||
dll_list = []
|
||||
dll_list += self.setts.get_native_win_dlls()
|
||||
dll_list += self.setts.get_native_win_deps()
|
||||
|
||||
for item in dll_list:
|
||||
src = join(mingwdir, item)
|
||||
helpers.copy_files(src, net45_build_dir)
|
||||
|
||||
# Get version
|
||||
GtkVersion = helpers.get_gtk_version(self.setts.msys2path)
|
||||
|
||||
# Edit the XML version / package name in the .nuspec file
|
||||
nuspecfile = join(self.setts.BuildDir, 'GtkSharp.nuspec')
|
||||
et.register_namespace('', 'http://schemas.microsoft.com/packaging/2011/08/nuspec.xsd')
|
||||
tree = et.parse(nuspecfile)
|
||||
xmlns = {'nuspec': '{http://schemas.microsoft.com/packaging/2011/08/nuspec.xsd}'}
|
||||
tree.find('.//{nuspec}version'.format(**xmlns)).text = GtkVersion
|
||||
tree.find('.//{nuspec}id'.format(**xmlns)).text = self.setts.Gtksharp_PackageName + '.' + arch
|
||||
tree.write(nuspecfile)
|
||||
|
||||
# Run Nuget
|
||||
helpers.run_cmd([self.setts.NuGetExe, 'pack', 'GtkSharp.nuspec'], self.setts.BuildDir)
|
||||
|
||||
nugetfile = join(self.setts.BuildDir, self.setts.Gtksharp_PackageName + '.' + arch + '.' + GtkVersion + '.nupkg')
|
||||
os.makedirs(self.setts.NugetPkgs, exist_ok=True)
|
||||
shutil.copy(nugetfile, self.setts.NugetPkgs)
|
||||
|
||||
print ('Generation of Nuget package complete')
|
||||
|
|
@ -1,4 +1,4 @@
|
|||
#! python3
|
||||
#!/usr/bin/python3
|
||||
"""Helper Functions"""
|
||||
|
||||
import os, subprocess, shutil, sys
|
||||
|
@ -57,7 +57,7 @@ class Helper(object):
|
|||
break
|
||||
return ret
|
||||
|
||||
def get_gtk_version(msyspath):
|
||||
def get_gtk_version_msys(msyspath):
|
||||
ret = ''
|
||||
pacman_path = join(msyspath, 'usr\\bin\\pacman.exe')
|
||||
# pull version from msys2 / pacman
|
||||
|
@ -72,7 +72,3 @@ class Helper(object):
|
|||
ret = ret[:-2]
|
||||
break
|
||||
return ret
|
||||
|
||||
def copy_files(src_glob, dst_folder):
|
||||
for fname in iglob(src_glob):
|
||||
shutil.copy(fname, join(dst_folder, ntpath.basename(fname)))
|
87
NuGet/pybuild/ProfileBase.py
Normal file
87
NuGet/pybuild/ProfileBase.py
Normal file
|
@ -0,0 +1,87 @@
|
|||
#!/usr/bin/python3
|
||||
"""Base class for Settings profiles"""
|
||||
|
||||
import os, shutil
|
||||
from os.path import abspath, join
|
||||
from xml.etree import ElementTree as et
|
||||
from pybuild.Helper import Helper
|
||||
|
||||
class ProfileBase(object):
|
||||
|
||||
def __init__(self):
|
||||
"""Class Init"""
|
||||
self._NuGetPath = 'nuget.exe'
|
||||
self._SrcDir = '../'
|
||||
self._BuildDir = './build'
|
||||
self._PackageDestination = './nupkg'
|
||||
self._NuGet_PackageName = ''
|
||||
self._MsysPath = 'C:\\msys64'
|
||||
self._LinuxBashPath = '/bin/bash'
|
||||
self._Version = '0.0.0'
|
||||
|
||||
@property
|
||||
def NuGetPath(self):
|
||||
return self._NuGetPath
|
||||
|
||||
@property
|
||||
def SrcDir(self):
|
||||
return abspath(self._SrcDir)
|
||||
|
||||
@property
|
||||
def BuildDir(self):
|
||||
return abspath(self._BuildDir)
|
||||
|
||||
@property
|
||||
def Build_NugetDir(self):
|
||||
return abspath(join(self._BuildDir, 'nuget'))
|
||||
|
||||
@property
|
||||
def PackageDestination(self):
|
||||
return abspath(self._PackageDestination)
|
||||
|
||||
@property
|
||||
def NuGet_PackageName(self):
|
||||
return self._NuGet_PackageName
|
||||
|
||||
@property
|
||||
def MsysPath(self):
|
||||
return abspath(self._MsysPath)
|
||||
|
||||
@property
|
||||
def LinuxBashPath(self):
|
||||
return abspath(self._LinuxBashPath)
|
||||
|
||||
@property
|
||||
def Version(self):
|
||||
return self._Version
|
||||
|
||||
|
||||
def clean(self):
|
||||
"""Clean the build dir"""
|
||||
Helper.emptydir('./build')
|
||||
print ("Clean finished")
|
||||
|
||||
|
||||
def build_nuget(self):
|
||||
"""Package up a nuget file based on the default build"""
|
||||
|
||||
# Copy Nuget Spec file
|
||||
shutil.copy('./misc/GtkSharp.nuspec', self.Build_NugetDir)
|
||||
|
||||
# Edit the XML version / package name in the .nuspec file
|
||||
nuspecfile = join(self.Build_NugetDir, 'GtkSharp.nuspec')
|
||||
et.register_namespace('', 'http://schemas.microsoft.com/packaging/2011/08/nuspec.xsd')
|
||||
tree = et.parse(nuspecfile)
|
||||
xmlns = {'nuspec': '{http://schemas.microsoft.com/packaging/2011/08/nuspec.xsd}'}
|
||||
tree.find('.//{nuspec}version'.format(**xmlns)).text = self.Version
|
||||
tree.find('.//{nuspec}id'.format(**xmlns)).text = self.NuGet_PackageName
|
||||
tree.write(nuspecfile)
|
||||
|
||||
# Run Nuget
|
||||
Helper.run_cmd([self.NuGetPath, 'pack', 'GtkSharp.nuspec'], self.Build_NugetDir)
|
||||
|
||||
# Copy Nuget files out of build directory
|
||||
nugetfile = join(self.Build_NugetDir, self.NuGet_PackageName + '.' + self.Version + '.nupkg')
|
||||
os.makedirs(self.PackageDestination, exist_ok=True)
|
||||
shutil.copy(nugetfile, self.PackageDestination)
|
||||
print ('Generation of Nuget package complete - ' + self.NuGet_PackageName)
|
|
@ -1,80 +0,0 @@
|
|||
#! python3
|
||||
"""Settings for scripts"""
|
||||
|
||||
import os
|
||||
|
||||
class Settings(object):
|
||||
|
||||
def __init__(self):
|
||||
"""Class Init"""
|
||||
|
||||
self.NuGetExe = 'nuget.exe'
|
||||
self.Gtksharp_PackageName = 'GBD.GtkSharp'
|
||||
|
||||
self.SrcDir = '../'
|
||||
self.BuildDir = './build'
|
||||
self.NugetPkgs = './nupkg'
|
||||
self.SrcDir = os.path.abspath(self.SrcDir)
|
||||
self.BuildDir = os.path.abspath(self.BuildDir)
|
||||
self.NugetPkgs = os.path.abspath(self.NugetPkgs)
|
||||
|
||||
self.msys2path = 'C:\\msys64'
|
||||
self.msys2path = os.path.abspath(self.msys2path)
|
||||
self.bashpath = '/bin/bash'
|
||||
|
||||
self.mingwin32path = 'C:\\msys64\\mingw32\\bin'
|
||||
self.mingwin32path = os.path.abspath(self.mingwin32path)
|
||||
self.mingwin64path = 'C:\\msys64\\mingw64\\bin'
|
||||
self.mingwin64path = os.path.abspath(self.mingwin64path)
|
||||
|
||||
def get_native_win_dlls(self):
|
||||
ret = []
|
||||
|
||||
# Gtk
|
||||
ret.append('libgtk-3-0.dll')
|
||||
ret.append('libgdk-3-0.dll')
|
||||
|
||||
# atk
|
||||
ret.append('libatk-1.0-0.dll')
|
||||
|
||||
# cairo
|
||||
ret.append('libcairo-2.dll')
|
||||
ret.append('libcairo-gobject-2.dll')
|
||||
|
||||
# gdk-pixbuf
|
||||
ret.append('libgdk_pixbuf-2.0-0.dll')
|
||||
|
||||
# glib2
|
||||
ret.append('libgio-2.0-0.dll')
|
||||
ret.append('libglib-2.0-0.dll')
|
||||
ret.append('libgmodule-2.0-0.dll')
|
||||
ret.append('libgobject-2.0-0.dll')
|
||||
|
||||
# pango
|
||||
ret.append('libpango-1.0-0.dll')
|
||||
ret.append('libpangocairo-1.0-0.dll')
|
||||
ret.append('libpangoft2-1.0-0.dll')
|
||||
ret.append('libpangowin32-1.0-0.dll')
|
||||
return ret
|
||||
|
||||
def get_native_win_deps(self):
|
||||
ret = []
|
||||
# Determined by using PE Explorer
|
||||
ret.append('libgcc_*.dll')
|
||||
ret.append('libepoxy-0.dll')
|
||||
ret.append('libintl-8.dll')
|
||||
ret.append('libwinpthread-1.dll')
|
||||
ret.append('libiconv-2.dll')
|
||||
ret.append('libfontconfig-1.dll')
|
||||
ret.append('libexpat-1.dll')
|
||||
ret.append('libfreetype-6.dll')
|
||||
ret.append('libpixman-1-0.dll')
|
||||
ret.append('libpng16-16.dll')
|
||||
ret.append('zlib1.dll')
|
||||
ret.append('libpcre-1.dll')
|
||||
ret.append('libffi-6.dll')
|
||||
ret.append('libharfbuzz-0.dll')
|
||||
ret.append('libgraphite2.dll')
|
||||
ret.append('libstdc++-6.dll')
|
||||
ret.append('libbz2-1.dll')
|
||||
return ret
|
51
NuGet/pybuild/profiles/Glue_Win32.py
Normal file
51
NuGet/pybuild/profiles/Glue_Win32.py
Normal file
|
@ -0,0 +1,51 @@
|
|||
#!/usr/bin/python3
|
||||
|
||||
import os, shutil, ntpath
|
||||
from pybuild.ProfileBase import ProfileBase
|
||||
from os.path import abspath, join
|
||||
from glob import glob
|
||||
from pybuild.Helper import Helper
|
||||
from pybuild.profiles.GtkSharp import GtkSharp
|
||||
|
||||
class Glue_Win32(ProfileBase):
|
||||
|
||||
def __init__(self):
|
||||
"""Class Init"""
|
||||
super().__init__()
|
||||
self._NuGet_PackageName = 'GtkSharp.Win32.Glue'
|
||||
self._Version = Helper.get_gtksharp_version(self.SrcDir)
|
||||
self.MSYSTEM = 'MINGW32'
|
||||
|
||||
def Get_Dlls_GtkSharp_Glue(self):
|
||||
ret = []
|
||||
|
||||
# Gtksharp Glue libs
|
||||
ret.append(['atk/glue/.libs/*atksharpglue-3.dll', 'atksharpglue-3.dl_'])
|
||||
ret.append(['pango/glue/.libs/*pangosharpglue-3.dll', 'pangosharpglue-3.dl_'])
|
||||
ret.append(['gio/glue/.libs/*giosharpglue-3.dll', 'giosharpglue-3.dl_'])
|
||||
ret.append(['gtk/glue/.libs/*gtksharpglue-3.dll', 'gtksharpglue-3.dl_'])
|
||||
return ret
|
||||
|
||||
def build(self):
|
||||
"""Package up a nuget file based on the default build"""
|
||||
|
||||
if os.name != 'nt':
|
||||
print("Skipping Native Nuget package build, as this needs to be run on Windows")
|
||||
return
|
||||
|
||||
# Trigger build of gtksharp with specific bash for Mingw32
|
||||
builder = GtkSharp()
|
||||
builder.MSYSTEM = self.MSYSTEM
|
||||
builder.build()
|
||||
|
||||
net45_build_dir = join(self.Build_NugetDir, 'build', 'net45')
|
||||
os.makedirs(net45_build_dir, exist_ok=True)
|
||||
|
||||
print ('Copying Files')
|
||||
dll_list = self.Get_Dlls_GtkSharp_Glue()
|
||||
|
||||
for item in dll_list:
|
||||
src = glob(abspath(join(self.SrcDir, item[0])))[0]
|
||||
f_basename, f_extension = os.path.splitext(ntpath.basename(src))
|
||||
dest = join(net45_build_dir, item[1])
|
||||
shutil.copy(src, dest)
|
14
NuGet/pybuild/profiles/Glue_Win64.py
Normal file
14
NuGet/pybuild/profiles/Glue_Win64.py
Normal file
|
@ -0,0 +1,14 @@
|
|||
#!/usr/bin/python3
|
||||
|
||||
from pybuild.ProfileBase import ProfileBase
|
||||
from pybuild.Helper import Helper
|
||||
from pybuild.profiles.Glue_Win32 import Glue_Win32
|
||||
|
||||
class Glue_Win64(Glue_Win32):
|
||||
|
||||
def __init__(self):
|
||||
"""Class Init"""
|
||||
super().__init__()
|
||||
self._NuGet_PackageName = 'GtkSharp.Win64.Glue'
|
||||
self._Version = Helper.get_gtksharp_version(self.SrcDir)
|
||||
self.MSYSTEM = 'MINGW64'
|
71
NuGet/pybuild/profiles/GtkSharp.py
Normal file
71
NuGet/pybuild/profiles/GtkSharp.py
Normal file
|
@ -0,0 +1,71 @@
|
|||
#!/usr/bin/python3
|
||||
import os, shutil
|
||||
from pybuild.ProfileBase import ProfileBase
|
||||
from os.path import abspath, join
|
||||
from pybuild.Helper import Helper
|
||||
|
||||
class GtkSharp(ProfileBase):
|
||||
|
||||
def __init__(self):
|
||||
"""Class Init"""
|
||||
super().__init__()
|
||||
self._NuGet_PackageName = 'GtkSharp'
|
||||
self._Version = Helper.get_gtksharp_version(self.SrcDir)
|
||||
self.MSYSTEM = 'MINGW64'
|
||||
|
||||
@property
|
||||
def Build_ScriptDir(self):
|
||||
return abspath(join(self._BuildDir, 'scripts'))
|
||||
|
||||
def build(self):
|
||||
"""Build the gtksharp binaries for .Net 4.5"""
|
||||
os.makedirs(self.Build_ScriptDir, exist_ok=True)
|
||||
buildfile = join(self.Build_ScriptDir, 'net45_build.sh')
|
||||
buildbatch = join(self.Build_ScriptDir, 'net45_build.bat')
|
||||
|
||||
# run script via MSYS for windows, or shell for linux
|
||||
if os.name == 'nt':
|
||||
print("Building .Net GtkSharp using MSYS2")
|
||||
with open(buildfile, 'w') as f:
|
||||
f.write('PATH=$PATH:/c/Program\ Files\ \(x86\)/Microsoft\ SDKs/Windows/v10.0A/bin/NETFX\ 4.6\ Tools/\n')
|
||||
f.write('PATH=$PATH:/c/Windows/Microsoft.NET/Framework/v4.0.30319/\n')
|
||||
f.write('cd ' + Helper.winpath_to_msyspath(self.SrcDir + '\n'))
|
||||
f.write('./autogen.sh --prefix=/tmp/install\n')
|
||||
f.write('make clean\n')
|
||||
f.write('make\n')
|
||||
|
||||
bashexe = join(self.MsysPath, 'usr\\bin\\bash.exe')
|
||||
|
||||
with open(buildbatch, 'w') as f:
|
||||
f.write('set MSYSTEM=' + self.MSYSTEM + '\n')
|
||||
f.write(bashexe + ' --login ' + buildfile)
|
||||
|
||||
cmds = ['C:\Windows\System32\cmd.exe', '/C', buildbatch]
|
||||
cmd = Helper.run_cmd(cmds, self.SrcDir)
|
||||
|
||||
else:
|
||||
print("Building using Linux shell")
|
||||
with open(buildfile, 'w') as f:
|
||||
f.write('cd ' + self.SrcDir + '\n')
|
||||
f.write('./autogen.sh --prefix=/tmp/install\n')
|
||||
f.write('make clean\n')
|
||||
f.write('make\n')
|
||||
cmds = [self.LinuxBashPath, buildfile]
|
||||
cmd = Helper.run_cmd(cmds, self.SrcDir)
|
||||
|
||||
|
||||
def copy(self):
|
||||
"""Copy the .Net 4.5 dll's to the build dir"""
|
||||
|
||||
net45_build_dir = join(self.Build_NugetDir, 'build', 'net45')
|
||||
net45_lib_dir = join(self.Build_NugetDir, 'lib', 'net45')
|
||||
|
||||
os.makedirs(net45_build_dir, exist_ok=True)
|
||||
os.makedirs(net45_lib_dir, exist_ok=True)
|
||||
shutil.copy('./misc/GtkSharp.targets', net45_build_dir)
|
||||
|
||||
dll_list = ['atk', 'cairo', 'gdk', 'gio', 'glib', 'gtk', 'pango']
|
||||
for item in dll_list:
|
||||
shutil.copy(join(self.SrcDir, item, item + "-sharp.dll"), net45_lib_dir)
|
||||
if item != 'cairo':
|
||||
shutil.copy(join(self.SrcDir, item, item + '-sharp.dll.config'), net45_build_dir)
|
155
NuGet/pybuild/profiles/GtkSharp_Core.py
Normal file
155
NuGet/pybuild/profiles/GtkSharp_Core.py
Normal file
|
@ -0,0 +1,155 @@
|
|||
#!/usr/bin/python3
|
||||
import os, shutil
|
||||
from pybuild.ProfileBase import ProfileBase
|
||||
from pybuild.vsgenext.CoreVSProject import CoreVSProject
|
||||
from os.path import abspath, join
|
||||
from pybuild.Helper import Helper
|
||||
from glob import glob
|
||||
import vsgen
|
||||
|
||||
# Note at this stage we can't complile GtkSharp using the .Net Core platform libraries, such as netstandard1.6
|
||||
# https://docs.microsoft.com/en-us/dotnet/articles/standard/library
|
||||
# This is due to some small api changes in the platform that the Gtksharp code would need to be adjusted to
|
||||
|
||||
# We can however use the newer dotnet build system specifying the net461 platform
|
||||
# This is the same set of platform libs under the surface (using mono) but a step in the right direction
|
||||
# with modernising the build system. One advantage to this newer build system is that we don't need to list all the .cs files
|
||||
# Within the project files (see generated .xproj file and project.json)
|
||||
|
||||
# TODO look into package for symbols, via NuGet -symbols
|
||||
|
||||
class GtkSharp_Core(ProfileBase):
|
||||
|
||||
def __init__(self):
|
||||
"""Class Init"""
|
||||
super().__init__()
|
||||
self._NuGet_PackageName = 'GtkSharp.Core'
|
||||
self._Version = Helper.get_gtksharp_version(self.SrcDir)
|
||||
self.Solution = None
|
||||
self.BuildConfig = 'Release'
|
||||
|
||||
@property
|
||||
def Build_CoreDir(self):
|
||||
return abspath(join(self._BuildDir, 'core'))
|
||||
|
||||
@property
|
||||
def Dotnet_BuildExe(self):
|
||||
return 'dotnet.exe'
|
||||
|
||||
|
||||
def Copy_CS_Files(self, csfiles):
|
||||
srclist = glob(join(self.SrcDir, csfiles[0]))
|
||||
destdir = join(self.Build_CoreDir, csfiles[1])
|
||||
os.makedirs(destdir, exist_ok=True)
|
||||
for fname in srclist:
|
||||
shutil.copy(fname, destdir)
|
||||
|
||||
def SetupProject(self, projname):
|
||||
proj = CoreVSProject()
|
||||
proj.Name = projname
|
||||
proj.RootNamespace=projname
|
||||
proj.FileName = join(self.Build_CoreDir, projname, projname + '.xproj')
|
||||
proj.Frameworks = {'net461': {}}
|
||||
proj.Depends = {}
|
||||
proj.BuildOptions = { "allowUnsafe": True , "outputName": projname + "-sharp"}
|
||||
proj.Version = self._Version
|
||||
self.Solution.Projects.append(proj)
|
||||
self.Solution.write()
|
||||
return proj
|
||||
|
||||
def Build_Project(self, proj):
|
||||
projdir = join(self.Build_CoreDir, proj.Name)
|
||||
Helper.run_cmd([self.Dotnet_BuildExe, 'restore'], projdir)
|
||||
Helper.run_cmd([self.Dotnet_BuildExe, 'build',
|
||||
'--configuration', self.BuildConfig,
|
||||
'--framework', 'net461',
|
||||
'--output', join(self.Build_CoreDir, 'build')]
|
||||
, projdir)
|
||||
|
||||
|
||||
def build(self):
|
||||
"""Build the gtksharp binaries for .Net 4.5"""
|
||||
os.makedirs(self.Build_CoreDir, exist_ok=True)
|
||||
self.Solution = vsgen.solution.VSGSolution()
|
||||
self.Solution.FileName = join(self.Build_CoreDir, 'GtkSharp.sln')
|
||||
|
||||
# Build Glib
|
||||
self.Copy_CS_Files(['glib/*.cs', 'glib/'])
|
||||
proj = self.SetupProject('glib')
|
||||
proj.write()
|
||||
self.Build_Project(proj)
|
||||
|
||||
# Build Gio
|
||||
self.Copy_CS_Files(['gio/*.cs', 'gio/'])
|
||||
self.Copy_CS_Files(['gio/generated/GLib/*.cs', 'gio/generated/GLib/'])
|
||||
proj = self.SetupProject('gio')
|
||||
proj.Depends = {'glib': self._Version}
|
||||
proj.write()
|
||||
self.Build_Project(proj)
|
||||
|
||||
# Build Cairo
|
||||
self.Copy_CS_Files(['cairo/*.cs', 'cairo/'])
|
||||
proj = self.SetupProject('cairo')
|
||||
proj.write()
|
||||
self.Build_Project(proj)
|
||||
|
||||
# Build Pango
|
||||
self.Copy_CS_Files(['pango/*.cs', 'pango/'])
|
||||
self.Copy_CS_Files(['pango/generated/Pango/*.cs', 'pango/generated/Pango/'])
|
||||
proj = self.SetupProject('pango')
|
||||
proj.Depends = {'glib': self._Version,
|
||||
'cairo': self._Version}
|
||||
proj.write()
|
||||
self.Build_Project(proj)
|
||||
|
||||
# Build Atk
|
||||
self.Copy_CS_Files(['atk/*.cs', 'atk/'])
|
||||
self.Copy_CS_Files(['atk/generated/Atk/*.cs', 'atk/generated/Atk/'])
|
||||
proj = self.SetupProject('atk')
|
||||
proj.Depends = {'glib': self._Version}
|
||||
proj.write()
|
||||
self.Build_Project(proj)
|
||||
|
||||
# Build Gdk
|
||||
self.Copy_CS_Files(['gdk/*.cs', 'gdk/'])
|
||||
self.Copy_CS_Files(['gdk/generated/Gdk/*.cs', 'gdk/generated/Gdk/'])
|
||||
self.Copy_CS_Files(['gdk/generated/GLib/*.cs', 'gdk/generated/GLib/'])
|
||||
proj = self.SetupProject('gdk')
|
||||
proj.Depends = {'atk': self._Version,
|
||||
'cairo': self._Version,
|
||||
'gio': self._Version,
|
||||
'glib': self._Version,
|
||||
'pango': self._Version}
|
||||
proj.write()
|
||||
self.Build_Project(proj)
|
||||
|
||||
# Build Gtk
|
||||
self.Copy_CS_Files(['gtk/*.cs', 'gtk/'])
|
||||
self.Copy_CS_Files(['gtk/generated/GLib/*.cs', 'gtk/generated/GLib/'])
|
||||
self.Copy_CS_Files(['gtk/generated/Gtk/*.cs', 'gtk/generated/Gtk/'])
|
||||
proj = self.SetupProject('gtk')
|
||||
proj.Depends = {'gdk': self._Version,
|
||||
'glib': self._Version}
|
||||
proj.write()
|
||||
self.Build_Project(proj)
|
||||
|
||||
|
||||
def copy_dll(self):
|
||||
"""Copy the .Net 4.5 dll's to the build dir"""
|
||||
|
||||
net45_build_dir = join(self.Build_NugetDir, 'build', 'net45')
|
||||
net45_lib_dir = join(self.Build_NugetDir, 'lib', 'net45')
|
||||
|
||||
os.makedirs(net45_build_dir, exist_ok=True)
|
||||
os.makedirs(net45_lib_dir, exist_ok=True)
|
||||
shutil.copy('./misc/GtkSharp.targets', net45_build_dir)
|
||||
|
||||
srclist = glob(join(self.Build_CoreDir, 'build', '*.dll'))
|
||||
for item in srclist:
|
||||
shutil.copy(item, net45_lib_dir)
|
||||
|
||||
# Get the Config files
|
||||
dll_list = ['atk', 'cairo', 'gdk', 'gio', 'glib', 'gtk', 'pango']
|
||||
for item in dll_list:
|
||||
if item != 'cairo':
|
||||
shutil.copy(join(self.SrcDir, item, item + '-sharp.dll.config'), net45_build_dir)
|
102
NuGet/pybuild/profiles/Gtk_Win32.py
Normal file
102
NuGet/pybuild/profiles/Gtk_Win32.py
Normal file
|
@ -0,0 +1,102 @@
|
|||
#!/usr/bin/python3
|
||||
"""Build of GTK3 into a NuGet package - Windows 32bit"""
|
||||
|
||||
import os, shutil, ntpath
|
||||
from pybuild.ProfileBase import ProfileBase
|
||||
from os.path import abspath, join
|
||||
from glob import iglob
|
||||
from pybuild.Helper import Helper
|
||||
|
||||
class Gtk_Win32(ProfileBase):
|
||||
|
||||
def __init__(self):
|
||||
"""Class Init"""
|
||||
super().__init__()
|
||||
self._NuGet_PackageName = 'GtkSharp.Win32'
|
||||
self._MingwBinPath = join(self.MsysPath + '\\mingw32\\bin')
|
||||
self.arch = 'Win32'
|
||||
self._Version = Helper.get_gtk_version_msys(self.MsysPath)
|
||||
|
||||
@property
|
||||
def MingwBinPath(self):
|
||||
return abspath(self._MingwBinPath)
|
||||
|
||||
|
||||
def Get_Dlls_Native_GTK(self):
|
||||
ret = []
|
||||
|
||||
# Gtk
|
||||
ret.append('libgtk-3-0.dll')
|
||||
ret.append('libgdk-3-0.dll')
|
||||
|
||||
# atk
|
||||
ret.append('libatk-1.0-0.dll')
|
||||
|
||||
# cairo
|
||||
ret.append('libcairo-2.dll')
|
||||
ret.append('libcairo-gobject-2.dll')
|
||||
|
||||
# gdk-pixbuf
|
||||
ret.append('libgdk_pixbuf-2.0-0.dll')
|
||||
|
||||
# glib2
|
||||
ret.append('libgio-2.0-0.dll')
|
||||
ret.append('libglib-2.0-0.dll')
|
||||
ret.append('libgmodule-2.0-0.dll')
|
||||
ret.append('libgobject-2.0-0.dll')
|
||||
|
||||
# pango
|
||||
ret.append('libpango-1.0-0.dll')
|
||||
ret.append('libpangocairo-1.0-0.dll')
|
||||
ret.append('libpangoft2-1.0-0.dll')
|
||||
ret.append('libpangowin32-1.0-0.dll')
|
||||
return ret
|
||||
|
||||
def Get_Dlls_Native_GTK_Deps(self):
|
||||
ret = []
|
||||
# Determined by using PE Explorer
|
||||
ret.append('libgcc_*.dll')
|
||||
ret.append('libepoxy-0.dll')
|
||||
ret.append('libintl-8.dll')
|
||||
ret.append('libwinpthread-1.dll')
|
||||
ret.append('libiconv-2.dll')
|
||||
ret.append('libfontconfig-1.dll')
|
||||
ret.append('libexpat-1.dll')
|
||||
ret.append('libfreetype-6.dll')
|
||||
ret.append('libpixman-1-0.dll')
|
||||
ret.append('libpng16-16.dll')
|
||||
ret.append('zlib1.dll')
|
||||
ret.append('libpcre-1.dll')
|
||||
ret.append('libffi-6.dll')
|
||||
ret.append('libharfbuzz-0.dll')
|
||||
ret.append('libgraphite2.dll')
|
||||
ret.append('libstdc++-6.dll')
|
||||
ret.append('libbz2-1.dll')
|
||||
return ret
|
||||
|
||||
|
||||
def build(self):
|
||||
"""Package up a nuget file based on the default build"""
|
||||
|
||||
if os.name != 'nt':
|
||||
print("Skipping Native Nuget package build, as this needs to be run on Windows")
|
||||
return
|
||||
|
||||
net45_build_dir = join(self.Build_NugetDir, 'build', 'net45')
|
||||
os.makedirs(net45_build_dir, exist_ok=True)
|
||||
|
||||
print ('Copying Files')
|
||||
shutil.copy('./misc/GtkSharp.Native.targets', join(net45_build_dir, 'GtkSharp.' + self.arch + '.targets'))
|
||||
|
||||
# Copy dlls
|
||||
dll_list = []
|
||||
dll_list += self.Get_Dlls_Native_GTK()
|
||||
dll_list += self.Get_Dlls_Native_GTK_Deps()
|
||||
|
||||
for item in dll_list:
|
||||
src = join(self.MingwBinPath, item)
|
||||
|
||||
srclist = iglob(src)
|
||||
for fname in srclist:
|
||||
f_basename, f_extension = os.path.splitext(ntpath.basename(fname))
|
||||
shutil.copy(fname, join(net45_build_dir, f_basename + '.dl_'))
|
18
NuGet/pybuild/profiles/Gtk_Win64.py
Normal file
18
NuGet/pybuild/profiles/Gtk_Win64.py
Normal file
|
@ -0,0 +1,18 @@
|
|||
#!/usr/bin/python3
|
||||
"""Build of GTK3 into a NuGet package - Windows 64bit"""
|
||||
|
||||
import os, shutil
|
||||
from pybuild.ProfileBase import ProfileBase
|
||||
from os.path import abspath, join
|
||||
from pybuild.Helper import Helper
|
||||
from pybuild.profiles.Gtk_Win32 import Gtk_Win32
|
||||
|
||||
class Gtk_Win64(Gtk_Win32):
|
||||
|
||||
def __init__(self):
|
||||
"""Class Init"""
|
||||
super().__init__()
|
||||
self._NuGet_PackageName = 'GtkSharp.Win64'
|
||||
self._MingwBinPath = join(self.MsysPath + '\\mingw64\\bin')
|
||||
self.arch = 'Win64'
|
||||
self._Version = Helper.get_gtk_version_msys(self.MsysPath)
|
0
NuGet/pybuild/profiles/__init__.py
Normal file
0
NuGet/pybuild/profiles/__init__.py
Normal file
144
NuGet/pybuild/vsgenext/CoreVSProject.py
Normal file
144
NuGet/pybuild/vsgenext/CoreVSProject.py
Normal file
|
@ -0,0 +1,144 @@
|
|||
#!/usr/bin/python3
|
||||
|
||||
import os, json
|
||||
from vsgen.project import VSGProject
|
||||
from xml.etree import ElementTree as et
|
||||
from yattag import indent
|
||||
from os.path import abspath, join
|
||||
from collections import OrderedDict
|
||||
|
||||
class CoreVSProject(VSGProject):
|
||||
"""
|
||||
CoreVSProject extends :class:`~vsgen.project.VSGProject` with data and logic needed to create a `.xproj` file.
|
||||
:ivar str TargetFrameworkVersion: The target framework version.
|
||||
:ivar str BaseIntermediateOutputPath: Intermediate path for building the output.
|
||||
:ivar str ProjectXml: Override the xml within the .xproj file.
|
||||
:ivar str ProjectJson: Override the json within the project.lock file.
|
||||
"""
|
||||
__project_type__ = 'netcore'
|
||||
|
||||
__writable_name__ = "Visual Studio .Net Core Project"
|
||||
|
||||
__registerable_name__ = "Visual Studio C# Compiler"
|
||||
|
||||
def __init__(self, **kwargs):
|
||||
"""
|
||||
Constructor.
|
||||
:param kwargs: List of arbitrary keyworded arguments to be processed as instance variable data
|
||||
"""
|
||||
super(CoreVSProject, self).__init__(**kwargs)
|
||||
|
||||
def _import(self, datadict):
|
||||
"""
|
||||
Internal method to import instance variables data from a dictionary
|
||||
:param dict datadict: The dictionary containing variables values.
|
||||
"""
|
||||
super(CoreVSProject, self)._import(datadict)
|
||||
self.TargetFrameworkVersion = datadict.get('TargetFrameworkVersion', 'v4.6.1')
|
||||
self.BaseIntermediateOutputPath = datadict.get('BaseIntermediateOutputPath', '.\obj')
|
||||
self.ProjectXml = datadict.get('ProjectXml', None)
|
||||
self.ProjectJson = datadict.get('ProjectJson', None)
|
||||
self.Version = datadict.get('Version', '1.0.0-*')
|
||||
self.Depends = datadict.get('Depends', {'NETStandard.Library': '1.6.0'})
|
||||
self.Frameworks = datadict.get('Frameworks', None)
|
||||
self.BuildOptions = datadict.get('BuildOptions', None)
|
||||
|
||||
def get_project_json(self):
|
||||
"""
|
||||
Get the json for use in Project.lock
|
||||
"""
|
||||
|
||||
data = OrderedDict()
|
||||
ver = {'version': self.Version}
|
||||
data.update(ver)
|
||||
|
||||
depends = self.Depends
|
||||
depends2 = {'dependencies': depends}
|
||||
data.update(depends2)
|
||||
|
||||
if self.Frameworks != None:
|
||||
frameworks = {'frameworks': self.Frameworks}
|
||||
else:
|
||||
frameworks = {'frameworks': {'netstandard1.6': {'imports': 'dnxcore50'}}}
|
||||
data.update(frameworks)
|
||||
|
||||
if self.BuildOptions != None:
|
||||
buildopts = {'buildOptions': self.BuildOptions}
|
||||
data.update(buildopts)
|
||||
|
||||
return data
|
||||
|
||||
def get_project_xml(self):
|
||||
"""
|
||||
Get the xml for use in the xproj file
|
||||
"""
|
||||
|
||||
xml_projroot = et.Element('Project')
|
||||
xml_projroot.set('ToolsVersion', '14.0')
|
||||
xml_projroot.set('DefaultTargets', 'Build')
|
||||
xml_projroot.set('xmlns', 'http://schemas.microsoft.com/developer/msbuild/2003')
|
||||
|
||||
propgroup1 = et.SubElement(xml_projroot, 'PropertyGroup')
|
||||
studiover = et.SubElement(propgroup1, 'VisualStudioVersion')
|
||||
studiover.set('Condition', "'$(VisualStudioVersion)' == ''")
|
||||
studiover.text = '14.0'
|
||||
vstoolspath = et.SubElement(propgroup1, 'VSToolsPath')
|
||||
vstoolspath.set('Condition', "'$(VSToolsPath)' == ''")
|
||||
vstoolspath.text = r"$(MSBuildExtensionsPath32)\Microsoft\VisualStudio\v$(VisualStudioVersion)"
|
||||
|
||||
import1 = et.SubElement(xml_projroot, 'Import')
|
||||
import1.set('Project', '$(VSToolsPath)\DotNet\Microsoft.DotNet.Props')
|
||||
import1.set('Condition', "'$(VSToolsPath)' != ''")
|
||||
|
||||
propgroup2 = et.SubElement(xml_projroot, 'PropertyGroup')
|
||||
propgroup2.set('Label', 'Globals')
|
||||
projguid = et.SubElement(propgroup2, 'ProjectGuid')
|
||||
projguid.text = self.lower(self.GUID)
|
||||
rootnamespace = et.SubElement(propgroup2, 'RootNamespace')
|
||||
rootnamespace.text = self.RootNamespace
|
||||
baseintermediateoutputpath = et.SubElement(propgroup2, 'BaseIntermediateOutputPath')
|
||||
baseintermediateoutputpath.set('Condition', "'$(BaseIntermediateOutputPath)'=='' ")
|
||||
baseintermediateoutputpath.text = self.BaseIntermediateOutputPath
|
||||
targetframeworkversion = et.SubElement(propgroup2, 'TargetFrameworkVersion')
|
||||
targetframeworkversion.text = self.TargetFrameworkVersion
|
||||
|
||||
propgroup3 = et.SubElement(xml_projroot, 'PropertyGroup')
|
||||
schemaver = et.SubElement(propgroup3, 'SchemaVersion')
|
||||
schemaver.text = '2.0'
|
||||
|
||||
import2 = et.SubElement(xml_projroot, 'Import')
|
||||
import2.set('Project', '$(VSToolsPath)\DotNet\Microsoft.DotNet.targets')
|
||||
import2.set('Condition', "'$(VSToolsPath)' != ''")
|
||||
|
||||
etstr = et.tostring(xml_projroot, encoding='utf-8', method='xml').decode('utf-8')
|
||||
outtxt = indent(etstr)
|
||||
return outtxt
|
||||
|
||||
|
||||
def write(self):
|
||||
"""
|
||||
Creates the project files.
|
||||
"""
|
||||
npath = os.path.normpath(self.FileName)
|
||||
(filepath, filename) = os.path.split(npath)
|
||||
os.makedirs(filepath, exist_ok=True)
|
||||
|
||||
projectFileName = os.path.normpath(self.FileName)
|
||||
projxml = ''
|
||||
if self.ProjectXml == None:
|
||||
projxml = self.get_project_xml()
|
||||
else:
|
||||
projxml = self.ProjectXml
|
||||
with open(projectFileName, 'wt') as f:
|
||||
f.write(projxml)
|
||||
|
||||
jsonFileName = join(filepath, 'project.json')
|
||||
|
||||
if self.ProjectJson == None:
|
||||
projjson = self.get_project_json()
|
||||
else:
|
||||
projjson = self.ProjectJson
|
||||
|
||||
with open(jsonFileName, 'w') as f:
|
||||
txt = json.dumps(projjson, indent=2, separators=(',', ': '))
|
||||
f.write(txt)
|
0
NuGet/pybuild/vsgenext/__init__.py
Normal file
0
NuGet/pybuild/vsgenext/__init__.py
Normal file
|
@ -7,7 +7,7 @@
|
|||
<ProjectHome>
|
||||
</ProjectHome>
|
||||
<StartupFile>..\..\build.py</StartupFile>
|
||||
<SearchPath>..\..\;..\..\pybuild\</SearchPath>
|
||||
<SearchPath>..\..\;..\..\pybuild\;..\..\pybuild\vsgen\</SearchPath>
|
||||
<WorkingDirectory>..\..\</WorkingDirectory>
|
||||
<OutputPath>.</OutputPath>
|
||||
<Name>GtkSharp-NugetBuild</Name>
|
||||
|
@ -38,17 +38,38 @@
|
|||
<Compile Include="..\..\build.py">
|
||||
<Link>build.py</Link>
|
||||
</Compile>
|
||||
<Compile Include="..\..\pybuild\GtkSharp_Builder.py">
|
||||
<Link>pybuild\GtkSharp_Builder.py</Link>
|
||||
</Compile>
|
||||
<Compile Include="..\..\pybuild\Gtk_Builder.py">
|
||||
<Link>pybuild\Gtk_Builder.py</Link>
|
||||
</Compile>
|
||||
<Compile Include="..\..\pybuild\Helper.py">
|
||||
<Link>pybuild\Helper.py</Link>
|
||||
</Compile>
|
||||
<Compile Include="..\..\pybuild\Settings.py">
|
||||
<Link>pybuild\Settings.py</Link>
|
||||
<Compile Include="..\..\pybuild\ProfileBase.py">
|
||||
<Link>pybuild\ProfileBase.py</Link>
|
||||
</Compile>
|
||||
<Compile Include="..\..\pybuild\profiles\Glue_Win32.py">
|
||||
<Link>pybuild\profiles\Glue_Win32.py</Link>
|
||||
</Compile>
|
||||
<Compile Include="..\..\pybuild\profiles\Glue_Win64.py">
|
||||
<Link>pybuild\profiles\Glue_Win64.py</Link>
|
||||
</Compile>
|
||||
<Compile Include="..\..\pybuild\profiles\GtkSharp.py">
|
||||
<Link>pybuild\profiles\GtkSharp.py</Link>
|
||||
</Compile>
|
||||
<Compile Include="..\..\pybuild\profiles\GtkSharp_Core.py">
|
||||
<Link>pybuild\profiles\GtkSharp_Core.py</Link>
|
||||
</Compile>
|
||||
<Compile Include="..\..\pybuild\profiles\Gtk_Win32.py">
|
||||
<Link>pybuild\profiles\Gtk_Win32.py</Link>
|
||||
</Compile>
|
||||
<Compile Include="..\..\pybuild\profiles\Gtk_Win64.py">
|
||||
<Link>pybuild\profiles\Gtk_Win64.py</Link>
|
||||
</Compile>
|
||||
<Compile Include="..\..\pybuild\profiles\__init__.py">
|
||||
<Link>pybuild\profiles\__init__.py</Link>
|
||||
</Compile>
|
||||
<Compile Include="..\..\pybuild\vsgenext\CoreVSProject.py">
|
||||
<Link>pybuild\vsgenext\CoreVSProject.py</Link>
|
||||
</Compile>
|
||||
<Compile Include="..\..\pybuild\vsgenext\__init__.py">
|
||||
<Link>pybuild\vsgenext\__init__.py</Link>
|
||||
</Compile>
|
||||
<Compile Include="..\..\pybuild\__init__.py">
|
||||
<Link>pybuild\__init__.py</Link>
|
||||
|
@ -56,6 +77,8 @@
|
|||
</ItemGroup>
|
||||
<ItemGroup>
|
||||
<Folder Include="pybuild\" />
|
||||
<Folder Include="pybuild\vsgenext\" />
|
||||
<Folder Include="pybuild\profiles\" />
|
||||
</ItemGroup>
|
||||
<Import Condition="Exists($(PtvsTargetsFile))" Project="$(PtvsTargetsFile)" />
|
||||
<Import Condition="!Exists($(PtvsTargetsFile))" Project="$(MSBuildToolsPath)\Microsoft.Common.targets" />
|
||||
|
|
|
@ -1,5 +1,5 @@
|
|||
|
||||
AC_INIT(gtk-sharp, 3.20.6)
|
||||
AC_INIT(gtk-sharp, 3.22.1)
|
||||
|
||||
AM_INIT_AUTOMAKE([1.10 no-dist-gzip dist-bzip2 tar-ustar foreign])
|
||||
AC_CANONICAL_HOST
|
||||
|
|
112
sources/Generating-Sources.md
Normal file
112
sources/Generating-Sources.md
Normal file
|
@ -0,0 +1,112 @@
|
|||
# Generating Sources
|
||||
|
||||
## Overview
|
||||
|
||||
This is a quick overview of some of the commands to run when updating the sources for a new gtk version
|
||||
|
||||
### Linux
|
||||
|
||||
You may need to install the following package for generating the source under Linux
|
||||
```
|
||||
sudo apt-get install libxml-libxml-perl
|
||||
```
|
||||
|
||||
### Windows
|
||||
|
||||
So far I've only managed to get this working in ubuntu, not Windows due to the way the .net app launches the perl script via libc
|
||||
i.e. [DllImport ("libc")]
|
||||
|
||||
It looks like we need to use the 32bit version of MinGW if we do try it this way.
|
||||
The following path statements are needed in the console at the very least
|
||||
```
|
||||
PATH=$PATH:/c/Program\ Files\ \(x86\)/Microsoft\ SDKs/Windows/v10.0A/bin/NETFX\ 4.6\ Tools/
|
||||
PATH=$PATH:/c/Windows/Microsoft.NET/Framework/v4.0.30319/
|
||||
```
|
||||
|
||||
Also the parser can be rebuilt via
|
||||
```
|
||||
./autogen.sh --prefix=/tmp/install
|
||||
cd parser
|
||||
make clean
|
||||
make
|
||||
```
|
||||
|
||||
Also it's important to make sure MSYS2 is uptodate with
|
||||
```
|
||||
pacman -Syuu
|
||||
```
|
||||
|
||||
To search for a package that's been install (to see what version it is for example)
|
||||
```
|
||||
pacman -Ss gtk3
|
||||
```
|
||||
|
||||
|
||||
## Editing Files for Downloaded Source
|
||||
|
||||
### Configure.ac version number
|
||||
|
||||
First change the version number in configure.ac to match that of the gtk version we're moving to
|
||||
```
|
||||
AC_INIT(gtk-sharp, 3.22.1)
|
||||
```
|
||||
|
||||
### Sources/Makefile.am
|
||||
|
||||
Next change the version number in sources/Makefile.am to match
|
||||
```
|
||||
TARGET_GTK_VERSION=3.22.1
|
||||
TARGET_GTK_API=3.22
|
||||
```
|
||||
|
||||
Next update the orher url's in Makefile.am, the version numbers should match those in use on the system (such as MSYS2)
|
||||
```
|
||||
GTK_DOWNLOADS = \
|
||||
http://ftp.gnome.org/pub/GNOME/sources/glib/2.50/glib-2.50.0.tar.xz \
|
||||
http://ftp.gnome.org/pub/GNOME/sources/pango/1.40/pango-1.40.3.tar.xz \
|
||||
http://ftp.gnome.org/pub/GNOME/sources/atk/2.22/atk-2.22.0.tar.xz \
|
||||
http://ftp.gnome.org/pub/GNOME/sources/gdk-pixbuf/2.36/gdk-pixbuf-2.36.0.tar.xz \
|
||||
http://ftp.gnome.org/pub/GNOME/sources/gtk+/$(TARGET_GTK_API)/gtk+-$(TARGET_GTK_VERSION).tar.xz
|
||||
```
|
||||
|
||||
### Patches
|
||||
|
||||
As part of the source code download, some of the files will be patched
|
||||
so you need to look at and check that all the patches apply correctly to the downloaded source when running make get-source-code
|
||||
|
||||
|
||||
## Download the sources
|
||||
|
||||
Next we're going to download the source
|
||||
```
|
||||
./autogen.sh --prefix=/tmp/install
|
||||
cd sources
|
||||
make get-source-code
|
||||
```
|
||||
|
||||
At this stage the sources should now be extracted within the sources sub directory
|
||||
|
||||
### Update sources.xml
|
||||
|
||||
One last file to update is the sources/sources.xml file
|
||||
all directories in this file need to match the extracted directories
|
||||
|
||||
## Generate the API Code
|
||||
|
||||
### Generate the XML Files
|
||||
|
||||
Next to generate the xml files needed for the generation of code
|
||||
```
|
||||
make api
|
||||
```
|
||||
|
||||
This should result in the following files
|
||||
|
||||
* gdk/gdk-api.raw
|
||||
* gio/gio-api.raw
|
||||
* gtk/gtk-api.raw
|
||||
* pango/pango-api.raw
|
||||
|
||||
### Generate the API Code from the XML Files
|
||||
|
||||
TODO we need to use generator/gapi_codegen.exe on each of the xml files to generate the .cs code within the generated sub directories
|
|
@ -3,14 +3,14 @@ EXTRA_DIST = \
|
|||
sources.xml \
|
||||
gtk_tree_model_signal_fix.patch
|
||||
|
||||
TARGET_GTK_VERSION=3.20.6
|
||||
TARGET_GTK_API=3.20
|
||||
TARGET_GTK_VERSION=3.22.1
|
||||
TARGET_GTK_API=3.22
|
||||
|
||||
GTK_DOWNLOADS = \
|
||||
http://ftp.gnome.org/pub/GNOME/sources/glib/2.48/glib-2.48.0.tar.xz \
|
||||
http://ftp.gnome.org/pub/GNOME/sources/pango/1.40/pango-1.40.1.tar.xz \
|
||||
http://ftp.gnome.org/pub/GNOME/sources/atk/2.20/atk-2.20.0.tar.xz \
|
||||
http://ftp.gnome.org/pub/GNOME/sources/gdk-pixbuf/2.34/gdk-pixbuf-2.34.0.tar.xz \
|
||||
http://ftp.gnome.org/pub/GNOME/sources/glib/2.50/glib-2.50.0.tar.xz \
|
||||
http://ftp.gnome.org/pub/GNOME/sources/pango/1.40/pango-1.40.3.tar.xz \
|
||||
http://ftp.gnome.org/pub/GNOME/sources/atk/2.22/atk-2.22.0.tar.xz \
|
||||
http://ftp.gnome.org/pub/GNOME/sources/gdk-pixbuf/2.36/gdk-pixbuf-2.36.0.tar.xz \
|
||||
http://ftp.gnome.org/pub/GNOME/sources/gtk+/$(TARGET_GTK_API)/gtk+-$(TARGET_GTK_VERSION).tar.xz
|
||||
|
||||
api:
|
||||
|
@ -21,9 +21,8 @@ get-source-code:
|
|||
wget $$i --output-document=- | tar -xJ ; \
|
||||
done;
|
||||
ln -f -s gtkfilechooserprivate.h gtk+-$(TARGET_GTK_VERSION)/gtk/gtkfilechooserpriv.h
|
||||
patch -p0 gtk+-$(TARGET_GTK_VERSION)/gtk/gtktreemodel.c < gtk_tree_model_signal_fix.patch
|
||||
patch -p1 -d gtk+-$(TARGET_GTK_VERSION) < patches/gtk_tree_model_signal_fix.patch
|
||||
echo "typedef struct _GtkClipboard GtkClipboard;" >> gtk+-$(TARGET_GTK_VERSION)/gtk/gtkclipboard.h
|
||||
echo "typedef struct _GtkClipboardClass GtkClipboardClass;" >> gtk+-$(TARGET_GTK_VERSION)/gtk/gtkclipboard.h
|
||||
patch -p0 gtk+-$(TARGET_GTK_VERSION)/gtk/gtktextattributes.h < gtktextattributes-gi-scanner.patch
|
||||
patch -p0 glib-2.48.0/gio/gwin32registrykey.h < gwin32registrykey-little-endian.patch
|
||||
|
||||
patch -p0 gtk+-$(TARGET_GTK_VERSION)/gtk/gtktextattributes.h < patches/gtktextattributes-gi-scanner.patch
|
||||
patch -p0 glib-2.50.0/gio/gwin32registrykey.h < patches/gwin32registrykey-little-endian.patch
|
||||
|
|
|
@ -1,6 +1,7 @@
|
|||
--- gtk+-2.14.3/gtk/gtktreemodel.c 2009-01-04 11:52:01.000000000 -0600
|
||||
+++ gtktreemodel.c 2009-01-04 12:03:58.000000000 -0600
|
||||
@@ -193,14 +193,15 @@
|
||||
diff -Naur gtk+-3.22.1.orig/gtk/gtktreemodel.c gtk+-3.22.1/gtk/gtktreemodel.c
|
||||
--- gtk+-3.22.1.orig/gtk/gtktreemodel.c 2016-08-29 18:20:43.000000000 +0100
|
||||
+++ gtk+-3.22.1/gtk/gtktreemodel.c 2016-10-17 13:57:41.204889300 +0100
|
||||
@@ -395,14 +395,15 @@
|
||||
closure = g_closure_new_simple (sizeof (GClosure), NULL);
|
||||
g_closure_set_marshal (closure, row_inserted_marshal);
|
||||
tree_model_signals[ROW_INSERTED] =
|
||||
|
@ -19,7 +20,7 @@
|
|||
|
||||
/**
|
||||
* GtkTreeModel::row-has-child-toggled:
|
||||
@@ -242,14 +243,14 @@
|
||||
@@ -441,14 +442,14 @@
|
||||
closure = g_closure_new_simple (sizeof (GClosure), NULL);
|
||||
g_closure_set_marshal (closure, row_deleted_marshal);
|
||||
tree_model_signals[ROW_DELETED] =
|
||||
|
@ -30,14 +31,14 @@
|
|||
- closure,
|
||||
+ G_STRUCT_OFFSET (GtkTreeModelIface, row_deleted),
|
||||
NULL, NULL,
|
||||
_gtk_marshal_VOID__BOXED,
|
||||
NULL,
|
||||
G_TYPE_NONE, 1,
|
||||
- row_deleted_params);
|
||||
+ GTK_TYPE_TREE_PATH);
|
||||
|
||||
/**
|
||||
* GtkTreeModel::rows-reordered:
|
||||
@@ -268,14 +269,15 @@
|
||||
* GtkTreeModel::rows-reordered: (skip)
|
||||
@@ -471,14 +472,15 @@
|
||||
closure = g_closure_new_simple (sizeof (GClosure), NULL);
|
||||
g_closure_set_marshal (closure, rows_reordered_marshal);
|
||||
tree_model_signals[ROWS_REORDERED] =
|
|
@ -2,7 +2,7 @@
|
|||
<api filename="../gio/gio-api.raw">
|
||||
<library name="libgio-2.0-0.dll">
|
||||
<namespace name="G">
|
||||
<directory path="glib-2.48.0/gio">
|
||||
<directory path="glib-2.50.0/gio">
|
||||
<exclude>gasynchelper.h</exclude>
|
||||
<exclude>gcontenttypeprivate.h</exclude>
|
||||
<exclude>gdelayedsettingsbackend.h</exclude>
|
||||
|
@ -91,14 +91,14 @@
|
|||
<api filename="../atk/atk-api.raw">
|
||||
<library name="libatk-1.0-0.dll">
|
||||
<namespace name="Atk">
|
||||
<dir>atk-2.20.0/atk</dir>
|
||||
<dir>atk-2.22.0/atk</dir>
|
||||
</namespace>
|
||||
</library>
|
||||
</api>
|
||||
<api filename="../pango/pango-api.raw">
|
||||
<library name="libpango-1.0-0.dll">
|
||||
<namespace name="Pango">
|
||||
<directory path="pango-1.40.1/pango">
|
||||
<directory path="pango-1.40.3/pango">
|
||||
<exclude>pangoatsui.c</exclude>
|
||||
<exclude>pangoatsui.h</exclude>
|
||||
<exclude>pangoatsui-fontmap.h</exclude>
|
||||
|
@ -140,17 +140,17 @@
|
|||
<api filename="../gdk/gdk-api.raw">
|
||||
<library name="libgdk-3-0.dll">
|
||||
<namespace name="Gdk">
|
||||
<directory path="gtk+-3.20.6/gdk">
|
||||
<directory path="gtk+-3.22.1/gdk">
|
||||
<exclude>gdkalias.h</exclude>
|
||||
<exclude>gdkwindowimpl.h</exclude>
|
||||
<exclude>keyname-table.h</exclude>
|
||||
</directory>
|
||||
<directory path="gtk+-3.20.6/gdk/deprecated" />
|
||||
<directory path="gtk+-3.22.1/gdk/deprecated" />
|
||||
</namespace>
|
||||
</library>
|
||||
<library name="libgdk_pixbuf-2.0-0.dll">
|
||||
<namespace name="Gdk">
|
||||
<directory path="gdk-pixbuf-2.34.0/gdk-pixbuf">
|
||||
<directory path="gdk-pixbuf-2.36.0/gdk-pixbuf">
|
||||
<exclude>io-gdip-native.h</exclude>
|
||||
<exclude>io-gdip-propertytags.h</exclude>
|
||||
<exclude>io-gdip-utils.h</exclude>
|
||||
|
@ -165,7 +165,7 @@
|
|||
<api filename="../gtk/gtk-api.raw">
|
||||
<library name="libgtk-3-0.dll">
|
||||
<namespace name="Gtk">
|
||||
<directory path="gtk+-3.20.6/gtk">
|
||||
<directory path="gtk+-3.22.1/gtk">
|
||||
<!-- Internal stuff -->
|
||||
<exclude>gtkalias.h</exclude>
|
||||
<exclude>gtkappchooseronline.h</exclude>
|
||||
|
@ -263,7 +263,7 @@
|
|||
<exclude>gtkcomposetable.c</exclude>
|
||||
<exclude>gtkcomposetable.h</exclude>
|
||||
</directory>
|
||||
<directory path="gtk+-3.20.6/gtk/deprecated" />
|
||||
<directory path="gtk+-3.22.1/gtk/deprecated" />
|
||||
</namespace>
|
||||
</library>
|
||||
</api>
|
||||
|
|
Loading…
Reference in a new issue