Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
40 changes: 40 additions & 0 deletions THIRD-PARTY-NOTICES.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1,40 @@
NOTICES AND INFORMATION
Do Not Translate or Localize

This software incorporates material from third parties.
Microsoft makes certain open source code available at https://3rdpartysource.microsoft.com,
or you may send a check or money order for US $5.00, including the product name,
the open source component name, platform, and version number, to:

Source Code Compliance Team
Microsoft Corporation
One Microsoft Way
Redmond, WA 98052
USA

Notwithstanding any other terms, you may reverse engineer this software to the extent
required to debug changes to any libraries licensed under the GNU Lesser General Public License.

libxml2
Comment thread
plnelson marked this conversation as resolved.
=======

Copyright (C) 1998-2012 Daniel Veillard. All Rights Reserved.
Copyright (C) The Libxml2 Contributors.

Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files (the "Software"), to deal
in the Software without restriction, including without limitation the rights
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
copies of the Software, and to permit persons to whom the Software is
furnished to do so, subject to the following conditions:

The above copyright notice and this permission notice shall be included in
all copies or substantial portions of the Software.

THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
THE SOFTWARE.
11 changes: 11 additions & 0 deletions build/yaml/steps/linux/binaries.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -13,12 +13,23 @@ steps:
scriptLocation: inlineScript
inlineScript: 'az acr login --name proddiagbuild'

# Restore vcpkg source and binary caches
- task: Cache@2
displayName: Restore vcpkg cache
inputs:
key: '"vcpkg" | "$(Agent.OS)" | "$(Distro)" | src/vcpkg.json | src/unix/docker/context/components/vcpkg/cgmanifest.json'
restoreKeys: |
"vcpkg" | "$(Agent.OS)" | "$(Distro)"
path: $(Pipeline.Workspace)/vcpkg-cache

# Build binaries
- task: Bash@3
displayName: Docker Build
inputs:
filePath: src/unix/docker/docker-build.sh
arguments: $(Distro) $(Configuration) $(Platform) verbose
env:
VCPKG_CACHE_ROOT: $(Pipeline.Workspace)/vcpkg-cache

# Cleanup containers
- task: Bash@3
Expand Down
9 changes: 9 additions & 0 deletions src/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -365,6 +365,15 @@ add_library_pal(coreclrpal true ${CORECLR_PAL_ROOT}/lib/${CMAKE_BUILD_TYPE}/libc
add_library_pal(palrt true ${CORECLR_PAL_ROOT}/lib/${CMAKE_BUILD_TYPE}/libpalrt.a)
add_library_pal(corguids false ${CORECLR_PAL_ROOT}/lib/${CMAKE_BUILD_TYPE}/libcorguids.a)

if(CMAKE_SYSTEM_NAME STREQUAL Linux)
find_package(LibXml2 CONFIG REQUIRED)
target_link_options(LibXml2::LibXml2 INTERFACE
"LINKER:--exclude-libs,libxml2.a"
)
else()
find_package(LibXml2 REQUIRED)
endif()

add_subdirectory(unix/src)
add_subdirectory(unix/src/atl)
add_subdirectory(Common.Lib)
Expand Down
8 changes: 6 additions & 2 deletions src/Common.Lib/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -3,9 +3,8 @@

cmake_minimum_required(VERSION 3.14)
project(Common.Lib)
find_package(LibXml2 REQUIRED)

include_directories(. ${LIBXML2_INCLUDE_DIR})
include_directories(.)
build_init(CPP Common.Lib)

#note: we purposfully exclude windows-only files,
Expand All @@ -28,4 +27,9 @@ add_lib(${PROJECT_NAME}
${src_files}
)

target_link_libraries(${PROJECT_NAME}
PUBLIC
LibXml2::LibXml2
)

#target_compile_options(Common.Lib PUBLIC "-H")
10 changes: 7 additions & 3 deletions src/InstrumentationEngine.Lib/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -3,9 +3,8 @@

cmake_minimum_required(VERSION 3.14)
project(InstrumentationEngine.Lib)
find_package(LibXml2 REQUIRED)

include_directories(. ${LIBXML2_INCLUDE_DIR})
include_directories(.)

build_init(CPP InstrumentationEngine.Lib)

Expand All @@ -30,4 +29,9 @@ add_lib(${PROJECT_NAME}
true # use_redefines
false # hide_symbols
${src_files}
)
)

