Bug 146979 - editors/emacs configuration ignores "-D WITHOUT_X11"
Summary: editors/emacs configuration ignores "-D WITHOUT_X11"
Status: Closed FIXED
Alias: None
Product: Ports & Packages
Classification: Unclassified
Component: Individual Port(s) (show other bugs)
Version: Latest
Hardware: Any Any
: Normal Affects Only Me
Assignee: Ashish SHUKLA
URL:
Keywords:
Depends on:
Blocks:
 
Reported: 2010-05-25 23:20 UTC by phoffman
Modified: 2010-09-27 02:24 UTC (History)
0 users

See Also:


Attachments
emacs.diff (13.78 KB, patch)
2010-06-10 02:02 UTC, Ashish Shukla
no flags Details | Diff

Note You need to log in before you can comment on or make changes to this bug.
Description phoffman 2010-05-25 23:20:01 UTC
In a fresh editors/emacs, 'make -D WITHOUT_X11' still shows X11 as selected in the initial configurations screen. Even if you deselect it, a bunch of related options are still selected. It seems that the Makefile is somewhat busted in that command-line options are ignored for the configuration. I would think that -D WITHOUT_X11 would cause the following options to be set to OFF: GCONF, GIF, GTK2, JPEG, M17N, MOTIF, OTF, PNG, SOUND, SVG, TIFF, X11, XAW, XAW3D,  XFT, XIM, and XPM. (That's a guess, I could have over-added there.)

I'm no Makefile expert, so I don't know how to fix this, but it seems completely wrong that specifying a make variable is ignored in the configuration.

How-To-Repeat: cd /usr/ports/editors/emacs; make -D WITHOUT_X11
See that X11 is selected in the configuration.
Comment 1 Edwin Groothuis freebsd_committer freebsd_triage 2010-05-25 23:22:45 UTC
Maintainer of editors/emacs,

Please note that PR ports/146979 has just been submitted.

If it contains a patch for an upgrade, an enhancement or a bug fix
you agree on, reply to this email stating that you approve the patch
and a committer will take care of it.

The full text of the PR can be found at:
    http://www.freebsd.org/cgi/query-pr.cgi?pr=ports/146979

-- 
Edwin Groothuis via the GNATS Auto Assign Tool
edwin@FreeBSD.org
Comment 2 Edwin Groothuis freebsd_committer freebsd_triage 2010-05-25 23:22:47 UTC
State Changed
From-To: open->feedback

Awaiting maintainers feedback (via the GNATS Auto Assign Tool)
Comment 3 Ashish Shukla 2010-05-25 23:51:39 UTC
Hi Paul,

The values of the OPTIONS (displayed by 'make config') are stored in
/var/db/ports/${PORTNAME}/options file. 'make config' reads/writes that file
and doesn't care about what options are set/unset, and there is no way you can
specify any dependency.

Just think of that interface as a board of MCBs[1], where you can turn off the
main MCB, and power will cut off, but that doesn't cause state of other MCBs
to change.

References:
[1]  http://en.wikipedia.org/wiki/Circuit_breaker

I hope this clarifies your doubt.
-- 
Ashish SHUKLA

Sent via Gnus from GNU Emacs
Comment 4 phoffman 2010-05-26 00:28:14 UTC
At 4:21 AM +0530 5/26/10, Ashish SHUKLA wrote:
>Hi Paul,
>
>The values of the OPTIONS (displayed by 'make config') are stored in
>/var/db/ports/${PORTNAME}/options file. 'make config' reads/writes that file
>and doesn't care about what options are set/unset, and there is no way you can
>specify any dependency.
>
>Just think of that interface as a board of MCBs[1], where you can turn off the
>main MCB, and power will cut off, but that doesn't cause state of other MCBs
>to change.
>
>References:
>[1]  http://en.wikipedia.org/wiki/Circuit_breaker
>
>I hope this clarifies your doubt.

It does not. What does it mean for a user to say "make -DWITHOUT_X11", sees the config, and leaves "X11" checked? Will "make" require X11 or not?

I'm pretty sure "make -DWITHOUT_X11" worked as expected a few years ago when I created editors/emacs-nox11.

There is a strong need for servers that don't want to have lots of X11-specific goop installed to be able to install current Emacs. The config dialog should not fight with that.

Is the use of the config dialog inherently incompatible with -D variables?
Comment 5 Ashish Shukla 2010-05-26 00:40:34 UTC
Paul Hoffman writes:

[...]

> I'm pretty sure "make -DWITHOUT_X11" worked as expected a few years ago when
> I created editors/emacs-nox11.


#v+
% make -C /usr/ports/editors/emacs -DWITHOUT_X11 -V CONFIGURE_ARGS
--without-x --prefix=/usr/local ${_LATE_CONFIGURE_ARGS}
#v-

> There is a strong need for servers that don't want to have lots of
> X11-specific goop installed to be able to install current Emacs. The config
> dialog should not fight with that.


> Is the use of the config dialog inherently incompatible with -D variables?


config UI is just a helper UI to let you set OPTIONS which a port claims to
support. You can set those OPTIONS over command-line also, and how those
OPTIONS are being interpreted is upto the port Makefile.

HTH
-- 
Ashish SHUKLA

Sent via Gnus from GNU Emacs
Comment 6 phoffman 2010-05-26 03:55:44 UTC
At 5:10 AM +0530 5/26/10, Ashish SHUKLA wrote:
> > Is the use of the config dialog inherently incompatible with -D variables?
>
>config UI is just a helper UI to let you set OPTIONS which a port claims to
>support.

Right.

>You can set those OPTIONS over command-line also, and how those
>OPTIONS are being interpreted is upto the port Makefile.

Sure, but the Makefile for emacs ignores the commandline arguments when it sets the defaults for the config UI. Shouldn't the Makefile first process the commandline arguments and make sensible defaults?

And, again, I have to ask: What does it mean for a user to say "make -DWITHOUT_X11", sees the config, and leaves "X11" checked? Will "make" require X11 or not? It is far from obvious.

--Paul Hoffman
Comment 7 swell.k 2010-05-26 06:13:10 UTC
SOUND support is not related to X11. It may depend on alsa-lib when it's
installed but that's all. This should let you build with minimum
dependencies (only devel/gmake)

  $ make WITHOUT_X11= WITHOUT_DBUS= BATCH=

I'm not sure what GETTEXT is doing there, though. It's not used by emacs
directly and is useless for nox11 builds. And this comment gives pretty
clear answer in which specific case it's needed

  # Solaris requires -lintl if you want strerror (which calls dgettext)
  # to return localized messages.
  AC_CHECK_LIB(intl, dgettext)

--- a.diff begins here ---
Index: editors/emacs/Makefile
===================================================================
RCS file: /a/.cvsup/ports/editors/emacs/Makefile,v
retrieving revision 1.95
diff -u -p -r1.95 Makefile
--- editors/emacs/Makefile	21 May 2010 19:51:04 -0000	1.95
+++ editors/emacs/Makefile	26 May 2010 05:12:18 -0000
@@ -28,8 +28,6 @@ GNU_CONFIGURE=	yes
 USE_GMAKE=	yes
 USE_BZIP2=	yes
 
-USE_GETTEXT=	yes
-
 MAN1=		b2m.1 ctags.1 ebrowse.1 emacs.1 emacsclient.1 etags.1 \
 		grep-changelog.1 rcs-checkin.1
 PLIST_SUB=	EMACS_VER=${EMACS_VER} EMACS_ARCH=${CONFIGURE_TARGET}
--- a.diff ends here ---
Comment 8 Ashish Shukla 2010-05-26 15:56:14 UTC
[CCing to keramida@ for his inputs, if there any]

Anonymous  writes:
> SOUND support is not related to X11. It may depend on alsa-lib when it's
> installed but that's all. This should let you build with minimum
> dependencies (only devel/gmake)


SOUND support doesn't require ALSA on BSDs. It uses OSS, and works great.

M-x play-sound-file works for me.

But yes, Thanks for reminding that its not dependent upon X11, and I should
take that WITHOUT_SOUND block from the WITHOUT_X11 block.

>   $ make WITHOUT_X11= WITHOUT_DBUS= BATCH=


> I'm not sure what GETTEXT is doing there, though. It's not used by emacs
> directly and is useless for nox11 builds. And this comment gives pretty
> clear answer in which specific case it's needed


Right, we can take that out, or make that support optional via NLS knob, in
case they later decide to use gettext functionality.

>   # Solaris requires -lintl if you want strerror (which calls dgettext)
>   # to return localized messages.
>   AC_CHECK_LIB(intl, dgettext)


> --- a.diff begins here ---
> Index: editors/emacs/Makefile
> ===================================================================
> RCS file: /a/.cvsup/ports/editors/emacs/Makefile,v
> retrieving revision 1.95
> diff -u -p -r1.95 Makefile
> --- editors/emacs/Makefile	21 May 2010 19:51:04 -0000	1.95
> +++ editors/emacs/Makefile	26 May 2010 05:12:18 -0000
> @@ -28,8 +28,6 @@ GNU_CONFIGURE=	yes
>  USE_GMAKE=	yes
>  USE_BZIP2=	yes

 
> -USE_GETTEXT=	yes
> -
>  MAN1=		b2m.1 ctags.1 ebrowse.1 emacs.1 emacsclient.1 etags.1 \
>  		grep-changelog.1 rcs-checkin.1
>  PLIST_SUB=	EMACS_VER=${EMACS_VER} EMACS_ARCH=${CONFIGURE_TARGET}
> --- a.diff ends here ---


Thanks for your diff, I'll modify/integrate it and file a PR.

-- 
Ashish SHUKLA

Sent via Gnus from GNU Emacs
Comment 9 Ashish Shukla 2010-05-26 18:51:30 UTC
Ashish SHUKLA writes:

[...]

>> # Solaris requires -lintl if you want strerror (which calls dgettext)
>> # to return localized messages.
>> AC_CHECK_LIB(intl, dgettext)


>> --- a.diff begins here ---
>> Index: editors/emacs/Makefile
>> ===================================================================
>> RCS file: /a/.cvsup/ports/editors/emacs/Makefile,v
>> retrieving revision 1.95
>> diff -u -p -r1.95 Makefile
>> --- editors/emacs/Makefile	21 May 2010 19:51:04 -0000	1.95
>> +++ editors/emacs/Makefile	26 May 2010 05:12:18 -0000
>> @@ -28,8 +28,6 @@ GNU_CONFIGURE=	yes
>> USE_GMAKE=	yes
>> USE_BZIP2=	yes

 
>> -USE_GETTEXT=	yes
>> -
>> MAN1=		b2m.1 ctags.1 ebrowse.1 emacs.1 emacsclient.1 etags.1 \
>> grep-changelog.1 rcs-checkin.1
>> PLIST_SUB=	EMACS_VER=${EMACS_VER} EMACS_ARCH=${CONFIGURE_TARGET}
>> --- a.diff ends here ---


I'm not using the patch as it is, since emacs links with libintl.so if it
founds one, and its dependencies depend on libintl directly or indirectly. In
case dependency is not registered, then wiping off gettext won't cause emacs
to deinstall, and might cause emacs to stop working.

#v+
% readelf -d /usr/local/bin/emacs |fgrep intl
 0x0000000000000001 (NEEDED)             Shared library: [libintl.so.8]
#v-

For the patch, check the PR ports/147087.

Thanks
-- 
Ashish SHUKLA

Sent via Gnus from GNU Emacs
Comment 10 Ashish Shukla 2010-05-26 19:38:24 UTC
Paul Hoffman writes:
> At 5:10 AM +0530 5/26/10, Ashish SHUKLA wrote:
>> > Is the use of the config dialog inherently incompatible with -D variables?
>> 
>> config UI is just a helper UI to let you set OPTIONS which a port claims to
>> support.


> Right.


>> You can set those OPTIONS over command-line also, and how those
>> OPTIONS are being interpreted is upto the port Makefile.


> Sure, but the Makefile for emacs ignores the commandline arguments when it
> sets the defaults for the config UI. Shouldn't the Makefile first process
> the commandline arguments and make sensible defaults?


> And, again, I have to ask: What does it mean for a user to say "make
> -DWITHOUT_X11", sees the config, and leaves "X11" checked? Will "make"
> require X11 or not? It is far from obvious.


It all depends on how the Makefile is written. May be read porters handbook
for better understanding of how the system works.

-- 
Ashish SHUKLA

Sent via Gnus from GNU Emacs
Comment 11 swell.k 2010-05-26 21:26:36 UTC
wahjava@gmail.com (Ashish SHUKLA) writes:

> Ashish SHUKLA writes:
>
> [...]
>
>>> # Solaris requires -lintl if you want strerror (which calls dgettext)
>>> # to return localized messages.
>>> AC_CHECK_LIB(intl, dgettext)
>
>>> --- a.diff begins here ---
>>> Index: editors/emacs/Makefile
>>> ===================================================================
>>> RCS file: /a/.cvsup/ports/editors/emacs/Makefile,v
>>> retrieving revision 1.95
>>> diff -u -p -r1.95 Makefile
>>> --- editors/emacs/Makefile	21 May 2010 19:51:04 -0000	1.95
>>> +++ editors/emacs/Makefile	26 May 2010 05:12:18 -0000
>>> @@ -28,8 +28,6 @@ GNU_CONFIGURE=	yes
>>> USE_GMAKE=	yes
>>> USE_BZIP2=	yes
>  
>>> -USE_GETTEXT=	yes
>>> -
>>> MAN1=		b2m.1 ctags.1 ebrowse.1 emacs.1 emacsclient.1 etags.1 \
>>> grep-changelog.1 rcs-checkin.1
>>> PLIST_SUB=	EMACS_VER=${EMACS_VER} EMACS_ARCH=${CONFIGURE_TARGET}
>>> --- a.diff ends here ---
>
> I'm not using the patch as it is, since emacs links with libintl.so if it
> founds one, and its dependencies depend on libintl directly or indirectly. In
> case dependency is not registered, then wiping off gettext won't cause emacs
> to deinstall, and might cause emacs to stop working.
>
> #v+
> % readelf -d /usr/local/bin/emacs |fgrep intl
>  0x0000000000000001 (NEEDED)             Shared library: [libintl.so.8]
> #v-

I think such dependencies should pull gettext themselves, not emacs.
If they do not have GETTEXT in their Makefile but require -lintl when
linking then they should be fixed. Can you list them?

Besides, some ports do not respect WITHOUT_NLS ifdef (e.g., gtk and
glib) and it's useless for emacs built WITHOUT_X11 and WITHOUT_DBUS.

>
> For the patch, check the PR ports/147087.
>
> Thanks
Comment 12 swell.k 2010-05-26 22:01:06 UTC
wahjava@gmail.com (Ashish SHUKLA) writes:

> [CCing to keramida@ for his inputs, if there any]
>
> Anonymous  writes:
>> SOUND support is not related to X11. It may depend on alsa-lib when it's
>> installed but that's all. This should let you build with minimum
>> dependencies (only devel/gmake)
>
> SOUND support doesn't require ALSA on BSDs. It uses OSS, and works
> great.

That's why I said `may' depend. But it's linked against uncoditionally
when alsa-lib is installed and sound support is specified. After
ports/145964 gets committed you'd need to patch emacs' configure script
to decouple sound support from alsa-lib.

>
> M-x play-sound-file works for me.
>
> But yes, Thanks for reminding that its not dependent upon X11, and I should
> take that WITHOUT_SOUND block from the WITHOUT_X11 block.
>
Comment 13 swell.k 2010-05-27 01:22:49 UTC
I've filed ports/147103 that should address this PR. Do you *both*
approve it?
Comment 14 Giorgos Keramidas freebsd_committer freebsd_triage 2010-05-27 06:32:45 UTC
On Wed, 26 May 2010 20:26:14 +0530, wahjava@gmail.com (Ashish SHUKLA) wrote:
> [CCing to keramida@ for his inputs, if there any]
>
> Anonymous  writes:
>> SOUND support is not related to X11. It may depend on alsa-lib when it's
>> installed but that's all. This should let you build with minimum
>> dependencies (only devel/gmake)
>
> SOUND support doesn't require ALSA on BSDs. It uses OSS, and works great.
>
> M-x play-sound-file works for me.
>
> But yes, Thanks for reminding that its not dependent upon X11, and I should
> take that WITHOUT_SOUND block from the WITHOUT_X11 block.
>
>>   $ make WITHOUT_X11= WITHOUT_DBUS= BATCH=
>
>> I'm not sure what GETTEXT is doing there, though. It's not used by emacs
>> directly and is useless for nox11 builds. And this comment gives pretty
>> clear answer in which specific case it's needed
>
> Right, we can take that out, or make that support optional via NLS knob, in
> case they later decide to use gettext functionality.

Emacs itself doesn't need gettext when it is built without X11.  There
are, however, other libraries that Emacs links with which pull gettext
as an indirect dependency.

There are libraries that Emacs links with which require libintl:

  $ for libname in $( ( cd /usr/local/bin ; ldd emacs ) | \
                      awk '{print $3}' | fgrep /local/ | \
                      sort | uniq ) ; do
      ldd $libname 2>&1 | sed -n -e 1p -e /int/p ; \
    done
  /usr/local/lib/libORBit-2.so.0:
        libintl.so.8 => /usr/local/lib/libintl.so.8 (0x28313000)
  /usr/local/lib/libatk-1.0.so.0:
        libintl.so.8 => /usr/local/lib/libintl.so.8 (0x282d2000)
  /usr/local/lib/libcroco-0.6.so.3:
        libintl.so.8 => /usr/local/lib/libintl.so.8 (0x282b1000)
  /usr/local/lib/libdbus-glib-1.so.2:
        libintl.so.8 => /usr/local/lib/libintl.so.8 (0x28316000)
  /usr/local/lib/libgconf-2.so.4:
        libintl.so.8 => /usr/local/lib/libintl.so.8 (0x283a2000)
  /usr/local/lib/libgdk-x11-2.0.so.0:
        libintl.so.8 => /usr/local/lib/libintl.so.8 (0x28d00000)
  /usr/local/lib/libgdk_pixbuf-2.0.so.0:
        libintl.so.8 => /usr/local/lib/libintl.so.8 (0x28362000)
  /usr/local/lib/libgio-2.0.so.0:
        libintl.so.8 => /usr/local/lib/libintl.so.8 (0x2837b000)
  /usr/local/lib/libglib-2.0.so.0:
        libintl.so.8 => /usr/local/lib/libintl.so.8 (0x283d4000)
  /usr/local/lib/libgmodule-2.0.so.0:
        libintl.so.8 => /usr/local/lib/libintl.so.8 (0x283d8000)
  /usr/local/lib/libgobject-2.0.so.0:
        libintl.so.8 => /usr/local/lib/libintl.so.8 (0x282b8000)
  /usr/local/lib/libgsf-1.so.114:
        libintl.so.8 => /usr/local/lib/libintl.so.8 (0x28a44000)
  /usr/local/lib/libgthread-2.0.so.0:
        libintl.so.8 => /usr/local/lib/libintl.so.8 (0x283d9000)
  /usr/local/lib/libgtk-x11-2.0.so.0:
        libintl.so.8 => /usr/local/lib/libintl.so.8 (0x290cb000)
  /usr/local/lib/libm17n-core.so.3:
        libintl.so.8 => /usr/local/lib/libintl.so.8 (0x281ef000)
  /usr/local/lib/libm17n-flt.so.3:
        libintl.so.8 => /usr/local/lib/libintl.so.8 (0x281f8000)
  /usr/local/lib/libpango-1.0.so.0:
        libintl.so.8 => /usr/local/lib/libintl.so.8 (0x282fc000)
  /usr/local/lib/libpangocairo-1.0.so.0:
        libintl.so.8 => /usr/local/lib/libintl.so.8 (0x28abe000)
  /usr/local/lib/libpangoft2-1.0.so.0:
        libintl.so.8 => /usr/local/lib/libintl.so.8 (0x2832d000)
  /usr/local/lib/librsvg-2.so.2:
        libintl.so.8 => /usr/local/lib/libintl.so.8 (0x28e29000)

ISTR that we discovered the dependency with gettext when we linked with
the m17n library.  It's not a direct dependency of Emacs, but it should
stay if you ask me.
Comment 15 swell.k 2010-05-27 10:00:22 UTC
keramida@freebsd.org (Giorgos Keramidas) writes:

> On Wed, 26 May 2010 20:26:14 +0530, wahjava@gmail.com (Ashish SHUKLA) wrote:
>> [CCing to keramida@ for his inputs, if there any]
>>
>> Anonymous  writes:
>>> SOUND support is not related to X11. It may depend on alsa-lib when it's
>>> installed but that's all. This should let you build with minimum
>>> dependencies (only devel/gmake)
>>
>> SOUND support doesn't require ALSA on BSDs. It uses OSS, and works great.
>>
>> M-x play-sound-file works for me.
>>
>> But yes, Thanks for reminding that its not dependent upon X11, and I should
>> take that WITHOUT_SOUND block from the WITHOUT_X11 block.
>>
>>>   $ make WITHOUT_X11= WITHOUT_DBUS= BATCH=
>>
>>> I'm not sure what GETTEXT is doing there, though. It's not used by emacs
>>> directly and is useless for nox11 builds. And this comment gives pretty
>>> clear answer in which specific case it's needed
>>
>> Right, we can take that out, or make that support optional via NLS knob, in
>> case they later decide to use gettext functionality.
>
> Emacs itself doesn't need gettext when it is built without X11.  There
> are, however, other libraries that Emacs links with which pull gettext
> as an indirect dependency.

x11: gettext is pulled by gconf2, gtk2, rsvg2 (via gtk2). You can use X11
with Xaw, Xaw3d or Motif toolkit.

nox11: gettext is not used by DBUS because emacs doesn't depend on glib2 (and
dbus-glib). BTW, notice `-pthread':

  cc -nostdlib `./prefix-args -Xlinker  -L/usr/local/lib -znocombreloc` -Wl,-znocombreloc  -o temacs pre-crt0.o /usr/lib/crt1.o /usr/lib/crti.o dispnew.o frame.o scroll.o xdisp.o menu.o  window.o charset.o coding.o category.o ccl.o character.o chartab.o cm.o term.o terminal.o xfaces.o   dbusbind.o emacs.o keyboard.o macros.o keymap.o sysdep.o buffer.o filelock.o insdel.o marker.o minibuf.o fileio.o dired.o filemode.o cmds.o casetab.o casefiddle.o indent.o search.o regex.o undo.o alloc.o data.o doc.o editfn s.o callint.o eval.o floatfns.o fns.o font.o print.o lread.o syntax.o unexelf.o bytecode.o process.o callproc.o region-cache.o sound.o atimer.o doprnt.o strftime.o intervals.o textprop.o composite.o md5.o     terminfo.o lastfile.o gmalloc.o  vm-limit.o  mktime.o      -pthread -L/usr/pkg/lib -ldbus-1 -lutil -lncurses    -lm -lgcc -lc -lgcc /usr/lib/crtn.o
  /usr/pkg/lib/libdbus-1.so: undefined reference to `pthread_condattr_destroy'
  /usr/pkg/lib/libdbus-1.so: undefined reference to `pthread_condattr_init'
  /usr/pkg/lib/libdbus-1.so: undefined reference to `pthread_condattr_setclock'
  collect2: ld returned 1 exit status

