bneradt commented on code in PR #11192: URL: https://github.com/apache/trafficserver/pull/11192#discussion_r1561063070
########## tools/cripts/compiler.sh: ########## @@ -0,0 +1,97 @@ +#!/usr/bin/env bash + +# Licensed to the Apache Software Foundation (ASF) under one +# or more contributor license agreements. See the NOTICE file +# distributed with this work for additional information +# regarding copyright ownership. The ASF licenses this file +# to you under the Apache License, Version 2.0 (the +# "License"); you may not use this file except in compliance +# with the License. You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. + +############################################################################## +# This is an example compiler script for compiling Cripts and other plugins +# on the fly. You would set proxy.config.plugin.compiler_path to point to a +# customized version of this script, and it will be called whenever a plugin +# needs to be compiled via remap.config. +############################################################################## + +# Configurable parts +ATS_ROOT=/opt/ats +CXX=clang++ +CXXFLAGS="-std=c++20 -I/opt/homebrew/include -undefined dynamic_lookup" + +# Probably don't need to change these ? +STDFLAGS="-shared -fPIC -Wall -Werror -I${ATS_ROOT}/include -L${ATS_ROOT}/lib -lcripts" + +# This is optional, but if set, the script will cache the compiled shared objects for faster restarts/reloads +CACHE_DIR=/tmp/ats-cache + +# Extract the arguments, and do some sanity checks +SOURCE=$1 +DEST=$2 + +SOURCE_DIR=$(dirname $SOURCE) +DEST_DIR=$(dirname $DEST) +SOURCE_FILE=$(basename $SOURCE) +DEST_FILE=$(basename $DEST) + +cd "$SOURCE_DIR" +if [ $(pwd) != "$SOURCE_DIR" ]; then + echo "Failed to cd to $SOURCE_DIR" + exit 1 +fi + +cd "$DEST_DIR" +if [ $(pwd) != "$DEST_DIR" ]; then + echo "Failed to cd to $DEST_DIR" + exit 1 +fi + +if [ ! -f "$SOURCE" ]; then + echo "Source file $SOURCE does not exist" + exit 1 +fi + +if [ "${DEST_FILE}" != "${SOURCE_FILE}.so" ]; then + echo "Destination file name must match source file name with .so extension" + exit 1 +fi Review Comment: Sounds reasonable. -- This is an automated message from the Apache Git Service. To respond to the message, please log on to GitHub and use the URL above to go to the specific comment. To unsubscribe, e-mail: github-unsubscr...@trafficserver.apache.org For queries about this service, please contact Infrastructure at: us...@infra.apache.org