target_link_libraries(${PROJECT_NAME}
PRIVATE
LibXml2::LibXml2
)
Original file line number Diff line number Diff line change
Expand Up @@ -26,6 +26,7 @@

<!-- Licensing -->
<file src="$enlistmentroot$\$licenseFile$*" target="" />
<file src="$enlistmentroot$\THIRD-PARTY-NOTICES.txt" target="" />

<!-- Icon -->
<file src="$enlistmentroot$\src\SharedNuGetAssets\icon.png" target="" />
Expand Down
5 changes: 1 addition & 4 deletions src/InstrumentationEngine/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -5,9 +5,7 @@
cmake_minimum_required(VERSION 2.8.12)
project(InstrumentationEngine)

find_package(LibXml2 REQUIRED)

include_directories(. ../InstrumentationEngine.Lib ${LIBXML2_INCLUDE_DIR})
include_directories(. ../InstrumentationEngine.Lib)

build_init(CPP InstrumentationEngine)

Expand Down Expand Up @@ -90,7 +88,6 @@ endif()
target_link_libraries(${PROJECT_NAME}
pthread
stdc++
${LIBXML2_LIBRARIES}
${CORECLRPAL}
${LINUXPAL}
${ATL}
Expand Down
4 changes: 1 addition & 3 deletions src/Tests/CommonLibTests/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -7,10 +7,9 @@ cmake_minimum_required(VERSION 3.14)
fetch_google_test()

project(Common.LibTests)
find_package(LibXml2 REQUIRED)

# the midl directory is needed to replace the rpc headers referenced by midl generated headers.
include_directories(. ${REPOSITORY_ROOT}/src/unix/inc/midl ${REPOSITORY_ROOT}/src ${LIBXML2_INCLUDE_DIR})
include_directories(. ${REPOSITORY_ROOT}/src/unix/inc/midl ${REPOSITORY_ROOT}/src)

build_init(CPP Common.LibTests)

Expand All @@ -29,7 +28,6 @@ add_executable(

target_link_libraries(
${PROJECT_NAME}
${LIBXML2_LIBRARIES}
Common.Lib
gtest_main
)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -4,9 +4,8 @@
cmake_minimum_required(VERSION 3.14)

project(NaglerInstrumentationEngine)
find_package(LibXml2 REQUIRED)

include_directories(. ${REPOSITORY_ROOT}/src ${LIBXML2_INCLUDE_DIR})
include_directories(. ${REPOSITORY_ROOT}/src)

# don't use the PAL for tests
build_init(CPP InstrumentationEngine)
Expand Down Expand Up @@ -47,7 +46,6 @@ target_link_libraries(
${PROJECT_NAME}
pthread
stdc++
${LIBXML2_LIBRARIES}
Common.Lib
)

Expand Down
4 changes: 1 addition & 3 deletions src/Tests/InstrumentationEngineLibTests/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -7,9 +7,8 @@ cmake_minimum_required(VERSION 3.14)
fetch_google_test()

project(InstrumentationEngine.LibTests)
find_package(LibXml2 REQUIRED)

include_directories(. ${REPOSITORY_ROOT}/src ${LIBXML2_INCLUDE_DIR})
include_directories(. ${REPOSITORY_ROOT}/src)

# don't use the PAL for tests
build_init(CPP InstrumentationEngine.LibTests)
Expand Down Expand Up @@ -58,7 +57,6 @@ target_link_libraries(
${PROJECT_NAME}
pthread
stdc++
${LIBXML2_LIBRARIES}
${CORECLRPAL}
${LINUXPAL}
${ATL}
Expand Down
59 changes: 53 additions & 6 deletions src/build.sh
Original file line number Diff line number Diff line change
Expand Up @@ -134,12 +134,10 @@ get_cmake()
echo "found cmake version $cmakeVersion"
cmakeMajor=$(echo $cmakeVersion | sed 's/^.*[^0-9]\([0-9]*\)\..*$/\1'/)
cmakeMinor=$(echo $cmakeVersion | sed 's/^.*[^0-9]*\.\([0-9]*\)\..*$/\1'/)
if (( $cmakeMajor > 3 )); then
if (( $cmakeMinor >= 14 )); then
# found sufficient cmake, continue.
echo $cmakeLocation
return
fi
if (( $cmakeMajor > 3 || ($cmakeMajor == 3 && $cmakeMinor >= 14) )); then
# found sufficient cmake, continue.
echo $cmakeLocation
return
fi

echo "Insufficient cmake version. Ensure cmake version 3.14 or later is installed"
Expand Down Expand Up @@ -190,6 +188,10 @@ locate_build_tools()
cmake_extra_defines="$cmake_extra_defines -DCLR_CMAKE_LINUX_ID=$ID"
fi

if [[ -n "$__VcpkgInstalledDir" ]]; then
cmake_extra_defines="$cmake_extra_defines -DCMAKE_PREFIX_PATH=$__VcpkgInstalledDir/$__VcpkgTriplet"
fi

locate_google_test
$echo "found google version '$__GoogleTestTag' test at '$__GoogleTestUrl'"
}
Expand Down Expand Up @@ -359,6 +361,47 @@ restore_build_dependencies()
fi
}

restore_vcpkg_dependencies()
{
if [ -z "$VCPKG_ROOT" ] || [ ! -x "$VCPKG_ROOT/vcpkg" ]; then
echo "ERROR: VCPKG_ROOT must point to a bootstrapped vcpkg installation."
exit 1
fi

__VcpkgInstalledDir="$__IntermediatesDir/vcpkg_installed"
__VcpkgTriplet=x64-linux

"$VCPKG_ROOT/vcpkg" install \
--x-manifest-root="$EnlistmentRoot/src" \
--x-install-root="$__VcpkgInstalledDir" \
--triplet="$__VcpkgTriplet" \
--clean-after-build

if [ $? -ne 0 ]; then
echo "ERROR: vcpkg dependency restore failed."
exit 1
fi
}

configure_vcpkg_cache()
{
local cacheRoot="${VCPKG_CACHE_ROOT:-$EnlistmentRoot/out/vcpkg-cache}"

mkdir -p "$cacheRoot/assets" "$cacheRoot/archives"
if [ $? -ne 0 ]; then
echo "ERROR: Unable to create vcpkg cache at '$cacheRoot'."
exit 1
fi

if [ -z "$X_VCPKG_ASSET_SOURCES" ]; then
export X_VCPKG_ASSET_SOURCES="clear;x-azurl,file://$cacheRoot/assets/,,readwrite"
fi

if [ -z "$VCPKG_BINARY_SOURCES" ]; then
export VCPKG_BINARY_SOURCES="clear;files,$cacheRoot/archives,readwrite"
fi
}

# Set default clang version
set_clang_path_and_version()
{
Expand Down Expand Up @@ -570,6 +613,10 @@ setup_dirs
check_prereqs

restore_build_dependencies
if [ "$OSName" == "Linux" ]; then
configure_vcpkg_cache
restore_vcpkg_dependencies
fi

pwd

Expand Down
6 changes: 3 additions & 3 deletions src/unix/docker/context/components/cmake/cgmanifest.json
Original file line number Diff line number Diff line change
Expand Up @@ -6,9 +6,9 @@
"Type": "other",
"other": {
"Name": "cmake",
"Version": "3.20.2",
"DownloadUrl": " https://github.com/Kitware/CMake/releases/download/v3.20.2/cmake-3.20.2.tar.gz",
"SHA256CHECK": "aecf6ecb975179eb3bb6a4a50cae192d41e92b9372b02300f9e8f1d5f559544e"
"Version": "3.31.10",
"DownloadUrl": "https://github.com/Kitware/CMake/releases/download/v3.31.10/cmake-3.31.10.tar.gz",
"SHA256CHECK": "cf06fadfd6d41fa8e1ade5099e54976d1d844fd1487ab99942341f91b13d3e29"
}
},
"DevelopmentDependency": true
Expand Down
15 changes: 15 additions & 0 deletions src/unix/docker/context/components/vcpkg/cgmanifest.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
{
"$schema": "https://json.schemastore.org/component-detection-manifest.json",
"Registrations": [
{
"Component": {
"Type": "git",
"git": {
"RepositoryUrl": "https://github.com/microsoft/vcpkg",
"CommitHash": "2d318737bc7daa8a872f4469955a0559686f7580"
}
},
"DevelopmentDependency": true
}
]
}
17 changes: 17 additions & 0 deletions src/unix/docker/docker-build.sh
Original file line number Diff line number Diff line change
Expand Up @@ -104,6 +104,23 @@ invoke_build()
fi
docker_run_args="$docker_run_args -v $LocalBuildPath:/root/ClrInstrumentationEngine/build:ro"

local VcpkgCachePath="${VCPKG_CACHE_ROOT:-${TMPDIR:-/tmp}/clrie-vcpkg-cache}"
mkdir -p "$VcpkgCachePath"
if [ $? -ne 0 ]; then
echo "ERROR: failed to create vcpkg cache at '$VcpkgCachePath'."
exit 1
fi
docker_run_args="$docker_run_args -v $VcpkgCachePath:/root/ClrInstrumentationEngine/out/vcpkg-cache"
docker_run_args="$docker_run_args --env VCPKG_CACHE_ROOT=/root/ClrInstrumentationEngine/out/vcpkg-cache"

if [[ -n "$X_VCPKG_ASSET_SOURCES" ]]; then
docker_run_args="$docker_run_args --env X_VCPKG_ASSET_SOURCES"
fi

if [[ -n "$VCPKG_BINARY_SOURCES" ]]; then
docker_run_args="$docker_run_args --env VCPKG_BINARY_SOURCES"
fi

build_cmd="bash /root/ClrInstrumentationEngine/src/build.sh $__BuildArch $__BuildType clean $__UnprocessedBuildArgs"
docker_run_args="$docker_run_args --net=host $__DockerImage $build_cmd"

Expand Down
29 changes: 23 additions & 6 deletions src/unix/docker/dockerfiles/build/alpine/Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -35,11 +35,14 @@ RUN wget -O dotnet.tar.gz https://builds.dotnet.microsoft.com/dotnet/Sdk/$DOTNET
&& dotnet help

# CLR Instrumentation Engine Build Prerequisites
RUN apk update \
&& apk add --no-cache libxml2-dev

# Add jq to make it easer to read json in shell scripts
RUN apk add --no-cache jq
RUN apk add --no-cache \
git \
jq \
ninja \
patchelf \
pkgconf \
unzip \
zip

# Install newer version of cmake. We need to run make commands inside the directory
# that it is extracted to, so WORKDIR is the easiest context to use.
Expand All @@ -62,4 +65,18 @@ RUN cmakeurl=$(cat cgmanifest.json | jq '.Registrations[0].Component.other.Downl

# Delete the cmake installer it is no longer needed.
WORKDIR /
RUN rm -rf /usr/share/cmakeinst
RUN rm -rf /usr/share/cmakeinst

ENV VCPKG_ROOT=/opt/vcpkg
ENV VCPKG_FORCE_SYSTEM_BINARIES=1
ENV PATH="$VCPKG_ROOT:$PATH"

COPY "components/vcpkg/cgmanifest.json" /tmp/vcpkg-cgmanifest.json
RUN vcpkg_repo=$(jq -r '.Registrations[0].Component.git.RepositoryUrl' /tmp/vcpkg-cgmanifest.json) \
&& vcpkg_commit=$(jq -r '.Registrations[0].Component.git.CommitHash' /tmp/vcpkg-cgmanifest.json) \
&& git init "$VCPKG_ROOT" \
&& git -C "$VCPKG_ROOT" remote add origin "$vcpkg_repo" \
&& git -C "$VCPKG_ROOT" fetch --depth 1 origin "$vcpkg_commit" \
&& git -C "$VCPKG_ROOT" checkout --detach FETCH_HEAD \
&& "$VCPKG_ROOT/bootstrap-vcpkg.sh" -disableMetrics \
&& rm /tmp/vcpkg-cgmanifest.json
Loading
Loading