On 7/20/2012 8:35 AM, Yaakov (Cygwin/X) wrote:
On 2012-07-19 00:22, Yaakov (Cygwin/X) wrote:
On 2012-07-18 06:53, Ken Brown wrote:
When I build a package using cygport, I sometimes forget to run
cygport's "dep" command to make sure my setup.hint is up to date. I
think it would be useful for cygport to do this as part of its packaging
step. It could print out a list of dependencies or, better, print a
warning if there are dependencies that are not listed in any of the
setup.hint files.
I'm actually working on setup.hint generation in cygport, which would
work by defining [PKG_]CATEGORY, [PKG_]REQUIRES, [PKG_]SUMMARY, and
[PKG_]DESCRIPTION variables in the .cygport file itself, rather than
having to maintain a set of files for each package. The next natural,
albeit more difficult, step would be for cygport to automatically
generate the requires for each (sub)package based on the algorithm used
in "cygport deps", similar to what rpmbuild does for binary packages. Of
course, non-binary deps (e.g. commands called in scripts, or by fork(),
etc.) would still have to be explicitly defined.
The first version is now in cygport git master. See the Packaging
section of the manual for the variables you need to set in order for
this to work, and be sure to remove your .hint files from $C.
Wow, that was fast. Thanks!
I tested it on cygport itself, emacs, and texlive. I only found two
small glitches:
1. The setup.hint generated for emacs (but not emacs-X11) erroneously
listed perl and python in the "requires". I'm attaching my .cygport
file and the associated patches in case you want to try to replicate this.
2. If a package is listed in REQUIRES but then cygport also finds it as
a dependency, it gets listed twice in the generated setup.hint file.
Ken
--- origsrc/emacs-24.0.94/lisp/net/browse-url.el 2012-02-13
11:13:25.000000000 -0500
+++ src/emacs-24.0.94/lisp/net/browse-url.el 2012-04-01 14:53:40.592684900
-0400
@@ -467,7 +467,7 @@ commands reverses the effect of this var
;; it in anonymous cases. If it's not anonymous the next regexp
;; applies.
("^/\\([^:@]+@\\)?\\([^:]+\\):/*" . "ftp://\\1\\2/")
- ,@(if (memq system-type '(windows-nt ms-dos cygwin))
+ ,@(if (memq system-type '(windows-nt ms-dos))
'(("^\\([a-zA-Z]:\\)[\\/]" . "file:///\\1/")
("^[\\/][\\/]+" . "file://")))
("^/+" . "file:///"))
@@ -724,12 +724,6 @@ interactively. Turn the filename into a
(defun browse-url-file-url (file)
"Return the URL corresponding to FILE.
Use variable `browse-url-filename-alist' to map filenames to URLs."
- ;; De-munge Cygwin filenames before passing them to Windows browser.
- (if (eq system-type 'cygwin)
- (let ((winfile (with-output-to-string
- (call-process "cygpath" nil standard-output
- nil "-m" file))))
- (setq file (substring winfile 0 -1))))
(let ((coding (and (default-value 'enable-multibyte-characters)
(or file-name-coding-system
default-file-name-coding-system))))
=== modified file 'src/s/cygwin.h'
--- src/s/cygwin.h 2011-11-10 08:14:27 +0000
+++ src/s/cygwin.h 2012-01-02 18:20:53 +0000
@@ -58,7 +58,8 @@
if (-1 == openpty (&fd, &dummy, pty_name, 0, 0)) \
fd = -1; \
sigsetmask (mask); \
- emacs_close (dummy); \
+ if (fd >= 0) \
+ emacs_close (dummy); \
} \
while (0)
@@ -81,10 +82,6 @@
#define HAVE_SOCKETS
-/* vfork() interacts badly with setsid(), causing ptys to fail to
- change their controlling terminal */
-#define vfork fork
-
/* This should work (at least when compiling with gcc). But I have no way
or intention to verify or even test it. If you encounter a problem with
it, feel free to change this setting, but please add a comment here about
HOMEPAGE="http://www.gnu.org/software/emacs/"
SRC_URI="mirror://gnu/emacs/${P}.tar.gz"
DEPEND="libtiff-devel
libgif-devel
libjpeg-devel
pkgconfig(dbus-1)
pkgconfig(fontconfig)
pkgconfig(freetype2)
pkgconfig(gio-2.0)
pkgconfig(glib-2.0)
pkgconfig(gnutls)
pkgconfig(gtk+-2.0)
pkgconfig(librsvg-2.0)
pkgconfig(libxml-2.0)
pkgconfig(libpng14)
pkgconfig(ncursesw)
pkgconfig(sm)
pkgconfig(Wand)
pkgconfig(x11)
pkgconfig(xft)
pkgconfig(xpm)
pkgconfig(xrender)"
PATCH_URI="
adapt_to_new_cygstart.patch
cygwin.h.patch
xgselect-24.0.97.patch
"
PKG_NAMES="${PN} ${PN}-el ${PN}-X11"
PKG_HINTS="${PN} ${PN}-el ${PN}-X11"
CPPFLAGS=-I/usr/include/ncursesw
LDFLAGS=-L/usr/lib/ncursesw
CATEGORY="Editors Interpreters"
emacs_SUMMARY="The extensible, customizable, self-documenting real-time display
editor."
emacs_X11_SUMMARY="X11 binaries for Emacs."
emacs_el_SUMMARY="LISP source code for Emacs (including LEIM)."
emacs_DESCRIPTION="Emacs is a powerful, customizable, self-documenting,
modeless text
editor. Emacs contains special code editing features, a scripting
language (elisp), and the capability to read mail, news and more without
leaving the editor. This package supplies everything needed for a non-X11
emacs."
emacs_X11_DESCRIPTION="This package contains the X11 binaries for emacs.
Install
it if you want to run emacs using the X window system for
display. The binaries also can be used in non-X11 mode."
emacs_el_DESCRIPTION="This package contains the LISP source code for the various
emacs addons including code for input methods for
internationalization. Install it if you want to personalize built-in
emacs functionality in some way on your machine."
emacs_REQUIRES="xemacs-emacs-common alternatives"
emacs_X11_REQUIRES="alternatives emacs font-adobe-dpi75 font-misc-misc"
emacs_CONTENTS="
--exclude=usr/share/${PN}/${PV}/lisp*el.gz
--exclude=usr/share/${PN}/${PV}/leim*el.gz
--exclude=usr/bin/emacs-X11.exe
--exclude=etc/postinstall/emacs-X11.sh
--exclude=etc/preremove/emacs-X11.sh
etc/
usr/"
emacs_el_CONTENTS="
--exclude=usr/share/${PN}/${PV}/lisp*el
--exclude=usr/share/${PN}/${PV}/leim*el
--exclude=usr/share/${PN}/${PV}/lisp*elc
--exclude=usr/share/${PN}/${PV}/leim*elc
--exclude=usr/share/${PN}/${PV}/lisp/COPYING
--exclude=usr/share/${PN}/${PV}/lisp/README
--exclude=usr/share/${PN}/${PV}/lisp/calc/README
--exclude=usr/share/${PN}/${PV}/lisp/calc/README.prev
--exclude=usr/share/${PN}/${PV}/lisp/international/README
--exclude=usr/share/${PN}/${PV}/lisp/term/README
--exclude=usr/share/${PN}/${PV}/lisp/nxml/TODO
--exclude=usr/share/${PN}/${PV}/lisp/forms-d2.dat
usr/share/${PN}/${PV}/lisp
usr/share/${PN}/${PV}/leim"
emacs_X11_CONTENTS="
usr/bin/emacs-X11.exe
etc/postinstall/emacs-X11.sh
etc/preremove/emacs-X11.sh"
DIFF_EXCLUDES="loaddefs.el config.in *.elc loaddefs.el~ subdirs.el~ config.in~"
ACLOCAL_FLAGS='-I m4'
src_compile() {
cd ${S}
cygautoreconf
cd ${B}
cygconf --with-x=no
cygmake
cp -v src/emacs.exe emacs-nox.exe
make distclean
cygconf --without-gsettings --without-gconf
cygmake
mv -v emacs-nox.exe src/emacs-nox.exe
cp -v src/emacs.exe src/emacs-X11.exe
}
src_install() {
cd ${B}
cyginstall
dobin src/emacs-nox.exe
dobin src/emacs-X11.exe
dobin ${C}/make-emacs-shortcut
insinto /usr/bin
doins ${S}/nt/icons/emacs.ico
cd ${D}
rm -fv \
usr/bin/${P}.exe \
usr/bin/emacs.exe \
usr/bin/b2m.exe \
usr/bin/rcs-checkin \
usr/bin/ctags.exe \
usr/bin/etags.exe \
usr/share/man/man1/ctags* \
usr/share/man/man1/etags*
}
--- origsrc/emacs-24.0.97/src/xfns.c 2012-05-14 08:00:02.000000000 -0400
+++ src/emacs-24.0.97/src/xfns.c 2012-05-21 07:20:22.595785300 -0400
@@ -136,7 +136,7 @@ char *gray_bitmap_bits = gray_bits;
/* Nonzero if using X. */
-static int x_in_use;
+int x_in_use;
static Lisp_Object Qnone;
static Lisp_Object Qsuppress_icon;
--- origsrc/emacs-24.0.97/src/xgselect.c 2012-05-14 08:00:02.000000000
-0400
+++ src/emacs-24.0.97/src/xgselect.c 2012-05-21 07:18:32.983123300 -0400
@@ -27,28 +27,33 @@ along with GNU Emacs. If not, see <http
#include <glib.h>
#include <errno.h>
#include <setjmp.h>
+#include "xterm.h"
static GPollFD *gfds;
static ptrdiff_t gfds_size;
int
-xg_select (int max_fds, SELECT_TYPE *rfds, SELECT_TYPE *wfds, SELECT_TYPE
*efds,
+xg_select (int fds_lim, SELECT_TYPE *rfds, SELECT_TYPE *wfds, SELECT_TYPE
*efds,
EMACS_TIME *timeout)
{
SELECT_TYPE all_rfds, all_wfds;
EMACS_TIME tmo, *tmop = timeout;
- GMainContext *context = g_main_context_default ();
+ GMainContext *context;
int have_wfds = wfds != NULL;
- int n_gfds = 0, our_tmo = 0, retval = 0, our_fds = 0;
+ int n_gfds = 0, our_tmo = 0, retval = 0, our_fds = 0, max_fds = fds_lim - 1;
int i, nfds, tmo_in_millisec;
+ if (!x_in_use)
+ return select (fds_lim, rfds, wfds, efds, timeout);
+
if (rfds) memcpy (&all_rfds, rfds, sizeof (all_rfds));
else FD_ZERO (&all_rfds);
if (wfds) memcpy (&all_wfds, wfds, sizeof (all_rfds));
else FD_ZERO (&all_wfds);
/* Update event sources in GLib. */
+ context = g_main_context_default ();
g_main_context_pending (context);
do {
@@ -97,14 +102,14 @@ xg_select (int max_fds, SELECT_TYPE *rfd
if (our_tmo) tmop = &tmo;
}
- nfds = select (max_fds+1, &all_rfds, have_wfds ? &all_wfds : NULL,
- efds, tmop);
+ fds_lim = max_fds + 1;
+ nfds = select (fds_lim, &all_rfds, have_wfds ? &all_wfds : NULL, efds, tmop);
if (nfds < 0)
retval = nfds;
else if (nfds > 0)
{
- for (i = 0; i < max_fds+1; ++i)
+ for (i = 0; i < fds_lim; ++i)
{
if (FD_ISSET (i, &all_rfds))
{
--- origsrc/emacs-24.0.97/src/xterm.h 2012-04-07 23:03:02.000000000 -0400
+++ src/emacs-24.0.97/src/xterm.h 2012-05-21 07:19:12.967143300 -0400
@@ -1038,6 +1038,7 @@ extern void x_clipboard_manager_save_all
extern struct x_display_info * check_x_display_info (Lisp_Object);
extern Lisp_Object x_get_focus_frame (struct frame *);
+extern int x_in_use;
#ifdef USE_GTK
extern int xg_set_icon (struct frame *, Lisp_Object);