<div dir="ltr"><div dir="ltr"><div dir="ltr"><div dir="ltr"><div dir="ltr"><div dir="ltr"><div dir="ltr"><div dir="ltr"><br><br><div class="gmail_quote"><div dir="ltr">Le mar. 20 nov. 2018 à 22:40, Oleh Kravchenko <<a href="mailto:oleg@kaa.org.ua">oleg@kaa.org.ua</a>> a écrit :<br></div><blockquote class="gmail_quote" style="margin:0px 0px 0px 0.8ex;border-left:1px solid rgb(204,204,204);padding-left:1ex">20.11.18 23:29, Brad King wrote:<br>
> SOURCE_DATE_EPOCH was created for use by packagers where tools<br>
> already wrap the build.  By making it an environment variable<br>
> packagers could jump through any number of build system layers<br>
> with no patching.<br>
<br>
That's makes me confused, because CMake has CPack.<br>
And with CPack process looks like:<br>
- `cmake && make package`<br>
So there are no any packagers tools, all work done with CMake.<br></blockquote><div><br></div><div>The package tool here is CPack.</div><div>You consider CMake and CPack as monolithic software they were not designed this way (and I personally find it nice to be so).</div><div><br></div><div>CMake and CPack (or CTest) may work together but they may well be used independently.</div><div>Moreover they do not run at the same time, have a look at the figure here:</div><div><a href="https://github.com/dev-cafe/cmake-cookbook/blob/master/figures/cmake-times/cmake-times.jpg">https://github.com/dev-cafe/cmake-cookbook/blob/master/figures/cmake-times/cmake-times.jpg</a><br></div><div><br></div><div>And you may see that setting environment var at configure time is relatively far away from packaging time.</div><div><br></div><div>All that saif you are right CPack may honor SOURCE_DATE_EPOCH, and CMake "may" forward the usage</div><div>of SOURCE_DATE_EPOCH from configuration time down to CPack time.</div><div><br></div><div>At least one CPack generator (the DEB one) recently honor SOURCE_DATE_EPOCH</div><div><a href="https://gitlab.kitware.com/cmake/cmake/commit/548ac51d8ea319c65abefa0a771636893c45014c">https://gitlab.kitware.com/cmake/cmake/commit/548ac51d8ea319c65abefa0a771636893c45014c</a> <br></div><div><br></div><div>If you use a <a href="https://cmake.org/cmake/help/v3.12/module/CPack.html#variable:CPACK_PROJECT_CONFIG_FILE">https://cmake.org/cmake/help/v3.12/module/CPack.html#variable:CPACK_PROJECT_CONFIG_FILE</a> for your project</div><div>you may easily set the SOURCE_DATE_EPOCH env var at CPack time, i.e. when CPack runs.</div><div><br></div><div><br></div><blockquote class="gmail_quote" style="margin:0px 0px 0px 0.8ex;border-left:1px solid rgb(204,204,204);padding-left:1ex"><br>
> Build systems configure compilers with command-line flags, not<br>
> environment variables.  If you want to do this from within the<br>
> build system then GCC could be taught a new option for that.<br></blockquote><div><br></div><div>Apparently gcc team decided to use env var for that:</div><div><a href="https://gcc.gnu.org/onlinedocs/cpp/Environment-Variables.html">https://gcc.gnu.org/onlinedocs/cpp/Environment-Variables.html</a><br></div><div>see associated discussion (I did not read it all):</div><div><a href="https://gcc.gnu.org/ml/gcc-patches/2015-06/msg02210.html">https://gcc.gnu.org/ml/gcc-patches/2015-06/msg02210.html</a><br></div><div> </div><div>llvm/clang discussion on this does not seem to be closed:</div><div><a href="https://reviews.llvm.org/D23934">https://reviews.llvm.org/D23934</a></div><div>  </div><blockquote class="gmail_quote" style="margin:0px 0px 0px 0.8ex;border-left:1px solid rgb(204,204,204);padding-left:1ex">
> <br>
> You could try hacking it with `CMAKE_<LANG>_COMPILER_LAUNCHER`:<br>
> <br>
>    <a href="https://cmake.org/cmake/help/v3.13/variable/CMAKE_LANG_COMPILER_LAUNCHER.html" rel="noreferrer" target="_blank">https://cmake.org/cmake/help/v3.13/variable/CMAKE_LANG_COMPILER_LAUNCHER.html</a><br>
> <br>
> e.g. -DCMAKE_C_COMPILER_LAUNCHER='env;SOURCE_DATE_EPOCH=1' or<br>
> <br>
> ```cmake<br>
> set(CMAKE_C_COMPILER_LAUNCHER env SOURCE_DATE_EPOCH=1)<br>
> ```<br>
<br>
Thank you, I will try that.<br></blockquote><div><br></div><div>AFAIU this should already work with gcc.</div><div><br></div><div>I discovered <a href="https://reproducible-builds.org/">https://reproducible-builds.org/</a>, while reading your question.</div><div>The goal is nice, and I think CMake/CPack should support that for compiler/[package] build tools that support it.</div><div><br></div><div>I won't have time to work on patches for that but I'll certainly take time to read/test one if someone is working on it.  </div><div><br></div></div>-- <br><div dir="ltr" class="gmail_signature"><div dir="ltr"><div><div dir="ltr"><div>Eric<br></div></div></div></div></div></div></div></div></div></div></div></div></div>