build.c (240120) | build.c (273929) |
---|---|
1/* 2 * Automated Testing Framework (atf) 3 * 4 * Copyright (c) 2009 The NetBSD Foundation, Inc. | 1/* Copyright (c) 2009 The NetBSD Foundation, Inc. |
5 * All rights reserved. 6 * 7 * Redistribution and use in source and binary forms, with or without 8 * modification, are permitted provided that the following conditions 9 * are met: 10 * 1. Redistributions of source code must retain the above copyright 11 * notice, this list of conditions and the following disclaimer. 12 * 2. Redistributions in binary form must reproduce the above copyright --- 6 unchanged lines hidden (view full) --- 19 * MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. 20 * IN NO EVENT SHALL THE FOUNDATION OR CONTRIBUTORS BE LIABLE FOR ANY 21 * DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL 22 * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE 23 * GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS 24 * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER 25 * IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR 26 * OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN | 2 * All rights reserved. 3 * 4 * Redistribution and use in source and binary forms, with or without 5 * modification, are permitted provided that the following conditions 6 * are met: 7 * 1. Redistributions of source code must retain the above copyright 8 * notice, this list of conditions and the following disclaimer. 9 * 2. Redistributions in binary form must reproduce the above copyright --- 6 unchanged lines hidden (view full) --- 16 * MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. 17 * IN NO EVENT SHALL THE FOUNDATION OR CONTRIBUTORS BE LIABLE FOR ANY 18 * DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL 19 * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE 20 * GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS 21 * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER 22 * IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR 23 * OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN |
27 * IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. 28 */ | 24 * IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. */ |
29 | 25 |
26#include "atf-c/build.h" 27 |
|
30#include <stdlib.h> 31#include <string.h> 32 | 28#include <stdlib.h> 29#include <string.h> 30 |
33#include "atf-c/build.h" 34#include "atf-c/config.h" | 31#include "atf-c/detail/env.h" 32#include "atf-c/detail/sanity.h" 33#include "atf-c/detail/text.h" |
35#include "atf-c/error.h" 36 | 34#include "atf-c/error.h" 35 |
37#include "detail/sanity.h" 38#include "detail/text.h" 39 | |
40/* --------------------------------------------------------------------- 41 * Auxiliary functions. 42 * --------------------------------------------------------------------- */ 43 44static 45atf_error_t | 36/* --------------------------------------------------------------------- 37 * Auxiliary functions. 38 * --------------------------------------------------------------------- */ 39 40static 41atf_error_t |
46append_config_var(const char *var, atf_list_t *argv) | 42append_config_var(const char *var, const char *default_value, atf_list_t *argv) |
47{ 48 atf_error_t err; 49 atf_list_t words; 50 | 43{ 44 atf_error_t err; 45 atf_list_t words; 46 |
51 err = atf_text_split(atf_config_get(var), " ", &words); | 47 err = atf_text_split(atf_env_get_with_default(var, default_value), 48 " ", &words); |
52 if (atf_is_error(err)) 53 goto out; 54 55 atf_list_append_list(argv, &words); 56 57out: 58 return err; 59} --- 93 unchanged lines hidden (view full) --- 153{ 154 atf_error_t err; 155 atf_list_t argv_list; 156 157 err = atf_list_init(&argv_list); 158 if (atf_is_error(err)) 159 goto out; 160 | 49 if (atf_is_error(err)) 50 goto out; 51 52 atf_list_append_list(argv, &words); 53 54out: 55 return err; 56} --- 93 unchanged lines hidden (view full) --- 150{ 151 atf_error_t err; 152 atf_list_t argv_list; 153 154 err = atf_list_init(&argv_list); 155 if (atf_is_error(err)) 156 goto out; 157 |
161 err = append_config_var("atf_build_cc", &argv_list); | 158 err = append_config_var("ATF_BUILD_CC", ATF_BUILD_CC, &argv_list); |
162 if (atf_is_error(err)) 163 goto out_list; 164 | 159 if (atf_is_error(err)) 160 goto out_list; 161 |
165 err = append_config_var("atf_build_cppflags", &argv_list); | 162 err = append_config_var("ATF_BUILD_CPPFLAGS", ATF_BUILD_CPPFLAGS, 163 &argv_list); |
166 if (atf_is_error(err)) 167 goto out_list; 168 | 164 if (atf_is_error(err)) 165 goto out_list; 166 |
169 err = append_config_var("atf_build_cflags", &argv_list); | 167 err = append_config_var("ATF_BUILD_CFLAGS", ATF_BUILD_CFLAGS, &argv_list); |
170 if (atf_is_error(err)) 171 goto out_list; 172 173 if (optargs != NULL) { 174 err = append_optargs(optargs, &argv_list); 175 if (atf_is_error(err)) 176 goto out_list; 177 } --- 20 unchanged lines hidden (view full) --- 198{ 199 atf_error_t err; 200 atf_list_t argv_list; 201 202 err = atf_list_init(&argv_list); 203 if (atf_is_error(err)) 204 goto out; 205 | 168 if (atf_is_error(err)) 169 goto out_list; 170 171 if (optargs != NULL) { 172 err = append_optargs(optargs, &argv_list); 173 if (atf_is_error(err)) 174 goto out_list; 175 } --- 20 unchanged lines hidden (view full) --- 196{ 197 atf_error_t err; 198 atf_list_t argv_list; 199 200 err = atf_list_init(&argv_list); 201 if (atf_is_error(err)) 202 goto out; 203 |
206 err = append_config_var("atf_build_cpp", &argv_list); | 204 err = append_config_var("ATF_BUILD_CPP", ATF_BUILD_CPP, &argv_list); |
207 if (atf_is_error(err)) 208 goto out_list; 209 | 205 if (atf_is_error(err)) 206 goto out_list; 207 |
210 err = append_config_var("atf_build_cppflags", &argv_list); | 208 err = append_config_var("ATF_BUILD_CPPFLAGS", ATF_BUILD_CPPFLAGS, 209 &argv_list); |
211 if (atf_is_error(err)) 212 goto out_list; 213 214 if (optargs != NULL) { 215 err = append_optargs(optargs, &argv_list); 216 if (atf_is_error(err)) 217 goto out_list; 218 } --- 24 unchanged lines hidden (view full) --- 243{ 244 atf_error_t err; 245 atf_list_t argv_list; 246 247 err = atf_list_init(&argv_list); 248 if (atf_is_error(err)) 249 goto out; 250 | 210 if (atf_is_error(err)) 211 goto out_list; 212 213 if (optargs != NULL) { 214 err = append_optargs(optargs, &argv_list); 215 if (atf_is_error(err)) 216 goto out_list; 217 } --- 24 unchanged lines hidden (view full) --- 242{ 243 atf_error_t err; 244 atf_list_t argv_list; 245 246 err = atf_list_init(&argv_list); 247 if (atf_is_error(err)) 248 goto out; 249 |
251 err = append_config_var("atf_build_cxx", &argv_list); | 250 err = append_config_var("ATF_BUILD_CXX", ATF_BUILD_CXX, &argv_list); |
252 if (atf_is_error(err)) 253 goto out_list; 254 | 251 if (atf_is_error(err)) 252 goto out_list; 253 |
255 err = append_config_var("atf_build_cppflags", &argv_list); | 254 err = append_config_var("ATF_BUILD_CPPFLAGS", ATF_BUILD_CPPFLAGS, 255 &argv_list); |
256 if (atf_is_error(err)) 257 goto out_list; 258 | 256 if (atf_is_error(err)) 257 goto out_list; 258 |
259 err = append_config_var("atf_build_cxxflags", &argv_list); | 259 err = append_config_var("ATF_BUILD_CXXFLAGS", ATF_BUILD_CXXFLAGS, 260 &argv_list); |
260 if (atf_is_error(err)) 261 goto out_list; 262 263 if (optargs != NULL) { 264 err = append_optargs(optargs, &argv_list); 265 if (atf_is_error(err)) 266 goto out_list; 267 } --- 14 unchanged lines hidden --- | 261 if (atf_is_error(err)) 262 goto out_list; 263 264 if (optargs != NULL) { 265 err = append_optargs(optargs, &argv_list); 266 if (atf_is_error(err)) 267 goto out_list; 268 } --- 14 unchanged lines hidden --- |