Welcome to OGeek Q&A Community for programmer and developer-Open, Learning and Share
Welcome To Ask or Share your Answers For Others

Categories

0 votes
277 views
in Technique[技术] by (71.8m points)

linux - How can I copy an autoconf build to another directory for further testing?

If I build a package with autoconf, how can I copy everything in the source/build* directory to another location for further testing etc.?

To elaborate further, I would like to do a simple backup of some of my work by building + testing everything in one directory before copying the directory, applying some transformations to the code (that don't require recompiling), and rerunning the tests. The problem I am running into is autoconf seems to want me to run autoreconf in the newly copied directory requiring me to rebuild things. This is what I would like to avoid, if possible.

For example, when I try to run tests with the newly copied m4 (without even applying any transformations), I get the following:

m4-1.4.18/build-aux/missing: line 81: aclocal-1.15: command not found
WARNING: 'aclocal-1.15' is missing on your system.
You should only need it if you modified 'acinclude.m4' or
'configure.ac' or m4 files included by 'configure.ac'.
The 'aclocal' program is part of the GNU Automake package:
<http://www.gnu.org/software/automake>
It also requires GNU Autoconf, GNU m4 and Perl in order to run:
<http://www.gnu.org/software/autoconf>
<http://www.gnu.org/software/m4/>
<http://www.perl.org/>

EDIT:

As @Bodo pointed out, I should say that the copying method I use is cp -r.


* I build things in the source directory without a separate build directory.

question from:https://stackoverflow.com/questions/65945870/how-can-i-copy-an-autoconf-build-to-another-directory-for-further-testing

与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
Welcome To Ask or Share your Answers For Others

1 Reply

0 votes
by (71.8m points)

By copying the data with cp -r you create new files with the modification time set to the time of copying. Depending on the order in which the files are copied this will result in make (or your build tool) to re-build the target.

You can use something like

cd sourcedir
tar cvf ../sorcedit.tar .
cd ../targetdir
tar xvf ../sourcedir.tar

to copy the files while keeping their original time stamps.

Or you could use something like Git (or any other distributed version control system) to save every step of your work. Then you can run the tests directly in the source/build directory and afterwards throw away all files (except the Git repository, of course) and use Git to re-create the source files.


与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
OGeek|极客中国-欢迎来到极客的世界,一个免费开放的程序员编程交流平台!开放,进步,分享!让技术改变生活,让极客改变未来! Welcome to OGeek Q&A Community for programmer and developer-Open, Learning and Share
Click Here to Ask a Question

...