Skip to content

Commit

Permalink
Merge pull request iovisor#477 from ragnard/nixos
Browse files Browse the repository at this point in the history
Add support for nixos
  • Loading branch information
drzaeus77 committed Apr 6, 2016
2 parents 7a82fa6 + dbc21ea commit 5cb8de7
Show file tree
Hide file tree
Showing 4 changed files with 8 additions and 2 deletions.
6 changes: 6 additions & 0 deletions CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -39,6 +39,12 @@ FOREACH(DIR ${LLVM_INCLUDE_DIRS})
include_directories("${DIR}/../tools/clang/include")
ENDFOREACH()

# Set to a string path if system places kernel lib directory in
# non-default location.
if(NOT DEFINED BCC_KERNEL_MODULES_DIR)
set(BCC_KERNEL_MODULES_DIR "/lib/modules")
endif()

# Set to non-zero if system installs kernel headers with split source and build
# directories in /lib/modules/`uname -r`/. This is the case for debian and
# suse, to the best of my knowledge.
Expand Down
1 change: 1 addition & 0 deletions src/cc/frontends/clang/CMakeLists.txt
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
# Copyright (c) PLUMgrid, Inc.
# Licensed under the Apache License, Version 2.0 (the "License")

set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -DKERNEL_MODULES_DIR='\"${BCC_KERNEL_MODULES_DIR}\"'")
set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -DKERNEL_MODULES_SUFFIX='\"${BCC_KERNEL_MODULES_SUFFIX}\"'")
set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -DKERNEL_HAS_SOURCE_DIR=${BCC_KERNEL_HAS_SOURCE_DIR}")
add_library(clang_frontend loader.cc b_frontend_action.cc kbuild_helper.cc)
1 change: 1 addition & 0 deletions src/cc/frontends/clang/kbuild_helper.cc
Original file line number Diff line number Diff line change
Expand Up @@ -68,6 +68,7 @@ int KBuildHelper::get_flags(const char *uname_machine, vector<string> *cflags) {
cflags->push_back("-I" + kdir_ + "/build/./arch/"+arch+"/include/uapi");
cflags->push_back("-I" + kdir_ + "/build/arch/"+arch+"/include/generated/uapi");
cflags->push_back("-I" + kdir_ + "/build/include/uapi");
cflags->push_back("-I" + kdir_ + "/build/include/generated");
cflags->push_back("-I" + kdir_ + "/build/include/generated/uapi");
}

Expand Down
2 changes: 0 additions & 2 deletions src/cc/frontends/clang/kbuild_helper.h
Original file line number Diff line number Diff line change
Expand Up @@ -19,8 +19,6 @@
#include <vector>
#include <unistd.h>

#define KERNEL_MODULES_DIR "/lib/modules"

namespace ebpf {

struct FileDeleter {
Expand Down

0 comments on commit 5cb8de7

Please sign in to comment.