From 1e0ff32ad4a4251d7e0a7dc02a4829479df5dfe3 Mon Sep 17 00:00:00 2001 From: Timothy G Collett Date: Sun, 3 Jun 2012 11:01:13 -0400 Subject: [PATCH 1/6] fix clsocket? --- depends/clsocket | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/depends/clsocket b/depends/clsocket index 27216d9a4..c85e9fb35 160000 --- a/depends/clsocket +++ b/depends/clsocket @@ -1 +1 @@ -Subproject commit 27216d9a4be418729cb4671371b7309f0af558f1 +Subproject commit c85e9fb35d3510c5dcc367056cda3237d77a7add From 8f67139a7550f3168b2bb3c74d8ba9dc6096b342 Mon Sep 17 00:00:00 2001 From: Timothy G Collett Date: Sun, 3 Jun 2012 14:33:44 -0400 Subject: [PATCH 2/6] fix clsocket? --- depends/clsocket | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/depends/clsocket b/depends/clsocket index c85e9fb35..651c72229 160000 --- a/depends/clsocket +++ b/depends/clsocket @@ -1 +1 @@ -Subproject commit c85e9fb35d3510c5dcc367056cda3237d77a7add +Subproject commit 651c722295da233ca8d918e298ed226cc0e6c9b9 From b40682f61c3d86e1e6f279454fca2247cdd81954 Mon Sep 17 00:00:00 2001 From: Timothy G Collett Date: Sun, 24 Jun 2012 18:32:53 -0400 Subject: [PATCH 3/6] Add running scripts --- package/darwin/dfhack | 15 +++++++++++++++ package/darwin/dfhack-run | 8 ++++++++ 2 files changed, 23 insertions(+) create mode 100755 package/darwin/dfhack create mode 100755 package/darwin/dfhack-run diff --git a/package/darwin/dfhack b/package/darwin/dfhack new file mode 100755 index 000000000..6f54d15d8 --- /dev/null +++ b/package/darwin/dfhack @@ -0,0 +1,15 @@ +#!/bin/sh +PWD=`dirname "${0}"` +#thanks to Iriel for figuring this out +OSREV=`uname -r | cut -d. -f1` +if [ "$OSREV" -ge 11 ] ; then + export DYLD_INSERT_LIBRARIES=./hack/libdfhack.dylib + export DYLD_LIBRARY_PATH=${PWD}/hack:${PWD}/libs + export DYLD_FRAMEWORK_PATH=${PWD}/hack${PWD}/libs +else + export DYLD_INSERT_LIBRARIES=./hack/libdfhack.dylib + export DYLD_FALLBACK_LIBRARY_PATH=${PWD}/hack:${PWD}/libs + export DYLD_FALLBACK_FRAMEWORK_PATH=${PWD}/hack:${PWD}/libs +fi +export DYLD_FORCE_FLAT_NAMESPACE=1 +cd "${PWD}"; ./dwarfort.exe diff --git a/package/darwin/dfhack-run b/package/darwin/dfhack-run new file mode 100755 index 000000000..cc69db964 --- /dev/null +++ b/package/darwin/dfhack-run @@ -0,0 +1,8 @@ +#!/bin/sh + +DF_DIR=$(dirname "$0") +cd "${DF_DIR}" + +export LD_LIBRARY_PATH=$LD_LIBRARY_PATH:"./stonesense/deplibs":"./hack" + +exec hack/dfhack-run "$@" From 7cdbae3f049126af7631cd23428ec3349fc9524f Mon Sep 17 00:00:00 2001 From: Timothy G Collett Date: Sun, 24 Jun 2012 18:35:16 -0400 Subject: [PATCH 4/6] Update df-structures --- library/xml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/library/xml b/library/xml index 234d0f57a..ad38c5e96 160000 --- a/library/xml +++ b/library/xml @@ -1 +1 @@ -Subproject commit 234d0f57a927f306f2052fc2f45d38b3201ddee6 +Subproject commit ad38c5e96b05fedf16114fd16bd463e933f13582 From 274d6038adce5797b58cee78a330eb5d639bf59e Mon Sep 17 00:00:00 2001 From: Timothy Collett Date: Mon, 10 Sep 2012 09:19:21 -0400 Subject: [PATCH 5/6] Merge further changes (???) --- depends/protobuf/CMakeLists.txt | 6 +++--- library/RemoteClient.cpp | 2 +- library/RemoteServer.cpp | 2 +- library/RemoteTools.cpp | 2 +- library/include/DataDefs.h | 2 +- library/include/RemoteTools.h | 2 +- library/modules/Job.cpp | 2 +- library/modules/Units.cpp | 2 +- library/modules/kitchen.cpp | 2 +- plugins/autolabor.cpp | 6 +++--- plugins/cleaners.cpp | 4 ++-- plugins/cleanowned.cpp | 14 +++++++------- plugins/jobutils.cpp | 2 +- plugins/prospector.cpp | 2 +- plugins/tiletypes.cpp | 2 +- plugins/workflow.cpp | 2 +- plugins/zone.cpp | 4 ++-- 17 files changed, 29 insertions(+), 29 deletions(-) diff --git a/depends/protobuf/CMakeLists.txt b/depends/protobuf/CMakeLists.txt index 570c77b18..8cd5febcd 100644 --- a/depends/protobuf/CMakeLists.txt +++ b/depends/protobuf/CMakeLists.txt @@ -7,10 +7,10 @@ IF(CMAKE_COMPILER_IS_GNUCC) STRING(REGEX MATCHALL "[0-9]+" GCC_VERSION_COMPONENTS ${GCC_VERSION}) LIST(GET GCC_VERSION_COMPONENTS 0 GCC_MAJOR) LIST(GET GCC_VERSION_COMPONENTS 1 GCC_MINOR) - IF(GCC_MAJOR LESS 4 OR (GCC_MAJOR EQUAL 4 AND GCC_MINOR LESS 2)) + #IF(GCC_MAJOR LESS 4 OR (GCC_MAJOR EQUAL 4 AND GCC_MINOR LESS 2)) #GCC is too old - SET(STL_HASH_OLD_GCC 1) - ENDIF() + # SET(STL_HASH_OLD_GCC 1) + #ENDIF() #SET(CMAKE_CXX_FLAGS "-std=c++0x") SET(HAVE_HASH_MAP 0) diff --git a/library/RemoteClient.cpp b/library/RemoteClient.cpp index 4d30988c6..09861ad5f 100644 --- a/library/RemoteClient.cpp +++ b/library/RemoteClient.cpp @@ -394,7 +394,7 @@ command_result RemoteFunctionBase::execute(color_ostream &out, //out.print("Received %d:%d\n", header.id, header.size); - if (header.id == RPC_REPLY_FAIL) + if ((DFHack::DFHackReplyCode)header.id == RPC_REPLY_FAIL) return header.size == CR_OK ? CR_FAILURE : command_result(header.size); if (header.size < 0 || header.size > RPCMessageHeader::MAX_MESSAGE_SIZE) diff --git a/library/RemoteServer.cpp b/library/RemoteServer.cpp index 53428f2bd..06a9f859c 100644 --- a/library/RemoteServer.cpp +++ b/library/RemoteServer.cpp @@ -250,7 +250,7 @@ void ServerConnection::threadFn() break; } - if (header.id == RPC_REQUEST_QUIT) + if ((DFHack::DFHackReplyCode)header.id == RPC_REQUEST_QUIT) break; if (header.size < 0 || header.size > RPCMessageHeader::MAX_MESSAGE_SIZE) diff --git a/library/RemoteTools.cpp b/library/RemoteTools.cpp index 95c495e93..b371d60fa 100644 --- a/library/RemoteTools.cpp +++ b/library/RemoteTools.cpp @@ -287,7 +287,7 @@ void DFHack::describeUnit(BasicUnitInfo *info, df::unit *unit, if (mask && mask->profession()) { - if (unit->profession >= 0) + if (unit->profession >= (df::profession)0) info->set_profession(unit->profession); if (!unit->custom_profession.empty()) info->set_custom_profession(unit->custom_profession); diff --git a/library/include/DataDefs.h b/library/include/DataDefs.h index 1d485156f..7f4d94c80 100644 --- a/library/include/DataDefs.h +++ b/library/include/DataDefs.h @@ -506,7 +506,7 @@ namespace DFHack { template inline const char *enum_item_raw_key(T val) { typedef df::enum_traits traits; - return traits::is_valid(val) ? traits::key_table[val - traits::first_item_value] : NULL; + return traits::is_valid(val) ? traits::key_table[(short)val - traits::first_item_value] : NULL; } /** diff --git a/library/include/RemoteTools.h b/library/include/RemoteTools.h index 65884badc..e87e8026b 100644 --- a/library/include/RemoteTools.h +++ b/library/include/RemoteTools.h @@ -88,7 +88,7 @@ namespace DFHack { typedef df::enum_traits traits; int base = traits::first_item; - int size = traits::last_item - base + 1; + int size = (int)traits::last_item - base + 1; describeEnum(pf, base, size, traits::key_table); } diff --git a/library/modules/Job.cpp b/library/modules/Job.cpp index 1207c97b3..a5e73bf19 100644 --- a/library/modules/Job.cpp +++ b/library/modules/Job.cpp @@ -181,7 +181,7 @@ void DFHack::Job::printItemDetails(color_ostream &out, df::job_item *item, int i out << " reaction class: " << item->reaction_class << endl; if (!item->has_material_reaction_product.empty()) out << " reaction product: " << item->has_material_reaction_product << endl; - if (item->has_tool_use >= 0) + if (item->has_tool_use >= (df::tool_uses)0) out << " tool use: " << ENUM_KEY_STR(tool_uses, item->has_tool_use) << endl; } diff --git a/library/modules/Units.cpp b/library/modules/Units.cpp index ee383cc07..308700fb7 100644 --- a/library/modules/Units.cpp +++ b/library/modules/Units.cpp @@ -838,7 +838,7 @@ std::string DFHack::Units::getCasteProfessionName(int race, int casteid, df::pro { std::string prof, race_prefix; - if (pid < 0 || !is_valid_enum_item(pid)) + if (pid < (df::profession)0 || !is_valid_enum_item(pid)) return ""; bool use_race_prefix = (race >= 0 && race != df::global::ui->race_id); diff --git a/library/modules/kitchen.cpp b/library/modules/kitchen.cpp index 4300d63df..aa235780d 100644 --- a/library/modules/kitchen.cpp +++ b/library/modules/kitchen.cpp @@ -114,7 +114,7 @@ void Kitchen::fillWatchMap(std::map& watchMap) watchMap.clear(); for(std::size_t i = 0; i < size(); ++i) { - if(ui->kitchen.item_subtypes[i] == limitType && ui->kitchen.item_subtypes[i] == limitSubtype && ui->kitchen.exc_types[i] == limitExclusion) + if(ui->kitchen.item_subtypes[i] == (short)limitType && ui->kitchen.item_subtypes[i] == (short)limitSubtype && ui->kitchen.exc_types[i] == limitExclusion) { watchMap[ui->kitchen.mat_indices[i]] = (unsigned int) ui->kitchen.mat_types[i]; } diff --git a/plugins/autolabor.cpp b/plugins/autolabor.cpp index de1a1aef6..5536335c4 100644 --- a/plugins/autolabor.cpp +++ b/plugins/autolabor.cpp @@ -732,9 +732,9 @@ DFhackCExport command_result plugin_onupdate ( color_ostream &out ) if (df::enums::building_type::Workshop == type) { auto subType = build->getSubtype(); - if (df::enums::workshop_type::Butchers == subType) + if ((short)df::enums::workshop_type::Butchers == subType) has_butchers = true; - if (df::enums::workshop_type::Fishery == subType) + if ((short)df::enums::workshop_type::Fishery == subType) has_fishery = true; } else if (df::enums::building_type::TradeDepot == type) @@ -863,7 +863,7 @@ DFhackCExport command_result plugin_onupdate ( color_ostream &out ) { // 7 / 0x7 = Newly arrived migrant, will not work yet // 17 / 0x11 = On break - if ((*p)->id == 0x07 || (*p)->id == 0x11) + if ((*p)->id == (df::misc_trait_type)0x07 || (*p)->id == (df::misc_trait_type)0x11) is_on_break = true; } diff --git a/plugins/cleaners.cpp b/plugins/cleaners.cpp index 30befab2f..fb436a6db 100644 --- a/plugins/cleaners.cpp +++ b/plugins/cleaners.cpp @@ -50,12 +50,12 @@ command_result cleanmap (color_ostream &out, bool snow, bool mud) // filter snow if(!snow && spatter->mat_type == builtin_mats::WATER - && spatter->mat_state == matter_state::Powder) + && spatter->mat_state == (short)matter_state::Powder) continue; // filter mud if(!mud && spatter->mat_type == builtin_mats::MUD - && spatter->mat_state == matter_state::Solid) + && spatter->mat_state == (short)matter_state::Solid) continue; delete evt; diff --git a/plugins/cleanowned.cpp b/plugins/cleanowned.cpp index c1521b8de..a9d461d2f 100644 --- a/plugins/cleanowned.cpp +++ b/plugins/cleanowned.cpp @@ -117,13 +117,13 @@ command_result df_cleanowned (color_ostream &out, vector & parameters) else if (item->flags.bits.on_ground) { int32_t type = item->getType(); - if(type == item_type::MEAT || - type == item_type::FISH || - type == item_type::VERMIN || - type == item_type::PET || - type == item_type::PLANT || - type == item_type::CHEESE || - type == item_type::FOOD + if((df::enums::item_type::item_type)type == item_type::MEAT || + (df::enums::item_type::item_type)type == item_type::FISH || + (df::enums::item_type::item_type)type == item_type::VERMIN || + (df::enums::item_type::item_type)type == item_type::PET || + (df::enums::item_type::item_type)type == item_type::PLANT || + (df::enums::item_type::item_type)type == item_type::CHEESE || + (df::enums::item_type::item_type)type == item_type::FOOD ) { confiscate = true; diff --git a/plugins/jobutils.cpp b/plugins/jobutils.cpp index 24ad4170e..dbfe26b90 100644 --- a/plugins/jobutils.cpp +++ b/plugins/jobutils.cpp @@ -372,7 +372,7 @@ static command_result job_cmd(color_ostream &out, vector & parameters) out << "Job item updated." << endl; - if (item->item_type < 0 && minfo.isValid()) + if (item->item_type < (df::item_type)0 && minfo.isValid()) out.printerr("WARNING: Due to a probable bug, creature & plant material subtype\n" " is ignored unless the item type is also specified.\n"); diff --git a/plugins/prospector.cpp b/plugins/prospector.cpp index e2f1e9534..91abd544e 100644 --- a/plugins/prospector.cpp +++ b/plugins/prospector.cpp @@ -293,7 +293,7 @@ static command_result embark_prospector(color_ostream &out, df::viewscreen_choos int level_cnt = layer->top_height - layer->bottom_height + 1; int layer_size = 48*48*cnt*level_cnt; - int sums[ENUM_LAST_ITEM(inclusion_type)+1] = { 0 }; + int sums[(int)ENUM_LAST_ITEM(inclusion_type)+1] = { 0 }; for (unsigned j = 0; j < layer->vein_mat.size(); j++) if (is_valid_enum_item(layer->vein_type[j])) diff --git a/plugins/tiletypes.cpp b/plugins/tiletypes.cpp index 190bda7cd..6af94f2ee 100644 --- a/plugins/tiletypes.cpp +++ b/plugins/tiletypes.cpp @@ -767,7 +767,7 @@ command_result executePaintJob(color_ostream &out) } // Remove liquid from walls, etc - if (type != -1 && !DFHack::FlowPassable(type)) + if (type != (df::tiletype)-1 && !DFHack::FlowPassable(type)) { des.bits.flow_size = 0; //des.bits.liquid_type = DFHack::liquid_water; diff --git a/plugins/workflow.cpp b/plugins/workflow.cpp index dbf546070..9e0e45292 100644 --- a/plugins/workflow.cpp +++ b/plugins/workflow.cpp @@ -808,7 +808,7 @@ static void compute_custom_job(ProtectedJob *pj, df::job *job) using namespace df::enums::reaction_product_item_flags; VIRTUAL_CAST_VAR(prod, df::reaction_product_itemst, r->products[i]); - if (!prod || (prod->item_type < 0 && !prod->flags.is_set(CRAFTS))) + if (!prod || (prod->item_type < (df::item_type)0 && !prod->flags.is_set(CRAFTS))) continue; MaterialInfo mat(prod); diff --git a/plugins/zone.cpp b/plugins/zone.cpp index ce610128b..b5e45f5c5 100644 --- a/plugins/zone.cpp +++ b/plugins/zone.cpp @@ -792,7 +792,7 @@ void unitInfo(color_ostream & out, df::unit* unit, bool verbose = false) bool isActivityZone(df::building * building) { if( building->getType() == building_type::Civzone - && building->getSubtype() == civzone_type::ActivityZone) + && building->getSubtype() == (short)civzone_type::ActivityZone) return true; else return false; @@ -1603,7 +1603,7 @@ void zoneInfo(color_ostream & out, df::building* building, bool verbose) if(building->getType()!= building_type::Civzone) return; - if(building->getSubtype() != civzone_type::ActivityZone) + if(building->getSubtype() != (short)civzone_type::ActivityZone) return; string name; From 24b93ea61fd1cb6ad69c2e3beab182f5f60646c7 Mon Sep 17 00:00:00 2001 From: Timothy Collett Date: Thu, 13 Sep 2012 14:58:52 -0400 Subject: [PATCH 6/6] Library location fixing script --- library/CMakeLists.txt | 4 ++++ package/darwin/fix-libs.sh | 21 +++++++++++++++++++++ 2 files changed, 25 insertions(+) create mode 100755 package/darwin/fix-libs.sh diff --git a/library/CMakeLists.txt b/library/CMakeLists.txt index 109a97e7c..536f4d34d 100644 --- a/library/CMakeLists.txt +++ b/library/CMakeLists.txt @@ -286,6 +286,10 @@ SET_TARGET_PROPERTIES(dfhack PROPERTIES LINK_INTERFACE_LIBRARIES "") TARGET_LINK_LIBRARIES(dfhack-client protobuf-lite clsocket) TARGET_LINK_LIBRARIES(dfhack-run dfhack-client) +if(APPLE) + add_custom_command(TARGET dfhack-run COMMAND ${dfhack_SOURCE_DIR}/package/darwin/fix-libs.sh WORKING_DIRECTORY ../ COMMENT "Fixing library dependencies...") +endif() + IF(UNIX) if (APPLE) install(PROGRAMS ${dfhack_SOURCE_DIR}/package/darwin/dfhack diff --git a/package/darwin/fix-libs.sh b/package/darwin/fix-libs.sh new file mode 100755 index 000000000..cff98b6a6 --- /dev/null +++ b/package/darwin/fix-libs.sh @@ -0,0 +1,21 @@ +#!/bin/bash + +BUILD_DIR=`pwd` + +echo "Fixing library dependencies in $BUILD_DIR/library" + +install_name_tool -change $BUILD_DIR/library/libdfhack.1.0.0.dylib @executable_path/hack/libdfhack.1.0.0.dylib library/libdfhack.1.0.0.dylib +install_name_tool -change $BUILD_DIR/library/libdfhack-client.dylib @executable_path/hack/libdfhack-client.dylib library/libdfhack-client.dylib +install_name_tool -change $BUILD_DIR/library/libdfhack-client.dylib @executable_path/hack/libdfhack-client.dylib library/dfhack-run +install_name_tool -change $BUILD_DIR/depends/protobuf/libprotobuf-lite.dylib @executable_path/hack/libprotobuf-lite.dylib library/libdfhack.1.0.0.dylib +install_name_tool -change $BUILD_DIR/depends/protobuf/libprotobuf-lite.dylib @executable_path/hack/libprotobuf-lite.dylib library/libdfhack-client.dylib +install_name_tool -change $BUILD_DIR/depends/protobuf/libprotobuf-lite.dylib @executable_path/hack/libprotobuf-lite.dylib library/dfhack-run +install_name_tool -change $BUILD_DIR/depends/lua/liblua.dylib @executable_path/hack/liblua.dylib library/libdfhack.1.0.0.dylib +install_name_tool -change @executable_path/../Frameworks/SDL.framework/Versions/A/SDL @executable_path/libs/SDL.framework/Versions/A/SDL library/libdfhack.1.0.0.dylib +install_name_tool -change /usr/local/lib/libstdc++.6.dylib @executable_path/libs/libstdc++.6.dylib library/libdfhack.1.0.0.dylib +install_name_tool -change /opt/local/lib/i386/libstdc++.6.dylib @executable_path/libs/libstdc++.6.dylib library/libdfhack.1.0.0.dylib +install_name_tool -change /opt/local/lib/i386/libstdc++.6.dylib @executable_path/libs/libstdc++.6.dylib library/libdfhack-client.dylib +install_name_tool -change /opt/local/lib/i386/libstdc++.6.dylib @executable_path/libs/libstdc++.6.dylib library/dfhack-run +install_name_tool -change /opt/local/lib/i386/libgcc_s.1.dylib @executable_path/libs/libgcc_s.1.dylib library/libdfhack.1.0.0.dylib +install_name_tool -change /opt/local/lib/i386/libgcc_s.1.dylib @executable_path/libs/libgcc_s.1.dylib library/libdfhack-client.dylib +install_name_tool -change /opt/local/lib/i386/libgcc_s.1.dylib @executable_path/libs/libgcc_s.1.dylib library/dfhack-run \ No newline at end of file