unofficial mirror of emacs-devel@gnu.org 
 help / color / mirror / code / Atom feed
* Including C sources in packaged Emacs
@ 2016-02-28  0:41 Wilfred Hughes
  2016-02-28  3:34 ` Paul Eggert
                   ` (3 more replies)
  0 siblings, 4 replies; 7+ messages in thread
From: Wilfred Hughes @ 2016-02-28  0:41 UTC (permalink / raw)
  To: emacs-devel


[-- Attachment #1.1: Type: text/plain, Size: 473 bytes --]

Currently, most (all?) linux distros package Emacs without C sources. As a
result, find-function does not work for any functions written in C. Users
who have compiled Emacs themselves have the source, but most don't.

I would love to see Emacs include its C code in /usr/share. In principle
this would just be a change to the build script, and I've attached a patch
that would work.

Does this seem reasonable? Is there some configure flag that does this
already?

Wilfred

[-- Attachment #1.2: Type: text/html, Size: 525 bytes --]

[-- Attachment #2: install_c_src.diff --]
[-- Type: text/plain, Size: 1383 bytes --]

diff --git a/Makefile.in b/Makefile.in
index 7aac403..6f958ae 100644
--- a/Makefile.in
+++ b/Makefile.in
@@ -460,7 +460,7 @@ $(srcdir)/src/stamp-h.in: $(AUTOCONF_INPUTS)
 
 # ==================== Installation ====================
 
-.PHONY: install install-arch-dep install-arch-indep install-etcdoc install-info
+.PHONY: install install-arch-dep install-arch-indep install-c-src install-etcdoc install-info
 .PHONY: install-man install-etc install-strip install-$(NTDIR)
 .PHONY: uninstall uninstall-$(NTDIR)
 
@@ -468,7 +468,7 @@ $(srcdir)/src/stamp-h.in: $(AUTOCONF_INPUTS)
 ## don't have to duplicate the list of utilities to install in
 ## this Makefile as well.
 
-install: all install-arch-indep install-etcdoc install-arch-dep install-$(NTDIR) blessmail
+install: all install-arch-indep install-c-src install-etcdoc install-arch-dep install-$(NTDIR) blessmail
 	@true
 
 ## Ensure that $subdir contains a subdirs.el file.
@@ -504,6 +504,12 @@ else
 	rm -rf ${ns_appresdir}/share
 endif
 
+### Copy C files to the destination dir, so users can view the source
+### code of C functions with `find-file'.
+install-c-src:
+	${MKDIR_P} "$(DESTDIR)${datadir}/emacs/${version}/src"
+	cp ${srcdir}/src/*.{c,h} "$(DESTDIR)${datadir}/emacs/${version}/src"
+
 ### Windows-specific install target for installing programs produced
 ### in nt/, and its Posix do-nothing shadow.
 install-:

^ permalink raw reply related	[flat|nested] 7+ messages in thread

* Re: Including C sources in packaged Emacs
  2016-02-28  0:41 Including C sources in packaged Emacs Wilfred Hughes
@ 2016-02-28  3:34 ` Paul Eggert
  2016-02-28 15:38   ` Eli Zaretskii
  2016-02-28  3:44 ` Lars Ingebrigtsen
                   ` (2 subsequent siblings)
  3 siblings, 1 reply; 7+ messages in thread
From: Paul Eggert @ 2016-02-28  3:34 UTC (permalink / raw)
  To: emacs-devel

Wilfred Hughes wrote:
> Does this seem reasonable? Is there some configure flag that does this
> already?

It seems reasonable, for the same reason we install .el files. We compress .el 
files, and so probably should do the same for source files, right? Also, there 
are source files whose names end in .m, as well as source files in lib/* and 
perhaps other areas.



^ permalink raw reply	[flat|nested] 7+ messages in thread

* Re: Including C sources in packaged Emacs
  2016-02-28  0:41 Including C sources in packaged Emacs Wilfred Hughes
  2016-02-28  3:34 ` Paul Eggert
@ 2016-02-28  3:44 ` Lars Ingebrigtsen
  2016-02-28  9:37 ` Andreas Schwab
  2016-02-28 21:56 ` Richard Stallman
  3 siblings, 0 replies; 7+ messages in thread
From: Lars Ingebrigtsen @ 2016-02-28  3:44 UTC (permalink / raw)
  To: Wilfred Hughes; +Cc: emacs-devel

Wilfred Hughes <me@wilfred.me.uk> writes:

> Currently, most (all?) linux distros package Emacs without C sources. As a
> result, find-function does not work for any functions written in C. Users who
> have compiled Emacs themselves have the source, but most don't.
>
> I would love to see Emacs include its C code in /usr/share. In principle this
> would just be a change to the build script, and I've attached a patch that
> would work.
>
> Does this seem reasonable? Is there some configure flag that does this
> already?

Including the source in /usr/share for a program would be highly
unusual.  And if you want to hack on the C bits of Emacs, you have to
install Emacs (from git) anyway, so I think the usefulness of this would
be kinda slim.

-- 
(domestic pets only, the antidote for overdose, milk.)
   bloggy blog: http://lars.ingebrigtsen.no



^ permalink raw reply	[flat|nested] 7+ messages in thread

* Re: Including C sources in packaged Emacs
  2016-02-28  0:41 Including C sources in packaged Emacs Wilfred Hughes
  2016-02-28  3:34 ` Paul Eggert
  2016-02-28  3:44 ` Lars Ingebrigtsen
@ 2016-02-28  9:37 ` Andreas Schwab
  2016-02-28 21:56 ` Richard Stallman
  3 siblings, 0 replies; 7+ messages in thread
From: Andreas Schwab @ 2016-02-28  9:37 UTC (permalink / raw)
  To: Wilfred Hughes; +Cc: emacs-devel

Wilfred Hughes <me@wilfred.me.uk> writes:

> Currently, most (all?) linux distros package Emacs without C sources.

They are usually part of the debugsource package.

Andreas.

-- 
Andreas Schwab, schwab@linux-m68k.org
GPG Key fingerprint = 58CA 54C7 6D53 942B 1756  01D3 44D5 214B 8276 4ED5
"And now for something completely different."



^ permalink raw reply	[flat|nested] 7+ messages in thread

* Re: Including C sources in packaged Emacs
  2016-02-28  3:34 ` Paul Eggert
@ 2016-02-28 15:38   ` Eli Zaretskii
  2016-03-02 21:49     ` Wilfred Hughes
  0 siblings, 1 reply; 7+ messages in thread
From: Eli Zaretskii @ 2016-02-28 15:38 UTC (permalink / raw)
  To: Paul Eggert; +Cc: emacs-devel

> From: Paul Eggert <eggert@cs.ucla.edu>
> Date: Sat, 27 Feb 2016 19:34:25 -0800
> 
> Wilfred Hughes wrote:
> > Does this seem reasonable? Is there some configure flag that does this
> > already?
> 
> It seems reasonable, for the same reason we install .el files.

Installing C sources could be an option, off by default.  But
installing always or by default is something we shouldn't do, IMO.
Many users will not want or need that.




^ permalink raw reply	[flat|nested] 7+ messages in thread

* Re: Including C sources in packaged Emacs
  2016-02-28  0:41 Including C sources in packaged Emacs Wilfred Hughes
                   ` (2 preceding siblings ...)
  2016-02-28  9:37 ` Andreas Schwab
@ 2016-02-28 21:56 ` Richard Stallman
  3 siblings, 0 replies; 7+ messages in thread
From: Richard Stallman @ 2016-02-28 21:56 UTC (permalink / raw)
  To: Wilfred Hughes; +Cc: emacs-devel

[[[ To any NSA and FBI agents reading my email: please consider    ]]]
[[[ whether defending the US Constitution against all enemies,     ]]]
[[[ foreign or domestic, requires you to follow Snowden's example. ]]]

  > Currently, most (all?) linux distros package Emacs without C sources.

Emacs is not a part of Linux.  Linux is one program, and Emacs is another.
Did you mean GNU/Linux distros?

Unfortunately, we can't control how they package things.
The GNU GPL does require that they distribute the source,
but gives them a lot of flexibility about how they do it.

-- 
Dr Richard Stallman
President, Free Software Foundation (gnu.org, fsf.org)
Internet Hall-of-Famer (internethalloffame.org)
Skype: No way! See stallman.org/skype.html.




^ permalink raw reply	[flat|nested] 7+ messages in thread

* Re: Including C sources in packaged Emacs
  2016-02-28 15:38   ` Eli Zaretskii
@ 2016-03-02 21:49     ` Wilfred Hughes
  0 siblings, 0 replies; 7+ messages in thread
From: Wilfred Hughes @ 2016-03-02 21:49 UTC (permalink / raw)
  To: Eli Zaretskii; +Cc: Paul Eggert, emacs-devel

[-- Attachment #1: Type: text/plain, Size: 623 bytes --]

OK, I've updated the patch so configure takes a --with-builtin-sources
argument, which is off by default.

On 28 February 2016 at 15:38, Eli Zaretskii <eliz@gnu.org> wrote:
>> From: Paul Eggert <eggert@cs.ucla.edu>
>> Date: Sat, 27 Feb 2016 19:34:25 -0800
>>
>> Wilfred Hughes wrote:
>> > Does this seem reasonable? Is there some configure flag that does this
>> > already?
>>
>> It seems reasonable, for the same reason we install .el files.
>
> Installing C sources could be an option, off by default.  But
> installing always or by default is something we shouldn't do, IMO.
> Many users will not want or need that.
>
>

[-- Attachment #2: with_builtin_sources.diff --]
[-- Type: text/plain, Size: 2899 bytes --]

diff --git a/Makefile.in b/Makefile.in
index 7aac403..9bbe820 100644
--- a/Makefile.in
+++ b/Makefile.in
@@ -141,6 +141,9 @@ datarootdir=@datarootdir@
 # and ${etcdir} are subdirectories of this.
 datadir=@datadir@
 
+# Where to install C sources of builtin functions.
+builtinsrcdir=@builtinsrcdir@
+
 # Where to install and expect the files that Emacs modifies as it
 # runs.  These files are all architecture-independent.
 # Right now, this is not used.
@@ -460,7 +463,7 @@ $(srcdir)/src/stamp-h.in: $(AUTOCONF_INPUTS)
 
 # ==================== Installation ====================
 
-.PHONY: install install-arch-dep install-arch-indep install-etcdoc install-info
+.PHONY: install install-arch-dep install-arch-indep install-builtin-src install-etcdoc install-info
 .PHONY: install-man install-etc install-strip install-$(NTDIR)
 .PHONY: uninstall uninstall-$(NTDIR)
 
@@ -468,7 +471,7 @@ $(srcdir)/src/stamp-h.in: $(AUTOCONF_INPUTS)
 ## don't have to duplicate the list of utilities to install in
 ## this Makefile as well.
 
-install: all install-arch-indep install-etcdoc install-arch-dep install-$(NTDIR) blessmail
+install: all install-arch-indep install-builtin-src install-etcdoc install-arch-dep install-$(NTDIR) blessmail
 	@true
 
 ## Ensure that $subdir contains a subdirs.el file.
@@ -504,6 +507,14 @@ else
 	rm -rf ${ns_appresdir}/share
 endif
 
+### Copy C sources of builtin function to the destination dir, so
+### users can view the source code of C functions with `find-file'.
+install-builtin-src:
+ifneq (${builtinsrcdir},)
+	${MKDIR_P} "${builtinsrcdir}"
+	cp ${srcdir}/src/*.{c,h} "${builtinsrcdir}"
+endif
+
 ### Windows-specific install target for installing programs produced
 ### in nt/, and its Posix do-nothing shadow.
 install-:
diff --git a/configure.ac b/configure.ac
index e750a43..8b45007 100644
--- a/configure.ac
+++ b/configure.ac
@@ -196,6 +196,7 @@ dnl hence the single quotes.  This is per the GNU coding standards, see
 dnl (autoconf) Installation Directory Variables
 dnl See also epaths.h below.
 lispdir='${datadir}/emacs/${version}/lisp'
+builtinsrcdir='${datadir}/emacs/${version}/src'
 standardlisppath='${lispdir}'
 locallisppath='${datadir}/emacs/${version}/site-lisp:'\
 '${datadir}/emacs/site-lisp'
@@ -410,6 +411,13 @@ case ${with_gameuser} in
   *) gameuser=${with_gameuser} ;;
 esac
 
+OPTION_DEFAULT_OFF([builtin-sources],[install C sources of built-in functions])
+
+echo "with builtin sources: $with_builtin_sources"
+if test $with_builtin_sources != "yes"; then
+   builtinsrcdir=
+fi
+
 AC_ARG_WITH([gnustep-conf],dnl
 [AS_HELP_STRING([--with-gnustep-conf=FILENAME],
    [name of GNUstep configuration file to use on systems where the command
@@ -4876,6 +4884,7 @@ AC_SUBST(libexecdir)
 AC_SUBST(mandir)
 AC_SUBST(infodir)
 AC_SUBST(lispdir)
+AC_SUBST(builtinsrcdir)
 AC_SUBST(standardlisppath)
 AC_SUBST(locallisppath)
 AC_SUBST(lisppath)

^ permalink raw reply related	[flat|nested] 7+ messages in thread

end of thread, other threads:[~2016-03-02 21:49 UTC | newest]

Thread overview: 7+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2016-02-28  0:41 Including C sources in packaged Emacs Wilfred Hughes
2016-02-28  3:34 ` Paul Eggert
2016-02-28 15:38   ` Eli Zaretskii
2016-03-02 21:49     ` Wilfred Hughes
2016-02-28  3:44 ` Lars Ingebrigtsen
2016-02-28  9:37 ` Andreas Schwab
2016-02-28 21:56 ` Richard Stallman

Code repositories for project(s) associated with this public inbox

	https://git.savannah.gnu.org/cgit/emacs.git

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).