-
Notifications
You must be signed in to change notification settings - Fork 12
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Add compile script for libvirt 0.9.11
- Loading branch information
Showing
4 changed files
with
344 additions
and
1 deletion.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,62 @@ | ||
#!/bin/sh -ex | ||
|
||
. utilslib.sh | ||
|
||
basedir=/src/libvirt | ||
baseurl=http://libvirt.org/sources | ||
version=0.9.11 | ||
revision=0 | ||
tarball=libvirt-${version}.tar.gz | ||
directory=libvirt-${version}-${revision} | ||
|
||
mkdir -p $basedir | ||
pushd $basedir | ||
|
||
utilslib_download $baseurl $tarball | ||
|
||
if [ ! -d $directory ] | ||
then | ||
echo unpacking $tarball ... | ||
mkdir -p $directory | ||
tar -xvf $tarball -C $directory --strip-components=1 | ||
fi | ||
|
||
pushd $directory | ||
|
||
if [ ! -f mingw.patch.applied ] | ||
then | ||
echo patching ... | ||
patch -p1 < ../../libvirt-${version}-mingw.patch | ||
echo applied > mingw.patch.applied | ||
fi | ||
|
||
if [ -d /include/libvirt ] | ||
then | ||
# remove previously installed libvirt header files. specifying -I/include | ||
# makes the build pickup the old headers instead of it's own files. | ||
# removing the old header files is a simple workaround for this problem. | ||
rm -r /include/libvirt | ||
fi | ||
|
||
if [ ! -f configure.done ] | ||
then | ||
CFLAGS=-I/include \ | ||
LDFLAGS=-L/lib \ | ||
./configure --prefix= \ | ||
--without-libvirtd \ | ||
--without-openvz \ | ||
--without-lxc \ | ||
--without-phyp \ | ||
--with-python | ||
echo done > configure.done | ||
fi | ||
|
||
make | ||
make install | ||
|
||
# copy libvirtmod.dll to the correct place so python will find it | ||
cp /python/Lib/site-packages/libvirtmod.dll /python/DLLs/libvirtmod.pyd | ||
|
||
|
||
popd | ||
popd |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,278 @@ | ||
--- a/python/Makefile.am 2010-05-26 22:09:50 +0000 | ||
+++ b/python/Makefile.am 2010-09-10 20:26:24 +0000 | ||
@@ -41,9 +41,9 @@ | ||
libvirtmod_la_CFLAGS = $(WARN_PYTHON_CFLAGS) | ||
|
||
libvirtmod_la_LDFLAGS = -module -avoid-version -shared -L$(top_builddir)/src/.libs \ | ||
- $(CYGWIN_EXTRA_LDFLAGS) | ||
+ $(CYGWIN_EXTRA_LDFLAGS) $(MINGW_EXTRA_LDFLAGS) -L/python/libs | ||
libvirtmod_la_LIBADD = $(mylibs) \ | ||
- $(CYGWIN_EXTRA_LIBADD) $(CYGWIN_EXTRA_PYTHON_LIBADD) | ||
+ $(CYGWIN_EXTRA_LIBADD) $(CYGWIN_EXTRA_PYTHON_LIBADD) -lpython26 | ||
|
||
GENERATE = generator.py | ||
API_DESC = $(top_srcdir)/docs/libvirt-api.xml $(srcdir)/libvirt-override-api.xml | ||
diff -ur a/python/Makefile.in b/python/Makefile.in | ||
--- a/python/Makefile.in 2010-09-07 17:46:28 +0000 | ||
+++ b/python/Makefile.in 2010-09-10 21:04:52 +0000 | ||
@@ -1118,10 +1118,10 @@ | ||
# need extra flags here | ||
@WITH_PYTHON_TRUE@libvirtmod_la_CFLAGS = $(WARN_PYTHON_CFLAGS) | ||
@WITH_PYTHON_TRUE@libvirtmod_la_LDFLAGS = -module -avoid-version -shared -L$(top_builddir)/src/.libs \ | ||
-@WITH_PYTHON_TRUE@ $(CYGWIN_EXTRA_LDFLAGS) | ||
+@WITH_PYTHON_TRUE@ $(CYGWIN_EXTRA_LDFLAGS) $(MINGW_EXTRA_LDFLAGS) -L/python/libs | ||
|
||
@WITH_PYTHON_TRUE@libvirtmod_la_LIBADD = $(mylibs) \ | ||
-@WITH_PYTHON_TRUE@ $(CYGWIN_EXTRA_LIBADD) $(CYGWIN_EXTRA_PYTHON_LIBADD) | ||
+@WITH_PYTHON_TRUE@ $(CYGWIN_EXTRA_LIBADD) $(CYGWIN_EXTRA_PYTHON_LIBADD) -lpython26 | ||
|
||
@WITH_PYTHON_TRUE@GENERATE = generator.py | ||
@WITH_PYTHON_TRUE@API_DESC = $(top_srcdir)/docs/libvirt-api.xml $(srcdir)/libvirt-override-api.xml | ||
|
||
|
||
|
||
|
||
|
||
Make the remote driver use TLS certificates from %APPDATA%\libvirt\pki\ instead of /etc/pki/ | ||
--- a/src/remote/remote_driver.c 2010-11-11 17:25:02 +0000 | ||
+++ b/src/remote/remote_driver.c 2010-11-20 12:04:52 +0000 | ||
@@ -276,6 +276,70 @@ | ||
static int initialize_gnutls(void); | ||
static gnutls_session_t negotiate_gnutls_on_connection (virConnectPtr conn, struct private_data *priv, int no_verify); | ||
|
||
+#ifdef WIN32 | ||
+ | ||
+static char *remoteWin32CertPaths[5]; | ||
+ | ||
+static int | ||
+remoteInitCertPaths(void) | ||
+{ | ||
+ const char *appdata = getenv("APPDATA"); | ||
+ | ||
+ if (appdata == NULL || *appdata == '\0') { | ||
+ appdata = "C:"; | ||
+ | ||
+ VIR_WARN("APPDATA not set, falling back to '%s'", appdata); | ||
+ } | ||
+ | ||
+ if (virAsprintf(&remoteWin32CertPaths[0], | ||
+ "%s\\libvirt\\pki\\CA\\cacert.pem", appdata) < 0 || | ||
+ virAsprintf(&remoteWin32CertPaths[1], | ||
+ "%s\\libvirt\\pki\\libvirt\\private\\clientkey.pem", appdata) < 0 || | ||
+ virAsprintf(&remoteWin32CertPaths[2], | ||
+ "%s\\libvirt\\pki\\libvirt\\clientcert.pem", appdata) < 0 || | ||
+ virAsprintf(&remoteWin32CertPaths[3], | ||
+ "%s\\libvirt\\pki\\libvirt\\private\\serverkey.pem", appdata) < 0 || | ||
+ virAsprintf(&remoteWin32CertPaths[4], | ||
+ "%s\\libvirt\\pki\\libvirt\\servercert.pem", appdata) < 0) { | ||
+ virReportOOMError(); | ||
+ return -1; | ||
+ } | ||
+ | ||
+ return 0; | ||
+} | ||
+ | ||
+static const char * | ||
+remoteCACertPath(void) | ||
+{ | ||
+ return remoteWin32CertPaths[0]; | ||
+} | ||
+ | ||
+static const char * | ||
+remoteClientKeyPath(void) | ||
+{ | ||
+ return remoteWin32CertPaths[1]; | ||
+} | ||
+ | ||
+static const char * | ||
+remoteClientCertPath(void) | ||
+{ | ||
+ return remoteWin32CertPaths[2]; | ||
+} | ||
+ | ||
+static const char * | ||
+remoteServerKeyPath(void) | ||
+{ | ||
+ return remoteWin32CertPaths[3]; | ||
+} | ||
+ | ||
+static const char * | ||
+remoteServerCertPath(void) | ||
+{ | ||
+ return remoteWin32CertPaths[4]; | ||
+} | ||
+ | ||
+#endif /* WIN32 */ | ||
+ | ||
#ifdef WITH_LIBVIRTD | ||
static int | ||
remoteStartup(int privileged ATTRIBUTE_UNUSED) | ||
@@ -4881,6 +4971,10 @@ | ||
{ | ||
remoteDriver = &remote_driver; | ||
|
||
+#ifdef WIN32 | ||
+ if (remoteInitCertPaths()) return -1; | ||
+#endif | ||
+ | ||
if (virRegisterDriver (&remote_driver) == -1) return -1; | ||
if (virRegisterNetworkDriver (&network_driver) == -1) return -1; | ||
if (virRegisterInterfaceDriver (&interface_driver) == -1) return -1; | ||
--- a/src/remote/remote_driver.h 2010-11-17 17:25:02 +0000 | ||
+++ b/src/remote/remote_driver.h 2010-11-18 08:24:54 +0000 | ||
@@ -41,12 +41,19 @@ | ||
# define LIBVIRTD_CONFIGURATION_FILE SYSCONFDIR "/libvirtd.conf" | ||
|
||
/* Defaults for PKI directory. */ | ||
-# define LIBVIRT_PKI_DIR SYSCONFDIR "/pki" | ||
-# define LIBVIRT_CACERT LIBVIRT_PKI_DIR "/CA/cacert.pem" | ||
-# define LIBVIRT_CLIENTKEY LIBVIRT_PKI_DIR "/libvirt/private/clientkey.pem" | ||
-# define LIBVIRT_CLIENTCERT LIBVIRT_PKI_DIR "/libvirt/clientcert.pem" | ||
-# define LIBVIRT_SERVERKEY LIBVIRT_PKI_DIR "/libvirt/private/serverkey.pem" | ||
-# define LIBVIRT_SERVERCERT LIBVIRT_PKI_DIR "/libvirt/servercert.pem" | ||
- | ||
+# ifndef WIN32 | ||
+# define LIBVIRT_PKI_DIR SYSCONFDIR "/pki" | ||
+# define LIBVIRT_CACERT LIBVIRT_PKI_DIR "/CA/cacert.pem" | ||
+# define LIBVIRT_CLIENTKEY LIBVIRT_PKI_DIR "/libvirt/private/clientkey.pem" | ||
+# define LIBVIRT_CLIENTCERT LIBVIRT_PKI_DIR "/libvirt/clientcert.pem" | ||
+# define LIBVIRT_SERVERKEY LIBVIRT_PKI_DIR "/libvirt/private/serverkey.pem" | ||
+# define LIBVIRT_SERVERCERT LIBVIRT_PKI_DIR "/libvirt/servercert.pem" | ||
+# else | ||
+# define LIBVIRT_CACERT remoteCACertPath() | ||
+# define LIBVIRT_CLIENTKEY remoteClientKeyPath() | ||
+# define LIBVIRT_CLIENTCERT remoteClientCertPath() | ||
+# define LIBVIRT_SERVERKEY remoteServerKeyPath() | ||
+# define LIBVIRT_SERVERCERT remoteServerCertPath() | ||
+# endif | ||
|
||
#endif /* __VIR_REMOTE_INTERNAL_H__ */ | ||
--- a/src/util/viruri.c | ||
+++ b/src/util/viruri.c | ||
@@ -185,7 +185,9 @@ virURIParse(const char *uri) | ||
if (xmluri->fragment && | ||
!(ret->fragment = strdup(xmluri->fragment))) | ||
goto no_memory; | ||
- | ||
+ if (xmluri->user && | ||
+ !(ret->user = strdup(xmluri->user))) | ||
+ goto no_memory; | ||
|
||
/* First check: does it even make sense to jump inside */ | ||
if (ret->server != NULL && | ||
@@ -249,6 +251,7 @@ virURIFormat(virURIPtr uri) | ||
xmluri.query = uri->query; | ||
#endif | ||
xmluri.fragment = uri->fragment; | ||
+ xmluri.user = uri->user; | ||
|
||
/* First check: does it make sense to do anything */ | ||
if (xmluri.server != NULL && | ||
--- a/src/esx/esx_driver.c | ||
+++ b/src/esx/esx_driver.c | ||
@@ -1023,6 +1023,8 @@ esxOpen(virConnectPtr conn, virConnectAuthPtr auth, | ||
priv->supportsLongMode = esxVI_Boolean_Undefined; | ||
priv->usedCpuTimeCounterId = -1; | ||
|
||
+ conn->privateData = priv; | ||
+ | ||
/* | ||
* Set the port dependent on the transport protocol if no port is | ||
* specified. This allows us to rely on the port parameter being | ||
@@ -1114,8 +1116,6 @@ esxOpen(virConnectPtr conn, virConnectAuthPtr auth, | ||
goto cleanup; | ||
} | ||
|
||
- conn->privateData = priv; | ||
- | ||
result = VIR_DRV_OPEN_SUCCESS; | ||
|
||
cleanup: | ||
--- a/src/util/virauth.c | ||
+++ b/src/util/virauth.c | ||
@@ -100,7 +100,7 @@ no_memory: | ||
goto cleanup; | ||
} | ||
|
||
- | ||
+/* | ||
static int | ||
virAuthGetCredential(virConnectPtr conn, | ||
const char *servicename, | ||
@@ -144,25 +144,25 @@ cleanup: | ||
virAuthConfigFree(config); | ||
VIR_FREE(path); | ||
return ret; | ||
-} | ||
+}*/ | ||
|
||
|
||
char * | ||
-virAuthGetUsername(virConnectPtr conn, | ||
+virAuthGetUsername(virConnectPtr conn ATTRIBUTE_UNUSED, | ||
virConnectAuthPtr auth, | ||
- const char *servicename, | ||
+ const char *servicename ATTRIBUTE_UNUSED, | ||
const char *defaultUsername, | ||
const char *hostname) | ||
{ | ||
unsigned int ncred; | ||
virConnectCredential cred; | ||
char *prompt; | ||
- char *ret = NULL; | ||
+ /*char *ret = NULL; | ||
|
||
if (virAuthGetCredential(conn, servicename, "username", &ret) < 0) | ||
return NULL; | ||
if (ret != NULL) | ||
- return ret; | ||
+ return ret;*/ | ||
|
||
memset(&cred, 0, sizeof(virConnectCredential)); | ||
|
||
@@ -204,21 +204,21 @@ virAuthGetUsername(virConnectPtr conn, | ||
|
||
|
||
char * | ||
-virAuthGetPassword(virConnectPtr conn, | ||
+virAuthGetPassword(virConnectPtr conn ATTRIBUTE_UNUSED, | ||
virConnectAuthPtr auth, | ||
- const char *servicename, | ||
+ const char *servicename ATTRIBUTE_UNUSED, | ||
const char *username, | ||
const char *hostname) | ||
{ | ||
unsigned int ncred; | ||
virConnectCredential cred; | ||
char *prompt; | ||
- char *ret = NULL; | ||
+ /*char *ret = NULL; | ||
|
||
if (virAuthGetCredential(conn, servicename, "password", &ret) < 0) | ||
return NULL; | ||
if (ret != NULL) | ||
- return ret; | ||
+ return ret;*/ | ||
|
||
memset(&cred, 0, sizeof(virConnectCredential)); | ||
|
||
--- a/src/util/threads-win32.c | ||
+++ b/src/util/threads-win32.c | ||
@@ -316,8 +316,15 @@ int virThreadCreate(virThreadPtr thread, | ||
void virThreadSelf(virThreadPtr thread) | ||
{ | ||
virThreadPtr self = TlsGetValue(selfkey); | ||
- thread->thread = self->thread; | ||
- thread->joinable = self->joinable; | ||
+ | ||
+ if (self == NULL) { | ||
+ /* called on a thread not created by virThreadCreate, e.g. the main thread */ | ||
+ thread->thread = 0; | ||
+ thread->joinable = false; | ||
+ } else { | ||
+ thread->thread = self->thread; | ||
+ thread->joinable = self->joinable; | ||
+ } | ||
} | ||
|
||
bool virThreadIsSelf(virThreadPtr thread) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters