Copy kernel headers to musl package
This commit is contained in:
parent
579ecb082a
commit
37e75b9f09
|
@ -14,6 +14,8 @@
|
|||
# You should have received a copy of the GNU General Public License
|
||||
# along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||
import os
|
||||
import shutil
|
||||
from pathlib import Path
|
||||
|
||||
|
||||
class current_dir:
|
||||
|
@ -42,6 +44,33 @@ def get_version(pkg_name):
|
|||
return env
|
||||
|
||||
|
||||
def copy_tree(src, dst, preserve_symlinks=True, ignore=None):
|
||||
src = Path(src)
|
||||
dst = Path(dst)
|
||||
|
||||
dst.mkdir(exist_ok=True, parents=True)
|
||||
|
||||
for item in src.iterdir():
|
||||
skip_this = False
|
||||
if ignore:
|
||||
for pattern in ignore:
|
||||
if fnmatch(item.name, pattern):
|
||||
skip_this = True
|
||||
break
|
||||
if skip_this:
|
||||
continue
|
||||
if item.is_dir():
|
||||
shutil.copytree(
|
||||
item,
|
||||
dst / item.name,
|
||||
dirs_exist_ok=True,
|
||||
symlinks=preserve_symlinks,
|
||||
copy_function=shutil.copy2,
|
||||
)
|
||||
elif item.is_file() or item.is_symlink:
|
||||
shutil.copy2(item, dst / item.name, follow_symlinks=not preserve_symlinks)
|
||||
|
||||
|
||||
def with_static_flags(cmake_vars):
|
||||
cmake_vars["CMAKE_C_FLAGS"] = f"-static {cmake_vars.get('CMAKE_C_FLAGS', '')}"
|
||||
cmake_vars["CMAKE_CXX_FLAGS"] = f"-static {cmake_vars.get('CMAKE_CXX_FLAGS', '')}"
|
||||
|
|
|
@ -22,7 +22,7 @@ from conan.tools.gnu import AutotoolsToolchain, Autotools
|
|||
|
||||
from conan.tools.files import get
|
||||
|
||||
from conf.utils import current_dir, get_version
|
||||
from conf.utils import copy_tree, get_version
|
||||
|
||||
|
||||
class Musl(ConanFile):
|
||||
|
@ -79,3 +79,13 @@ class Musl(ConanFile):
|
|||
)
|
||||
autotools.make()
|
||||
autotools.make(target="install")
|
||||
|
||||
ld_so = Path(self.package_folder) / "lib" / "ld-musl-x86_64.so.1"
|
||||
ld_so.symlink_to("libc.so")
|
||||
|
||||
kernel_inc_dir = Path(self.dependencies[f"kernel-headers"].package_folder)
|
||||
target_inc_dir = Path(self.package_folder) / "include"
|
||||
|
||||
for include_dir in (kernel_inc_dir / "include").iterdir():
|
||||
self.output.info(f"Copying kernel headers: {include_dir.name}")
|
||||
copy_tree(str(include_dir), str(target_inc_dir / include_dir.name))
|
||||
|
|
Loading…
Reference in New Issue