index.html 14 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304
  1. <!DOCTYPE html>
  2. <html lang="en">
  3. <head>
  4. <meta charset="UTF-8">
  5. <title>xrepo</title>
  6. <link rel="icon" href="/assets/img/favicon.ico">
  7. <meta http-equiv="X-UA-Compatible" content="IE=edge,chrome=1" />
  8. <meta name="description" content="Description">
  9. <meta name="viewport" content="width=device-width, user-scalable=no, initial-scale=1.0, maximum-scale=1.0, minimum-scale=1.0">
  10. <link href="//cdn.jsdelivr.net/npm/[email protected]/github-markdown.min.css" rel="stylesheet">
  11. <style>
  12. .markdown-body {
  13. box-sizing: border-box;
  14. min-width: 200px;
  15. max-width: 980px;
  16. margin: 0 auto;
  17. padding: 45px;
  18. }
  19. @media (max-width: 767px) {
  20. .markdown-body {
  21. padding: 15px;
  22. }
  23. }
  24. </style>
  25. </head>
  26. <body>
  27. <article class="markdown-body">
  28. <h4>This is a mirror page, please see the original page: </h4><a href="https://xrepo.xmake.io/#/">https://xrepo.xmake.io/#/</a>
  29. <div id="wwads-panel" class="wwads-cn wwads-vertical wwads-sticky" data-id="239" style="max-width:180px;bottom:20px;right:20px;width:200px;height:260px;background:#fff;position:fixed"></div>
  30. </br>
  31. <script type="text/javascript" charset="UTF-8" src="https://cdn.wwads.cn/js/makemoney.js" async></script>
  32. <script async type="text/javascript" src="//cdn.carbonads.com/carbon.js?serve=CE7I52QU&placement=xmakeio" id="_carbonads_js"></script>
  33. <style>
  34. #carbonads {
  35. font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Oxygen-Sans, Ubuntu,
  36. Cantarell, "Helvetica Neue", Helvetica, Arial, sans-serif;
  37. }
  38. #carbonads {
  39. display: flex;
  40. max-width: 330px;
  41. background-color: hsl(0, 0%, 98%);
  42. box-shadow: 0 1px 4px 1px hsla(0, 0%, 0%, .1);
  43. }
  44. #carbonads a {
  45. color: inherit;
  46. text-decoration: none;
  47. }
  48. #carbonads a:hover {
  49. color: inherit;
  50. }
  51. #carbonads span {
  52. position: relative;
  53. display: block;
  54. overflow: hidden;
  55. }
  56. #carbonads .carbon-wrap {
  57. display: flex;
  58. }
  59. .carbon-img {
  60. display: block;
  61. margin: 0;
  62. line-height: 1;
  63. }
  64. .carbon-img img {
  65. display: block;
  66. }
  67. .carbon-text {
  68. font-size: 13px;
  69. padding: 10px;
  70. line-height: 1.5;
  71. text-align: left;
  72. }
  73. .carbon-poweredby {
  74. display: block;
  75. padding: 8px 10px;
  76. background: repeating-linear-gradient(-45deg, transparent, transparent 5px, hsla(0, 0%, 0%, .025) 5px, hsla(0, 0%, 0%, .025) 10px) hsla(203, 11%, 95%, .4);
  77. text-align: center;
  78. text-transform: uppercase;
  79. letter-spacing: .5px;
  80. font-weight: 600;
  81. font-size: 9px;
  82. line-height: 1;
  83. }
  84. </style>
  85. <h2 id="introduction">Introduction</h2>
  86. <p>xrepo is a cross-platform C/C++ package manager based on <a href="https://github.com/xmake-io/xmake">Xmake</a>.</p>
  87. <p>It is based on the runtime provided by xmake, but it is a complete and independent package management program. Compared with package managers such as vcpkg/homebrew, xrepo can provide C/C++ packages for more platforms and architectures at the same time.</p>
  88. <p>And it also supports multi-version semantic selection. In addition, it is also a decentralized distributed repository. It not only provides the official <a href="https://github.com/xmake-io/xmake-repo">xmake-repo</a> repository, It also supports users to build multiple private repositorys.</p>
  89. <p>At the same time, xrepo also supports installing packages from third-party package managers such as vcpkg/homebrew/conan, and provides unified and consistent library link information to facilitate integration and docking with third-party projects.</p>
  90. <p>If you want to know more, please refer to: <a href="https://xmake.io/#/home">Documents</a>, <a href="https://github.com/xmake-io/xrepo">Github</a> and <a href="https://gitee.com/tboox/xrepo">Gitee</a></p>
  91. <p><img src="https://github.com/xmake-io/xrepo-docs/raw/master/assets/img/xrepo.gif" alt=""></p>
  92. <h2 id="installation">Installation</h2>
  93. <p>We only need install xmake to use the xrepo command. About the installation of xmake, we can see: <a href="https://xmake.io/#/guide/installation">Xmake Installation Document</a>.</p>
  94. <h2 id="supportedplatforms">Supported platforms</h2>
  95. <ul>
  96. <li>Windows (x86, x64)</li>
  97. <li>macOS (i386, x86_64, arm64)</li>
  98. <li>Linux (i386, x86_64, cross-toolchains ..)</li>
  99. <li>*BSD (i386, x86_64)</li>
  100. <li>Android (x86, x86_64, armeabi, armeabi-v7a, arm64-v8a)</li>
  101. <li>iOS (armv7, armv7s, arm64, i386, x86_64)</li>
  102. <li>MSYS (i386, x86_64)</li>
  103. <li>MinGW (i386, x86_64, arm, arm64)</li>
  104. <li>Cross Toolchains</li>
  105. </ul>
  106. <h2 id="supporydistributedrepository">Suppory distributed repository</h2>
  107. <p>In addition to directly retrieving the installation package from the official repository: <a href="https://github.com/xmake-io/xmake-repo">xmake-repo</a>.</p>
  108. <p>We can also add any number of self-built repositories, and even completely isolate the external network, and only maintain the installation and integration of private packages on the company&#39;s internal network.</p>
  109. <p>Just use the following command to add your own repository address:</p>
  110. <pre><code class="lang-console">$ xrepo add-repo myrepo https://github.com/mygroup/myrepo
  111. </code></pre>
  112. <h2 id="seamlessintegrationwithxmakeproject">Seamless integration with xmake project</h2>
  113. <pre><code class="lang-lua">add_requires("tbox >1.6.1", "libuv master", "vcpkg::ffmpeg", "brew::pcre2/libpcre2-8")
  114. add_requires("conan::openssl/1.1.1g", {alias = "openssl", optional = true, debug = true})
  115. target("test")
  116. set_kind("binary")
  117. add_files("src/*.c")
  118. add_packages("tbox", "libuv", "vcpkg::ffmpeg", "brew::pcre2/libpcre2-8", "openssl")
  119. </code></pre>
  120. <p>The following is the overall architecture and compilation process integrated with xmake.</p>
  121. <p><img src="https://xmake.io/assets/img/index/package_arch.png" width="650px" /></p>
  122. <h2 id="getstarted">Get started</h2>
  123. <h3 id="useitincmake">Use it in cmake</h3>
  124. <p>We need CMake wrapper for Xrepo C and C++ package manager. <a href="https://github.com/xmake-io/xrepo-cmake">xrepo-cmake</a></p>
  125. <h3 id="installationpackage">Installation package</h3>
  126. <h4 id="basicusage">Basic usage</h4>
  127. <pre><code class="lang-console">$ xrepo install zlib tbox
  128. </code></pre>
  129. <h4 id="installthespecifiedversionpackage">Install the specified version package</h4>
  130. <pre><code class="lang-console">$ xrepo install "zlib 1.2.x"
  131. $ xrepo install "zlib >=1.2.0"
  132. </code></pre>
  133. <h4 id="installthespecifiedplatformpackage">Install the specified platform package</h4>
  134. <pre><code class="lang-console">$ xrepo install -p iphoneos -a arm64 zlib
  135. $ xrepo install -p android [--ndk=/xxx] zlib
  136. $ xrepo install -p mingw [--mingw=/xxx] zlib
  137. $ xrepo install -p cross --sdk=/xxx/arm-linux-musleabi-cross zlib
  138. </code></pre>
  139. <h4 id="installthedebugpackage">Install the debug package</h4>
  140. <pre><code class="lang-console">$ xrepo install -m debug zlib
  141. </code></pre>
  142. <h4 id="installthepackagewithdynamiclibrary">Install the package with dynamic library</h4>
  143. <pre><code class="lang-console">$ xrepo install -k shared zlib
  144. </code></pre>
  145. <h4 id="installthespecifiedconfigurationpackage">Install the specified configuration package</h4>
  146. <pre><code class="lang-console">$ xrepo install -f "vs_runtime=&#39;MD&#39;" zlib
  147. $ xrepo install -f "regex=true,thread=true" boost
  148. </code></pre>
  149. <h4 id="installpackagesfromthirdpartypackagemanager">Install packages from third-party package manager</h4>
  150. <pre><code class="lang-console">$ xrepo install brew::zlib
  151. $ xrepo install vcpkg::zlib
  152. $ xrepo install conan::zlib/1.2.11
  153. </code></pre>
  154. <h3 id="findthelibraryinformationofthepackage">Find the library information of the package</h3>
  155. <pre><code class="lang-console">$ xrepo fetch pcre2
  156. {
  157. {
  158. linkdirs = {
  159. "/usr/local/Cellar/pcre2/10.33/lib"
  160. },
  161. links = {
  162. "pcre2-8"
  163. },
  164. defines = {
  165. "PCRE2_CODE_UNIT_WIDTH=8"
  166. },
  167. includedirs = "/usr/local/Cellar/pcre2/10.33/include"
  168. }
  169. }
  170. </code></pre>
  171. <pre><code class="lang-console">$ xrepo fetch --ldflags openssl
  172. -L/Users/ruki/.xmake/packages/o/openssl/1.1.1/d639b7d6e3244216b403b39df5101abf/lib -lcrypto -lssl
  173. </code></pre>
  174. <pre><code class="lang-console">$ xrepo fetch --cflags openssl
  175. -I/Users/ruki/.xmake/packages/o/openssl/1.1.1/d639b7d6e3244216b403b39df5101abf/include
  176. </code></pre>
  177. <pre><code class="lang-console">$ xrepo fetch -p [iphoneos|android] --cflags "zlib 1.2.x"
  178. -I/Users/ruki/.xmake/packages/z/zlib/1.2.11/df72d410e7e14391b1a4375d868a240c/include
  179. </code></pre>
  180. <pre><code class="lang-console">$ xrepo fetch --cflags --ldflags conan::zlib/1.2.11
  181. -I/Users/ruki/.conan/data/zlib/1.2.11/_/_/package/f74366f76f700cc6e991285892ad7a23c30e6d47/include -L/Users/ruki/.conan/data/zlib/1.2.11/_/_/package/f74366f76f700cc6e991285892ad7a23c30e6d47/lib -lz
  182. </code></pre>
  183. <h3 id="importandexportpackages">Import and export packages</h3>
  184. <p>xrepo can quickly export the installed packages, including the corresponding library files, header files, and so on.</p>
  185. <pre><code class="lang-console">$ xrepo export -o /tmp/output zlib
  186. </code></pre>
  187. <p>You can also import the previously exported installation package on other machines to implement package migration.</p>
  188. <pre><code class="lang-console">$ xrepo import -i /xxx/packagedir zlib
  189. </code></pre>
  190. <h3 id="searchsupportedpackages">Search supported packages</h3>
  191. <pre><code class="lang-console">$ xrepo search zlib "pcr*"
  192. zlib:
  193. -> zlib: A Massively Spiffy Yet Delicately Unobtrusive Compression Library (in xmake-repo)
  194. pcr*:
  195. -> pcre2: A Perl Compatible Regular Expressions Library (in xmake-repo)
  196. -> pcre: A Perl Compatible Regular Expressions Library (in xmake-repo)
  197. </code></pre>
  198. <p>In addition, you can now search for their packages from third-party package managers such as vcpkg, conan, conda, and apt. You only need to add the corresponding package namespace, for example:</p>
  199. <pre><code class="lang-console">$ xrepo search vcpkg::pcre
  200. The package names:
  201. vcpkg::pcre:
  202. -> vcpkg::pcre-8.44#8: Perl Compatible Regular Expressions
  203. -> vcpkg::pcre2-10.35#2: PCRE2 is a re-working of the original Perl Compatible Regular Expressions library
  204. </code></pre>
  205. <pre><code class="lang-console">$ xrepo search conan::openssl
  206. The package names:
  207. conan::openssl:
  208. -> conan::openssl/1.1.1g:
  209. -> conan::openssl/1.1.1h:
  210. </code></pre>
  211. <h3 id="showpackageenvironmentinformation">Show package environment information</h3>
  212. <pre><code class="lang-console">$ xrepo env --show luajit
  213. {
  214. OLDPWD = "/mnt/tbox",
  215. HOME = "/home/ruki",
  216. PATH = "/home/ruki/.xmake/packages/l/luajit/2.1.0-beta3/fbac76d823b844f0b91abf3df0a3bc61/bin:/tmp:/tmp/arm-linux-musleabi-cross/bin:~/.local/bin: /usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin",
  217. TERM = "xterm",
  218. PWD = "/mnt/xmake",
  219. XMAKE_PROGRAM_DIR = "/mnt/xmake/xmake",
  220. HOSTNAME = "e6edd61ff1ab",
  221. LD_LIBRARY_PATH = "/home/ruki/.xmake/packages/l/luajit/2.1.0-beta3/fbac76d823b844f0b91abf3df0a3bc61/lib",
  222. SHLVL = "1",
  223. _ = "/mnt/xmake/scripts/xrepo.sh"
  224. }
  225. </code></pre>
  226. <h3 id="loadpackageenvironmentandruncommands">Load package environment and run commands</h3>
  227. <pre><code class="lang-console">$ xrepo env luajit
  228. LuaJIT 2.1.0-beta3 -- Copyright (C) 2005-2017 Mike Pall. http://luajit.org/
  229. JIT: ON SSE2 SSE3 SSE4.1 BMI2 fold cse dce fwd dse narrow loop abc sink fuse
  230. >
  231. </code></pre>
  232. <pre><code class="lang-console">$ xrepo env -b "luajit 2.x" luajit
  233. $ xrepo env -p iphoneos -b "zlib,libpng,luajit 2.x" cmake ..
  234. </code></pre>
  235. <h3 id="enterthepackageshellenvironment">Enter the package shell environment</h3>
  236. <p>We can customize some package configurations by adding the xmake.lua file in the current directory, and then enter the specific package shell environment.</p>
  237. <pre><code class="lang-lua">add_requires("zlib 1.2.11")
  238. add_requires("python 3.x", "luajit")
  239. </code></pre>
  240. <pre><code class="lang-console">$ xrepo env shell
  241. > python --version
  242. > luajit --version
  243. </code></pre>
  244. <p>We can also configure and load the corresponding toolchain environment in xmake.lua, for example, load the VS compilation environment.</p>
  245. <pre><code class="lang-lua">set_toolchains("msvc")
  246. </code></pre>
  247. <h3 id="showthegivenpackageinformation">Show the given package information</h3>
  248. <pre><code class="lang-console">$ xrepo info zlib
  249. The package info of project:
  250. require(zlib):
  251. -> description: A Massively Spiffy Yet Delicately Unobtrusive Compression Library
  252. -> version: 1.2.11
  253. -> urls:
  254. -> http://zlib.net/zlib-1.2.11.tar.gz
  255. -> c3e5e9fdd5004dcb542feda5ee4f0ff0744628baf8ed2dd5d66f8ca1197cb1a1
  256. -> https://downloads.sourceforge.net/project/libpng/zlib/1.2.11/zlib-1.2.11.tar.gz
  257. -> c3e5e9fdd5004dcb542feda5ee4f0ff0744628baf8ed2dd5d66f8ca1197cb1a1
  258. -> repo: xmake-repo https://gitee.com/tboox/xmake-repo.git master
  259. -> cachedir: /Users/ruki/.xmake/cache/packages/2010/z/zlib/1.2.11
  260. -> installdir: /Users/ruki/.xmake/packages/z/zlib/1.2.11/d639b7d6e3244216b403b39df5101abf
  261. -> searchdirs:
  262. -> searchnames: zlib-1.2.11.tar.gz
  263. -> fetchinfo: 1.2.11, system
  264. -> version: 1.2.11
  265. -> links: z
  266. -> linkdirs: /usr/local/Cellar/zlib/1.2.11/lib
  267. -> includedirs: /usr/local/Cellar/zlib/1.2.11/include
  268. -> platforms: iphoneos, mingw@windows, macosx, mingw@linux,macosx, android@linux,macosx, windows, linux
  269. -> requires:
  270. -> plat: macosx
  271. -> arch: x86_64
  272. -> configs:
  273. -> debug: false
  274. -> vs_runtime: MT
  275. -> shared: false
  276. -> configs:
  277. -> configs (builtin):
  278. -> debug: Enable debug symbols. (default: false)
  279. -> shared: Enable shared library. (default: false)
  280. -> cflags: Set the C compiler flags.
  281. -> cxflags: Set the C/C++ compiler flags.
  282. -> cxxflags: Set the C++ compiler flags.
  283. -> asflags: Set the assembler flags.
  284. -> vs_runtime: Set vs compiler runtime. (default: MT)
  285. -> values: {"MT","MD"}
  286. </code></pre>
  287. <h3 id="uninstallallpackages">Uninstall all packages</h3>
  288. <p>We can use the following command to batch uninstall and delete the installed packages, supporting pattern matching:</p>
  289. <pre><code class="lang-bash">$ xrepo remove --all
  290. $ xrepo remove --all zlib pcr*
  291. </code></pre>
  292. </article>
  293. </body>
  294. </html>