Rhdf5lib 1.16.0
在这里,我们描述的步骤过程原始HDF5源代码的修改版本的分布式生产这个包。这是仅供记录,用户的Rhdf5lib包预计不会遵循任何步骤详细。
库(stringr)
下载源tarball HDF5并解压缩到一个临时目录中。我们将输出文件夹重命名为hdf5。
hdf5_source < - tempfile()下载。文件(url = " https://support.hdfgroup.org/ftp/hdf5/releases/hdf5 - 1.10 / - hdf5 1.10.7/src/hdf5 1.10.7.tar.bz2”, dest = hdf5_source)解压(tarfile = hdf5_source exdir = tempdir())系统2 (“mv”, args = c (file.path (tempdir (),“hdf5-1.10.7”), file.path (tempdir (),“hdf5”)))
hdf5_dir < - file.path (tempdir (),“hdf5”)
我们没有分配删除文件夹。
分离(x =文件。路径(hdf5_dir c(“例子”,“fortran”,“java”、“release_docs”、“测试”、“testpar”、“工具”、“c++ /例子”,“c++ /测试”、“霍奇金淋巴瘤/ fortran”、“霍奇金淋巴瘤/例子”,“霍奇金淋巴瘤/工具”,“霍奇金淋巴瘤/测试”、“霍奇金淋巴瘤/ c++ /例子”,“霍奇金淋巴瘤/ c++ /测试”)),递归= TRUE)
接下来,我们来配置脚本,使文件作了一些修改,删除引用我们的文件夹删除。
configure_ac < - xfun:: read_utf8(文件。路径(hdf5_dir configure.ac)) # #修改列表构建文件启动<——(str_detect (configure_ac、模式=“AC_CONFIG_FILES”)) <——结束(str_detect (configure_ac(开始:(长度(configure_ac))),模式= \ \)$))[1]+开始- 1 config_files < - configure_ac[开始:结束]rm_idx <——(str_detect (config_files、模式=“测试/ | testpar / |工具/ / | fortran / java / | | |例子h5c + + /”)) config_files < - config_files [-rm_idx] config_files[长度(config_files)] < - paste0(尾(config_files, 1),“]”) configure_ac[开始]< -粘贴(config_files崩溃=“\ n”) configure_ac < - configure_ac[-((+ 1)开始(结束)))# #删除引用h5cc h5cc < - str_which (configure_ac、模式= " chmod 755 a - z / * / h5cc”) configure_ac < - configure_ac [- ((h5cc): (h5cc + 4))) # # fortran头fortran_inc < str_which (configure_ac、模式= " AC_CONFIG_HEADERS \ \ (\ \ [fortran / src / H5config_f \ \ . inc”) configure_ac [fortran_inc (fortran_inc + 1)): < - - - - - -粘贴(“# #”,configure_ac [fortran_inc: (fortran_inc + 1)]) # #写xfun:: write_utf8 (configure_ac con =文件。路径(hdf5_dir configure.ac)) # # c++ makefile make_cplusplus < - xfun:: read_utf8(文件。路径(hdf5_dir, c++ / Makefile.am)) idx < - str_which (make_cplusplus, BUILD_CXX_CONDITIONAL) make_cplusplus [idx] < -“如果BUILD_CXX_CONDITIONAL \ n子目录= src \ nendif \ nDIST_SUBDIRS = src " make_cplusplus <——make_cplusplus [- ((idx + 1):(长度(make_cplusplus) 2))) xfun:: write_utf8 (make_cplusplus con =文件。路径(hdf5_dir“c++ / Makefile.am”)) # # HL makefile make_hl < - xfun:: read_utf8(文件。路径(hdf5_dir,霍奇金淋巴瘤/ Makefile.am)) idx < - str_which (make_hl, BUILD_HDF5_HL_CONDITIONAL) make_hl [idx] < -“如果BUILD_HDF5_HL_CONDITIONAL \ n子目录= src (CXX_DIR) \ nendif \ nDIST_SUBDIRS =美元src c++”make_hl <——make_hl [- ((idx + 1):(长度(make_hl) 2))) xfun:: write_utf8 (make_hl con =文件。路径(hdf5_dir“霍奇金淋巴瘤/ Makefile.am”)) # # hl c++ makefile make_hl_cpp < - xfun:: read_utf8(文件。路径(hdf5_dir,霍奇金淋巴瘤/ c++ / Makefile.am)) idx < - str_which (make_hl_cpp,“^子目录= src ") make_hl_cpp [idx] < -“子目录= src \ nDIST_SUBDIRS = src " make_hl_cpp <——make_hl_cpp [- ((idx + 1):(长度(make_hl_cpp) 2))) xfun:: write_utf8 (make_hl_cpp con =文件。路径(hdf5_dir,霍奇金淋巴瘤/ c++ / Makefile.am)) # #主要makefile < - xfun:: read_utf8(文件。路径(hdf5_dir Makefile.am)) idx < - str_which(,“子目录= src”) [1] [idx] < -”子目录= src。(CXX_DIR) (HDF5_HL_DIR)”使美元(idx + 1) <——“DIST_SUBDIRS = src。c++ hl“[idx + 2] < -”“idx < - str_which(,“#让所有、测试和\ \(联合国\ \)安装”)使((idx + 1): (idx + 6) <——paste0(“# #”,使[(idx + 1): (idx + 6)]) xfun:: write_utf8(,反对=文件。路径(hdf5_dir Makefile.am))
解决问题的源代码报道凹口Solaris建设者。
代码< - xfun:: read_utf8(文件。路径(hdf5_dir、“c++”、“src”、“H5Library.cpp”) < -)代码(代码,大小写不敏感([]{1})(退出\ \()”,替换= ' \ \ 1 std:: \ \ 2”) xfun: write_utf8(代码,反对=文件。路径(hdf5_dir、“c++”、“src”、“H5Library.cpp”))
流程修改后的脚本。
系统(命令= paste0 (hdf5_dir“cd”,“& & autoconf”))系统(命令= paste0 (hdf5_dir“cd”,“& & aclocal”))系统(命令= paste0 (hdf5_dir“cd”,“& & automake”)) unlink(文件。路径(hdf5_dir autom4te.cache),递归= TRUE)
现在我们进行一个类似的过程SZIP库。
szip_source < - tempfile()下载。文件(url = " https://support.hdfgroup.org/ftp/lib-external/szip/2.1.1/src/szip-2.1.1.tar.gz ", dest = szip_source)解压(tarfile = szip_source exdir = tempdir())系统2 (“mv”, args = c (file.path (tempdir (),“szip-2.1.1”), file.path (tempdir (),“szip”)))
szip_dir < - file.path (tempdir (),“szip”)
分离(x =文件。路径(szip_dir“测试”),递归= TRUE)
xfun:: read_utf8(文件。路径(szip_dir configure.ac)) % > % str_remove(“测试/ Makefile”) % > % xfun:: write_utf8(文件。路径(szip_dir configure.ac)) xfun:: read_utf8(文件。路径(szip_dir Makefile.am))%>% str_replace(pattern = "SUBDIRS=src test", replacement = "SUBDIRS=src") %>% xfun::write_utf8(file.path(szip_dir, "Makefile.am"))
系统(命令= paste0 (szip_dir“cd”,“& & autoconf”))系统(命令= paste0 (szip_dir“cd”,“& & aclocal”))系统(命令= paste0 (szip_dir“cd”,“& & automake”)) unlink(文件。路径(szip_dir autom4te.cache),递归= TRUE)
SZIP源进入HDF5分布并创建压缩文件,将分布式R包。我们使用这个系统焦油
命令在这里我不能找出如何只包括tarball的基目录在使用R的内置函数。
系统2 (“mv”, args = c (szip_dir,文件。路径(hdf5_dir, szip)))系统2(“焦油”,args = c (“c”, tempdir (),“-czf file.path (tempdir (),“hdf5small_cxx_hl_1.10.7.tar.gz”),“hdf5”))
最后这个副本/ tmp /
所以很容易找到,检查,并将包目录是否正确。
如果(file.exists (“/ tmp / hdf5small_cxx_hl_1.10.7.tar.gz”)) {file.remove (“/ tmp / hdf5small_cxx_hl_1.10.7.tar.gz”)} file.copy (file.path (tempdir (),“hdf5small_cxx_hl_1.10.7.tar.gz”), =“/ tmp /”)