summaryrefslogtreecommitdiffstats
path: root/perl-install
diff options
context:
space:
mode:
authorPascal Rigaux <pixel@mandriva.com>2004-02-08 17:50:15 +0000
committerPascal Rigaux <pixel@mandriva.com>2004-02-08 17:50:15 +0000
commit092a51022843b9217bbbe8cbd2affc312450523e (patch)
tree9ae8eec1552f3d5c9ebfacf89c72db4c1d6907d8 /perl-install
parent5f68450cc9d2f7c543a5d3cd5b8351a83ddffb4b (diff)
downloaddrakx-092a51022843b9217bbbe8cbd2affc312450523e.tar
drakx-092a51022843b9217bbbe8cbd2affc312450523e.tar.gz
drakx-092a51022843b9217bbbe8cbd2affc312450523e.tar.bz2
drakx-092a51022843b9217bbbe8cbd2affc312450523e.tar.xz
drakx-092a51022843b9217bbbe8cbd2affc312450523e.zip
move Xtest() and setMouseLive() out of c/stuff to xf86misc::main
so that we can use them (esp. setMouseLive) in standalone without making drakxtools-newt require xfree libs
Diffstat (limited to 'perl-install')
-rw-r--r--perl-install/Makefile.config4
-rw-r--r--perl-install/Makefile.drakxtools2
-rw-r--r--perl-install/Xconfig/test.pm7
-rw-r--r--perl-install/c/stuff.xs.pl69
-rw-r--r--perl-install/common.pm6
-rw-r--r--perl-install/drakxtools.spec2
-rw-r--r--perl-install/install_steps_gtk.pm3
-rw-r--r--perl-install/mouse.pm5
-rw-r--r--perl-install/xf86misc/.cvsignore5
-rw-r--r--perl-install/xf86misc/Makefile10
-rw-r--r--perl-install/xf86misc/Makefile.PL15
-rw-r--r--perl-install/xf86misc/main.pm12
-rw-r--r--perl-install/xf86misc/main.xs73
13 files changed, 134 insertions, 79 deletions
diff --git a/perl-install/Makefile.config b/perl-install/Makefile.config
index 30a022e75..347efd3c4 100644
--- a/perl-install/Makefile.config
+++ b/perl-install/Makefile.config
@@ -11,7 +11,7 @@ endif
VERSION = 2.2.10-BOOT
SUDO = sudo
SO_FILES = c/blib/arch/auto/c/c.so
-PMS_DIRS = Newt Xconfig c diskdrake harddrake interactive modules network partition_table printer resize_fat sbus_probing security
+PMS_DIRS = Newt Xconfig c xf86misc diskdrake harddrake interactive modules network partition_table printer resize_fat sbus_probing security
PMS = *.pm $(PMS_DIRS:%=%/*.pm) commands install2
STANDALONEPMS_ = XFdrake adduserdrake diskdrake drakTermServ drakautoinst drakauth drakbackup drakboot drakbug drakbug_report drakclock drakconnect drakedm drakfirewall drakfloppy drakfont drakgw drakhelp drakperm drakproxy drakpxe draksec draksound draksplash drakupdate_fstab drakups drakxservices drakxtv fileshareset harddrake2 keyboarddrake localedrake logdrake lsnetdrake mousedrake net_monitor printerdrake scannerdrake service_harddrake
@@ -25,7 +25,7 @@ BASE = $(ROOTDEST)/Mandrake/base
DESTREP4PMS = $(DEST)$(REP4PMS)
PERL = perl
LOCALFILES = $(patsubst %, ../tools/%,ddcprobe/ddcxinfos serial_probe/serial_probe xhost+)
-DIRS = c Newt resize_fat #po
+DIRS = c Newt resize_fat xf86misc #po
CFLAGS = -Wall
override CFLAGS += -pipe
diff --git a/perl-install/Makefile.drakxtools b/perl-install/Makefile.drakxtools
index 38af30433..640bed021 100644
--- a/perl-install/Makefile.drakxtools
+++ b/perl-install/Makefile.drakxtools
@@ -1,7 +1,7 @@
# -*- Makefile -*-
include Makefile.config
-INLIBDEST_DIRS = Newt c resize_fat sbus_probing
+INLIBDEST_DIRS = Newt c resize_fat xf86misc sbus_probing
HAVEINST_DIRS = share/po standalone/interactive_http
DIRS = $(INLIBDEST_DIRS) $(HAVEINST_DIRS) ddcprobe harddrake printer serial_probe
NAME = libDrakX
diff --git a/perl-install/Xconfig/test.pm b/perl-install/Xconfig/test.pm
index 93ec31e6e..8a2ecc632 100644
--- a/perl-install/Xconfig/test.pm
+++ b/perl-install/Xconfig/test.pm
@@ -14,9 +14,10 @@ my $tmpconfig = "/tmp/Xconfig";
sub xtest {
my ($display) = @_;
- $::isStandalone ?
- system("DISPLAY=$display /usr/X11R6/bin/xtest") == 0 :
- c::Xtest($display);
+ eval {
+ require xf86misc::main;
+ xf86misc::main::Xtest($display);
+ };
}
sub test {
diff --git a/perl-install/c/stuff.xs.pl b/perl-install/c/stuff.xs.pl
index 40cec2b84..fd91dc768 100644
--- a/perl-install/c/stuff.xs.pl
+++ b/perl-install/c/stuff.xs.pl
@@ -52,16 +52,12 @@ typedef __uint8_t u8;
#include <linux/hiddev.h>
#include <libldetect.h>
-#include <X11/Xlib.h>
-#include <X11/extensions/xf86misc.h>
#include <langinfo.h>
#include <string.h>
#include <iconv.h>
#include <libintl.h>
-#include <term.h>
-#undef max_colors
#define SECTORSIZE 512
@@ -97,21 +93,6 @@ void rpmError_callback(void) {
$ENV{C_DRAKX} and print '
-void initIMPS2() {
- unsigned char imps2_s1[] = { 243, 200, 243, 100, 243, 80, };
- unsigned char imps2_s2[] = { 246, 230, 244, 243, 100, 232, 3, };
-
- int fd = open("/dev/mouse", O_WRONLY);
- if (fd < 0) return;
-
- write (fd, imps2_s1, sizeof (imps2_s1));
- usleep (30000);
- write (fd, imps2_s2, sizeof (imps2_s2));
- usleep (30000);
- tcflush (fd, TCIFLUSH);
- tcdrain(fd);
-}
-
void log_message(const char * s, ...) {
va_list args;
va_list args_copy;
@@ -172,56 +153,6 @@ char *
pcmcia_probe()
';
-$ENV{C_DRAKX} and print '
-
-int
-Xtest(display)
- char *display
- CODE:
- int pid;
- if ((pid = fork()) == 0) {
- Display *d = XOpenDisplay(display);
- if (d) {
- int child;
- /* keep a client until some window is created, otherwise X server blinks to hell */
- if ((child = fork()) == 0) {
- XEvent event;
- XSelectInput(d, DefaultRootWindow(d), SubstructureNotifyMask);
- do {
- XNextEvent(d, &event);
- } while (event.type != CreateNotify);
- XCloseDisplay(d);
- exit(0);
- }
- }
- _exit(d != NULL);
- }
- waitpid(pid, &RETVAL, 0);
- OUTPUT:
- RETVAL
-
-void
-setMouseLive(display, type, emulate3buttons)
- char *display
- int type
- int emulate3buttons
- CODE:
- {
- XF86MiscMouseSettings mseinfo;
- Display *d = XOpenDisplay(display);
- if (d) {
- if (XF86MiscGetMouseSettings(d, &mseinfo) == True) {
- mseinfo.type = type;
- mseinfo.flags |= MF_REOPEN;
- mseinfo.emulate3buttons = emulate3buttons;
- XF86MiscSetMouseSettings(d, &mseinfo);
- XFlush(d);
- if (type == MTYPE_IMPS2) initIMPS2();
- }
- }
- }
-';
-
print '
char *
dgettext(domainname, msgid)
diff --git a/perl-install/common.pm b/perl-install/common.pm
index d8072df85..c692bd175 100644
--- a/perl-install/common.pm
+++ b/perl-install/common.pm
@@ -276,7 +276,11 @@ sub require_root_capability() {
sub check_for_xserver() {
if (!defined $::xtest) {
- $::xtest = $ENV{DISPLAY} && system('/usr/X11R6/bin/xtest') == 0;
+ $::xtest = 0;
+ eval {
+ require xf86misc::main;
+ $::xtest = xf86misc::main::xtest($ENV{DISPLAY});
+ } if $ENV{DISPLAY};
}
return $::xtest;
}
diff --git a/perl-install/drakxtools.spec b/perl-install/drakxtools.spec
index 2ef9ca42b..8804dde20 100644
--- a/perl-install/drakxtools.spec
+++ b/perl-install/drakxtools.spec
@@ -174,7 +174,7 @@ dirs1="usr/lib/libDrakX usr/share/libDrakX"
(cd $RPM_BUILD_ROOT ; find $dirs1 usr/bin usr/sbin ! -type d -printf "/%%p\n")|egrep -v 'bin/.*harddrake' > %{name}.list
(cd $RPM_BUILD_ROOT ; find $dirs1 -type d -printf "%%%%dir /%%p\n") >> %{name}.list
-perl -ni -e '/clock|drak(backup|bug|clock|floppy|font|log|net_monitor|perm|printer|sec|TermServ)|gtk|icons|logdrake|net_monitor|pixmaps|printer/ ? print STDERR $_ : print' %{name}.list 2> %{name}-gtk.list
+perl -ni -e '/clock|drak(backup|bug|clock|floppy|font|log|net_monitor|perm|printer|sec|TermServ)|gtk|icons|logdrake|net_monitor|pixmaps|printer|xf86misc/ ? print STDERR $_ : print' %{name}.list 2> %{name}-gtk.list
perl -ni -e '/http/ ? print STDERR $_ : print' %{name}.list 2> %{name}-http.list
#mdk menu entry
diff --git a/perl-install/install_steps_gtk.pm b/perl-install/install_steps_gtk.pm
index f3abe2110..df9119703 100644
--- a/perl-install/install_steps_gtk.pm
+++ b/perl-install/install_steps_gtk.pm
@@ -12,6 +12,7 @@ use vars qw(@ISA);
use pkgs;
use install_steps_interactive;
use interactive::gtk;
+use xf86misc::main;
use common;
use ugtk2 qw(:helpers :wrappers :create);
use devices;
@@ -63,7 +64,7 @@ sub new($$) {
foreach (1..60) {
sleep 1;
log::l("Server died"), return 0 if !fuzzy_pidofs(qr/\b$server\b/);
- $nb++ if c::Xtest($wanted_DISPLAY);
+ $nb++ if xf86misc::main::Xtest($wanted_DISPLAY);
if ($nb > 2) { #- one succeeded test is not enough :-(
$ugtk2::force_focus = 1;
log::l("AFAIK X server is up");
diff --git a/perl-install/mouse.pm b/perl-install/mouse.pm
index ed166a48f..62617feb7 100644
--- a/perl-install/mouse.pm
+++ b/perl-install/mouse.pm
@@ -424,7 +424,10 @@ sub change_mouse_live {
if (!$::testing) {
devices::make($mouse->{device});
symlinkf($mouse->{device}, "/dev/mouse");
- c::setMouseLive($ENV{DISPLAY}, $xId, $mouse->{nbuttons} < 3);
+ eval {
+ require xf86misc::main;
+ xf86misc::main::setMouseLive($ENV{DISPLAY}, $xId, $mouse->{nbuttons} < 3);
+ };
}
1;
}
diff --git a/perl-install/xf86misc/.cvsignore b/perl-install/xf86misc/.cvsignore
new file mode 100644
index 000000000..83a662f9d
--- /dev/null
+++ b/perl-install/xf86misc/.cvsignore
@@ -0,0 +1,5 @@
+main.bs
+main.c
+pm_to_blib
+blib
+Makefile_c
diff --git a/perl-install/xf86misc/Makefile b/perl-install/xf86misc/Makefile
new file mode 100644
index 000000000..2d874b989
--- /dev/null
+++ b/perl-install/xf86misc/Makefile
@@ -0,0 +1,10 @@
+.PHONY: clean
+
+main: %: %.xs
+ test -e Makefile_c || perl Makefile.PL
+ $(MAKE) -f Makefile_c LD_RUN_PATH= || $(MAKE) -f Makefile_c LD_RUN_PATH=
+ rm -f ../auto/xf86misc ; ln -s ../xf86misc/blib/arch/auto ../auto/xf86misc
+
+clean:
+ test ! -e Makefile_c || $(MAKE) -f Makefile_c clean
+ rm -f *~ *.o
diff --git a/perl-install/xf86misc/Makefile.PL b/perl-install/xf86misc/Makefile.PL
new file mode 100644
index 000000000..c0a1070cb
--- /dev/null
+++ b/perl-install/xf86misc/Makefile.PL
@@ -0,0 +1,15 @@
+use ExtUtils::MakeMaker;
+use MDK::Common;
+# See lib/ExtUtils/MakeMaker.pm for details of how to influence
+# the contents of the Makefile that is written.
+
+my $lib = arch() =~ /x86_64/ ? 'lib64' : 'lib';
+
+WriteMakefile(
+ 'NAME' => 'main',
+ 'MAKEFILE' => 'Makefile_c',
+ 'OPTIMIZE' => '-Os',
+ 'VERSION_FROM' => 'main.pm', # finds $VERSION
+ 'LIBS' => ["-L/usr/X11R6/$lib -lX11 -lXext -lXxf86misc"],
+ 'DEFINE' => '', # e.g., '-DHAVE_SOMETHING'
+);
diff --git a/perl-install/xf86misc/main.pm b/perl-install/xf86misc/main.pm
new file mode 100644
index 000000000..300e1aba0
--- /dev/null
+++ b/perl-install/xf86misc/main.pm
@@ -0,0 +1,12 @@
+package xf86misc::main; # $Id$
+
+use strict;
+use vars qw($VERSION @ISA);
+use DynaLoader;
+
+use vars qw($VERSION @ISA);
+@ISA = qw(DynaLoader);
+$VERSION = '0.01';
+xf86misc::main->bootstrap($VERSION);
+
+1;
diff --git a/perl-install/xf86misc/main.xs b/perl-install/xf86misc/main.xs
new file mode 100644
index 000000000..4dc1d8ade
--- /dev/null
+++ b/perl-install/xf86misc/main.xs
@@ -0,0 +1,73 @@
+#include "EXTERN.h"
+#include "perl.h"
+#include "XSUB.h"
+
+#include <X11/Xlib.h>
+#include <X11/extensions/xf86misc.h>
+
+#include <term.h>
+#undef max_colors
+
+void initIMPS2() {
+ unsigned char imps2_s1[] = { 243, 200, 243, 100, 243, 80, };
+ unsigned char imps2_s2[] = { 246, 230, 244, 243, 100, 232, 3, };
+
+ int fd = open("/dev/mouse", O_WRONLY);
+ if (fd < 0) return;
+
+ write (fd, imps2_s1, sizeof (imps2_s1));
+ usleep (30000);
+ write (fd, imps2_s2, sizeof (imps2_s2));
+ usleep (30000);
+ tcflush (fd, TCIFLUSH);
+ tcdrain(fd);
+}
+
+MODULE = xf86misc::main PACKAGE = xf86misc::main
+
+int
+Xtest(display)
+ char *display
+ CODE:
+ int pid;
+ if ((pid = fork()) == 0) {
+ Display *d = XOpenDisplay(display);
+ if (d) {
+ int child;
+ /* keep a client until some window is created, otherwise X server blinks to hell */
+ if ((child = fork()) == 0) {
+ XEvent event;
+ XSelectInput(d, DefaultRootWindow(d), SubstructureNotifyMask);
+ do {
+ XNextEvent(d, &event);
+ } while (event.type != CreateNotify);
+ XCloseDisplay(d);
+ exit(0);
+ }
+ }
+ _exit(d != NULL);
+ }
+ waitpid(pid, &RETVAL, 0);
+ OUTPUT:
+ RETVAL
+
+void
+setMouseLive(display, type, emulate3buttons)
+ char *display
+ int type
+ int emulate3buttons
+ CODE:
+ {
+ XF86MiscMouseSettings mseinfo;
+ Display *d = XOpenDisplay(display);
+ if (d) {
+ if (XF86MiscGetMouseSettings(d, &mseinfo) == True) {
+ mseinfo.type = type;
+ mseinfo.flags |= MF_REOPEN;
+ mseinfo.emulate3buttons = emulate3buttons;
+ XF86MiscSetMouseSettings(d, &mseinfo);
+ XFlush(d);
+ if (type == MTYPE_IMPS2) initIMPS2();
+ }
+ }
+ }