I guess it expects `-lpthread' not `-pthread' in `pkg-config dbus-1 --libs'
output.

--- a.diff begins here ---
Index: editors/emacs/Makefile
===================================================================
RCS file: /a/.cvsup/ports/editors/emacs/Makefile,v
retrieving revision 1.95
diff -u -p -r1.95 Makefile
--- editors/emacs/Makefile	21 May 2010 19:51:04 -0000	1.95
+++ editors/emacs/Makefile	27 May 2010 08:54:00 -0000
@@ -219,6 +216,7 @@ BROKEN= Does not currently build with db
 post-patch:
 	@${RM} -f ${WRKSRC}/info/*
 	@${REINPLACE_CMD} -e "s/%%EMACS_VER%%/${EMACS_VER}/g" -e "s/%%DATADIR%%/${DATADIR:C/\//\\\//g}/g" ${WRKSRC}/sources.el
+	@${REINPLACE_CMD} -e '/^DBUS_LIBS/s/$$/ -lpthread/' ${WRKSRC}/src/Makefile.in
 
 .if defined(WITH_SOURCES)
 post-install:
--- a.diff ends here ---
Comment 16 Ashish Shukla 2010-05-27 10:15:45 UTC
Anonymous  writes:
> keramida@freebsd.org (Giorgos Keramidas) writes:

>> On Wed, 26 May 2010 20:26:14 +0530, wahjava@gmail.com (Ashish SHUKLA) wrote:
>>> [CCing to keramida@ for his inputs, if there any]
>>> 
>>> Anonymous  writes:
>>>> SOUND support is not related to X11. It may depend on alsa-lib when it's
>>>> installed but that's all. This should let you build with minimum
>>>> dependencies (only devel/gmake)
>>> 
>>> SOUND support doesn't require ALSA on BSDs. It uses OSS, and works great.
>>> 
>>> M-x play-sound-file works for me.
>>> 
>>> But yes, Thanks for reminding that its not dependent upon X11, and I should
>>> take that WITHOUT_SOUND block from the WITHOUT_X11 block.
>>> 
>>>> $ make WITHOUT_X11= WITHOUT_DBUS= BATCH=
>>> 
>>>> I'm not sure what GETTEXT is doing there, though. It's not used by emacs
>>>> directly and is useless for nox11 builds. And this comment gives pretty
>>>> clear answer in which specific case it's needed
>>> 
>>> Right, we can take that out, or make that support optional via NLS knob, in
>>> case they later decide to use gettext functionality.
>> 
>> Emacs itself doesn't need gettext when it is built without X11.  There
>> are, however, other libraries that Emacs links with which pull gettext
>> as an indirect dependency.

> x11: gettext is pulled by gconf2, gtk2, rsvg2 (via gtk2). You can use X11
> with Xaw, Xaw3d or Motif toolkit.

> nox11: gettext is not used by DBUS because emacs doesn't depend on glib2 (and
> dbus-glib). BTW, notice `-pthread':

>   cc -nostdlib `./prefix-args -Xlinker  -L/usr/local/lib -znocombreloc` -Wl,-znocombreloc  -o temacs pre-crt0.o /usr/lib/crt1.o /usr/lib/crti.o dispnew.o frame.o scroll.o xdisp.o menu.o  window.o charset.o coding.o category.o ccl.o character.o chartab.o cm.o term.o terminal.o xfaces.o   dbusbind.o emacs.o keyboard.o macros.o keymap.o sysdep.o buffer.o filelock.o insdel.o marker.o minibuf.o fileio.o dired.o filemode.o cmds.o casetab.o casefiddle.o indent.o search.o regex.o undo.o alloc.o data.o doc.o edit fns.o callint.o eval.o floatfns.o fns.o font.o print.o lread.o syntax.o unexelf.o bytecode.o process.o callproc.o region-cache.o sound.o atimer.o doprnt.o strftime.o intervals.o textprop.o composite.o md5.o     terminfo.o lastfile.o gmalloc.o  vm-limit.o  mktime.o      -pthread -L/usr/pkg/lib -ldbus-1 -lutil -lncurses    -lm -lgcc -lc -lgcc /usr/lib/crtn.o
>   /usr/pkg/lib/libdbus-1.so: undefined reference to `pthread_condattr_destroy'
>   /usr/pkg/lib/libdbus-1.so: undefined reference to `pthread_condattr_init'
>   /usr/pkg/lib/libdbus-1.so: undefined reference to `pthread_condattr_setclock'
>   collect2: ld returned 1 exit status

> I guess it expects `-lpthread' not `-pthread' in `pkg-config dbus-1 --libs'
> output.

> --- a.diff begins here ---
> Index: editors/emacs/Makefile
> ===================================================================
> RCS file: /a/.cvsup/ports/editors/emacs/Makefile,v
> retrieving revision 1.95
> diff -u -p -r1.95 Makefile
> --- editors/emacs/Makefile	21 May 2010 19:51:04 -0000	1.95
> +++ editors/emacs/Makefile	27 May 2010 08:54:00 -0000
> @@ -219,6 +216,7 @@ BROKEN= Does not currently build with db
>  post-patch:
>  	@${RM} -f ${WRKSRC}/info/*
>  	@${REINPLACE_CMD} -e "s/%%EMACS_VER%%/${EMACS_VER}/g" -e "s/%%DATADIR%%/${DATADIR:C/\//\\\//g}/g" ${WRKSRC}/sources.el
> +	@${REINPLACE_CMD} -e '/^DBUS_LIBS/s/$$/ -lpthread/' ${WRKSRC}/src/Makefile.in
 
>  .if defined(WITH_SOURCES)
>  post-install:
> --- a.diff ends here ---

-- 
Ashish SHUKLA

Sent via Gnus from GNU Emacs
Comment 17 Ashish Shukla 2010-05-27 10:18:35 UTC
[sorry for the last reply, I pressed C-c C-c instead of C-c C-e.]

Anonymous  writes:

[...]

>   cc -nostdlib `./prefix-args -Xlinker  -L/usr/local/lib -znocombreloc` -Wl,-znocombreloc  -o temacs pre-crt0.o /usr/lib/crt1.o /usr/lib/crti.o dispnew.o frame.o scroll.o xdisp.o menu.o  window.o charset.o coding.o category.o ccl.o character.o chartab.o cm.o term.o terminal.o xfaces.o   dbusbind.o emacs.o keyboard.o macros.o keymap.o sysdep.o buffer.o filelock.o insdel.o marker.o minibuf.o fileio.o dired.o filemode.o cmds.o casetab.o casefiddle.o indent.o search.o regex.o undo.o alloc.o data.o doc.o editfns.o callint.o eval.o floatfns.o fns.o font.o print.o lread.o syntax.o unexelf.o bytecode.o process.o callproc.o region-cache.o sound.o atimer.o doprnt.o strftime.o intervals.o textprop.o composite.o md5.o     terminfo.o lastfile.o gmalloc.o  vm-limit.o  mktime.o      -pthread -L/usr/pkg/lib -ldbus-1 -lutil -lncurses    -lm -lgcc -lc -lgcc /usr/lib/crtn.o
>   /usr/pkg/lib/libdbus-1.so: undefined reference to `pthread_condattr_destroy'
>   /usr/pkg/lib/libdbus-1.so: undefined reference to `pthread_condattr_init'
>   /usr/pkg/lib/libdbus-1.so: undefined reference to `pthread_condattr_setclock'
>   collect2: ld returned 1 exit status


> I guess it expects `-lpthread' not `-pthread' in `pkg-config dbus-1 --libs'
> output.


I assume you're on FreeBSD 6.x. Correct me, if I'm wrong.

BtW, we already discussed this, and according to Pav (pav@), '-pthread' is the
way to go, not '-lpthread'.

Do you think it would be nice to have a freebsd-emacs@ list ? 

-- 
Ashish SHUKLA

Sent via Gnus from GNU Emacs
Comment 18 swell.k 2010-05-27 10:32:45 UTC
wahjava@gmail.com (Ashish SHUKLA) writes:

> [sorry for the last reply, I pressed C-c C-c instead of C-c C-e.]
>
> Anonymous  writes:
>
> [...]
>
>>   cc -nostdlib `./prefix-args -Xlinker  -L/usr/local/lib -znocombreloc` -Wl,-znocombreloc  -o temacs pre-crt0.o /usr/lib/crt1.o /usr/lib/crti.o dispnew.o frame.o scroll.o xdisp.o menu.o  window.o charset.o coding.o category.o ccl.o character.o chartab.o cm.o term.o terminal.o xfaces.o   dbusbind.o emacs.o keyboard.o macros.o keymap.o sysdep.o buffer.o filelock.o insdel.o marker.o minibuf.o fileio.o dired.o filemode.o cmds.o casetab.o casefiddle.o indent.o search.o regex.o undo.o alloc.o data.o doc.o edi tfns.o callint.o eval.o floatfns.o fns.o font.o print.o lread.o syntax.o unexelf.o bytecode.o process.o callproc.o region-cache.o sound.o atimer.o doprnt.o strftime.o intervals.o textprop.o composite.o md5.o     terminfo.o lastfile.o gmalloc.o  vm-limit.o  mktime.o      -pthread -L/usr/pkg/lib -ldbus-1 -lutil -lncurses    -lm -lgcc -lc -lgcc /usr/lib/crtn.o
>>   /usr/pkg/lib/libdbus-1.so: undefined reference to `pthread_condattr_destroy'
>>   /usr/pkg/lib/libdbus-1.so: undefined reference to `pthread_condattr_init'
>>   /usr/pkg/lib/libdbus-1.so: undefined reference to `pthread_condattr_setclock'
>>   collect2: ld returned 1 exit status
>
>> I guess it expects `-lpthread' not `-pthread' in `pkg-config dbus-1 --libs'
>> output.
>
> I assume you're on FreeBSD 6.x. Correct me, if I'm wrong.

No. gcc45 + binutils-2.20 but I can reporoduce using old toolchain from /usr/bin.

  $ uname -vm
  FreeBSD 9.0-CURRENT #0 r208557=0462081-dirty: Wed May 26 02:05:21 UTC 2010 .../sys/PHOENIX  amd64

>
> BtW, we already discussed this, and according to Pav (pav@), '-pthread' is the
> way to go, not '-lpthread'.

I'm aware that ports should use ${PTHREAD_LIBS} (-pthread) but it may be
because of linking flags, e.g. `-nostdlib'.
Comment 19 Ashish Shukla 2010-05-27 10:46:20 UTC
Anonymous  writes:

[...]

> I'm aware that ports should use ${PTHREAD_LIBS} (-pthread) but it may be
> because of linking flags, e.g. `-nostdlib'.


Can you confirm this, and may be generate a patch wiping off '-nostdlib'
instead, since build process is adding all other libraries manually.

-- 
Ashish SHUKLA

Sent via Gnus from GNU Emacs
Comment 20 swell.k 2010-05-29 10:24:31 UTC
wahjava@gmail.com (Ashish SHUKLA) writes:

> Anonymous  writes:
>
> [...]
>
>> I'm aware that ports should use ${PTHREAD_LIBS} (-pthread) but it may be
>> because of linking flags, e.g. `-nostdlib'.
>
> Can you confirm this, and may be generate a patch wiping off '-nostdlib'
> instead, since build process is adding all other libraries manually.

It's not clear what else GCC skips from reading manpage and whether it
affects -pthread option.

  $ echo 'void main(void) { }' | gcc -v -xc -o/dev/null - -pthread |& fgrep ld-elf
   /usr/bin/ld --eh-frame-hdr -V -dynamic-linker /libexec/ld-elf.so.1 -o/dev/null /usr/lib/crt1.o /usr/lib/crti.o /usr/lib/crtbegin.o -L/usr/lib -L/usr/lib /var/tmp//cc7qVe4q.o -lgcc --as-needed -lgcc_s --no-as-needed -lpthread -lc -lgcc --as-needed -lgcc_s --no-as-needed /usr/lib/crtend.o /usr/lib/crtn.o
  $ echo 'void main(void) { }' | gcc -v -xc -o/dev/null - -pthread -nostdlib |& fgrep ld-elf
   /usr/bin/ld --eh-frame-hdr -V -dynamic-linker /libexec/ld-elf.so.1 -o/dev/null -L/usr/lib -L/usr/lib /var/tmp//ccOFKiwN.o

  $ echo 'void main(void) { }' | gcc45 -v -xc -o/dev/null - -pthread |& fgrep ld-elf
   .../4.5.1/collect2 --eh-frame-hdr -V -dynamic-linker /libexec/ld-elf.so.1 -o /dev/null /usr/lib/crt1.o /usr/lib/crti.o .../4.5.1/crtbegin.o -L.../4.5.1 -L.../4.5.1/../../../../../x86_64-portbld-freebsd9.0/lib -L.../4.5.1/../../.. /var/tmp//cc3SBfLM.o -lgcc --as-needed -lgcc_s --no-as-needed -lpthread -lc -lgcc --as-needed -lgcc_s --no-as-needed .../4.5.1/crtend.o /usr/lib/crtn.o
  $ echo 'void main(void) { }' | gcc45 -v -xc -o/dev/null - -pthread -nostdlib |& fgrep ld-elf
   .../4.5.1/collect2 --eh-frame-hdr -V -dynamic-linker /libexec/ld-elf.so.1 -o /dev/null -L.../4.5.1 -L.../4.5.1/../../../../../x86_64-portbld-freebsd9.0/lib -L.../4.5.1/../../.. /var/tmp//cc0OdbQg.o

Note: -lpthread is only present when -nostdilb is *not* specified.

I'm not sure why we should invent even more hacky way to solve -nostdlib
issue. I think my REINPLACE_CMD hack is simple enough. And we can
probably drop BROKEN on 6.x, too.

The interesting question is how other ports that have -nostdlib but need
threading support handle it.

--
BTW, pre-everything target should probably be hidden behind WITHOUT_X11 ifdef.
Comment 21 Ashish Shukla 2010-06-02 15:29:28 UTC
Hi Anonymous,

Sorry for the late reply.

Anonymous  writes:
> wahjava@gmail.com (Ashish SHUKLA) writes:


>> Anonymous  writes:
>> 
>> [...]
>> 
>>> I'm aware that ports should use ${PTHREAD_LIBS} (-pthread) but it may be
>>> because of linking flags, e.g. `-nostdlib'.
>> 
>> Can you confirm this, and may be generate a patch wiping off '-nostdlib'
>> instead, since build process is adding all other libraries manually.


> It's not clear what else GCC skips from reading manpage and whether it
> affects -pthread option.


>   $ echo 'void main(void) { }' | gcc -v -xc -o/dev/null - -pthread |& fgrep ld-elf
>    /usr/bin/ld --eh-frame-hdr -V -dynamic-linker /libexec/ld-elf.so.1 -o/dev/null /usr/lib/crt1.o /usr/lib/crti.o /usr/lib/crtbegin.o -L/usr/lib -L/usr/lib /var/tmp//cc7qVe4q.o -lgcc --as-needed -lgcc_s --no-as-needed -lpthread -lc -lgcc --as-needed -lgcc_s --no-as-needed /usr/lib/crtend.o /usr/lib/crtn.o
>   $ echo 'void main(void) { }' | gcc -v -xc -o/dev/null - -pthread -nostdlib |& fgrep ld-elf
>    /usr/bin/ld --eh-frame-hdr -V -dynamic-linker /libexec/ld-elf.so.1 -o/dev/null -L/usr/lib -L/usr/lib /var/tmp//ccOFKiwN.o


>   $ echo 'void main(void) { }' | gcc45 -v -xc -o/dev/null - -pthread |& fgrep ld-elf
>    .../4.5.1/collect2 --eh-frame-hdr -V -dynamic-linker /libexec/ld-elf.so.1 -o /dev/null /usr/lib/crt1.o /usr/lib/crti.o .../4.5.1/crtbegin.o -L.../4.5.1 -L.../4.5.1/../../../../../x86_64-portbld-freebsd9.0/lib -L.../4.5.1/../../.. /var/tmp//cc3SBfLM.o -lgcc --as-needed -lgcc_s --no-as-needed -lpthread -lc -lgcc --as-needed -lgcc_s --no-as-needed .../4.5.1/crtend.o /usr/lib/crtn.o
>   $ echo 'void main(void) { }' | gcc45 -v -xc -o/dev/null - -pthread -nostdlib |& fgrep ld-elf
>    .../4.5.1/collect2 --eh-frame-hdr -V -dynamic-linker /libexec/ld-elf.so.1 -o /dev/null -L.../4.5.1 -L.../4.5.1/../../../../../x86_64-portbld-freebsd9.0/lib -L.../4.5.1/../../.. /var/tmp//cc0OdbQg.o


> Note: -lpthread is only present when -nostdilb is *not* specified.


So the problem is the exclusion of 'pthread_*' routines from '-lgcc -lgcc_s'
of GCC 3.4 (or whatever version ships with 6.x) and GCC 4.5 ? or is it
exclusion of those routines from 'libc' of 9.x and 6.x ?

> I'm not sure why we should invent even more hacky way to solve -nostdlib
> issue. I think my REINPLACE_CMD hack is simple enough. And we can
> probably drop BROKEN on 6.x, too.


> The interesting question is how other ports that have -nostdlib but need
> threading support handle it.


Also I've got a diff related to Japanese IM (Canna) support in Emacs from a
contributor, I'll send another diff for that. So please delay committing the
new port.

Thanks
-- 
Ashish SHUKLA

Sent via Gnus from GNU Emacs
Comment 22 swell.k 2010-06-02 18:42:58 UTC
wahjava@gmail.com (Ashish SHUKLA) writes:

>> Note: -lpthread is only present when -nostdilb is *not* specified.
>
> So the problem is the exclusion of 'pthread_*' routines from '-lgcc -lgcc_s'
> of GCC 3.4 (or whatever version ships with 6.x) and GCC 4.5 ? or is it
> exclusion of those routines from 'libc' of 9.x and 6.x ?

No. -nostdlib cancels implicit -lpthread from -pthread option. So,
-lpthread should be specified explicitly. It just doesn't link against
threading library otherwise.

--- dbus_pthread.diff begins here ---

  Explicitly link against -lpthread only if dbus has -pthread in ldflags.
  Command line bit stolen from Mk/bsd.gecko.mk.

Index: editors/emacs/Makefile
===================================================================
RCS file: /a/.cvsup/ports/editors/emacs/Makefile,v
retrieving revision 1.96
diff -u -p -r1.96 Makefile
--- editors/emacs/Makefile	31 May 2010 01:58:29 -0000	1.96
+++ editors/emacs/Makefile	2 Jun 2010 17:20:19 -0000
@@ -68,6 +68,8 @@
 
 .include <bsd.port.options.mk>
 
+DBUS_PTHREAD_LIBS!=${CC} -dumpspecs | ${GREP} -m 1 pthread: | ${SED} -e 's|^.*%{\!pg: %{pthread:|| ; s|}.*$$||' || ${TRUE}
+
 .if defined(WITHOUT_X11)
 CONFIGURE_ARGS+=	--without-x
 .else
@@ -213,14 +212,13 @@ PLIST_SUB+=	SOURCES=""
 BROKEN=	Emacs 23.X does not currently build on ia64
 .endif
 
-.if ${OSVERSION} < 700000 && defined(WITHOUT_X11) && defined(WITH_DBUS)
-BROKEN= Does not currently build with dbus support but without X11
-.endif
-
 post-patch:
 	@${RM} -f ${WRKSRC}/info/*
 	@${REINPLACE_CMD} -e "s/%%EMACS_VER%%/${EMACS_VER}/g" -e "s/%%DATADIR%%/${DATADIR:C/\//\\\//g}/g" ${WRKSRC}/sources.el
 
+post-configure:
+	@${REINPLACE_CMD} -e '/^DBUS_LIBS/s/-pthread/& ${DBUS_PTHREAD_LIBS}/' ${WRKSRC}/src/Makefile
+
 .if defined(WITH_SOURCES)
 post-install:
 	@${MKDIR} ${DATADIR}/${EMACS_VER}/src
--- dbus_pthread.diff ends here ---
Comment 23 Ashish Shukla 2010-06-10 02:02:08 UTC
The attached diff includes:

- OPTIONS related changes.
- removal of ALSA detection code from configure.
- dependencies fix.
- Compilation fixes on 6.x/9.x due to DBUS sent by swell.k@gmail.com.
- Canna support contributed by Yuji TAKANO.
- CONFLICTS with 24.x.

Thanks
-- 
Ashish SHUKLA

Sent via Gnus from GNU Emacs
Comment 24 Mark Linimon freebsd_committer freebsd_triage 2010-06-19 07:05:55 UTC
Responsible Changed
From-To: freebsd-ports-bugs->ashish

Maintainer is now a committer.
Comment 25 dfilter service freebsd_committer freebsd_triage 2010-09-27 02:14:57 UTC
ashish      2010-09-27 01:14:52 UTC

  FreeBSD ports repository

  Modified files:
    editors/emacs        Makefile distinfo pkg-descr pkg-plist 
  Added files:
    editors/emacs/files  patch-configure 
  Log:
  - Add CANNA support to the port, provided by Yuji TAKANO.
  - Update CONFLICTS to conflict with 24.x.
  - Include the license file to the port.
  - Update descriptions of the OPTIONS.
  - Fix building of port on 6.x/9.x with DBUS option enabled, provided
    by swell.k@gmail.com .
  - Remove unneeded dependencies on gettext and dbus-glib.
  - Remove ALSA checks.
  - Clean up pkg-plist.
  
  PR:             ports/146979
  Approved by:    tabthorpe (mentor)
  
  Revision  Changes    Path
  1.99      +62 -39    ports/editors/emacs/Makefile
  1.19      +3 -0      ports/editors/emacs/distinfo
  1.3       +220 -0    ports/editors/emacs/files/patch-configure (new)
  1.5       +2 -0      ports/editors/emacs/pkg-descr
  1.33      +3 -3784   ports/editors/emacs/pkg-plist
_______________________________________________
cvs-all@freebsd.org mailing list
http://lists.freebsd.org/mailman/listinfo/cvs-all
To unsubscribe, send any mail to "cvs-all-unsubscribe@freebsd.org"
Comment 26 Ashish SHUKLA freebsd_committer freebsd_triage 2010-09-27 02:24:50 UTC
State Changed
From-To: feedback->closed

Committed. Thanks!